PageRenderTime 22ms CodeModel.GetById 16ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/xbmc/visualizations/Milkdrop/vis_milkdrop/evallib/Scan.l

http://github.com/xbmc/xbmc
LEX | 54 lines | 45 code | 7 blank | 2 comment | 0 complexity | 75ffd13c29e7a513795ce397e69d8ccf MD5 | raw file
 1%{
 2#define YYSTYPE double
 3#include "cal_tab.h"
 4int c;
 5
 6extern YYSTYPE yylval;
 7double translate(int type);
 8void count(void);
 9void setLastVar(void);
10int lookup(int *typeOfObject);
11struct lextab *lexswitch(struct lextab *lp);
12
13
14#define INTCONST 1
15#define DBLCONST 2
16#define HEXCONST 3
17#define VARIABLE 4
18#define OTHER    5
19
20%}
21
22digit =     [0-9];
23letter =    [a-zA-Z_];
24hex =       [a-fA-F0-9];
25/* -- */
26space           = [\40];
27/*number          =  (digit* | "-" digit*);*/
28number          = digit*;
29exp             = [Ee] number;
30doubl           = number "." (digit* | digit* exp);
31
32%%
33hex hex* [hH]             { count(); yylval = translate(HEXCONST); return VALUE; }
34digit*                    { count(); yylval = translate(INTCONST); return VALUE; }
35digit digit* [Dd]         { count(); yylval = translate(INTCONST); return VALUE; }
36doubl               	  { count(); yylval = translate(DBLCONST); return VALUE; }
37letter*                   { count(); { int typeOfObject; setLastVar(); yylval = lookup(&typeOfObject); return typeOfObject; }}
38letter (letter|digit)*    { count(); { int typeOfObject; setLastVar(); yylval = lookup(&typeOfObject); return typeOfObject; }}
39'+'			  { count(); return '+'; }
40'-'			  { count(); return '-'; }
41'*'			  { count(); return '*'; }
42'/'			  { count(); return '/'; }
43'%'			  { count(); return '%'; }
44'&'			  { count(); return '&'; }
45'|'			  { count(); return '|'; }
46'('			  { count(); return '('; }
47')'			  { count(); return ')'; }
48'='			  { count(); return '='; }
49','                       { count(); return ','; }
50';'                       { count(); return ';'; }
51[ \t\v\f]		  { count(); }
52.               	  { count(); }
53
54%%