Pristine Ack-5.5
[Ack-5.5.git] / modules / src / em_opt / syntax.l
1 %{
2 /* $Id: syntax.l,v 1.4 1994/06/24 11:14:45 ceriel Exp $ */
3 #include "Lpars.h"
4 #include "parser.h"
5
6 struct idf      *opval;         /* opcode of returned OPCODE*/
7 int             lastintval;     /* value of last integer seen */
8 int             linenum = 1;    /*current line number of input file*/
9 %}
10 %%
11 sfit            return(SFIT);
12 ufit            return(UFIT);
13 rotate          return(ROTATE);
14 p               return(PSIZE);
15 w2              return(DWSIZE);
16 w               return(WSIZE);
17 defined         return(DEFINED);
18 undefined       return(UNDEFINED);
19 samesign        return(SAMESIGN);
20 sameext         return(SAMEEXT);
21 samenam         return(SAMENAM);
22 offset          return(OFFSET);
23 [a-z][a-z][a-z] {
24                 opval = str2idf(yytext,0);
25                 return(OPCODE);
26                 }
27 [0-9]+          {
28                 lastintval = atoi(yytext);
29                 return(INT);
30                 }
31 "$"             return(PATARG);
32 "&&"            return(LOGAND);
33 "||"            return(LOGOR);
34 "&"             return(BITAND);
35 "|"             return(BITOR);
36 "^"             return(XOR);
37 "-"             return(MINUS);
38 "+"             return(PLUS);
39 "*"             return(TIMES);
40 "/"             return(DIV);
41 "%"             return(MOD);
42 "=="            return(EQ);
43 "!="            return(NE);
44 "<"             return(LT);
45 "<="            return(LE);
46 ">"             return(GT);
47 ">="            return(GE);
48 "<<"            return(LSHIFT);
49 ">>"            return(RSHIFT);
50 "!"             return(NOT);
51 "~"             return(COMP);
52 ","             return(COMMA);
53 :[ \t]*\n[ \t]+ { linenum++; return(':'); }
54 ^"# "[0-9]+.*\n { linenum=atoi(yytext+2); }
55 ^\#.*\n         { linenum++; }
56 ^\n             { linenum++; }
57 [ \t]           ;
58 \n              { linenum++; return(yytext[0]);}
59 .               return(yytext[0]);
60 %%
61
62 back_token()
63 {
64         yyless(0);
65 }