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

- old
+ new

@@ -1,14 +1,17 @@ class Code class Parser - class Boolean < Parslet::Parser - rule(:nothing) { ::Code::Parser::Nothing.new } + class Boolean < Language + def true_keyword + str("true") + end - rule(:true_keyword) { str("true") } - rule(:false_keyword) { str("false") } + def false_keyword + str("false") + end - rule(:boolean) { (true_keyword | false_keyword).as(:boolean) | nothing } - - root(:boolean) + def root + (true_keyword | false_keyword).aka(:boolean) | ::Code::Parser::Nothing + end end end end