lib/code/parser/group.rb in code-ruby-0.4.0 vs lib/code/parser/group.rb in code-ruby-0.5.0
- old
+ new
@@ -1,17 +1,22 @@
class Code
class Parser
- class Group < Parslet::Parser
- rule(:name) { ::Code::Parser::Name.new }
- rule(:code) { ::Code::Parser::Code.new.present }
+ class Group < Language
+ def code
+ ::Code::Parser::Code
+ end
- rule(:opening_parenthesis) { str("(") }
- rule(:closing_parenthesis) { str(")") }
+ def opening_parenthesis
+ str("(")
+ end
- rule(:group) do
- (opening_parenthesis >> code >> closing_parenthesis).as(:group) | name
+ def closing_parenthesis
+ str(")")
end
- root(:group)
+ def root
+ (opening_parenthesis << code << closing_parenthesis.maybe).aka(:group) |
+ ::Code::Parser::Call
+ end
end
end
end