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