aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormitchell <70453897+orbitalquark@users.noreply.github.com>2024-06-18 11:52:54 +0200
committerRandy Palamar <randy@rnpnr.xyz>2024-07-26 05:49:52 -0600
commit8e9c76550bafd7c573b1da91214439c7d5e0b4c9 (patch)
tree0d7cb77643202c85f31485a91d5c1719983cc096
parent496fcacfd08b0f7afe34979cd0803b956d3c7efa (diff)
downloadvis-8e9c76550bafd7c573b1da91214439c7d5e0b4c9.tar.gz
vis-8e9c76550bafd7c573b1da91214439c7d5e0b4c9.tar.xz
pull latest changes from scintillua
This combines: Added 'done' literal to Hare lexer. Initialize fold constants when Scintillua is used as a standalone library.
-rw-r--r--lua/lexers/hare.lua2
-rw-r--r--lua/lexers/lexer.lua9
2 files changed, 6 insertions, 5 deletions
diff --git a/lua/lexers/hare.lua b/lua/lexers/hare.lua
index fcf6e6a..24f5375 100644
--- a/lua/lexers/hare.lua
+++ b/lua/lexers/hare.lua
@@ -74,7 +74,7 @@ lex:set_word_list(lexer.FUNCTION_BUILTIN, {
'vaarg', 'vaend', 'vastart'
})
-lex:set_word_list(lexer.CONSTANT_BUILTIN, 'false null true void')
+lex:set_word_list(lexer.CONSTANT_BUILTIN, 'done false null true void')
lexer.property['scintillua.comment'] = '//'
diff --git a/lua/lexers/lexer.lua b/lua/lexers/lexer.lua
index f860d66..12a1404 100644
--- a/lua/lexers/lexer.lua
+++ b/lua/lexers/lexer.lua
@@ -1269,8 +1269,7 @@ function M.fold(lexer, text, start_line, start_level)
local folds = {}
if text == '' then return folds end
local fold = M.property_int['fold'] > 0
- local FOLD_BASE = M.FOLD_BASE or 0x400
- local FOLD_HEADER, FOLD_BLANK = M.FOLD_HEADER or 0x2000, M.FOLD_BLANK or 0x1000
+ local FOLD_BASE, FOLD_HEADER, FOLD_BLANK = M.FOLD_BASE, M.FOLD_HEADER, M.FOLD_BLANK
if M._standalone then M._text, M.line_state = text, {} end
if fold and lexer._fold_points then
local lines = {}
@@ -1443,8 +1442,8 @@ function M.new(name, opts)
return lexer
end
---- Creates a substitute for some Scintilla tables and functions that Scintillua depends on
--- when using it as a standalone module.
+--- Creates a substitute for some Scintilla tables, functions, and fields that Scintillua
+-- depends on when using it as a standalone module.
local function initialize_standalone_library()
M.property = setmetatable({['scintillua.lexers'] = package.path:gsub('/%?%.lua', '/lexers')}, {
__index = function() return '' end, __newindex = function(t, k, v) rawset(t, k, tostring(v)) end
@@ -1471,6 +1470,8 @@ local function initialize_standalone_library()
end
})
+ M.FOLD_BASE, M.FOLD_HEADER, M.FOLD_BLANK = 0x400, 0x2000, 0x1000
+
M._standalone = true
end