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
#!test tokenize string with interpolation
a = "#{ 22 / 7 + {x: "#{a + b}"} + 2}"
" #{ "" + {} } )"
"""heredoc
"""
do ->

View file

@ -466,6 +466,23 @@
["constant.numeric","2"],
["paren.string","}"],
["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",
["string","\"\"\"heredoc"]

View file

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

View file

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

View file

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