Re: [code] Markdown lexer issue

From: Alexander Misel <alexander_misel.att.live.cn>
Date: Thu, 11 Oct 2018 04:49:39 +0000

I did some patch to lexer.lua (newline pattern I think should only match 1 newline, but old lexer matches 1+)
@@ -1596,9 +1596,10 @@
 M.punct = lpeg_R('!/', ':@', '[\'', '{~')
 M.space = lpeg_S('\t\v\f\n\r ')

-M.newline = lpeg_S('\r\n\f')^1
-M.nonnewline = 1 - M.newline
-M.nonnewline_esc = 1 - (M.newline + '\\') + '\\' * M.any
+M.newline = lpeg_P('\r')^-1 * lpeg_S('\n\f')
+M.raw_newline = lpeg_S('\r\n\f')
+M.nonnewline = 1 - M.raw_newline
+M.nonnewline_esc = 1 - (M.raw_newline + '\\') + '\\' * M.any

 M.dec_num = M.digit^1
 M.hex_num = '0' * lpeg_S('xX') * M.xdigit^1
and improve highlighting of markdown.lua
________________________________
From: Mitchell <m.att.foicica.com>
Sent: Monday, October 8, 2018 1:51
To: code.att.foicica.com
Subject: Re: [code] Markdown lexer issue

Hi Alexander,

On Sun, 7 Oct 2018, Alexander Misel wrote:

> For CRLF line ending, the hr rule doesn't match the most simple case like
> [cid:a85f263d-b6d6-4530-92fb-090939f5234b]

I've pushed a fix[1].

> and thus all text below becomes bold because of the bold rule. I don't understand why the hr rule should be so complicated to match like the code below. By the way, what situation does the following code solve?
> [cid:b8bee418-470a-46e7-b3b9-ea31677600a2]

Markdown is a hard language to parse correctly. I'm sure there is a legitimate reason for 'hr' to be such a complicated pattern.

Cheers,
Mitchell

[1]: https://foicica.com/hg/scintilla/rev/ab85b0f7fd48

--
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.


-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Thu 11 Oct 2018 - 00:49:39 EDT

This archive was generated by hypermail 2.2.0 : Thu 11 Oct 2018 - 06:49:43 EDT