Browse files

Support DOS EOL (\r\n)

Fixes #165
  • Loading branch information...
1 parent e18ad95 commit 31115ef933b3f13288247521044ec61574b96938 @rodjek committed Nov 6, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/puppet-lint/lexer.rb
View
4 lib/puppet-lint/lexer.rb
@@ -207,7 +207,7 @@ def tokenise(code)
tokens << new_token(:REGEX, str_content[0..-2], :chunk => code[0..i])
i += str_content.size + 1
- elsif indent = chunk[/\A\n([ \t]+)/m, 1]
+ elsif indent = chunk[/\A\r?\n([ \t]+)/m, 1]
tokens << new_token(:NEWLINE, '\n', :chunk => code[0..i])
tokens << new_token(:INDENT, indent, :chunk => code[0..i+1])
i += indent.size + 1
@@ -216,7 +216,7 @@ def tokenise(code)
tokens << new_token(:WHITESPACE, whitespace, :chunk => code[0..i])
i += whitespace.size
- elsif chunk.match(/\A\n/)
+ elsif chunk.match(/\A\r?\n/)
tokens << new_token(:NEWLINE, '\n', :chunk => code[0..i])
i += 1

0 comments on commit 31115ef

Please sign in to comment.