diff options
author | SoniEx2 <endermoneymod@gmail.com> | 2019-04-06 21:38:10 -0300 |
---|---|---|
committer | SoniEx2 <endermoneymod@gmail.com> | 2019-04-06 21:38:10 -0300 |
commit | d50ad877944ae9bc28d366ff1f3a30b3cc853748 (patch) | |
tree | 12af4b3e0b7e83e789b3d7590c7b6cbe2f700fd5 /parser.lua | |
parent | 0118cdcb80c8a299eb156ee669463b84fa44f51d (diff) |
Lots of todos still
Diffstat (limited to 'parser.lua')
-rw-r--r-- | parser.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/parser.lua b/parser.lua index 0cd2853..bfa7dd3 100644 --- a/parser.lua +++ b/parser.lua @@ -39,6 +39,17 @@ local function get_next_common(state, in_pos, token) if state[STATE] then local st = state[STATE] local rule = st[token] + do -- pre-hooks + 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 transition = rule if transition == nil then transition = st[""] @@ -143,6 +154,10 @@ return { if not rule then local t = state[COLLECT] t[#t+1] = token + if t.coalesce and #t > t.coalesce then + t[1] = table.concat(t) + for i=2, #t do t[i] = nil end + end end end, } |