Efficiency improvement (!Whitespace instead of &Nonspacechar). [jgm/peg-markdown]

See https://github.com/jgm/peg-markdown/commit/c95552a
This commit is contained in:
Michael Teichgräber 2013-01-23 22:41:13 +01:00
parent 3d0dcc5c4b
commit 7ce368c8ef
2 changed files with 7 additions and 5 deletions

View File

@ -531,7 +531,9 @@ UlLine = < "____" '_'* > | < Spacechar '_'+ &Spacechar >
Emph = EmphStar | EmphUl
EmphStar = '*' &Nonspacechar
Whitespace = Spacechar | Newline
EmphStar = '*' !Whitespace
a:StartList
( !'*' b:Inline { a = cons(b, a) }
| b:StrongStar { a = cons(b, a) }
@ -539,7 +541,7 @@ EmphStar = '*' &Nonspacechar
'*'
{ $$ = p.mkList(EMPH, a) }
EmphUl = '_' &Nonspacechar
EmphUl = '_' !Whitespace
a:StartList
( !'_' b:Inline { a = cons(b, a) }
| b:StrongUl { a = cons(b, a) }
@ -549,13 +551,13 @@ EmphUl = '_' &Nonspacechar
Strong = StrongStar | StrongUl
StrongStar = "**" &Nonspacechar
StrongStar = "**" !Whitespace
a:StartList
( !"**" b:Inline { a = cons(b, a) })+
"**"
{ $$ = p.mkList(STRONG, a) }
StrongUl = "__" &Nonspacechar
StrongUl = "__" !Whitespace
a:StartList
( !"__" b:Inline { a = cons(b, a) })+
"__"

2
portid
View File

@ -1 +1 @@
197
199