diff options
author | David Walter Seikel | 2012-01-16 00:01:28 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-16 00:01:28 +1000 |
commit | 28c2424eeb6fb829911af7d812cb7ce7540e8401 (patch) | |
tree | bd6c95c0b07c351204111e4ca4c9a851614050e3 /LuaSL/src/LuaSL_lexer.l | |
parent | Get multi file parsing working. (diff) | |
download | SledjHamr-28c2424eeb6fb829911af7d812cb7ce7540e8401.zip SledjHamr-28c2424eeb6fb829911af7d812cb7ce7540e8401.tar.gz SledjHamr-28c2424eeb6fb829911af7d812cb7ce7540e8401.tar.bz2 SledjHamr-28c2424eeb6fb829911af7d812cb7ce7540e8401.tar.xz |
Actually make use of the lexers line and column numbers.
Diffstat (limited to 'LuaSL/src/LuaSL_lexer.l')
-rw-r--r-- | LuaSL/src/LuaSL_lexer.l | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/LuaSL/src/LuaSL_lexer.l b/LuaSL/src/LuaSL_lexer.l index 15cfae2..876d30a 100644 --- a/LuaSL/src/LuaSL_lexer.l +++ b/LuaSL/src/LuaSL_lexer.l | |||
@@ -112,22 +112,9 @@ IDENTIFIER [[:alpha:]](_|[[:alpha:]]|[[:digit:]])* | |||
112 | 112 | ||
113 | int common(YYSTYPE *lval, char *text, LuaSL_yyparseParam *param, boolean checkIgnorable, int type) | 113 | int common(YYSTYPE *lval, char *text, LuaSL_yyparseParam *param, boolean checkIgnorable, int type) |
114 | { | 114 | { |
115 | int i; | ||
116 | |||
117 | for (i = 0; text[i] != '\0'; i++) | ||
118 | if (text[i] == '\n') | ||
119 | { | ||
120 | param->column = 0; | ||
121 | param->line++; | ||
122 | } | ||
123 | else if (text[i] == '\t') | ||
124 | param->column += 8 - (param->column % 8); | ||
125 | else | ||
126 | param->column++; | ||
127 | |||
128 | lval->token = tokens[type - lowestToken]; | 115 | lval->token = tokens[type - lowestToken]; |
129 | lval->line = param->line; | 116 | lval->line = yyget_lineno(param->scanner); |
130 | lval->column = param->column; | 117 | lval->column = yyget_column(param->scanner); |
131 | 118 | ||
132 | if (checkIgnorable) | 119 | if (checkIgnorable) |
133 | { | 120 | { |