26 ----------------------------------------------------------------------]] |
26 ----------------------------------------------------------------------]] |
27 |
27 |
28 local base = _G |
28 local base = _G |
29 local string = require "string" |
29 local string = require "string" |
30 module "lparser" |
30 module "lparser" |
31 local _G = base.getfenv() |
|
32 |
31 |
33 --[[-------------------------------------------------------------------- |
32 --[[-------------------------------------------------------------------- |
34 -- variable and data structure initialization |
33 -- variable and data structure initialization |
35 ----------------------------------------------------------------------]] |
34 ----------------------------------------------------------------------]] |
36 |
35 |
1204 line = ln -- may be needed for error messages |
1203 line = ln -- may be needed for error messages |
1205 local c = tok |
1204 local c = tok |
1206 local fn = stat_call[c] |
1205 local fn = stat_call[c] |
1207 -- handles: if while do for repeat function local return break |
1206 -- handles: if while do for repeat function local return break |
1208 if fn then |
1207 if fn then |
1209 _G[fn]() |
1208 _M[fn]() |
1210 -- return or break must be last statement |
1209 -- return or break must be last statement |
1211 if c == "return" or c == "break" then return true end |
1210 if c == "return" or c == "break" then return true end |
1212 else |
1211 else |
1213 expr_stat() |
1212 expr_stat() |
1214 end |
1213 end |
1290 ------------------------------------------------------------------ |
1289 ------------------------------------------------------------------ |
1291 globalinfo, globallookup, localinfo = {}, {}, {} |
1290 globalinfo, globallookup, localinfo = {}, {}, {} |
1292 ilocalinfo, ilocalrefs = {}, {} |
1291 ilocalinfo, ilocalrefs = {}, {} |
1293 end |
1292 end |
1294 |
1293 |
1295 return _G |
1294 return _M |