lib/code/parser/not_keyword.rb in template-ruby-0.4.0 vs lib/code/parser/not_keyword.rb in template-ruby-0.5.0
- old
+ new
@@ -1,21 +1,23 @@
class Code
class Parser
- class NotKeyword < Parslet::Parser
- rule(:equal) { ::Code::Parser::Equal.new }
+ class NotKeyword < Language
+ def not_class
+ ::Code::Parser::NotKeyword
+ end
- rule(:not_keyword) { str("not") }
+ def whitespace
+ ::Code::Parser::Whitespace
+ end
- rule(:operator) { not_keyword }
-
- rule(:space) { str(" ") }
- rule(:newline) { str("\n") }
- rule(:whitespace) { (space | newline).repeat(1) }
-
- rule(:not_rule) do
- (not_keyword >> whitespace >> not_rule).as(:not_keyword) | equal
+ def not_keyword
+ str("not")
end
- root(:not_rule)
+ def root
+ (not_keyword.aka(:operator) << whitespace << not_class.aka(:right)).aka(
+ :not
+ ) | ::Code::Parser::Equal
+ end
end
end
end