7fd59977 |
1 | %option yywrap |
2 | %{ |
3 | #include <ExprIntrp.tab.h> |
4 | #define YY_SKIP_YYWRAP |
5 | |
6 | static YY_BUFFER_STATE ExprIntrp_bufstring; |
7 | |
8 | void ExprIntrp_SetResult(); |
9 | void ExprIntrp_SetDegree(); |
10 | |
11 | void ExprIntrp_start_string(char* str) |
12 | { |
13 | ExprIntrp_bufstring = ExprIntrp_scan_string(str); |
14 | } |
15 | |
16 | void ExprIntrp_stop_string() |
17 | { |
18 | ExprIntrp_delete_buffer(ExprIntrp_bufstring); |
19 | } |
20 | |
21 | int yywrap() |
22 | { |
23 | return 1; |
24 | } |
25 | |
26 | %} |
27 | %% |
28 | " " {;} |
29 | "+" {return(SUMOP) ;} |
30 | "-" {return(MINUSOP) ;} |
31 | "/" {return(DIVIDEOP) ;} |
32 | "^" {return(EXPOP) ;} |
33 | "**" {return(EXPOP) ;} |
34 | "*" {return(MULTOP) ;} |
35 | "(" {return(PARENTHESIS);} |
36 | "[" {return(BRACKET);} |
37 | ")" {return(ENDPARENTHESIS);} |
38 | "]" {return(ENDBRACKET);} |
39 | "," {return(COMMA);} |
40 | "@" {return(DIFFERENTIAL);} |
41 | "<-" {return(ASSIGNOP);} |
42 | "=" {return(EQUALOP);} |
43 | "Deassign" {return(DEASSIGNKEY);} |
44 | "Deriv" {return(DERIVKEY);} |
45 | "Const" {return(CONSTKEY);} |
46 | "Sum" {return(SUMKEY);} |
47 | "Prod" {return(PRODKEY);} |
48 | [0-9.]+e[+|-]?[0-9]+ {ExprIntrp_SetResult(); return(VALUE);} |
49 | [0-9.]+ {ExprIntrp_SetResult(); return(VALUE);} |
50 | [a-zA-Z][a-zA-Z0-9_]* {ExprIntrp_SetResult(); return(IDENTIFIER);} |
51 | ";" {return(RELSEPARATOR);} |
52 | "'"+ {ExprIntrp_SetDegree();return(DERIVATE);} |