X Tutup
Skip to content

Commit 3bf8b97

Browse files
committed
remove deprecated warnings, update spec for overwritten moonscript lexer
1 parent 5aecf87 commit 3bf8b97

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

spec/syntaxhighlight_spec.moon

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ describe "syntaxhighlight", ->
3131
</span><span class="sh_operator">&lt;/</span><span class="sh_identifier">html</span><span class="sh_operator">&gt;</span><span class="sh_moonscript_whitespace sh_whitespace">
3232
</span></pre>]], out
3333

34+
it "highlights moonscript with custom changes", ->
35+
out = assert require("syntaxhighlight").highlight_to_html "moonscript", [[{for: @}]]
36+
assert.same [[<pre class="sh_highlight"><span class="sh_symbol sh_embedded">{</span><span class="sh_tbl_key sh_regex">for:</span><span class="sh_moonscript_whitespace sh_whitespace"> </span><span class="sh_self_ref sh_label">@</span><span class="sh_symbol sh_embedded">}</span></pre>]], out
37+
3438
it "highlights html with css", ->
3539
out = assert require("syntaxhighlight").highlight_to_html "html", [[
3640
<!DOCTYPE HTML>

syntaxhighlight/lexers/moonscript.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ local longstring = lpeg.Cmt('[' * lpeg.C(P('=')^0) * '[',
120120
end)
121121

122122
-- Strings.
123-
local sq_str = lexer.range("'", false, false)
124-
local dq_str = lexer.range('"', false, false)
123+
local sq_str = lexer.range("'")
124+
local dq_str = lexer.range('"')
125125
lex:add_rule('string', token(lexer.STRING, sq_str + dq_str) +
126126
token('longstring', longstring))
127127
lex:add_style('longstring', lexer.STYLE_STRING)

syntaxhighlight/lexers/nginx.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ lex:add_style('library', lexer.STYLE_TYPE)
9898

9999
lex:add_rule('variable', token(lexer.VARIABLE, '$' * (1 - lexer.space)^1))
100100

101-
local sq_str = lexer.delimited_range("'", false, true)
102-
local dq_str = lexer.delimited_range('"', false, true)
101+
local sq_str = lexer.range("'")
102+
local dq_str = lexer.range('"')
103103
lex:add_rule('string', token(lexer.STRING, sq_str + dq_str))
104104

105105
lex:add_rule('number', token(lexer.NUMBER, lexer.float + lexer.integer))

0 commit comments

Comments
 (0)
X Tutup