diff options
author | SoniEx2 <endermoneymod@gmail.com> | 2019-04-07 12:54:48 -0300 |
---|---|---|
committer | SoniEx2 <endermoneymod@gmail.com> | 2019-04-07 12:54:48 -0300 |
commit | fd48534de3427de16c3077f7d112d0bcfb030b73 (patch) | |
tree | fe17de889f1a763594b71551546d411af50d8878 /parser.lua | |
parent | 282dbabb7e4db8d2b2c4e2ab3e764fa9b8f48c8a (diff) |
Fix Lua 5.1/Lua 5.2/LuaJIT compat
Diffstat (limited to 'parser.lua')
-rw-r--r-- | parser.lua | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/parser.lua b/parser.lua index 4f4e166..12397ef 100644 --- a/parser.lua +++ b/parser.lua @@ -71,9 +71,15 @@ local function get_next_common(state, in_pos, token) recheck = true end end - for i, hook in ipairs(st) do - if hook then -- allow overriding/disabling hooks - hook(state, token, rule) + do -- post-hooks CANNOT USE ipairs HERE BECAUSE Lua 5.1/5.2 + local pos = 1 + local hook = st[pos] + while hook ~= nil do + if hook then + hook(state, token, rule) + end + pos = pos + 1 + hook = st[pos] end end state[STATE] = transition -- may be nil or false |