Fixed Str parser so it handles apostrophes inside words. [jgm/peg-markdown]

See https://github.com/jgm/peg-markdown/commit/4bb5083
This commit is contained in:
Michael Teichgräber 2012-04-30 01:22:42 +02:00
parent eb8169a8e5
commit 77a926239d
3 changed files with 13 additions and 6 deletions

View File

@ -31,7 +31,7 @@ const (
// rebuild it using
// make nuke
// make parser
needParserIfaceVersion = parserIfaceVersion_4
needParserIfaceVersion = parserIfaceVersion_5
)
// Markdown Options:

View File

@ -28,7 +28,7 @@ import (
)
const (
parserIfaceVersion_4 = iota
parserIfaceVersion_5 = iota
)
// Semantic value of a parsing action.
@ -491,8 +491,15 @@ Space = Spacechar+
{ $$ = p.mkString(" ")
$$.key = SPACE }
Str = < NormalChar (NormalChar | '_'+ &Alphanumeric)* >
{ $$ = p.mkString(yytext) }
Str = a:StartList < NormalChar+ > { a = cons(p.mkString(yytext), a) }
( StrChunk { a = cons($$, a) } )*
{ if a.next == nil { $$ = a; } else { $$ = p.mkList(LIST, a) } }
StrChunk = < (NormalChar | '_'+ &Alphanumeric)+ > { $$ = p.mkString(yytext) } |
AposChunk
AposChunk = &{ p.extension.Smart } '\'' &Alphanumeric
{ $$ = p.mkElem(APOSTROPHE) }
EscapedChar = '\\' !Newline < [-\\`|*_{}[\]()#+.!><] >
{ $$ = p.mkString(yytext) }
@ -747,7 +754,7 @@ EnDash = '-' &Digit
EmDash = ("---" | "--")
{ $$ = p.mkElem(EMDASH) }
SingleQuoteStart = '\'' ![)!\],.;:-? \t\n] !( ( "s" | "t" | "m" | "ve" | "ll" | "re" ) !Alphanumeric )
SingleQuoteStart = '\'' ![)!\],.;:-? \t\n]
SingleQuoteEnd = '\'' !Alphanumeric

2
portid
View File

@ -1 +1 @@
162
163