source: trunk/athena/etc/track/input.l @ 1090

Revision 1090, 1.7 KB checked in by don, 36 years ago (diff)
this version is not compatible with prior versions. it offers, chiefly, link-exporting, i.e., "->" systax in exception-lists. it also offers sped-up exception-checking, via hash-tables. a bug remains in -nopullflag support: if the entry's to-name top-level dir doesn't exist, update_file doesn't get over it. the fix should be put into the updated() routine, or possibly dec_entry().
Line 
1%%
2
3GLOBAL          {
4                        strncat(linebuf,yytext,yyleng);
5                        return(GEXCEPT);
6                }
7"->"            {
8                        strncat(linebuf,yytext,yyleng);
9                        return(ARROW);
10                }
11\\[\t ]*#[\t\40-\176]*\n       
12                {
13                        strcat(linebuf,"\n");
14                        return(BACKNEW);
15                }
16#[\t\40-\176]*$ ;
17[ \t]+          {
18                        strncat(linebuf,yytext,yyleng);
19                        return(WHITESPACE);
20                }
21[\42\44-\71\73-\133\135-\176]+  { /* everything except # : ! and \  */
22                        strncat(linebuf,yytext,yyleng);
23                        for ( wordp = yytext;
24                             *wordp == '/' && wordp[1];
25                              wordp++);
26                        strcpy(wordbuf, wordp);
27                        return(WORD);
28                }
29":"             {
30                        strncat(linebuf,yytext,yyleng);
31                        return(COLON);
32                }
33"!"             {
34                        strncat(linebuf,yytext,yyleng);
35                        return(BANG);
36                }
37"\\"            {
38                        strncat(linebuf,yytext,yyleng);
39                        return(BACKSLASH);
40                }
41"\n"            {
42                        strncat(linebuf,yytext,yyleng);
43                        return(NEWLINE);
44                }
45"\\\n"          {
46                        strcat(linebuf,"\n");
47                        return(BACKNEW);
48                }
49"\177"          {
50                        strcat(linebuf,"\n");
51                        return(NEWLINE);
52                }
53%%
54#undef input
55/* this version of input() is identical to yylex' original,
56 * except for the expression "endchar^='\177'", which is
57 * returned at end-of-file, and which is 0 in the original version.
58 * this expression will return '\177' on the 1st detection of EOF,
59 * and 0 (as usually happens at EOF) at the next invocation of input().
60 * our version allows yylex() to tokenize EOF, and yyparse() to parse it,
61 * so that an entry's command-field can optionally end without a newline.
62 * track supports this possibility, because emacs doesn't automatically
63 * terminate a file's last line with a newline.
64 */
65static unsigned char endchar = '\0';
66# define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?\
67(yylineno++,yytchar):yytchar)==EOF?(endchar^='\177'):yytchar)
Note: See TracBrowser for help on using the repository browser.