6 #include <grammar.tab.h>
9 # define PRINT(a...) printf(##a)
14 #define CHAR(x) PRINT ("char: %c\n", *yytext); return *yytext;
18 _float [[:digit:]]+"."*[[:digit:]]*
19 _number {_integer}|{_float}
20 _boolean "true"|"false"|"TRUE"|"FALSE"
21 _identifier [[:alpha:]][[:alnum:]\-_]*
22 _string ([^[:space:]\"]|"\\\"")+|("\""([^\"]|"\\\"")*"\"")
30 PRINT ("An integer: %s (%d)\n", yytext,
37 PRINT ("A float: %s (%g)\n", yytext, atof (yytext));
43 PRINT ("A boolean: %s (%d)\n", yytext, tolower (*yytext) == 't' ? 1 : 0);
51 *(yytext + strlen (yytext) - 1) = '\0';
53 PRINT ("A string: %s\n", yytext);
58 [[:space:]]+ { /* PRINT ("space: [%s]\n", yytext); */ }
61 PRINT ("unknown: %s\n", yytext);
66 PRINT ("An identifier: %s\n", yytext);
70 "=" { BEGIN (value); CHAR ('='); }
83 [[:space:]]+ { PRINT ("space: [%s]\n", yytext); }
86 printf ("unknown: %s\n", yytext);