From 6551e86a03f5fa1f499386c96faa4587bdfac24e Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Mon, 21 Sep 2009 22:48:30 +0200 Subject: Fix #2664 - Mathematic expressions mis-lexed as Regex This is not the real fix. It is just an hot-fix to limit the issue. The issue is that the lexer regexes have precedences over simple '/' (divide). In the following expression: $var = 4096 / 4 $var2 = "/tmp/file" The / 4... part is mis-lexed as a regex instead of a mathematical expression. The current fix limits regex to one-line. Signed-off-by: Brice Figureau --- lib/puppet/parser/lexer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb index e027a69d1..0db6c22f2 100644 --- a/lib/puppet/parser/lexer.rb +++ b/lib/puppet/parser/lexer.rb @@ -171,7 +171,7 @@ class Puppet::Parser::Lexer [self,value] end - TOKENS.add_token :REGEX, %r{/[^/]*/} do |lexer, value| + TOKENS.add_token :REGEX, %r{/[^/\n]*/} do |lexer, value| # Make sure we haven't matched an escaped / while value[-2..-2] == '\\' other = lexer.scan_until(%r{/}) -- cgit