Rewrote Strike parser to avoid exponential blowup. [jgm/peg-markdown]
See https://github.com/jgm/peg-markdown/commit/a035b71
This commit is contained in:
parent
002c4b71f8
commit
feacd19307
@ -534,7 +534,6 @@ Symbol = < SpecialChar >
|
|||||||
UlOrStarLine = (UlLine | StarLine) { $$ = p.mkString(yytext) }
|
UlOrStarLine = (UlLine | StarLine) { $$ = p.mkString(yytext) }
|
||||||
StarLine = < "****" '*'* > | < Spacechar '*'+ &Spacechar >
|
StarLine = < "****" '*'* > | < Spacechar '*'+ &Spacechar >
|
||||||
UlLine = < "____" '_'* > | < Spacechar '_'+ &Spacechar >
|
UlLine = < "____" '_'* > | < Spacechar '_'+ &Spacechar >
|
||||||
TildeLine = < "~~~~" '~'* > | < Spacechar '~'+ &Spacechar >
|
|
||||||
|
|
||||||
Emph = EmphStar | EmphUl
|
Emph = EmphStar | EmphUl
|
||||||
|
|
||||||
@ -574,10 +573,10 @@ TwoTildeOpen = &{ p.extension.Strike } !TildeLine "~~" !Spacechar !Newline
|
|||||||
TwoTildeClose = &{ p.extension.Strike } !Spacechar !Newline a:Inline "~~" { $$ = a; }
|
TwoTildeClose = &{ p.extension.Strike } !Spacechar !Newline a:Inline "~~" { $$ = a; }
|
||||||
|
|
||||||
Strike = &{ p.extension.Strike }
|
Strike = &{ p.extension.Strike }
|
||||||
TwoTildeOpen
|
"~~" !Whitespace
|
||||||
a:StartList
|
a:StartList
|
||||||
( !TwoTildeClose Inline { a = cons($$, a) } )*
|
( !"~~" b:Inline { a = cons(b, a) } )+
|
||||||
TwoTildeClose { a = cons($$, a) }
|
"~~"
|
||||||
{ $$ = p.mkList(STRIKE, a) }
|
{ $$ = p.mkList(STRIKE, a) }
|
||||||
|
|
||||||
Image = '!' ( ExplicitLink | ReferenceLink )
|
Image = '!' ( ExplicitLink | ReferenceLink )
|
||||||
|
Loading…
Reference in New Issue
Block a user