From cdaad286b1fe5fc3c1ab363c890bb6a8a752c9b5 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Fri, 5 Oct 2007 17:46:30 -0500 Subject: Fixing error thrown when the end of the file is encountered unexpectedly --- lib/puppet/parser/parser_support.rb | 10 ++++++---- 1 file 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 -- cgit