Issue #1027 ... leading indentation.
This commit is contained in:
parent
c851ed9d60
commit
83f9cb88cf
|
@ -15,6 +15,9 @@
|
||||||
if (opts == null) {
|
if (opts == null) {
|
||||||
opts = {};
|
opts = {};
|
||||||
}
|
}
|
||||||
|
if (WHITESPACE.test(code)) {
|
||||||
|
code = "\n" + code;
|
||||||
|
}
|
||||||
code = code.replace(/\r/g, '').replace(TRAILING_SPACES, '');
|
code = code.replace(/\r/g, '').replace(TRAILING_SPACES, '');
|
||||||
this.code = code;
|
this.code = code;
|
||||||
this.line = opts.line || 0;
|
this.line = opts.line || 0;
|
||||||
|
|
|
@ -32,6 +32,7 @@ exports.Lexer = class Lexer
|
||||||
# Before returning the token stream, run it through the [Rewriter](rewriter.html)
|
# Before returning the token stream, run it through the [Rewriter](rewriter.html)
|
||||||
# unless explicitly asked not to.
|
# unless explicitly asked not to.
|
||||||
tokenize: (code, opts = {}) ->
|
tokenize: (code, opts = {}) ->
|
||||||
|
code = "\n#{code}" if WHITESPACE.test code
|
||||||
code = code.replace(/\r/g, '').replace TRAILING_SPACES, ''
|
code = code.replace(/\r/g, '').replace TRAILING_SPACES, ''
|
||||||
|
|
||||||
@code = code # The remainder of the source code.
|
@code = code # The remainder of the source code.
|
||||||
|
|
Loading…
Reference in New Issue