Issue #1027 ... leading indentation.

This commit is contained in:
Jeremy Ashkenas 2011-01-10 21:58:35 -05:00
parent c851ed9d60
commit 83f9cb88cf
2 changed files with 4 additions and 0 deletions

View File

@ -15,6 +15,9 @@
if (opts == null) {
opts = {};
}
if (WHITESPACE.test(code)) {
code = "\n" + code;
}
code = code.replace(/\r/g, '').replace(TRAILING_SPACES, '');
this.code = code;
this.line = opts.line || 0;

View File

@ -32,6 +32,7 @@ exports.Lexer = class Lexer
# Before returning the token stream, run it through the [Rewriter](rewriter.html)
# unless explicitly asked not to.
tokenize: (code, opts = {}) ->
code = "\n#{code}" if WHITESPACE.test code
code = code.replace(/\r/g, '').replace TRAILING_SPACES, ''
@code = code # The remainder of the source code.