Open mcepl opened 9 months ago
Thanks for the report. The reST lexer really needs a refactor, and I'm not even sure significant newlines can be lexed properly since Scintillua doesn't always backtrack over newlines.
Does the following diff work for you? If it does, I can commit it. It doesn't work for me, but I'm using a GUI editor that typically starts lexing on newlines and doesn't always lex chunks as you'd expect.
--- lexers/lexer.lua
+++ lexers/lexer.lua
@@ -111,11 +111,11 @@
lex:add_style('substitution', lexer.styles.variable)
-- Comments.
local line_comment = lexer.to_eol(prefix)
local bprefix = any_indent * '..'
local block_comment = bprefix * lexer.newline * indented_block
-lex:add_rule('comment', #bprefix * token(lexer.COMMENT, starts_line(line_comment + block_comment)))
+lex:add_rule('comment', #bprefix * token(lexer.COMMENT, starts_line(block_comment + line_comment)))
-- Section titles (2 or more characters).
local adornment_chars = lpeg.C(S('!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'))
local adornment = lpeg.C(adornment_chars^2 * any_indent) * (lexer.newline + -1)
Talking about rST files, this is a wrong highlighting of a “commented out” paragraph.