Efficiency improvement (!Whitespace instead of &Nonspacechar). [jgm/peg-markdown]
See https://github.com/jgm/peg-markdown/commit/c95552a
This commit is contained in:
parent
3d0dcc5c4b
commit
7ce368c8ef
10
parser.leg
10
parser.leg
@ -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) })+
|
||||
"__"
|
||||
|
Loading…
Reference in New Issue
Block a user