fix error in coffeeScript mode

This commit is contained in:
nightwing 2014-09-02 01:16:10 +04:00
commit 7a3a84c858
5 changed files with 27 additions and 5 deletions

View file

@ -42,6 +42,7 @@ class Foo extends Bar
foo.static.function foo.static.function
#!test tokenize string with interpolation #!test tokenize string with interpolation
a = "#{ 22 / 7 + {x: "#{a + b}"} + 2}" a = "#{ 22 / 7 + {x: "#{a + b}"} + 2}"
" #{ "" + {} } )"
"""heredoc """heredoc
""" """
do -> do ->

View file

@ -466,6 +466,23 @@
["constant.numeric","2"], ["constant.numeric","2"],
["paren.string","}"], ["paren.string","}"],
["string.end","\""] ["string.end","\""]
],[
"start",
["string.start","\""],
["string"," "],
["paren.string","#{"],
["text"," "],
["string.start","\""],
["string.end","\""],
["text"," "],
["keyword.operator","+"],
["text"," "],
["paren","{}"],
["text"," "],
["paren.string","}"],
["string"," )"],
["string.end","\""],
["text"," "]
],[ ],[
"qqdoc", "qqdoc",
["string","\"\"\"heredoc"] ["string","\"\"\"heredoc"]

View file

@ -92,7 +92,9 @@
],[ ],[
"start", "start",
["text"," E &= mc^2 "], ["text"," E &= mc^2 "],
["constant.character.escape","\\\\"], ["constant.character.escape","\\\\"]
],[
"start",
["text"," m &= "], ["text"," m &= "],
["storage.type","\\frac"], ["storage.type","\\frac"],
["lparen","{"], ["lparen","{"],

View file

@ -138,7 +138,7 @@
["text"," "], ["text"," "],
["support.php_tag","<?php"] ["support.php_tag","<?php"]
],[ ],[
["php-qstring","php-start","js-start"], ["#tmp","php-qstring","php-start","js-start"],
["support.function","echo"], ["support.function","echo"],
["text"," "], ["text"," "],
["string","'"] ["string","'"]

View file

@ -221,6 +221,10 @@ var Tokenizer = function(rules) {
if (startState && typeof startState != "string") { if (startState && typeof startState != "string") {
var stack = startState.slice(0); var stack = startState.slice(0);
startState = stack[0]; startState = stack[0];
if (startState === "#tmp") {
stack.shift()
startState = stack.shift()
}
} else } else
var stack = []; var stack = [];
@ -269,8 +273,6 @@ var Tokenizer = function(rules) {
if (rule.next) { if (rule.next) {
if (typeof rule.next == "string") { if (typeof rule.next == "string") {
if (stack.length && stack[0] == currentState && stack[1] == rule.next)
stack.shift();
currentState = rule.next; currentState = rule.next;
} else { } else {
currentState = rule.next(currentState, stack); currentState = rule.next(currentState, stack);
@ -334,7 +336,7 @@ var Tokenizer = function(rules) {
if (stack.length > 1) { if (stack.length > 1) {
if (stack[0] !== currentState) if (stack[0] !== currentState)
stack.unshift(currentState); stack.unshift("#tmp", currentState);
} }
return { return {
tokens : tokens, tokens : tokens,