1 | %% |
---|
2 | |
---|
3 | GLOBAL { |
---|
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 | */ |
---|
65 | static unsigned char endchar = '\0'; |
---|
66 | # define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?\ |
---|
67 | (yylineno++,yytchar):yytchar)==EOF?(endchar^='\177'):yytchar) |
---|