mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Merge commit '72cf485dce
' into 2
# Conflicts: # Cakefile # docs/v1/index.html # documentation/sections/changelog.md # documentation/sections/installation.md # documentation/sections/introduction.md # lib/coffee-script/nodes.js # lib/coffee-script/rewriter.js # lib/coffee-script/sourcemap.js # lib/coffeescript/browser.js # lib/coffeescript/cake.js # lib/coffeescript/coffeescript.js # lib/coffeescript/command.js # lib/coffeescript/grammar.js # lib/coffeescript/helpers.js # lib/coffeescript/index.js # lib/coffeescript/lexer.js # lib/coffeescript/optparse.js # lib/coffeescript/register.js # lib/coffeescript/repl.js # lib/coffeescript/scope.js # package.json
This commit is contained in:
commit
9b77371ea8
11 changed files with 927 additions and 655 deletions
|
@ -1,6 +1,6 @@
|
|||
// Generated by CoffeeScript 2.0.0-alpha1
|
||||
(function() {
|
||||
var BOM, BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HERECOMMENT_ILLEGAL, HEREDOC_DOUBLE, HEREDOC_INDENT, HEREDOC_SINGLE, HEREGEX, HEREGEX_OMIT, HERE_JSTOKEN, IDENTIFIER, INDENTABLE_CLOSERS, INDEXABLE, INVALID_ESCAPE, INVERSES, JSTOKEN, JS_KEYWORDS, LEADING_BLANK_LINE, LINE_BREAK, LINE_CONTINUER, Lexer, MATH, MULTI_DENT, NOT_REGEX, NUMBER, OPERATOR, POSSIBLY_DIVISION, REGEX, REGEX_FLAGS, REGEX_ILLEGAL, RELATION, RESERVED, Rewriter, SHIFT, SIMPLE_STRING_OMIT, STRICT_PROSCRIBED, STRING_DOUBLE, STRING_OMIT, STRING_SINGLE, STRING_START, TRAILING_BLANK_LINE, TRAILING_SPACES, UNARY, UNARY_MATH, VALID_FLAGS, WHITESPACE, compact, count, invertLiterate, isForFrom, isUnassignable, key, locationDataToString, repeat, starts, throwSyntaxError,
|
||||
var BOM, BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HERECOMMENT_ILLEGAL, HEREDOC_DOUBLE, HEREDOC_INDENT, HEREDOC_SINGLE, HEREGEX, HEREGEX_OMIT, HERE_JSTOKEN, IDENTIFIER, INDENTABLE_CLOSERS, INDEXABLE, INVERSES, JSTOKEN, JS_KEYWORDS, LEADING_BLANK_LINE, LINE_BREAK, LINE_CONTINUER, Lexer, MATH, MULTI_DENT, NOT_REGEX, NUMBER, OPERATOR, POSSIBLY_DIVISION, REGEX, REGEX_FLAGS, REGEX_ILLEGAL, REGEX_INVALID_ESCAPE, RELATION, RESERVED, Rewriter, SHIFT, SIMPLE_STRING_OMIT, STRICT_PROSCRIBED, STRING_DOUBLE, STRING_INVALID_ESCAPE, STRING_OMIT, STRING_SINGLE, STRING_START, TRAILING_BLANK_LINE, TRAILING_SPACES, UNARY, UNARY_MATH, VALID_FLAGS, WHITESPACE, compact, count, invertLiterate, isForFrom, isUnassignable, key, locationDataToString, repeat, starts, throwSyntaxError,
|
||||
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
||||
|
||||
({Rewriter, INVERSES} = require('./rewriter'));
|
||||
|
@ -22,6 +22,7 @@
|
|||
this.seenFor = false;
|
||||
this.seenImport = false;
|
||||
this.seenExport = false;
|
||||
this.importSpecifierList = false;
|
||||
this.exportSpecifierList = false;
|
||||
this.chunkLine = opts.line || 0;
|
||||
this.chunkColumn = opts.column || 0;
|
||||
|
@ -422,6 +423,12 @@
|
|||
}
|
||||
indent = match[0];
|
||||
this.seenFor = false;
|
||||
if (!this.importSpecifierList) {
|
||||
this.seenImport = false;
|
||||
}
|
||||
if (!this.exportSpecifierList) {
|
||||
this.seenExport = false;
|
||||
}
|
||||
size = indent.length - 1 - indent.lastIndexOf('\n');
|
||||
noNewlines = this.unfinished();
|
||||
newIndentLiteral = size > 0 ? indent.slice(-size) : '';
|
||||
|
@ -577,7 +584,11 @@
|
|||
return value.length;
|
||||
}
|
||||
}
|
||||
if (value === '{' && (prev != null ? prev[0] : void 0) === 'EXPORT') {
|
||||
if (value === '{' && this.seenImport) {
|
||||
this.importSpecifierList = true;
|
||||
} else if (this.importSpecifierList && value === '}') {
|
||||
this.importSpecifierList = false;
|
||||
} else if (value === '{' && (prev != null ? prev[0] : void 0) === 'EXPORT') {
|
||||
this.exportSpecifierList = true;
|
||||
} else if (this.exportSpecifierList && value === '}') {
|
||||
this.exportSpecifierList = false;
|
||||
|
@ -880,15 +891,13 @@
|
|||
}
|
||||
|
||||
validateEscapes(str, options = {}) {
|
||||
var before, hex, invalidEscape, match, message, octal, ref, unicode;
|
||||
match = INVALID_ESCAPE.exec(str);
|
||||
var before, hex, invalidEscape, invalidEscapeRegex, match, message, octal, ref, unicode;
|
||||
invalidEscapeRegex = options.isRegex ? REGEX_INVALID_ESCAPE : STRING_INVALID_ESCAPE;
|
||||
match = invalidEscapeRegex.exec(str);
|
||||
if (!match) {
|
||||
return;
|
||||
}
|
||||
match[0], before = match[1], octal = match[2], hex = match[3], unicode = match[4];
|
||||
if (options.isRegex && octal && octal.charAt(0) !== '0') {
|
||||
return;
|
||||
}
|
||||
message = octal ? "octal escape sequences are not allowed" : "invalid escape sequence";
|
||||
invalidEscape = `\\${octal || hex || unicode}`;
|
||||
return this.error(`${message} ${invalidEscape}`, {
|
||||
|
@ -1065,7 +1074,9 @@
|
|||
|
||||
LINE_CONTINUER = /^\s*(?:,|\??\.(?![.\d])|::)/;
|
||||
|
||||
INVALID_ESCAPE = /((?:^|[^\\])(?:\\\\)*)\\(?:(0[0-7]|[1-7])|(x(?![\da-fA-F]{2}).{0,2})|(u(?![\da-fA-F]{4}).{0,4}))/;
|
||||
STRING_INVALID_ESCAPE = /((?:^|[^\\])(?:\\\\)*)\\(?:(0[0-7]|[1-7])|(x(?![\da-fA-F]{2}).{0,2})|(u(?![\da-fA-F]{4}).{0,4}))/;
|
||||
|
||||
REGEX_INVALID_ESCAPE = /((?:^|[^\\])(?:\\\\)*)\\(?:(0[0-7])|(x(?![\da-fA-F]{2}).{0,2})|(u(?![\da-fA-F]{4}).{0,4}))/;
|
||||
|
||||
LEADING_BLANK_LINE = /^[^\n\S]*\n/;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue