Rewrote Strike parser to avoid exponential blowup. [jgm/peg-markdown]

See https://github.com/jgm/peg-markdown/commit/a035b71
This commit is contained in:
Michael Teichgräber 2013-06-11 02:51:31 +02:00
parent 002c4b71f8
commit feacd19307
2 changed files with 4 additions and 5 deletions

View File

@ -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 )

2
portid
View File

@ -1 +1 @@
ad324b86de96 af94d25475d3