@surrealdb/lezer 1.0.4 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ IF $age > 18 { RETURN "adult" }
4
4
 
5
5
  ==>
6
6
 
7
- SurrealQL(IfElseStatement(Keyword,Modern(BinaryExpression(VariableName,Operator,Int),Block(BraceOpen,ReturnStatement(Keyword,String),BraceClose))))
7
+ SurrealQL(IfElseStatement(Keyword,Modern(BinaryExpression(VariableName,Operator,Number(Int)),Block(BraceOpen,ReturnStatement(Keyword,String),BraceClose))))
8
8
 
9
9
  # Modern if else
10
10
 
@@ -12,7 +12,7 @@ IF $age > 18 { RETURN "adult" } ELSE { RETURN "minor" }
12
12
 
13
13
  ==>
14
14
 
15
- SurrealQL(IfElseStatement(Keyword,Modern(BinaryExpression(VariableName,Operator,Int),Block(BraceOpen,ReturnStatement(Keyword,String),BraceClose),Keyword,Block(BraceOpen,ReturnStatement(Keyword,String),BraceClose))))
15
+ SurrealQL(IfElseStatement(Keyword,Modern(BinaryExpression(VariableName,Operator,Number(Int)),Block(BraceOpen,ReturnStatement(Keyword,String),BraceClose),Keyword,Block(BraceOpen,ReturnStatement(Keyword,String),BraceClose))))
16
16
 
17
17
  # Modern if else if else
18
18
 
@@ -20,7 +20,7 @@ IF $age > 65 { RETURN "senior" } ELSE IF $age > 18 { RETURN "adult" } ELSE { RET
20
20
 
21
21
  ==>
22
22
 
23
- SurrealQL(IfElseStatement(Keyword,Modern(BinaryExpression(VariableName,Operator,Int),Block(BraceOpen,ReturnStatement(Keyword,String),BraceClose),Keyword,Keyword,BinaryExpression(VariableName,Operator,Int),Block(BraceOpen,ReturnStatement(Keyword,String),BraceClose),Keyword,Block(BraceOpen,ReturnStatement(Keyword,String),BraceClose))))
23
+ SurrealQL(IfElseStatement(Keyword,Modern(BinaryExpression(VariableName,Operator,Number(Int)),Block(BraceOpen,ReturnStatement(Keyword,String),BraceClose),Keyword,Keyword,BinaryExpression(VariableName,Operator,Number(Int)),Block(BraceOpen,ReturnStatement(Keyword,String),BraceClose),Keyword,Block(BraceOpen,ReturnStatement(Keyword,String),BraceClose))))
24
24
 
25
25
  # Legacy if then end
26
26
 
@@ -28,7 +28,7 @@ IF $age > 18 THEN (RETURN "adult") END
28
28
 
29
29
  ==>
30
30
 
31
- SurrealQL(IfElseStatement(Keyword,Legacy(BinaryExpression(VariableName,Operator,Int),Keyword,SubQuery(ReturnStatement(Keyword,String)),Keyword)))
31
+ SurrealQL(IfElseStatement(Keyword,Legacy(BinaryExpression(VariableName,Operator,Number(Int)),Keyword,SubQuery(ReturnStatement(Keyword,String)),Keyword)))
32
32
 
33
33
  # Legacy if then else end
34
34
 
@@ -36,7 +36,7 @@ IF $age > 18 THEN (RETURN "adult") ELSE (RETURN "minor") END
36
36
 
37
37
  ==>
38
38
 
39
- SurrealQL(IfElseStatement(Keyword,Legacy(BinaryExpression(VariableName,Operator,Int),Keyword,SubQuery(ReturnStatement(Keyword,String)),Keyword,SubQuery(ReturnStatement(Keyword,String)),Keyword)))
39
+ SurrealQL(IfElseStatement(Keyword,Legacy(BinaryExpression(VariableName,Operator,Number(Int)),Keyword,SubQuery(ReturnStatement(Keyword,String)),Keyword,SubQuery(ReturnStatement(Keyword,String)),Keyword)))
40
40
 
41
41
  # Legacy if then else if then else end
42
42
 
@@ -44,4 +44,4 @@ IF $age > 65 THEN (RETURN "senior") ELSE IF $age > 18 THEN (RETURN "adult") ELSE
44
44
 
45
45
  ==>
46
46
 
47
- SurrealQL(IfElseStatement(Keyword,Legacy(BinaryExpression(VariableName,Operator,Int),Keyword,SubQuery(ReturnStatement(Keyword,String)),Keyword,Keyword,BinaryExpression(VariableName,Operator,Int),Keyword,SubQuery(ReturnStatement(Keyword,String)),Keyword,SubQuery(ReturnStatement(Keyword,String)),Keyword)))
47
+ SurrealQL(IfElseStatement(Keyword,Legacy(BinaryExpression(VariableName,Operator,Number(Int)),Keyword,SubQuery(ReturnStatement(Keyword,String)),Keyword,Keyword,BinaryExpression(VariableName,Operator,Number(Int)),Keyword,SubQuery(ReturnStatement(Keyword,String)),Keyword,SubQuery(ReturnStatement(Keyword,String)),Keyword)))
@@ -12,7 +12,7 @@ INSERT INTO person (name, age) VALUES ("Tobie", 30)
12
12
 
13
13
  ==>
14
14
 
15
- SurrealQL(InsertStatement(Keyword,Keyword,Ident,Ident,Ident,Keyword,String,Int))
15
+ SurrealQL(InsertStatement(Keyword,Keyword,Ident,Ident,Ident,Keyword,String,Number(Int)))
16
16
 
17
17
  # Insert with IGNORE
18
18
 
@@ -44,7 +44,7 @@ INSERT INTO person {name: "Tobie"} ON DUPLICATE KEY UPDATE age = 31
44
44
 
45
45
  ==>
46
46
 
47
- SurrealQL(InsertStatement(Keyword,Keyword,Ident,Object(BraceOpen,ObjectContent(ObjectProperty(ObjectKey(KeyName),Colon,String)),BraceClose),Keyword,Keyword,Keyword,Keyword,FieldAssignment(Ident,Operator,Int)))
47
+ SurrealQL(InsertStatement(Keyword,Keyword,Ident,Object(BraceOpen,ObjectContent(ObjectProperty(ObjectKey(KeyName),Colon,String)),BraceClose),Keyword,Keyword,Keyword,Keyword,FieldAssignment(Ident,Operator,Number(Int))))
48
48
 
49
49
  # Insert with RETURN
50
50
 
@@ -12,7 +12,7 @@ LET $age = 30
12
12
 
13
13
  ==>
14
14
 
15
- SurrealQL(LetStatement(Keyword,ParamDefinition(VariableName),Int))
15
+ SurrealQL(LetStatement(Keyword,ParamDefinition(VariableName),Number(Int)))
16
16
 
17
17
  # Let with subquery in parens
18
18
 
@@ -20,7 +20,7 @@ LET $bla = (SELECT * FROM 123)
20
20
 
21
21
  ==>
22
22
 
23
- SurrealQL(LetStatement(Keyword,ParamDefinition(VariableName),SubQuery(SelectStatement(Keyword,Fields(Any),Keyword,Int))))
23
+ SurrealQL(LetStatement(Keyword,ParamDefinition(VariableName),SubQuery(SelectStatement(Keyword,Fields(Any),Keyword,Number(Int)))))
24
24
 
25
25
  # Let with subquery statement
26
26
 
@@ -28,7 +28,7 @@ LET $bla = SELECT * FROM 123
28
28
 
29
29
  ==>
30
30
 
31
- SurrealQL(LetStatement(Keyword,ParamDefinition(VariableName),SelectStatement(Keyword,Fields(Any),Keyword,Int)))
31
+ SurrealQL(LetStatement(Keyword,ParamDefinition(VariableName),SelectStatement(Keyword,Fields(Any),Keyword,Number(Int))))
32
32
 
33
33
  # Let with typed parameter
34
34
 
@@ -36,7 +36,7 @@ LIVE SELECT * FROM person WHERE age > 18
36
36
 
37
37
  ==>
38
38
 
39
- SurrealQL(LiveSelectStatement(Keyword,Keyword,Any,Keyword,Ident,WhereClause(Keyword,BinaryExpression(Ident,Operator,Int))))
39
+ SurrealQL(LiveSelectStatement(Keyword,Keyword,Any,Keyword,Ident,WhereClause(Keyword,BinaryExpression(Ident,Operator,Number(Int)))))
40
40
 
41
41
  # Kill statement
42
42
 
@@ -4,7 +4,7 @@ RETURN 42
4
4
 
5
5
  ==>
6
6
 
7
- SurrealQL(ReturnStatement(Keyword,Int))
7
+ SurrealQL(ReturnStatement(Keyword,Number(Int)))
8
8
 
9
9
  # Return string
10
10
 
@@ -20,7 +20,7 @@ RETURN 1 + 2
20
20
 
21
21
  ==>
22
22
 
23
- SurrealQL(ReturnStatement(Keyword,BinaryExpression(Int,Operator,Int)))
23
+ SurrealQL(ReturnStatement(Keyword,BinaryExpression(Number(Int),Operator,Number(Int))))
24
24
 
25
25
  # Return variable
26
26
 
@@ -44,7 +44,7 @@ SELECT * FROM person WHERE age > 18
44
44
 
45
45
  ==>
46
46
 
47
- SurrealQL(SelectStatement(Keyword,Fields(Any),Keyword,Ident,WhereClause(Keyword,BinaryExpression(Ident,Operator,Int))))
47
+ SurrealQL(SelectStatement(Keyword,Fields(Any),Keyword,Ident,WhereClause(Keyword,BinaryExpression(Ident,Operator,Number(Int)))))
48
48
 
49
49
  # Select with ORDER BY
50
50
 
@@ -84,7 +84,7 @@ SELECT * FROM person LIMIT 10
84
84
 
85
85
  ==>
86
86
 
87
- SurrealQL(SelectStatement(Keyword,Fields(Any),Keyword,Ident,LimitStartComboClause(LimitClause(Keyword,Int))))
87
+ SurrealQL(SelectStatement(Keyword,Fields(Any),Keyword,Ident,LimitStartComboClause(LimitClause(Keyword,Number(Int)))))
88
88
 
89
89
  # Select with LIMIT BY
90
90
 
@@ -92,7 +92,7 @@ SELECT * FROM person LIMIT BY 10
92
92
 
93
93
  ==>
94
94
 
95
- SurrealQL(SelectStatement(Keyword,Fields(Any),Keyword,Ident,LimitStartComboClause(LimitClause(Keyword,Keyword,Int))))
95
+ SurrealQL(SelectStatement(Keyword,Fields(Any),Keyword,Ident,LimitStartComboClause(LimitClause(Keyword,Keyword,Number(Int)))))
96
96
 
97
97
  # Select with START
98
98
 
@@ -100,7 +100,7 @@ SELECT * FROM person START 5
100
100
 
101
101
  ==>
102
102
 
103
- SurrealQL(SelectStatement(Keyword,Fields(Any),Keyword,Ident,LimitStartComboClause(StartClause(Keyword,Int))))
103
+ SurrealQL(SelectStatement(Keyword,Fields(Any),Keyword,Ident,LimitStartComboClause(StartClause(Keyword,Number(Int)))))
104
104
 
105
105
  # Select with START AT
106
106
 
@@ -108,7 +108,7 @@ SELECT * FROM person START AT 5
108
108
 
109
109
  ==>
110
110
 
111
- SurrealQL(SelectStatement(Keyword,Fields(Any),Keyword,Ident,LimitStartComboClause(StartClause(Keyword,Keyword,Int))))
111
+ SurrealQL(SelectStatement(Keyword,Fields(Any),Keyword,Ident,LimitStartComboClause(StartClause(Keyword,Keyword,Number(Int)))))
112
112
 
113
113
  # Select with LIMIT and START
114
114
 
@@ -116,7 +116,7 @@ SELECT * FROM person LIMIT 10 START 5
116
116
 
117
117
  ==>
118
118
 
119
- SurrealQL(SelectStatement(Keyword,Fields(Any),Keyword,Ident,LimitStartComboClause(LimitClause(Keyword,Int),StartClause(Keyword,Int))))
119
+ SurrealQL(SelectStatement(Keyword,Fields(Any),Keyword,Ident,LimitStartComboClause(LimitClause(Keyword,Number(Int)),StartClause(Keyword,Number(Int)))))
120
120
 
121
121
  # Select with FETCH
122
122
 
@@ -124,7 +124,7 @@ SELECT * FROM person FETCH posts
124
124
 
125
125
  ==>
126
126
 
127
- SurrealQL(SelectStatement(Keyword,Fields(Any),Keyword,Ident,FetchClause(Keyword,Path(Ident,⚠))))
127
+ SurrealQL(SelectStatement(Keyword,Fields(Any),Keyword,Ident,FetchClause(Keyword,Idiom(Ident))))
128
128
 
129
129
  # Select with SPLIT
130
130
 
@@ -212,7 +212,7 @@ SELECT * FROM person WHERE age > 18 ORDER BY name LIMIT 10
212
212
 
213
213
  ==>
214
214
 
215
- SurrealQL(SelectStatement(Keyword,Fields(Any),Keyword,Ident,WhereClause(Keyword,BinaryExpression(Ident,Operator,Int)),OrderClause(Keyword,Keyword,Order(Idiom(Ident))),LimitStartComboClause(LimitClause(Keyword,Int))))
215
+ SurrealQL(SelectStatement(Keyword,Fields(Any),Keyword,Ident,WhereClause(Keyword,BinaryExpression(Ident,Operator,Number(Int))),OrderClause(Keyword,Keyword,Order(Idiom(Ident))),LimitStartComboClause(LimitClause(Keyword,Number(Int)))))
216
216
 
217
217
  # Select from multiple targets
218
218
 
@@ -20,7 +20,7 @@ SHOW CHANGES FOR TABLE person LIMIT 10
20
20
 
21
21
  ==>
22
22
 
23
- SurrealQL(ShowStatement(Keyword,Keyword,Keyword,Keyword,Ident,Keyword,Int))
23
+ SurrealQL(ShowStatement(Keyword,Keyword,Keyword,Keyword,Ident,Keyword,Number(Int)))
24
24
 
25
25
  # Show changes with since and limit
26
26
 
@@ -28,4 +28,4 @@ SHOW CHANGES FOR TABLE person SINCE "2024-01-01T00:00:00Z" LIMIT 10
28
28
 
29
29
  ==>
30
30
 
31
- SurrealQL(ShowStatement(Keyword,Keyword,Keyword,Keyword,Ident,Keyword,String,Keyword,Int))
31
+ SurrealQL(ShowStatement(Keyword,Keyword,Keyword,Keyword,Ident,Keyword,String,Keyword,Number(Int)))
@@ -20,7 +20,7 @@ UPDATE person SET age = 31
20
20
 
21
21
  ==>
22
22
 
23
- SurrealQL(UpdateStatement(Keyword,Ident,SetClause(Keyword,FieldAssignment(Ident,Operator,Int))))
23
+ SurrealQL(UpdateStatement(Keyword,Ident,SetClause(Keyword,FieldAssignment(Ident,Operator,Number(Int)))))
24
24
 
25
25
  # Update with CONTENT
26
26
 
@@ -36,7 +36,15 @@ UPDATE person MERGE {age: 31}
36
36
 
37
37
  ==>
38
38
 
39
- SurrealQL(UpdateStatement(Keyword,Ident,MergeClause(Keyword,Object(BraceOpen,ObjectContent(ObjectProperty(ObjectKey(KeyName),Colon,Int)),BraceClose))))
39
+ SurrealQL(UpdateStatement(Keyword,Ident,MergeClause(Keyword,Object(BraceOpen,ObjectContent(ObjectProperty(ObjectKey(KeyName),Colon,Number(Int))),BraceClose))))
40
+
41
+ # Update path target with MERGE expression
42
+
43
+ UPDATE $object.id MERGE ($object + {updatedBy: $user});
44
+
45
+ ==>
46
+
47
+ SurrealQL(UpdateStatement(Keyword,Path(VariableName,Subscript(Ident)),MergeClause(Keyword,SubQuery(BinaryExpression(VariableName,Operator,Object(BraceOpen,ObjectContent(ObjectProperty(ObjectKey(KeyName),Colon,VariableName)),BraceClose))))))
40
48
 
41
49
  # Update with REPLACE
42
50
 
@@ -52,7 +60,7 @@ UPDATE person UNSET temp = 0
52
60
 
53
61
  ==>
54
62
 
55
- SurrealQL(UpdateStatement(Keyword,Ident,UnsetClause(Keyword,FieldAssignment(Ident,Operator,Int))))
63
+ SurrealQL(UpdateStatement(Keyword,Ident,UnsetClause(Keyword,FieldAssignment(Ident,Operator,Number(Int)))))
56
64
 
57
65
  # Update with WHERE
58
66
 
@@ -60,7 +68,7 @@ UPDATE person SET age = 31 WHERE name = "Tobie"
60
68
 
61
69
  ==>
62
70
 
63
- SurrealQL(UpdateStatement(Keyword,Ident,SetClause(Keyword,FieldAssignment(Ident,Operator,Int)),WhereClause(Keyword,BinaryExpression(Ident,Operator,String))))
71
+ SurrealQL(UpdateStatement(Keyword,Ident,SetClause(Keyword,FieldAssignment(Ident,Operator,Number(Int))),WhereClause(Keyword,BinaryExpression(Ident,Operator,String))))
64
72
 
65
73
  # Update with RETURN
66
74
 
@@ -68,7 +76,7 @@ UPDATE person SET age = 31 RETURN AFTER
68
76
 
69
77
  ==>
70
78
 
71
- SurrealQL(UpdateStatement(Keyword,Ident,SetClause(Keyword,FieldAssignment(Ident,Operator,Int)),ReturnClause(Keyword,Literal)))
79
+ SurrealQL(UpdateStatement(Keyword,Ident,SetClause(Keyword,FieldAssignment(Ident,Operator,Number(Int))),ReturnClause(Keyword,Literal)))
72
80
 
73
81
  # Update with TIMEOUT
74
82
 
@@ -76,7 +84,7 @@ UPDATE person SET age = 31 TIMEOUT 5s
76
84
 
77
85
  ==>
78
86
 
79
- SurrealQL(UpdateStatement(Keyword,Ident,SetClause(Keyword,FieldAssignment(Ident,Operator,Int)),TimeoutClause(Keyword,Duration(DurationPart))))
87
+ SurrealQL(UpdateStatement(Keyword,Ident,SetClause(Keyword,FieldAssignment(Ident,Operator,Number(Int))),TimeoutClause(Keyword,Duration(DurationPart))))
80
88
 
81
89
  # Update with PARALLEL
82
90
 
@@ -84,4 +92,4 @@ UPDATE person SET age = 31 PARALLEL
84
92
 
85
93
  ==>
86
94
 
87
- SurrealQL(UpdateStatement(Keyword,Ident,SetClause(Keyword,FieldAssignment(Ident,Operator,Int)),ParallelClause(Keyword)))
95
+ SurrealQL(UpdateStatement(Keyword,Ident,SetClause(Keyword,FieldAssignment(Ident,Operator,Number(Int))),ParallelClause(Keyword)))
@@ -36,7 +36,7 @@ UPSERT person MERGE {age: 31}
36
36
 
37
37
  ==>
38
38
 
39
- SurrealQL(UpsertStatement(Keyword,Ident,MergeClause(Keyword,Object(BraceOpen,ObjectContent(ObjectProperty(ObjectKey(KeyName),Colon,Int)),BraceClose))))
39
+ SurrealQL(UpsertStatement(Keyword,Ident,MergeClause(Keyword,Object(BraceOpen,ObjectContent(ObjectProperty(ObjectKey(KeyName),Colon,Number(Int))),BraceClose))))
40
40
 
41
41
  # Upsert with WHERE
42
42
 
@@ -44,7 +44,7 @@ UPSERT person SET age = 31 WHERE name = "Tobie"
44
44
 
45
45
  ==>
46
46
 
47
- SurrealQL(UpsertStatement(Keyword,Ident,SetClause(Keyword,FieldAssignment(Ident,Operator,Int)),WhereClause(Keyword,BinaryExpression(Ident,Operator,String))))
47
+ SurrealQL(UpsertStatement(Keyword,Ident,SetClause(Keyword,FieldAssignment(Ident,Operator,Number(Int))),WhereClause(Keyword,BinaryExpression(Ident,Operator,String))))
48
48
 
49
49
  # Upsert with RETURN
50
50
 
@@ -52,4 +52,4 @@ UPSERT person SET age = 31 RETURN AFTER
52
52
 
53
53
  ==>
54
54
 
55
- SurrealQL(UpsertStatement(Keyword,Ident,SetClause(Keyword,FieldAssignment(Ident,Operator,Int)),ReturnClause(Keyword,Literal)))
55
+ SurrealQL(UpsertStatement(Keyword,Ident,SetClause(Keyword,FieldAssignment(Ident,Operator,Number(Int))),ReturnClause(Keyword,Literal)))
@@ -12,7 +12,7 @@ SurrealQL(Array("[","]"))
12
12
 
13
13
  ==>
14
14
 
15
- SurrealQL(Array("[",Int,"]"))
15
+ SurrealQL(Array("[",Number(Int),"]"))
16
16
 
17
17
  # Multiple elements
18
18
 
@@ -20,7 +20,7 @@ SurrealQL(Array("[",Int,"]"))
20
20
 
21
21
  ==>
22
22
 
23
- SurrealQL(Array("[",Int,Int,Int,"]"))
23
+ SurrealQL(Array("[",Number(Int),Number(Int),Number(Int),"]"))
24
24
 
25
25
  # Trailing comma
26
26
 
@@ -28,7 +28,7 @@ SurrealQL(Array("[",Int,Int,Int,"]"))
28
28
 
29
29
  ==>
30
30
 
31
- SurrealQL(Array("[",Int,Int,Int,"]"))
31
+ SurrealQL(Array("[",Number(Int),Number(Int),Number(Int),"]"))
32
32
 
33
33
  # Nested arrays
34
34
 
@@ -36,7 +36,7 @@ SurrealQL(Array("[",Int,Int,Int,"]"))
36
36
 
37
37
  ==>
38
38
 
39
- SurrealQL(Array("[",Array("[",Int,Int,"]"),Array("[",Int,Int,"]"),"]"))
39
+ SurrealQL(Array("[",Array("[",Number(Int),Number(Int),"]"),Array("[",Number(Int),Number(Int),"]"),"]"))
40
40
 
41
41
  # Mixed types
42
42
 
@@ -44,4 +44,4 @@ SurrealQL(Array("[",Array("[",Int,Int,"]"),Array("[",Int,Int,"]"),"]"))
44
44
 
45
45
  ==>
46
46
 
47
- SurrealQL(Array("[",Int,String,Bool,None,"]"))
47
+ SurrealQL(Array("[",Number(Int),String,Bool,None,"]"))
@@ -4,7 +4,7 @@
4
4
 
5
5
  ==>
6
6
 
7
- SurrealQL(Closure(Pipe,Pipe,Block(BraceOpen,Int,BraceClose)))
7
+ SurrealQL(Closure(Pipe,Pipe,Block(BraceOpen,Number(Int),BraceClose)))
8
8
 
9
9
  # Closure with param
10
10
 
@@ -20,7 +20,7 @@ SurrealQL(Closure(Pipe,ParamDefinition(VariableName),Pipe,Block(BraceOpen,Variab
20
20
 
21
21
  ==>
22
22
 
23
- SurrealQL(Closure(Pipe,ParamDefinition(VariableName,Colon,Type(TypeName)),Pipe,Block(BraceOpen,BinaryExpression(VariableName,Operator,Int),BraceClose)))
23
+ SurrealQL(Closure(Pipe,ParamDefinition(VariableName,Colon,Type(TypeName)),Pipe,Block(BraceOpen,BinaryExpression(VariableName,Operator,Number(Int)),BraceClose)))
24
24
 
25
25
  # Closure with multiple params
26
26
 
@@ -36,4 +36,4 @@ SurrealQL(Closure(Pipe,ParamDefinition(VariableName),ParamDefinition(VariableNam
36
36
 
37
37
  ==>
38
38
 
39
- SurrealQL(Closure(Pipe,ParamDefinition(VariableName,Colon,Type(TypeName)),Pipe,LookupRight,TypeName,Block(BraceOpen,BinaryExpression(VariableName,Operator,Int),BraceClose)))
39
+ SurrealQL(Closure(Pipe,ParamDefinition(VariableName,Colon,Type(TypeName)),Pipe,LookupRight,TypeName,Block(BraceOpen,BinaryExpression(VariableName,Operator,Number(Int)),BraceClose)))
@@ -12,7 +12,7 @@ $"result is {1 + 2 + 3}"
12
12
 
13
13
  ==>
14
14
 
15
- SurrealQL(FormatString(Interpolation(BraceOpen,BinaryExpression(BinaryExpression(Int,Operator,Int),Operator,Int),BraceClose)))
15
+ SurrealQL(FormatString(Interpolation(BraceOpen,BinaryExpression(BinaryExpression(Number(Int),Operator,Number(Int)),Operator,Number(Int)),BraceClose)))
16
16
 
17
17
  # Escaped quote in format string
18
18
 
@@ -20,7 +20,7 @@ $"some \" quote {1 + 2 + 3} and \{ some } brackets"
20
20
 
21
21
  ==>
22
22
 
23
- SurrealQL(FormatString(Interpolation(BraceOpen,BinaryExpression(BinaryExpression(Int,Operator,Int),Operator,Int),BraceClose)))
23
+ SurrealQL(FormatString(Interpolation(BraceOpen,BinaryExpression(BinaryExpression(Number(Int),Operator,Number(Int)),Operator,Number(Int)),BraceClose)))
24
24
 
25
25
  # Nested format strings
26
26
 
@@ -28,7 +28,7 @@ $'nested {$"string {22}"}'
28
28
 
29
29
  ==>
30
30
 
31
- SurrealQL(FormatString(Interpolation(BraceOpen,FormatString(Interpolation(BraceOpen,Int,BraceClose)),BraceClose)))
31
+ SurrealQL(FormatString(Interpolation(BraceOpen,FormatString(Interpolation(BraceOpen,Number(Int),BraceClose)),BraceClose)))
32
32
 
33
33
  # Single quoted format string
34
34
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  ==>
6
6
 
7
- SurrealQL(Point(Decimal,Decimal))
7
+ SurrealQL(Point(Number(Decimal),Number(Decimal)))
8
8
 
9
9
  # Point with integers
10
10
 
@@ -12,7 +12,7 @@ SurrealQL(Point(Decimal,Decimal))
12
12
 
13
13
  ==>
14
14
 
15
- SurrealQL(Point(Int,Int))
15
+ SurrealQL(Point(Number(Int),Number(Int)))
16
16
 
17
17
  # Point with floats
18
18
 
@@ -20,4 +20,4 @@ SurrealQL(Point(Int,Int))
20
20
 
21
21
  ==>
22
22
 
23
- SurrealQL(Point(Float,Float))
23
+ SurrealQL(Point(Number(Float),Number(Float)))
@@ -60,7 +60,7 @@ SurrealQL(SelectStatement(Keyword,Fields(Predicate(Path(Lookup(LookupRight,Ident
60
60
 
61
61
  ==>
62
62
 
63
- SurrealQL(Path(Int,Subscript(IdiomFunction(FunctionName,ArgumentList))))
63
+ SurrealQL(Path(Number(Int),Subscript(IdiomFunction(FunctionName,ArgumentList))))
64
64
 
65
65
  # Filter with variable key
66
66
 
@@ -100,7 +100,7 @@ SurrealQL(Path(RecordId(RecordTbIdent,Colon,RecordIdIdent),Filter("[",Ident,"]")
100
100
 
101
101
  ==>
102
102
 
103
- SurrealQL(Path(Array("[","]"),Filter("[",Int,"]")))
103
+ SurrealQL(Path(Array("[","]"),Filter("[",Number(Int),"]")))
104
104
 
105
105
  # Array variable access
106
106
 
@@ -116,7 +116,7 @@ SurrealQL(Path(Array("[","]"),Filter("[",VariableName,"]")))
116
116
 
117
117
  ==>
118
118
 
119
- SurrealQL(Path(Array("[","]"),Filter("[",WhereClause(Keyword,BinaryExpression(Ident,Operator,Int)),"]")))
119
+ SurrealQL(Path(Array("[","]"),Filter("[",WhereClause(Keyword,BinaryExpression(Ident,Operator,Number(Int))),"]")))
120
120
 
121
121
  # Array question mark filter
122
122
 
@@ -124,7 +124,7 @@ SurrealQL(Path(Array("[","]"),Filter("[",WhereClause(Keyword,BinaryExpression(Id
124
124
 
125
125
  ==>
126
126
 
127
- SurrealQL(Path(Array("[","]"),Filter("[",WhereClause(BinaryExpression(Ident,Operator,Int)),"]")))
127
+ SurrealQL(Path(Array("[","]"),Filter("[",WhereClause(BinaryExpression(Ident,Operator,Number(Int))),"]")))
128
128
 
129
129
  # Recurse unbounded
130
130
 
@@ -175,7 +175,7 @@ a:b.{1}
175
175
 
176
176
  SurrealQL(Path(
177
177
  RecordId(RecordTbIdent,Colon,RecordIdIdent),
178
- Subscript(Recurse(BraceOpen,RecurseRange(Int),RecurseOptions,BraceClose))
178
+ Subscript(Recurse(BraceOpen,RecurseRange(Number(Int)),RecurseOptions,BraceClose))
179
179
  ))
180
180
 
181
181
  # Recurse with min range
@@ -186,7 +186,7 @@ a:b.{1..}
186
186
 
187
187
  SurrealQL(Path(
188
188
  RecordId(RecordTbIdent,Colon,RecordIdIdent),
189
- Subscript(Recurse(BraceOpen,RecurseRange(Int,RangeOp),RecurseOptions,BraceClose))
189
+ Subscript(Recurse(BraceOpen,RecurseRange(Number(Int),RangeOp),RecurseOptions,BraceClose))
190
190
  ))
191
191
 
192
192
  # Recurse with full range
@@ -197,7 +197,7 @@ a:b.{1..2}
197
197
 
198
198
  SurrealQL(Path(
199
199
  RecordId(RecordTbIdent,Colon,RecordIdIdent),
200
- Subscript(Recurse(BraceOpen,RecurseRange(Int,RangeOp,Int),RecurseOptions,BraceClose))
200
+ Subscript(Recurse(BraceOpen,RecurseRange(Number(Int),RangeOp,Number(Int)),RecurseOptions,BraceClose))
201
201
  ))
202
202
 
203
203
  # Recurse with max range
@@ -208,7 +208,7 @@ a:b.{..2}
208
208
 
209
209
  SurrealQL(Path(
210
210
  RecordId(RecordTbIdent,Colon,RecordIdIdent),
211
- Subscript(Recurse(BraceOpen,RecurseRange(RangeOp,Int),RecurseOptions,BraceClose))
211
+ Subscript(Recurse(BraceOpen,RecurseRange(RangeOp,Number(Int)),RecurseOptions,BraceClose))
212
212
  ))
213
213
 
214
214
  # At reference with subscript
@@ -6,7 +6,7 @@
6
6
 
7
7
  ==>
8
8
 
9
- SurrealQL(Int,Int,Int)
9
+ SurrealQL(Number(Int),Number(Int),Number(Int))
10
10
 
11
11
  # Float
12
12
 
@@ -16,7 +16,7 @@ SurrealQL(Int,Int,Int)
16
16
 
17
17
  ==>
18
18
 
19
- SurrealQL(Float,Float,Float)
19
+ SurrealQL(Number(Float),Number(Float),Number(Float))
20
20
 
21
21
  # Float with exponent
22
22
 
@@ -27,16 +27,28 @@ SurrealQL(Float,Float,Float)
27
27
 
28
28
  ==>
29
29
 
30
- SurrealQL(Float,Float,Float,Float)
30
+ SurrealQL(Number(Float),Number(Float),Number(Float),Number(Float))
31
31
 
32
32
  # Float with f suffix
33
33
 
34
34
  2e4f;
35
- 3.14f
35
+ 3.14f;
36
+ 100f
36
37
 
37
38
  ==>
38
39
 
39
- SurrealQL(Float,Float)
40
+ SurrealQL(Number(Float),Number(Float),Number(Float))
41
+
42
+ # Underscore separators
43
+
44
+ 1_000_000;
45
+ 1_000_000.99;
46
+ 1_000.5f;
47
+ 2_000_000dec
48
+
49
+ ==>
50
+
51
+ SurrealQL(Number(Int),Number(Float),Number(Float),Number(Decimal))
40
52
 
41
53
  # Float special values
42
54
 
@@ -45,7 +57,7 @@ NaN
45
57
 
46
58
  ==>
47
59
 
48
- SurrealQL(Float,Float)
60
+ SurrealQL(Number(Float),Number(Float))
49
61
 
50
62
  # Decimal
51
63
 
@@ -54,7 +66,7 @@ SurrealQL(Float,Float)
54
66
 
55
67
  ==>
56
68
 
57
- SurrealQL(Decimal,Decimal)
69
+ SurrealQL(Number(Decimal),Number(Decimal))
58
70
 
59
71
  # Negative numbers
60
72
 
@@ -63,7 +75,7 @@ SurrealQL(Decimal,Decimal)
63
75
 
64
76
  ==>
65
77
 
66
- SurrealQL(Int,Float)
78
+ SurrealQL(Number(Int),Number(Float))
67
79
 
68
80
  # Positive explicit sign
69
81
 
@@ -72,4 +84,4 @@ SurrealQL(Int,Float)
72
84
 
73
85
  ==>
74
86
 
75
- SurrealQL(Int,Float)
87
+ SurrealQL(Number(Int),Number(Float))
@@ -4,7 +4,7 @@
4
4
 
5
5
  ==>
6
6
 
7
- SurrealQL(Object(BraceOpen,ObjectContent(ObjectProperty(ObjectKey(KeyName),Colon,Int)),BraceClose))
7
+ SurrealQL(Object(BraceOpen,ObjectContent(ObjectProperty(ObjectKey(KeyName),Colon,Number(Int))),BraceClose))
8
8
 
9
9
  # Object with string keys
10
10
 
@@ -13,8 +13,8 @@ SurrealQL(Object(BraceOpen,ObjectContent(ObjectProperty(ObjectKey(KeyName),Colon
13
13
  ==>
14
14
 
15
15
  SurrealQL(Object(BraceOpen,ObjectContent(
16
- ObjectProperty(ObjectKey(String),Colon,Int),
17
- ObjectProperty(ObjectKey(String),Colon,Int)
16
+ ObjectProperty(ObjectKey(String),Colon,Number(Int)),
17
+ ObjectProperty(ObjectKey(String),Colon,Number(Int))
18
18
  ),BraceClose))
19
19
 
20
20
  # Empty object
@@ -49,8 +49,8 @@ SurrealQL(Block(BraceOpen,Ident,BraceClose))
49
49
  ==>
50
50
 
51
51
  SurrealQL(
52
- Object(BraceOpen,ObjectContent(ObjectProperty(ObjectKey(KeyName),Colon,Int)),BraceClose),
53
- Int
52
+ Object(BraceOpen,ObjectContent(ObjectProperty(ObjectKey(KeyName),Colon,Number(Int))),BraceClose),
53
+ Number(Int)
54
54
  )
55
55
 
56
56
  # Nested objects
@@ -60,5 +60,5 @@ SurrealQL(
60
60
  ==>
61
61
 
62
62
  SurrealQL(Object(BraceOpen,ObjectContent(ObjectProperty(ObjectKey(KeyName),Colon,
63
- Object(BraceOpen,ObjectContent(ObjectProperty(ObjectKey(KeyName),Colon,Int)),BraceClose)
63
+ Object(BraceOpen,ObjectContent(ObjectProperty(ObjectKey(KeyName),Colon,Number(Int))),BraceClose)
64
64
  )),BraceClose))
@@ -4,7 +4,7 @@
4
4
 
5
5
  ==>
6
6
 
7
- SurrealQL(Range(Int,RangeOp,Int))
7
+ SurrealQL(Range(Number(Int),RangeOp,Number(Int)))
8
8
 
9
9
  # Right-open range
10
10
 
@@ -12,7 +12,7 @@ SurrealQL(Range(Int,RangeOp,Int))
12
12
 
13
13
  ==>
14
14
 
15
- SurrealQL(Range(Int,RangeOp))
15
+ SurrealQL(Range(Number(Int),RangeOp))
16
16
 
17
17
  # Left-open inclusive range
18
18
 
@@ -28,4 +28,4 @@ SurrealQL(Range(RangeOp,String))
28
28
 
29
29
  ==>
30
30
 
31
- SurrealQL(Range(Int,RangeOp,Int))
31
+ SurrealQL(Range(Number(Int),RangeOp,Number(Int)))
@@ -52,7 +52,7 @@ test:{a: 1}
52
52
 
53
53
  ==>
54
54
 
55
- SurrealQL(RecordId(RecordTbIdent,Colon,Object(BraceOpen,ObjectContent(ObjectProperty(ObjectKey(KeyName),Colon,Int)),BraceClose)))
55
+ SurrealQL(RecordId(RecordTbIdent,Colon,Object(BraceOpen,ObjectContent(ObjectProperty(ObjectKey(KeyName),Colon,Number(Int))),BraceClose)))
56
56
 
57
57
  # Record ID with array value
58
58
 
@@ -60,7 +60,7 @@ test:[1, 2]
60
60
 
61
61
  ==>
62
62
 
63
- SurrealQL(RecordId(RecordTbIdent,Colon,Array("[",Int,Int,"]")))
63
+ SurrealQL(RecordId(RecordTbIdent,Colon,Array("[",Number(Int),Number(Int),"]")))
64
64
 
65
65
  # Record ID with prefixed string value
66
66
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  ==>
6
6
 
7
- SurrealQL(Set(BraceOpen,Int,BraceClose))
7
+ SurrealQL(Set(BraceOpen,Number(Int),BraceClose))
8
8
 
9
9
  # Set with lone comma
10
10
 
@@ -20,7 +20,7 @@ SurrealQL(Set(BraceOpen,BraceClose))
20
20
 
21
21
  ==>
22
22
 
23
- SurrealQL(Set(BraceOpen,Int,Int,BraceClose))
23
+ SurrealQL(Set(BraceOpen,Number(Int),Number(Int),BraceClose))
24
24
 
25
25
  # Set with three elements
26
26
 
@@ -28,4 +28,4 @@ SurrealQL(Set(BraceOpen,Int,Int,BraceClose))
28
28
 
29
29
  ==>
30
30
 
31
- SurrealQL(Set(BraceOpen,Int,Int,Int,BraceClose))
31
+ SurrealQL(Set(BraceOpen,Number(Int),Number(Int),Number(Int),BraceClose))