From dc5f5a45a2315011ebeeb0a56a7434ead292dc96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Fri, 31 Mar 2017 12:50:33 +0200 Subject: 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. --- lua/lexers/lexer.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lua/lexers/lexer.lua') 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 -- cgit v1.2.3