Commit c13ac8a3 by Torkel Ödegaard

fix: lexer enhancement to support asterix and dash in metric segment

parent 9e270067
......@@ -42,7 +42,8 @@
"karma-phantomjs-launcher": "~0.1.1",
"karma": "~0.10.9",
"grunt-karma": "~0.6.2",
"karma-mocha": "~0.1.1"
"karma-mocha": "~0.1.1",
"karma-expect": "~1.0.0"
},
"license": "Apache License"
}
......@@ -119,6 +119,8 @@ define([
i === 36 || // $
i >= 65 && i <= 90 || // A-Z
i === 95 || // _
i === 45 || // -
i === 42 || // *
i >= 97 && i <= 122; // a-z
}
......
......@@ -14,6 +14,14 @@ define([
expect(tokens[4].pos).to.be(13);
});
it('should tokenize metric expression with dash', function() {
var lexer = new Lexer('metric.test.se1-server-*.asd.count');
var tokens = lexer.tokenize();
expect(tokens[4].type).to.be('identifier');
expect(tokens[4].value).to.be('se1-server-*');
});
it('should tokenize functions and args', function() {
var lexer = new Lexer("sum(metric.test, 12, 'test')");
var tokens = lexer.tokenize();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment