mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix: lexer enhancement to support asterix and dash in metric segment
This commit is contained in:
parent
9e270067f6
commit
c13ac8a36f
@ -42,7 +42,8 @@
|
|||||||
"karma-phantomjs-launcher": "~0.1.1",
|
"karma-phantomjs-launcher": "~0.1.1",
|
||||||
"karma": "~0.10.9",
|
"karma": "~0.10.9",
|
||||||
"grunt-karma": "~0.6.2",
|
"grunt-karma": "~0.6.2",
|
||||||
"karma-mocha": "~0.1.1"
|
"karma-mocha": "~0.1.1",
|
||||||
|
"karma-expect": "~1.0.0"
|
||||||
},
|
},
|
||||||
"license": "Apache License"
|
"license": "Apache License"
|
||||||
}
|
}
|
||||||
|
@ -119,6 +119,8 @@ define([
|
|||||||
i === 36 || // $
|
i === 36 || // $
|
||||||
i >= 65 && i <= 90 || // A-Z
|
i >= 65 && i <= 90 || // A-Z
|
||||||
i === 95 || // _
|
i === 95 || // _
|
||||||
|
i === 45 || // -
|
||||||
|
i === 42 || // *
|
||||||
i >= 97 && i <= 122; // a-z
|
i >= 97 && i <= 122; // a-z
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,14 @@ define([
|
|||||||
expect(tokens[4].pos).to.be(13);
|
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() {
|
it('should tokenize functions and args', function() {
|
||||||
var lexer = new Lexer("sum(metric.test, 12, 'test')");
|
var lexer = new Lexer("sum(metric.test, 12, 'test')");
|
||||||
var tokens = lexer.tokenize();
|
var tokens = lexer.tokenize();
|
||||||
|
Loading…
Reference in New Issue
Block a user