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