Skip to content

Commit e8e5a72

Browse files
authored
fix: consider longer alternative for null (#740)
* fix: consider longer alt for null * fix: add change set
1 parent 3d458ae commit e8e5a72

File tree

7 files changed

+151
-1
lines changed

7 files changed

+151
-1
lines changed

.changeset/twelve-onions-drum.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@ui5-language-assistant/binding-parser": patch
3+
"vscode-ui5-language-assistant": patch
4+
"@ui5-language-assistant/vscode-ui5-language-assistant-bas-ext": patch
5+
---
6+
7+
fix: consider longer alt for null

packages/binding-parser/src/lexer/token.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ const numberValue = createToken({
8686
pattern: /-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/,
8787
});
8888

89-
const nullValue = createToken({ name: NULL_VALUE, pattern: /null/ });
89+
const nullValue = createToken({
90+
name: NULL_VALUE,
91+
pattern: /null/,
92+
longer_alt: key,
93+
});
9094

9195
const comma = createToken({
9296
name: COMMA,
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"bindings": [
3+
{
4+
"leftCurly": {
5+
"type": "left-curly",
6+
"text": "{",
7+
"range": "[(0,0)..(0,1)]"
8+
},
9+
"elements": [
10+
{
11+
"key": {
12+
"type": "key",
13+
"text": "nullable",
14+
"range": "[(0,1)..(0,9)]",
15+
"originalText": "nullable"
16+
},
17+
"colon": {
18+
"type": "colon",
19+
"text": ":",
20+
"range": "[(0,9)..(0,10)]"
21+
},
22+
"value": {
23+
"type": "boolean-value",
24+
"text": "false",
25+
"range": "[(0,11)..(0,16)]"
26+
},
27+
"range": "[(0,1)..(0,16)]",
28+
"type": "structure-element"
29+
}
30+
],
31+
"rightCurly": {
32+
"type": "right-curly",
33+
"text": "}",
34+
"range": "[(0,17)..(0,18)]"
35+
},
36+
"range": "[(0,0)..(0,18)]",
37+
"commas": [],
38+
"type": "structure-value"
39+
}
40+
],
41+
"spaces": [
42+
{
43+
"type": "white-space",
44+
"text": " ",
45+
"range": "[(0,10)..(0,11)]"
46+
},
47+
{
48+
"type": "white-space",
49+
"text": " ",
50+
"range": "[(0,16)..(0,17)]"
51+
}
52+
],
53+
"type": "template"
54+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{
2+
"name": "template",
3+
"children": {
4+
"object": [
5+
{
6+
"name": "object",
7+
"children": {
8+
"left-curly": [
9+
{
10+
"image": "{",
11+
"startColumn": 1,
12+
"endColumn": 1,
13+
"tokenTypeName": "left-curly"
14+
}
15+
],
16+
"object-item": [
17+
{
18+
"name": "object-item",
19+
"children": {
20+
"key": [
21+
{
22+
"image": "nullable",
23+
"startColumn": 2,
24+
"endColumn": 9,
25+
"tokenTypeName": "key"
26+
}
27+
],
28+
"colon": [
29+
{
30+
"image": ":",
31+
"startColumn": 10,
32+
"endColumn": 10,
33+
"tokenTypeName": "colon"
34+
}
35+
],
36+
"value": [
37+
{
38+
"name": "value",
39+
"children": {
40+
"boolean-value": [
41+
{
42+
"image": "false",
43+
"startColumn": 12,
44+
"endColumn": 16,
45+
"tokenTypeName": "boolean-value"
46+
}
47+
]
48+
},
49+
"location": {
50+
"startColumn": 12,
51+
"endColumn": 16
52+
}
53+
}
54+
]
55+
},
56+
"location": {
57+
"startColumn": 2,
58+
"endColumn": 16
59+
}
60+
}
61+
],
62+
"right-curly": [
63+
{
64+
"image": "}",
65+
"startColumn": 18,
66+
"endColumn": 18,
67+
"tokenTypeName": "right-curly"
68+
}
69+
]
70+
},
71+
"location": {
72+
"startColumn": 1,
73+
"endColumn": 18
74+
}
75+
}
76+
]
77+
},
78+
"location": {
79+
"startColumn": 1,
80+
"endColumn": 18
81+
}
82+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{nullable: false }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]

0 commit comments

Comments
 (0)