diff --git a/addon/mode/simple.js b/addon/mode/simple.js index df663365e8c23459a6b1f1ea4f186a9a0b839f4c..de3848bb8b73221f97b533d481713dcf43d5d754 100644 --- a/addon/mode/simple.js +++ b/addon/mode/simple.js @@ -77,6 +77,7 @@ function asToken(val) { if (!val) return null; + if (val.apply) return val if (typeof val == "string") return val.replace(/\./g, " "); var result = []; for (var i = 0; i < val.length; i++) @@ -133,17 +134,19 @@ state.indent.push(stream.indentation() + config.indentUnit); if (rule.data.dedent) state.indent.pop(); + var token = rule.token + if (token.apply) token = token(matches) if (matches.length > 2) { state.pending = []; for (var j = 2; j < matches.length; j++) if (matches[j]) state.pending.push({text: matches[j], token: rule.token[j - 1]}); stream.backUp(matches[0].length - (matches[1] ? matches[1].length : 0)); - return rule.token[0]; - } else if (rule.token && rule.token.join) { - return rule.token[0]; + return token[0]; + } else if (token && token.join) { + return token[0]; } else { - return rule.token; + return token; } } }