creaturesImage work: add mutableCopy and tint methods to the base class (and change...
[openc2e.git] / caos.l
blob3aa111200af19a148fc29297fb59405b0b57d704
1 %{
2 #include <math.h>
3 #include <stdio.h>
4 #include <iostream>
5 //#include "token.h"
6 #include "lexutil.h"
7 #include "exceptions.h"
9 #define YY_FATAL_ERROR(str) throw parseException(str)
14 %option noyywrap
15 %option nodefault
16 %option yylineno
17 %x L_BYTESTR
18 %x L_STRING
19 %x L_COMMENT
21 STRINGBIT   \\.|[^\\]
22 DIGIT       [0-9]
23 WORDINIT    [a-zA-Z_]
24 WORDANY     [#a-zA-Z0-9:?!_+-]
27 \*[^\r\n]*
29 \'.\'       lex_lineno = yylineno; return make_int(yytext[1]);
30 %[01]*                 lex_lineno = yylineno; return make_bin(yytext);
31 {WORDINIT}{WORDANY}*                lex_lineno = yylineno; return make_word(yytext);
32 [-+]?{DIGIT}*\.{DIGIT}* lex_lineno = yylineno;  return make_float(atof(yytext));
33 [-+]?{DIGIT}+           lex_lineno = yylineno;  return make_int(atoi(yytext));
35 "<>"                     lex_lineno = yylineno;  return make_word("ne");
36 "<="                     lex_lineno = yylineno;  return make_word("le");
37 ">="                     lex_lineno = yylineno;  return make_word("ge");
38 "<"                      lex_lineno = yylineno;  return make_word("lt");
39 ">"                      lex_lineno = yylineno;  return make_word("gt");
40 "=="                     lex_lineno = yylineno;  return make_word("eq");
41 "="                      lex_lineno = yylineno;  return make_word("eq");
42 "&&"                     lex_lineno = yylineno;  return make_word("and");
43 "||"                     lex_lineno = yylineno;  return make_word("or");
45 "["         BEGIN(L_BYTESTR);
47 <L_BYTESTR>[0-9]+         push_bytestr(atoi(yytext));
48 <L_BYTESTR>[ \t\n\r]
49 <L_BYTESTR>"]"            BEGIN(INITIAL); lex_lineno = yylineno; return make_bytestr();
51 \"          BEGIN(L_STRING);
52 <L_STRING>\\.             push_string_escape(yytext[1]);
53 <L_STRING>\"              BEGIN(INITIAL); lex_lineno = yylineno; return make_string();
54 <L_STRING>.               push_string_lit(yytext[0]);
56 [ \t\n\r]     // eat whitespace
57 .                         parse_error(yytext, yylineno);