Allow distinguishing tag names in badpenny.

This commit is contained in:
Ian Gulliver
2014-08-03 11:04:52 -07:00
parent 8aacb5cfdb
commit b11a659f0c
2 changed files with 13 additions and 8 deletions

View File

@@ -7,7 +7,7 @@ badpenny = rr.Parser({
rr.Literal('}}')),
rr.Sequence(
rr.Literal('{{('),
rr.SavedLiteral('tagname'),
rr.Node('name', rr.SingleLineText()),
rr.Literal('}}'),
rr.MultiLineText(),
rr.Literal('{{)'),
@@ -22,7 +22,7 @@ badpenny = rr.Parser({
rr.Literal('}}')),
rr.Sequence(
rr.Literal('{{['),
rr.SavedLiteral('tagname'),
rr.Node('name', rr.SingleLineText()),
rr.Literal('}}'),
rr.MultiLineText(),
rr.Literal('{{]'),
@@ -31,7 +31,7 @@ badpenny = rr.Parser({
'value': rr.Node('value', rr.Sequence(
rr.Literal('{{'),
rr.SingleLineText(),
rr.Node('name', rr.SingleLineText()),
rr.Literal('}}'))),
'chunk': rr.Or(
@@ -44,4 +44,7 @@ badpenny = rr.Parser({
rr.ZeroOrMore(rr.Ref('chunk')),
rr.EndOfText()))
}, [
rr.ChildToAttribute('container', 'name'),
rr.ChildToAttribute('repeated', 'name'),
rr.ChildToAttribute('value', 'name')
]);