improve tmlanguage.js

This commit is contained in:
nightwing 2014-10-09 23:05:48 +04:00
commit ed40c1f51f
12 changed files with 898 additions and 175 deletions

View file

@ -0,0 +1,30 @@
require("amd-loader");
var assert = require("assert");
var tk = require("./regexp_tokenizer");
var tokenize = tk.tokenize;
var toStr = tk.toStr;
var logTokens = function(tokens) {
tokens.forEach(function(x) {
delete x.end
delete x.start
})
console.log(tokens)
}
assert.equal(toStr(
tokenize("(?x)c + +\n\
# comment\n\
(?-x) # (?x: 1 \n\
(2) [ ] # a \n\
3 4) c#"
)),
"(?x)c++(?-x) # (?x:1(2)[ ]34) c#"
)
assert.equal(toStr(
tokenize("(?x)\n\
u # comment\n\
")),
"(?x)u"
)