diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-05-25 00:31:28 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-05-25 00:31:28 +0000 |
commit | 62a4d4c91df2aa6e7a6f28dfdf81f95f28987216 (patch) | |
tree | 324aaf518981a1c6d4bf75b54c2119a82d76c0cf /lib/puppet/parser/parser.rb | |
parent | 2b372df7038a268eee31372f62e8cf6be989b09e (diff) | |
download | puppet-62a4d4c91df2aa6e7a6f28dfdf81f95f28987216.tar.gz puppet-62a4d4c91df2aa6e7a6f28dfdf81f95f28987216.tar.xz puppet-62a4d4c91df2aa6e7a6f28dfdf81f95f28987216.zip |
Adding better error reporting on unmatched brackets -- you will now get notification of what was expected in most cases
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2531 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser/parser.rb')
-rw-r--r-- | lib/puppet/parser/parser.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/puppet/parser/parser.rb b/lib/puppet/parser/parser.rb index 236bd390f..e52d53faa 100644 --- a/lib/puppet/parser/parser.rb +++ b/lib/puppet/parser/parser.rb @@ -29,7 +29,7 @@ module Puppet class Parser < Racc::Parser -module_eval <<'..end grammar.ra modeval..id3bb0c917f5', 'grammar.ra', 608 +module_eval <<'..end grammar.ra modeval..idec1116a64f', 'grammar.ra', 608 require 'puppet/parser/functions' attr_reader :file, :interp @@ -80,6 +80,9 @@ end # Raise a Parse error. def error(message) + if brace = @lexer.expected + message += "; expected '%s'" + end except = Puppet::ParseError.new(message) except.line = @lexer.line if @lexer.file @@ -183,6 +186,10 @@ def on_error(token,value,stack) # [@lexer.line,@lexer.last] error = "Syntax error at '%s'" % [value] + if brace = @lexer.expected + error += "; expected '%s'" % brace + end + except = Puppet::ParseError.new(error) except.line = @lexer.line if @lexer.file @@ -254,7 +261,7 @@ end # $Id$ -..end grammar.ra modeval..id3bb0c917f5 +..end grammar.ra modeval..idec1116a64f ##### racc 1.4.5 generates ### |