aboutsummaryrefslogtreecommitdiff
path: root/lua/lexers/lexer.lua
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-03-31 12:50:33 +0200
committerMarc André Tanner <mat@brain-dump.org>2017-03-31 12:58:21 +0200
commitdc5f5a45a2315011ebeeb0a56a7434ead292dc96 (patch)
tree42e155217801668ace0d7c0a2264a323ed42c801 /lua/lexers/lexer.lua
parent6f44057d09b865e9c7e443cd7d7adb8e541121db (diff)
downloadvis-dc5f5a45a2315011ebeeb0a56a7434ead292dc96.tar.gz
vis-dc5f5a45a2315011ebeeb0a56a7434ead292dc96.tar.xz
lexers: sync with scintillua changeset 600 rev fdeca0b808bf
I think the default value for the cache argument to the lexer load function should be true, not false. Optimize for the common case. This makes the API ugly/harder to use. But for now we follow upstream.
Diffstat (limited to 'lua/lexers/lexer.lua')
-rw-r--r--lua/lexers/lexer.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/lua/lexers/lexer.lua b/lua/lexers/lexer.lua
index e7d749f..d4af90c 100644
--- a/lua/lexers/lexer.lua
+++ b/lua/lexers/lexer.lua
@@ -1028,10 +1028,14 @@ end
-- @param name The name of the lexing language.
-- @param alt_name The alternate name of the lexing language. This is useful for
-- embedding the same child lexer with multiple sets of start and end tokens.
+-- @param cache Flag indicating whether or not to load lexers from the cache.
+-- This should only be `true` when initially loading a lexer (e.g. not from
+-- within another lexer for embedding purposes).
+-- The default value is `false`.
-- @return lexer object
-- @name load
-function M.load(name, alt_name)
- if M.lexers[alt_name or name] then return M.lexers[alt_name or name] end
+function M.load(name, alt_name, cache)
+ if cache and M.lexers[alt_name or name] then return M.lexers[alt_name or name] end
parent_lexer = nil -- reset
-- When using Scintillua as a stand-alone module, the `property` and