creaturesImage work: add mutableCopy and tint methods to the base class (and change...
[openc2e.git] / c2caos.l
blob0dac5264db9b04120015bad2b034427a6eb4c5e9
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)
12 %option noyywrap
13 %option nodefault
14 %option yylineno
15 %x L_BYTESTR
16 %x L_STRING
17 %x L_BRSTRING
18 %x L_COMMENT
20 STRINGBIT   \\.|[^\\]
21 DIGIT       [0-9]
22 WORDINIT    [a-zA-Z_]
23 WORDANY     [$#a-zA-Z0-9:?!_+-]
26 f\*\*k  lex_lineno = yylineno; return make_word("f**k");
28 \*[^\r\n]*
30 \'.\'       lex_lineno = yylineno; return make_int(yytext[1]);
31 %[01]*                 lex_lineno = yylineno; return make_bin(yytext);
32 {WORDANY}*{WORDINIT}{WORDANY}*                lex_lineno = yylineno; return make_word(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_BRSTRING);
46 <L_BRSTRING>"]"              BEGIN(INITIAL); lex_lineno = yylineno; return make_string();
47 <L_BRSTRING>.               push_string_lit(yytext[0]);
49 \"          BEGIN(L_STRING);
50 <L_STRING>\\.             push_string_escape(yytext[1]);
51 <L_STRING>\"              BEGIN(INITIAL); lex_lineno = yylineno; return make_string();
52 <L_STRING>.               push_string_lit(yytext[0]);
54 [ ,\t\n\r]     // eat whitespace and commas (separating commands)
55 .                         parse_error(yytext, yylineno);