diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-06-19 15:05:14 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-06-19 15:05:14 -0300 |
commit | feb2083730c718b8fa7de6824db1c1dfe7a5542a (patch) | |
tree | 29dda71837b7085a1d87caf8c95022442f0c70a8 /lparser.c | |
parent | 8d2baf719cf8687dba1648da4c5d9450d0bb2c14 (diff) | |
download | lua-feb2083730c718b8fa7de6824db1c1dfe7a5542a.tar.gz lua-feb2083730c718b8fa7de6824db1c1dfe7a5542a.tar.bz2 lua-feb2083730c718b8fa7de6824db1c1dfe7a5542a.zip |
better control of source name
Diffstat (limited to 'lparser.c')
-rw-r--r-- | lparser.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 1.94 2000/06/05 14:56:18 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 1.95 2000/06/12 13:52:05 roberto Exp roberto $ |
3 | ** LL(1) Parser and code generator for Lua | 3 | ** LL(1) Parser and code generator for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -352,7 +352,7 @@ static void pushclosure (LexState *ls, FuncState *func) { | |||
352 | } | 352 | } |
353 | 353 | ||
354 | 354 | ||
355 | static void open_func (LexState *ls, FuncState *fs, TString *source) { | 355 | static void open_func (LexState *ls, FuncState *fs) { |
356 | Proto *f = luaF_newproto(ls->L); | 356 | Proto *f = luaF_newproto(ls->L); |
357 | fs->prev = ls->fs; /* linked list of funcstates */ | 357 | fs->prev = ls->fs; /* linked list of funcstates */ |
358 | fs->ls = ls; | 358 | fs->ls = ls; |
@@ -364,7 +364,7 @@ static void open_func (LexState *ls, FuncState *fs, TString *source) { | |||
364 | fs->lastsetline = 0; | 364 | fs->lastsetline = 0; |
365 | fs->bl = NULL; | 365 | fs->bl = NULL; |
366 | fs->f = f; | 366 | fs->f = f; |
367 | f->source = source; | 367 | f->source = ls->source; |
368 | fs->pc = 0; | 368 | fs->pc = 0; |
369 | fs->lasttarget = 0; | 369 | fs->lasttarget = 0; |
370 | fs->jlt = NO_JUMP; | 370 | fs->jlt = NO_JUMP; |
@@ -398,8 +398,8 @@ static void close_func (LexState *ls) { | |||
398 | Proto *luaY_parser (lua_State *L, ZIO *z) { | 398 | Proto *luaY_parser (lua_State *L, ZIO *z) { |
399 | struct LexState lexstate; | 399 | struct LexState lexstate; |
400 | struct FuncState funcstate; | 400 | struct FuncState funcstate; |
401 | luaX_setinput(L, &lexstate, z); | 401 | luaX_setinput(L, &lexstate, z, luaS_new(L, zname(z))); |
402 | open_func(&lexstate, &funcstate, luaS_new(L, zname(z))); | 402 | open_func(&lexstate, &funcstate); |
403 | next(&lexstate); /* read first token */ | 403 | next(&lexstate); /* read first token */ |
404 | chunk(&lexstate); | 404 | chunk(&lexstate); |
405 | check_condition(&lexstate, (lexstate.t.token == TK_EOS), "<eof> expected"); | 405 | check_condition(&lexstate, (lexstate.t.token == TK_EOS), "<eof> expected"); |
@@ -1128,7 +1128,7 @@ static void parlist (LexState *ls) { | |||
1128 | static void body (LexState *ls, int needself, int line) { | 1128 | static void body (LexState *ls, int needself, int line) { |
1129 | /* body -> '(' parlist ')' chunk END */ | 1129 | /* body -> '(' parlist ')' chunk END */ |
1130 | FuncState new_fs; | 1130 | FuncState new_fs; |
1131 | open_func(ls, &new_fs, ls->fs->f->source); | 1131 | open_func(ls, &new_fs); |
1132 | new_fs.f->lineDefined = line; | 1132 | new_fs.f->lineDefined = line; |
1133 | check(ls, '('); | 1133 | check(ls, '('); |
1134 | if (needself) | 1134 | if (needself) |