README.txt in aniero-tire_swing-0.0.2 vs README.txt in aniero-tire_swing-0.0.3

- old
+ new

@@ -15,14 +15,14 @@ Given a treetop grammar: grammar SimpleAssignment rule assignment - lhs:variable space* "=" space* rhs:variable <create_node(:assignment)> + lhs:variable space* "=" space* rhs:variable <node(:assignment)> end rule variable - [a-z]+ <create_node(:variable)> + [a-z]+ <node(:variable)> end rule space [ ]+ end end @@ -34,13 +34,17 @@ node :assignment, :lhs, :rhs node :variable, :value => :text_value end -When you parse the grammar and call .build, it will return an AST using the nodes you defined, auto-building everything +And use TireSwing to extend the Treetop-provided parser with a helper method or two: + + TireSwing.parses_grammar(SimpleAssignment) + +When you parse the grammar using the helper, it will return an AST using the nodes you defined, auto-building everything for you: - ast = Parser.parse("foo = bar").build + ast = SimpleAssignment.ast("foo = bar") ast.class #=> SimpleAssignment::Assignment ast.lhs.class #=> SimpleAssignment::Variable ast.lhs.value #=> "foo"