Skip to content

Instantly share code, notes, and snippets.

@joewalnes
Created October 15, 2013 19:04
Show Gist options
  • Save joewalnes/6996934 to your computer and use it in GitHub Desktop.
Save joewalnes/6996934 to your computer and use it in GitHub Desktop.
parser notes
"{{foo bar.baz.bam}}"
OPEN ID(foo) ID(bar) SEP ID(baz) SEP ID(bam) CLOSE
root
TemplateNode(statements)
TemplateNode([statement])
TemplateNode([expression])
TemplateNode([ExpressionNode(expression_contents)])
TemplateNode([ExpressionNode(path param* hash?)])
TemplateNode([ExpressionNode(IdNode.build(path_segments) param*)])
TemplateNode([ExpressionNode(IdNode.build(id) param*)])
TemplateNode([ExpressionNode(IdNode.build([CallNode("foo")]) param*)])
TemplateNode([ExpressionNode(CallNode("foo") param*)])
TemplateNode([ExpressionNode(CallNode("foo") path)])
TemplateNode([ExpressionNode(CallNode("foo") IdNode.build(path_segments))])
TemplateNode([ExpressionNode(CallNode("foo") IdNode.build(((([CallNode("bar")]) << CallNode("baz")) << CallNode("bam"))))])
TemplateNode([ExpressionNode(CallNode("foo") IdNode.build([CallNode("bar"), CallNode("baz"), CallNode("bam")))])
TemplateNode([ExpressionNode(CallNode("foo") PathNode([CallNode("bar"), CallNode("baz"), CallNode("bam")))])
to_s => "EXPRESSION(ID(foo) [PATH(ID(bar) ID(baz) ID(bam)]) )"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment