diff options
author | Kristóf Marussy <kristof@marussy.com> | 2024-03-05 22:14:06 +0100 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2024-04-07 14:55:46 +0200 |
commit | bd909798aa2f8cfdf30258349f49e23dc1c85cdb (patch) | |
tree | 7e919b62bdb5cc5e8af5e489bfbcc35853a1d110 | |
parent | feat(language): type inference (diff) | |
download | refinery-bd909798aa2f8cfdf30258349f49e23dc1c85cdb.tar.gz refinery-bd909798aa2f8cfdf30258349f49e23dc1c85cdb.tar.zst refinery-bd909798aa2f8cfdf30258349f49e23dc1c85cdb.zip |
fix(frontend): * operator highlighting
Only highlight the * character as a number when it is not used as a
multiplication operator.
-rw-r--r-- | subprojects/frontend/src/language/problem.grammar | 6 | ||||
-rw-r--r-- | subprojects/frontend/src/language/problemLanguageSupport.ts | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/subprojects/frontend/src/language/problem.grammar b/subprojects/frontend/src/language/problem.grammar index 829dc138..7949f90c 100644 --- a/subprojects/frontend/src/language/problem.grammar +++ b/subprojects/frontend/src/language/problem.grammar | |||
@@ -119,7 +119,7 @@ BinaryExpr { | |||
119 | Expr !comparison ComparisonOp Expr | | 119 | Expr !comparison ComparisonOp Expr | |
120 | Expr !lattice (LatticeMeet | "\\/") Expr | | 120 | Expr !lattice (LatticeMeet | "\\/") Expr | |
121 | Expr !additive ("+" | "-") Expr | | 121 | Expr !additive ("+" | "-") Expr | |
122 | Expr !multiplicative (StarMult | Divide) Expr | | 122 | Expr !multiplicative (Star | Divide) Expr | |
123 | Expr !exponential "**" Expr | | 123 | Expr !exponential "**" Expr | |
124 | Expr !range ".." Expr | 124 | Expr !range ".." Expr |
125 | } | 125 | } |
@@ -184,6 +184,8 @@ AggregatorName { QualifiedName } | |||
184 | 184 | ||
185 | QualifiedName[implicitCompletion=true] { "::"? identifier (QualifiedNameSeparator "::" identifier)* } | 185 | QualifiedName[implicitCompletion=true] { "::"? identifier (QualifiedNameSeparator "::" identifier)* } |
186 | 186 | ||
187 | StarMult { Star } | ||
188 | |||
187 | kw<term> { @specialize[@name={term},implicitCompletion=true]<identifier, term> } | 189 | kw<term> { @specialize[@name={term},implicitCompletion=true]<identifier, term> } |
188 | 190 | ||
189 | ckw<term> { @extend[@name={term},implicitCompletion=true]<identifier, term> } | 191 | ckw<term> { @extend[@name={term},implicitCompletion=true]<identifier, term> } |
@@ -223,7 +225,7 @@ sep1<separator, content> { content (separator content)* } | |||
223 | 225 | ||
224 | IntMult { int } | 226 | IntMult { int } |
225 | 227 | ||
226 | StarMult { "*" } | 228 | Star { "*" } |
227 | 229 | ||
228 | Real { (exponential | int ("." (int | exponential))?) } | 230 | Real { (exponential | int ("." (int | exponential))?) } |
229 | 231 | ||
diff --git a/subprojects/frontend/src/language/problemLanguageSupport.ts b/subprojects/frontend/src/language/problemLanguageSupport.ts index 594351d6..dd5d6347 100644 --- a/subprojects/frontend/src/language/problemLanguageSupport.ts +++ b/subprojects/frontend/src/language/problemLanguageSupport.ts | |||
@@ -39,8 +39,8 @@ const parserWithMetadata = parser.configure({ | |||
39 | UnknownOp: t.operator, | 39 | UnknownOp: t.operator, |
40 | OrOp: t.separator, | 40 | OrOp: t.separator, |
41 | StarArgument: t.keyword, | 41 | StarArgument: t.keyword, |
42 | 'IntMult StarMult Real': t.number, | 42 | 'IntMult Real': t.number, |
43 | StarMult: t.number, | 43 | 'StarMult/Star': t.number, |
44 | String: t.string, | 44 | String: t.string, |
45 | 'RelationName/QualifiedName': t.typeName, | 45 | 'RelationName/QualifiedName': t.typeName, |
46 | 'DatatypeName/QualifiedName': t.keyword, | 46 | 'DatatypeName/QualifiedName': t.keyword, |