diff options
| author | Brice Figureau <brice-puppet@daysofwonder.com> | 2009-09-21 22:48:30 +0200 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2009-09-22 09:42:00 +1000 |
| commit | 6551e86a03f5fa1f499386c96faa4587bdfac24e (patch) | |
| tree | d8d7387759957ee5c74089e1f63e8492dcae2716 /spec/unit/parser | |
| parent | a5950339f43e08516130ff0b7463dbe3fa925890 (diff) | |
| download | puppet-6551e86a03f5fa1f499386c96faa4587bdfac24e.tar.gz puppet-6551e86a03f5fa1f499386c96faa4587bdfac24e.tar.xz puppet-6551e86a03f5fa1f499386c96faa4587bdfac24e.zip | |
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 <brice-puppet@daysofwonder.com>
Diffstat (limited to 'spec/unit/parser')
| -rwxr-xr-x | spec/unit/parser/lexer.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/spec/unit/parser/lexer.rb b/spec/unit/parser/lexer.rb index 1c3e91bd6..3c73ca986 100755 --- a/spec/unit/parser/lexer.rb +++ b/spec/unit/parser/lexer.rb @@ -460,6 +460,10 @@ describe Puppet::Parser::Lexer::TOKENS[:REGEX] do @token.regex.should =~ '/this is a regex/' end + it 'should not match if there is \n in the regex' do + @token.regex.should_not =~ "/this is \n a regex/" + end + describe "when including escaped slashes" do before { @lexer = Puppet::Parser::Lexer.new } |
