6 #include <grammar.tab.h>
8 #define CHAR(x) printf ("char: %c\n", *yytext); return *yytext;
12 _float [[:digit:]]+"."*[[:digit:]]*
13 _number {_integer}|{_float}
14 _boolean "true"|"false"|"TRUE"|"FALSE"
15 _identifier [[:alpha:]][[:alnum:]\-_]*
16 _string ([^[:space:]\"]|"\\\"")+|("\""([^\"]|"\\\"")*"\"")
24 printf ("An integer: %s (%d)\n", yytext,
31 printf ("A float: %s (%g)\n", yytext, atof (yytext));
37 printf ("A boolean: %s (%d)\n", yytext, tolower (*yytext) == 't' ? 1 : 0);
45 *(yytext + strlen (yytext) - 1) = '\0';
47 printf ("A string: %s\n", yytext);
52 [[:space:]]+ { /* printf ("space: [%s]\n", yytext); */ }
55 printf ("unknown: %s\n", yytext);
60 printf ("An identifier: %s\n", yytext);
63 "=" { BEGIN (value); CHAR ('='); }
76 [[:space:]]+ { /* printf ("space: [%s]\n", yytext); */ }
79 printf ("unknown: %s\n", yytext);