summaryrefslogtreecommitdiff
path: root/lexer.l
diff options
context:
space:
mode:
authorclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2009-06-23 10:31:25 (GMT)
committerclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2009-06-23 10:31:25 (GMT)
commit9271046a02c5e8b62a9ed92e914ab6cf30938fc7 (patch)
treedeb469a4f6787224ec84f74052eaec7c02e484ff /lexer.l
parent4480b67f960af29106e66d1c24e211cf4368f33b (diff)
Clifford Wolf:
Cleanups and improvements: values and expressions Avoid unnaccesary nodes in csg tree git-svn-id: http://svn.clifford.at/openscad/trunk@11 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'lexer.l')
-rw-r--r--lexer.l16
1 files changed, 9 insertions, 7 deletions
diff --git a/lexer.l b/lexer.l
index 20111e6..37dd9b5 100644
--- a/lexer.l
+++ b/lexer.l
@@ -32,10 +32,15 @@ int lexerget_lineno(void);
%x comment
-WS [\n\r\t ]
-
%%
+"module" return TOK_MODULE;
+"function" return TOK_FUNCTION;
+
+"true" return TOK_TRUE;
+"false" return TOK_FALSE;
+"undef" return TOK_UNDEF;
+
[0-9][0-9.]* { parserlval.number = atof(yytext); return TOK_NUMBER; }
[a-zA-Z0-9_]+ { parserlval.text = strdup(yytext); return TOK_ID; }
\"[^"]*\" { parserlval.text = strdup(yytext); return TOK_STRING; }
@@ -43,6 +48,7 @@ WS [\n\r\t ]
"." return '.';
"," return ',';
";" return ';';
+"?" return '?';
":" return ':';
"=" return '=';
"*" return '*';
@@ -57,15 +63,11 @@ WS [\n\r\t ]
"[" return '[';
"]" return ']';
-"module"/{WS} return TOK_MODULE;
-"function"/{WS} return TOK_FUNCTION;
-
+[\n\r\t ]
\/\/[^\n]*\n
"/*" BEGIN(comment);
<comment>"*/" BEGIN(INITIAL);
<comment>.|\n
-{WS}*
-
. { fprintf(stderr, "Unrecognized input character in line %d: %s\n", lexerget_lineno(), yytext); exit(1); }
contact: Jan Huwald // Impressum