scrubbing all carriage returns from CoffeeScript source before compiling for the benefit of Windows users.
This commit is contained in:
parent
dcb00b4fe8
commit
1b4edd0e37
1
Cakefile
1
Cakefile
|
@ -74,6 +74,7 @@ task 'test', 'run the CoffeeScript language test suite', ->
|
|||
process.mixin {
|
||||
ok: (args...) -> test_count += 1; original_ok(args...)
|
||||
throws: (args...) -> test_count += 1; original_throws(args...)
|
||||
CoffeeScript: CoffeeScript
|
||||
}
|
||||
process.addListener 'exit', ->
|
||||
time: ((new Date() - start_time) / 1000).toFixed(2)
|
||||
|
|
|
@ -33,7 +33,8 @@
|
|||
Lexer.prototype.tokenize = function tokenize(code, options) {
|
||||
var o;
|
||||
o = options || {};
|
||||
this.code = code || '';
|
||||
code = code.replace(/\r/g, '');
|
||||
this.code = code;
|
||||
// The remainder of the source code.
|
||||
this.i = 0;
|
||||
// Current character position we're parsing.
|
||||
|
|
|
@ -35,8 +35,9 @@ exports.Lexer: class Lexer
|
|||
# Before returning the token stream, run it through the [Rewriter](rewriter.html)
|
||||
# unless explicitly asked not to.
|
||||
tokenize: (code, options) ->
|
||||
code : code.replace(/\r/g, '')
|
||||
o : options or {}
|
||||
@code : code or '' # The remainder of the source code.
|
||||
@code : code # The remainder of the source code.
|
||||
@i : 0 # Current character position we're parsing.
|
||||
@line : o.line or 0 # The current line.
|
||||
@indent : 0 # The current indentation level.
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
js: CoffeeScript.compile("one\r\ntwo", {no_wrap: on})
|
||||
|
||||
ok js is "one;\ntwo;"
|
Loading…
Reference in New Issue