aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2024-02-29 02:24:06 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2024-04-07 14:55:46 +0200
commit71fc54a96bf33dde7895ade0bd280887553125b0 (patch)
tree5b475f117ba9e999d9df8699d0bea77555e45bb5 /subprojects/frontend
parentfeat(query): left join for data variables (diff)
downloadrefinery-71fc54a96bf33dde7895ade0bd280887553125b0.tar.gz
refinery-71fc54a96bf33dde7895ade0bd280887553125b0.tar.zst
refinery-71fc54a96bf33dde7895ade0bd280887553125b0.zip
refactor(language): assignment and cast expression
Also reorganizes operator names for easier future extension.
Diffstat (limited to 'subprojects/frontend')
-rw-r--r--subprojects/frontend/src/language/problem.grammar11
-rw-r--r--subprojects/frontend/src/language/problemLanguageSupport.ts2
2 files changed, 10 insertions, 3 deletions
diff --git a/subprojects/frontend/src/language/problem.grammar b/subprojects/frontend/src/language/problem.grammar
index 32f76f6a..0f6ea3e1 100644
--- a/subprojects/frontend/src/language/problem.grammar
+++ b/subprojects/frontend/src/language/problem.grammar
@@ -9,6 +9,7 @@
9@external prop implicitCompletion from './props' 9@external prop implicitCompletion from './props'
10 10
11@precedence { 11@precedence {
12 cast,
12 prefix, 13 prefix,
13 exponential @right, 14 exponential @right,
14 multiplicative @left, 15 multiplicative @left,
@@ -16,6 +17,7 @@
16 range @left, 17 range @left,
17 lattice @left, 18 lattice @left,
18 comparison @left, 19 comparison @left,
20 assignment,
19 feature @cut 21 feature @cut
20} 22}
21 23
@@ -97,14 +99,17 @@ Parameter { Modality? RelationName? VariableName }
97// Being looser with token sequencing enables more consistent syntactic highlighting. 99// Being looser with token sequencing enables more consistent syntactic highlighting.
98Conjunction { ("," | NextConjunction[@dynamicPrecedence=-10] { Expr })+ } 100Conjunction { ("," | NextConjunction[@dynamicPrecedence=-10] { Expr })+ }
99 101
100Case { Conjunction ("->" Expr)? } 102// Case { Conjunction ("->" Expr)? }
101 103
102OrOp { ";" } 104OrOp { ";" }
103 105
104Expr { 106Expr {
105 UnaryExpr | BinaryExpr | Aggregation | VariableName | Atom | Constant | "(" Expr ")" 107 AssignmentExpr | UnaryExpr | BinaryExpr | CastExpr | Aggregation |
108 VariableName | Atom | Constant | "(" Expr ")"
106} 109}
107 110
111AssignmentExpr { !assignment VariableName kw<"is"> Expr }
112
108BinaryExpr { 113BinaryExpr {
109 Expr !comparison ComparisonOp Expr | 114 Expr !comparison ComparisonOp Expr |
110 Expr !lattice (LatticeMeet | "\\/") Expr | 115 Expr !lattice (LatticeMeet | "\\/") Expr |
@@ -118,6 +123,8 @@ UnaryExpr {
118 !prefix ("+" | "-" | "!" | kw<"count"> | Modality) Expr 123 !prefix ("+" | "-" | "!" | kw<"count"> | Modality) Expr
119} 124}
120 125
126CastExpr { !cast Expr kw<"as"> DatatypeName }
127
121Aggregation { 128Aggregation {
122 AggregationOp "{" Expr "|" Expr "}" 129 AggregationOp "{" Expr "|" Expr "}"
123} 130}
diff --git a/subprojects/frontend/src/language/problemLanguageSupport.ts b/subprojects/frontend/src/language/problemLanguageSupport.ts
index 9500fbf2..3d25d699 100644
--- a/subprojects/frontend/src/language/problemLanguageSupport.ts
+++ b/subprojects/frontend/src/language/problemLanguageSupport.ts
@@ -33,7 +33,7 @@ const parserWithMetadata = parser.configure({
33 'default error contained containment': t.modifier, 33 'default error contained containment': t.modifier,
34 'true false unknown error': t.keyword, 34 'true false unknown error': t.keyword,
35 'may must current count': t.operatorKeyword, 35 'may must current count': t.operatorKeyword,
36 'sum prod min max in': t.operatorKeyword, 36 'sum prod min max in is': t.operatorKeyword,
37 // 'new delete': t.keyword, 37 // 'new delete': t.keyword,
38 NotOp: t.operator, 38 NotOp: t.operator,
39 UnknownOp: t.operator, 39 UnknownOp: t.operator,