From feacd19307e8b44c18161caf636e73a995011797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Teichgr=C3=A4ber?= Date: Tue, 11 Jun 2013 02:51:31 +0200 Subject: [PATCH] Rewrote Strike parser to avoid exponential blowup. [jgm/peg-markdown] See https://github.com/jgm/peg-markdown/commit/a035b71 --- parser.leg | 7 +++---- portid | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/parser.leg b/parser.leg index fc8b6b1..93eac70 100644 --- a/parser.leg +++ b/parser.leg @@ -534,7 +534,6 @@ Symbol = < SpecialChar > UlOrStarLine = (UlLine | StarLine) { $$ = p.mkString(yytext) } StarLine = < "****" '*'* > | < Spacechar '*'+ &Spacechar > UlLine = < "____" '_'* > | < Spacechar '_'+ &Spacechar > -TildeLine = < "~~~~" '~'* > | < Spacechar '~'+ &Spacechar > Emph = EmphStar | EmphUl @@ -574,10 +573,10 @@ TwoTildeOpen = &{ p.extension.Strike } !TildeLine "~~" !Spacechar !Newline TwoTildeClose = &{ p.extension.Strike } !Spacechar !Newline a:Inline "~~" { $$ = a; } Strike = &{ p.extension.Strike } - TwoTildeOpen + "~~" !Whitespace a:StartList - ( !TwoTildeClose Inline { a = cons($$, a) } )* - TwoTildeClose { a = cons($$, a) } + ( !"~~" b:Inline { a = cons(b, a) } )+ + "~~" { $$ = p.mkList(STRIKE, a) } Image = '!' ( ExplicitLink | ReferenceLink ) diff --git a/portid b/portid index 385c287..c0bdf6d 100644 --- a/portid +++ b/portid @@ -1 +1 @@ -ad324b86de96 +af94d25475d3