aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src/LuaSL_lexer.l
blob: 5e7d930837000e853a2b9a818a116c7d44ff9aac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
%{

#define excludeLexer
#include "LuaSL_LSL_tree.h"

#ifdef LUASL_DEBUG
    #undef ECHO
    #define ECHO printf ("[%s]\n", yytext)
#else
    #undef ECHO
    #define ECHO {}
#endif


%}

%option reentrant noyywrap never-interactive nounistd
%option bison-bridge

SPACE       [ \r\n\t]*
NAME        [a-zA-Z_][a-zA-Z0-9_]*
NUMBER      [0-9]+

%%

{SPACE}         { ECHO; /* Skip blanks. */ }
{NAME}          { ECHO; /* yylval->nameValue=strdup(yytext); return LSL_NAME; */ }
{NUMBER}        { ECHO; yylval->integerValue = atoi(yytext); return LSL_INTEGER; }

"("             { ECHO; return LSL_PARENTHESIS_OPEN; }
")"             { ECHO; return LSL_PARENTHESIS_CLOSE; }
"*"             { ECHO; return LSL_MULTIPLY; }
"+"             { ECHO; return LSL_ADD; }
.               { ECHO; printf(" unexpected character.\n"); }

%%

int XXyywrap()
{
#ifdef FLEX_SCANNER
    #ifndef LL_WINDOWS
	// get gcc to stop complaining about lack of use of yyunput
	(void) yyunput;
	(void) input;
    #endif
#endif
	return(1);
}