lib/citrus/file.rb in citrus-2.3.4 vs lib/citrus/file.rb in citrus-2.3.5
- old
+ new
@@ -19,11 +19,11 @@
def module_basename
module_segments.last
end
end
- # A grammar for Citrus grammar files. This grammar is used in Citrus#eval to
+ # A grammar for Citrus grammar files. This grammar is used in Citrus.eval to
# parse and evaluate Citrus grammars and serves as a prime example of how to
# create a complex grammar complete with semantic interpretation in pure Ruby.
File = Grammar.new do #:nodoc:
## Hierarchical syntax
@@ -314,16 +314,16 @@
all(one_or_more([ zero_or_one('::'), :constant ]), :space) {
first.to_s
}
end
- rule :require_keyword, [ 'require', :space ]
- rule :include_keyword, [ 'include', :space ]
- rule :grammar_keyword, [ 'grammar', :space ]
- rule :root_keyword, [ 'root', :space ]
- rule :rule_keyword, [ 'rule', :space ]
- rule :end_keyword, [ 'end', :space ]
+ rule :require_keyword, [ /\brequire\b/, :space ]
+ rule :include_keyword, [ /\binclude\b/, :space ]
+ rule :grammar_keyword, [ /\bgrammar\b/, :space ]
+ rule :root_keyword, [ /\broot\b/, :space ]
+ rule :rule_keyword, [ /\brule\b/, :space ]
+ rule :end_keyword, [ /\bend\b/, :space ]
rule :lparen, [ '(', :space ]
rule :rparen, [ ')', :space ]
rule :lcurly, [ '{', :space ]
rule :rcurly, [ '}', :space ]
rule :bar, [ '|', :space ]
@@ -334,10 +334,10 @@
rule :white, /[ \t\n\r]/
rule :comment, /#.*/
rule :space, zero_or_more(any(:white, :comment))
end
- def File.parse(*args) # :nodoc:
+ def File.parse(*) # :nodoc:
super
rescue ParseError => e
# Raise SyntaxError when a parse fails.
raise SyntaxError, e
end