Annotation of researchv10no/cmd/pret/pretlex.l, revision 1.1.1.1

1.1       root        1: %{
                      2: #include "stdio.h"
                      3: #include "pret.h"
                      4: #include "y.tab.h"
                      5: 
                      6: extern linenumber, nest;
                      7: extern char filename[256];
                      8: 
                      9: putback(c)
                     10: {      unput(c);
                     11: }
                     12: 
                     13: %}
                     14: %%
                     15: \n     { linenumber++; }
                     16: \/\*   { char c1, c2;          /* comment string */
                     17: 
                     18:          for(nest++, c2 = ' ';;){
                     19:                c1 = c2;
                     20:                c2 = input();
                     21:                if (c1 == '/' && c2 == '*')
                     22:                        nest++;
                     23:                else if (c1 == '*' && c2 == '/')
                     24:                        nest--;
                     25:                if (nest <= 0)
                     26:                        break;
                     27:                if (c2 == '\n')
                     28:                        linenumber++;
                     29:                else if (c2 == 0)
                     30:                        whoops("unexpected eof (in comment)");
                     31:          }
                     32:        }
                     33: [ \t]  { ; }
                     34: ^#[ ]+[0-9]+[ ]+\"[^\"]+\"\n   {
                     35:                sscanf(&yytext[1], "%d \"%s\"\n", &linenumber, filename);
                     36:                filename[strlen(filename)-1] = 0;       /* strip the last " */
                     37:        }
                     38: queue  { return(QUEUES); }
                     39: qset   { return(QSET); }
                     40: pvar   { return(PVAR); }
                     41: proc   { return(PROCESS); }
                     42: if     { return(IF); }
                     43: fi     { return(FI); }
                     44: do     { return(DO); }
                     45: od     { return(OD); }
                     46: skip   { return(skip); }
                     47: goto   { return(GOTO); }
                     48: break  { return(BREAK); }
                     49: any    { return(DEFAULT); }
                     50: default        { return(DEFAULT); }
                     51: assert { return(ASSERT); }
                     52: error  { return(ERROR); }
                     53: timeout        { return(timeout); }
                     54: \{     { return(PBEGIN); }
                     55: \}     { return(END); }
                     56: [0-9]+ { yylval.resu = atoi(yytext); return(VALUE); }
                     57: [a-zA-Z][_a-zA-Z0-9]*  {
                     58:                yylval.resu = newstring(yytext);
                     59:                if (isarrayvar(yytext)) return(ARNAME);
                     60:                if (isqset(yytext)) return(QSNAME);
                     61:                return(NAME);
                     62:        }
                     63: _PROCID        { yylval.resu = newstring("_PROCID"); return(NAME); }
                     64: "::"   { return(FLAG); }
                     65: "->"   { return(ARROW); }
                     66: ";"    { return(SEMICOLON); }
                     67: ":"    { return(COLON); }
                     68: \+\+   { return(INC); }
                     69: \-\-   { return(DEC); }
                     70: \+\=   { return(ADDEQ); }
                     71: \-\=   { return(SUBEQ); }
                     72: \*\=   { return(MULEQ); }
                     73: \/\=   { return(DIVEQ); }
                     74: \%\=   { return(MODEQ); }
                     75: \|\|   { return(OR); }
                     76: \&\&   { return(AND); }
                     77: \>\=   { return(GE); }
                     78: \<\=   { return(LE); }
                     79: \!\=   { return(NE); }
                     80: \>     { return(GT); }
                     81: \<     { return(LT); }
                     82: \!     { return(NOT); }
                     83: ==     { return(EQ); }
                     84: .      { return(yytext[0]); }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.