aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src/LuaSL_lexer.l
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-10 03:35:11 +1000
committerDavid Walter Seikel2012-01-10 03:35:11 +1000
commita1988411e9345dda06f2c273691bf87693e0d88a (patch)
tree75ca08d468f874517a49e6ab4f50902707732951 /LuaSL/src/LuaSL_lexer.l
parentGet rid of the LSL_AST structure, it's all in LSL_Leaf now. (diff)
downloadSledjHamr-a1988411e9345dda06f2c273691bf87693e0d88a.zip
SledjHamr-a1988411e9345dda06f2c273691bf87693e0d88a.tar.gz
SledjHamr-a1988411e9345dda06f2c273691bf87693e0d88a.tar.bz2
SledjHamr-a1988411e9345dda06f2c273691bf87693e0d88a.tar.xz
Get rid of the comment function.
Diffstat (limited to 'LuaSL/src/LuaSL_lexer.l')
-rw-r--r--LuaSL/src/LuaSL_lexer.l17
1 files changed, 2 insertions, 15 deletions
diff --git a/LuaSL/src/LuaSL_lexer.l b/LuaSL/src/LuaSL_lexer.l
index aaba74a..d81eb29 100644
--- a/LuaSL/src/LuaSL_lexer.l
+++ b/LuaSL/src/LuaSL_lexer.l
@@ -4,7 +4,6 @@
4#include "LuaSL_LSL_tree.h" 4#include "LuaSL_LSL_tree.h"
5#include <stdio.h> 5#include <stdio.h>
6 6
7void comment(yyscan_t yyscanner);
8int common(YYSTYPE *lval, char *text, boolean checkIgnorable, int type); 7int common(YYSTYPE *lval, char *text, boolean checkIgnorable, int type);
9 8
10%} 9%}
@@ -93,7 +92,7 @@ IDENTIFIER [[:alpha:]](_|[[:alpha:]]|[[:digit:]])*
93"state" %{ return common(yylval, yytext, TRUE, LSL_STATE_CHANGE); %} 92"state" %{ return common(yylval, yytext, TRUE, LSL_STATE_CHANGE); %}
94"while" %{ return common(yylval, yytext, TRUE, LSL_WHILE); %} 93"while" %{ return common(yylval, yytext, TRUE, LSL_WHILE); %}
95 94
96{IDENTIFIER} %{ /* yylval->value.nameValue = strdup(yytext); */ common(yylval, yytext, TRUE, LSL_IDENTIFIER); %} 95{IDENTIFIER} %{ /* yylval->value.identifierValue = strdup(yytext); */ common(yylval, yytext, TRUE, LSL_IDENTIFIER); %}
97 96
98 /* Other symbols. */ 97 /* Other symbols. */
99"@" %{ return common(yylval, yytext, TRUE, LSL_LABEL); %} 98"@" %{ return common(yylval, yytext, TRUE, LSL_LABEL); %}
@@ -108,19 +107,6 @@ IDENTIFIER [[:alpha:]](_|[[:alpha:]]|[[:digit:]])*
108 107
109%% 108%%
110 109
111void comment(yyscan_t yyscanner)
112{
113 char c, prev = 0;
114
115 while ((c = input(yyscanner)) != 0) /* (EOF maps to 0) */
116 {
117 if (c == '/' && prev == '*')
118 return;
119 prev = c;
120 }
121 yyerror("unterminated comment");
122}
123
124static char *ignorableText = NULL; 110static char *ignorableText = NULL;
125static int column = 0; 111static int column = 0;
126static int line = 0; 112static int line = 0;
@@ -182,6 +168,7 @@ int yywrap(yyscan_t yyscanner)
182 #ifndef LL_WINDOWS 168 #ifndef LL_WINDOWS
183 // Get gcc to stop complaining about lack of use of yyunput and input. 169 // Get gcc to stop complaining about lack of use of yyunput and input.
184 (void) yyunput; 170 (void) yyunput;
171 (void) input;
185 #endif 172 #endif
186#endif 173#endif
187// TODO - If we are getting files from stdin, or multiple -f arguments, we should loop through them and return 0. Return 1 when there are no more files. 174// TODO - If we are getting files from stdin, or multiple -f arguments, we should loop through them and return 0. Return 1 when there are no more files.