aboutsummaryrefslogtreecommitdiff
path: root/lexers/lexer.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lexers/lexer.lua')
-rw-r--r--lexers/lexer.lua5
1 files changed, 2 insertions, 3 deletions
diff --git a/lexers/lexer.lua b/lexers/lexer.lua
index bce9c29..5653bb2 100644
--- a/lexers/lexer.lua
+++ b/lexers/lexer.lua
@@ -1032,9 +1032,7 @@ function M.load(name, alt_name)
-- prevent errors from occurring.
if not M.property then
M.property, M.property_int = {}, setmetatable({}, {
- __index = function(t, k)
- return tostring(tonumber(M.property[k]) or 0)
- end,
+ __index = function(t, k) return tonumber(M.property[k]) or 0 end,
__newindex = function() error('read-only property') end
})
end
@@ -1114,6 +1112,7 @@ end
-- @return table of token names and positions.
-- @name lex
function M.lex(lexer, text, init_style)
+ if not lexer._GRAMMAR then return {M.DEFAULT, #text + 1} end
if not lexer._LEXBYLINE then
-- For multilang lexers, build a new grammar whose initial_rule is the
-- current language.