1 | %% |
---|
2 | |
---|
3 | GLOBAL { |
---|
4 | char * patt; |
---|
5 | while ( patt = next_def_except()) |
---|
6 | strcpy( wordbuf[ wordcnt++], patt); /* XXX */ |
---|
7 | strncat(linebuf,yytext,yyleng); |
---|
8 | return(GEXCEPT); |
---|
9 | } |
---|
10 | \\[\t ]*#[\t\40-\176]*\n |
---|
11 | { |
---|
12 | strcat(linebuf,"\n"); |
---|
13 | return(BACKNEW); |
---|
14 | } |
---|
15 | #[\t\40-\176]*$ ; |
---|
16 | [ \t]+ { |
---|
17 | strncat(linebuf,yytext,yyleng); |
---|
18 | return(WHITESPACE); |
---|
19 | } |
---|
20 | [\42\44-\71\73-\133\135-\176]+ { /* everything except # : ! and \ */ |
---|
21 | strncat(linebuf,yytext,yyleng); |
---|
22 | strcpy(wordbuf[wordcnt++],yytext); |
---|
23 | return(WORD); |
---|
24 | } |
---|
25 | ":" { |
---|
26 | strncat(linebuf,yytext,yyleng); |
---|
27 | return(COLON); |
---|
28 | } |
---|
29 | "!" { |
---|
30 | strncat(linebuf,yytext,yyleng); |
---|
31 | return(BANG); |
---|
32 | } |
---|
33 | "\\" { |
---|
34 | strncat(linebuf,yytext,yyleng); |
---|
35 | return(BACKSLASH); |
---|
36 | } |
---|
37 | "\n" { |
---|
38 | strncat(linebuf,yytext,yyleng); |
---|
39 | return(NEWLINE); |
---|
40 | } |
---|
41 | "\\\n" { |
---|
42 | strcat(linebuf,"\n"); |
---|
43 | return(BACKNEW); |
---|
44 | } |
---|
45 | "\177" { |
---|
46 | return(ENDOFFILE); |
---|
47 | } |
---|
48 | %% |
---|
49 | #undef input |
---|
50 | /* this version of input() is identical to yylex' original, |
---|
51 | * except for the "endchar^='\177'" returned-value at end-of-file, |
---|
52 | * which is 0 in the original. |
---|
53 | * this returned value will return '\177' on the 1st detection of EOF, |
---|
54 | * and 0 (as usually happens at EOF) at the next invocation of input(). |
---|
55 | * our version allows yylex() to tokenize EOF, and yyparse() to parse it, |
---|
56 | * so that an entry's command-field can optionally end without a newline. |
---|
57 | * track supports this possibility, because emacs doesn't automatically |
---|
58 | * terminate a file's last line with a newline. |
---|
59 | */ |
---|
60 | static unsigned char endchar = '\0'; |
---|
61 | # define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?\ |
---|
62 | (yylineno++,yytchar):yytchar)==EOF?(endchar^='\177'):yytchar) |
---|