lib/code/parser/or_keyword.rb in code-ruby-0.4.0 vs lib/code/parser/or_keyword.rb in code-ruby-0.5.0

- old
+ new

@@ -1,29 +1,21 @@ class Code class Parser - class OrKeyword < Parslet::Parser - rule(:not_keyword) { ::Code::Parser::NotKeyword.new } + class OrKeyword < Operation + def statement + ::Code::Parser::NotKeyword + end - rule(:or_keyword) { str("or") } - rule(:and_keyword) { str("and") } + def or_keyword + str("or") + end - rule(:operator) { or_keyword | and_keyword } - - rule(:space) { str(" ") } - rule(:newline) { str("\n") } - rule(:whitespace) { (space | newline).repeat(1) } - rule(:whitespace?) { whitespace.maybe } - - rule(:or_rule) do - ( - not_keyword.as(:first) >> - ( - whitespace? >> operator.as(:operator) >> whitespace? >> - not_keyword.as(:statement) - ).repeat(1).as(:rest) - ).as(:or_keyword) | not_keyword + def and_keyword + str("and") end - root(:or_rule) + def operator + or_keyword | and_keyword + end end end end