summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/lexer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser/lexer.rb')
-rw-r--r--lib/puppet/parser/lexer.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb
index e1377984f..bc1e99f65 100644
--- a/lib/puppet/parser/lexer.rb
+++ b/lib/puppet/parser/lexer.rb
@@ -201,9 +201,9 @@ module Puppet
# we've encountered an opening quote...
# slurp in the rest of the string and return it
def slurpstring(quote)
- #Puppet.debug("searching '%s'" % self.rest)
- str = @scanner.scan_until(/[^\\]#{quote}/)
- #str = @scanner.scan_until(/"/)
+ # we search for the next quote that isn't preceded by a
+ # backslash; the caret is there to match empty strings
+ str = @scanner.scan_until(/([^\\]|^)#{quote}/)
if str.nil?
raise Puppet::LexError.new("Unclosed quote after '%s' in '%s'" %
[self.last,self.rest])
@@ -215,6 +215,7 @@ module Puppet
return str
end
+ # just parse a string, not a whole file
def string=(string)
@scanner = StringScanner.new(string)
end