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:
parent
eb8169a8e5
commit
77a926239d
@ -31,7 +31,7 @@ const (
|
||||
// rebuild it using
|
||||
// make nuke
|
||||
// make parser
|
||||
needParserIfaceVersion = parserIfaceVersion_4
|
||||
needParserIfaceVersion = parserIfaceVersion_5
|
||||
)
|
||||
|
||||
// Markdown Options:
|
||||
|
15
parser.leg
15
parser.leg
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user