Skip to content

Commit

Permalink
fix: support single character
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Oct 2, 2022
1 parent d45f8fa commit 5bb19a8
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/grammar.ne
Original file line number Diff line number Diff line change
Expand Up @@ -292,4 +292,4 @@ regex_flags ->
[gmiyusd]:+ {% d => d[0].join('') %}

unquoted_value ->
[a-zA-Z_*@#$] [a-zA-Z\.\-_*@#$]:+ {% d => d[0] + d[1].join('') %}
[a-zA-Z_*@#$] [a-zA-Z\.\-_*@#$]:* {% d => d[0] + d[1].join('') %}
2 changes: 1 addition & 1 deletion src/grammar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ const grammar: Grammar = {
{"name": "regex_flags$ebnf$1", "symbols": [/[gmiyusd]/]},
{"name": "regex_flags$ebnf$1", "symbols": ["regex_flags$ebnf$1", /[gmiyusd]/], "postprocess": (d) => d[0].concat([d[1]])},
{"name": "regex_flags", "symbols": ["regex_flags$ebnf$1"], "postprocess": d => d[0].join('')},
{"name": "unquoted_value$ebnf$1", "symbols": [/[a-zA-Z\.\-_*@#$]/]},
{"name": "unquoted_value$ebnf$1", "symbols": []},
{"name": "unquoted_value$ebnf$1", "symbols": ["unquoted_value$ebnf$1", /[a-zA-Z\.\-_*@#$]/], "postprocess": (d) => d[0].concat([d[1]])},
{"name": "unquoted_value", "symbols": [/[a-zA-Z_*@#$]/, "unquoted_value$ebnf$1"], "postprocess": d => d[0] + d[1].join('')}
],
Expand Down
35 changes: 35 additions & 0 deletions test/liqe/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,41 @@ test('foo:bar', testQuery, {
type: 'Tag',
});

test('foo:b', testQuery, {
expression: {
location: {
end: 5,
start: 4,
},
quoted: false,
type: 'LiteralExpression',
value: 'b',
},
field: {
location: {
end: 3,
start: 0,
},
name: 'foo',
path: ['foo'],
quoted: false,
type: 'Field',
},
location: {
end: 5,
start: 0,
},
operator: {
location: {
end: 4,
start: 3,
},
operator: ':',
type: 'ComparisonOperator',
},
type: 'Tag',
});

test('foo:bar@baz.com', testQuery, {
expression: {
location: {
Expand Down

0 comments on commit 5bb19a8

Please sign in to comment.