summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/parser_support.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-10-05 17:46:30 -0500
committerLuke Kanies <luke@madstop.com>2007-10-05 17:46:30 -0500
commitcdaad286b1fe5fc3c1ab363c890bb6a8a752c9b5 (patch)
tree91a6841945eb2766f2ab9591ddc2b9ca5e0cd357 /lib/puppet/parser/parser_support.rb
parent7d7e428df34077062aebb8f08f10eef42d0c8907 (diff)
downloadpuppet-cdaad286b1fe5fc3c1ab363c890bb6a8a752c9b5.tar.gz
puppet-cdaad286b1fe5fc3c1ab363c890bb6a8a752c9b5.tar.xz
puppet-cdaad286b1fe5fc3c1ab363c890bb6a8a752c9b5.zip
Fixing error thrown when the end of the file is encountered unexpectedly
Diffstat (limited to 'lib/puppet/parser/parser_support.rb')
-rw-r--r--lib/puppet/parser/parser_support.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/puppet/parser/parser_support.rb b/lib/puppet/parser/parser_support.rb
index 8cf0dcfe8..acf3c9f7c 100644
--- a/lib/puppet/parser/parser_support.rb
+++ b/lib/puppet/parser/parser_support.rb
@@ -366,10 +366,12 @@ class Puppet::Parser::Parser
end
def on_error(token,value,stack)
- #on '%s' at '%s' in\n'%s'" % [token,value,stack]
- #error = "line %s: parse error after '%s'" %
- # [@lexer.line,@lexer.last]
- error = "Syntax error at '%s'" % [value]
+ if token == 0 # denotes end of file
+ value = 'end of file'
+ else
+ value = "'%s'" % value
+ end
+ error = "Syntax error at %s" % [value]
if brace = @lexer.expected
error += "; expected '%s'" % brace