1
1
/*
2
- ** $Id: llex.c,v 2.94 2015/10/28 18:51:47 roberto Exp roberto $
2
+ ** $Id: llex.c,v 2.95 2015/11/19 19:16:22 roberto Exp roberto $
3
3
** Lexical Analyzer
4
4
** See Copyright Notice in lua.h
5
5
*/
@@ -162,7 +162,6 @@ static void inclinenumber (LexState *ls) {
162
162
void luaX_setinput (lua_State * L , LexState * ls , ZIO * z , TString * source ,
163
163
int firstchar ) {
164
164
ls -> t .token = 0 ;
165
- ls -> decpoint = '.' ;
166
165
ls -> L = L ;
167
166
ls -> current = firstchar ;
168
167
ls -> lookahead .token = TK_EOS ; /* no look-ahead token */
@@ -207,35 +206,6 @@ static int check_next2 (LexState *ls, const char *set) {
207
206
}
208
207
209
208
210
- /*
211
- ** change all characters 'from' in buffer to 'to'
212
- */
213
- static void buffreplace (LexState * ls , char from , char to ) {
214
- if (from != to ) {
215
- size_t n = luaZ_bufflen (ls -> buff );
216
- char * p = luaZ_buffer (ls -> buff );
217
- while (n -- )
218
- if (p [n ] == from ) p [n ] = to ;
219
- }
220
- }
221
-
222
-
223
- /*
224
- ** in case of format error, try to change decimal point separator to
225
- ** the one defined in the current locale and check again
226
- */
227
- static void trydecpoint (LexState * ls , TValue * o ) {
228
- char old = ls -> decpoint ;
229
- ls -> decpoint = lua_getlocaledecpoint ();
230
- buffreplace (ls , old , ls -> decpoint ); /* try new decimal separator */
231
- if (luaO_str2num (luaZ_buffer (ls -> buff ), o ) == 0 ) {
232
- /* format error with correct decimal point: no more options */
233
- buffreplace (ls , ls -> decpoint , '.' ); /* undo change (for error message) */
234
- lexerror (ls , "malformed number" , TK_FLT );
235
- }
236
- }
237
-
238
-
239
209
/* LUA_NUMBER */
240
210
/*
241
211
** this function is quite liberal in what it accepts, as 'luaO_str2num'
@@ -259,9 +229,8 @@ static int read_numeral (LexState *ls, SemInfo *seminfo) {
259
229
else break ;
260
230
}
261
231
save (ls , '\0' );
262
- buffreplace (ls , '.' , ls -> decpoint ); /* follow locale for decimal point */
263
232
if (luaO_str2num (luaZ_buffer (ls -> buff ), & obj ) == 0 ) /* format error? */
264
- trydecpoint (ls , & obj ); /* try to update decimal point separator */
233
+ lexerror (ls , "malformed number" , TK_FLT );
265
234
if (ttisinteger (& obj )) {
266
235
seminfo -> i = ivalue (& obj );
267
236
return TK_INT ;
0 commit comments