aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/language
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2022-08-10 01:00:09 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2022-08-10 01:00:09 +0200
commit10b6c4fa59abcde40dfd3c548c4df4a8b08a21d8 (patch)
tree95ebb690ff1da41033891cdeb85a799f0cfc53f3 /subprojects/frontend/src/language
parentrefactor: direct predicates (diff)
downloadrefinery-10b6c4fa59abcde40dfd3c548c4df4a8b08a21d8.tar.gz
refinery-10b6c4fa59abcde40dfd3c548c4df4a8b08a21d8.tar.zst
refinery-10b6c4fa59abcde40dfd3c548c4df4a8b08a21d8.zip
feat(language): add support for count operator
Diffstat (limited to 'subprojects/frontend/src/language')
-rw-r--r--subprojects/frontend/src/language/problem.grammar9
-rw-r--r--subprojects/frontend/src/language/problemLanguageSupport.ts2
2 files changed, 9 insertions, 2 deletions
diff --git a/subprojects/frontend/src/language/problem.grammar b/subprojects/frontend/src/language/problem.grammar
index 6fb188d8..58c398a3 100644
--- a/subprojects/frontend/src/language/problem.grammar
+++ b/subprojects/frontend/src/language/problem.grammar
@@ -57,7 +57,12 @@ Conjunction { ("," | Literal)+ }
57 57
58OrOp { ";" } 58OrOp { ";" }
59 59
60Literal { Modality? NotOp? Modality? Atom ((":" | "=") LogicValue)? } 60Literal {
61 Modality? (
62 NotOp? Modality? Atom ((":" | "=") LogicValue)? |
63 ckw<"count"> "{" Modality? Atom "}" ComparisonOp int
64 )
65}
61 66
62Atom { RelationName "+"? ParameterList<Argument> } 67Atom { RelationName "+"? ParameterList<Argument> }
63 68
@@ -141,6 +146,8 @@ sep1<separator, content> { content (separator content)* }
141 "\"" (![\\"\n] | "\\" (![\n] | "\n"))* "\"" 146 "\"" (![\\"\n] | "\\" (![\n] | "\n"))* "\""
142 } 147 }
143 148
149 ComparisonOp { ">" | ">=" | "<" | "<=" | "=:=" | "=!=" }
150
144 NotOp { "!" } 151 NotOp { "!" }
145 152
146 UnknownOp { "?" } 153 UnknownOp { "?" }
diff --git a/subprojects/frontend/src/language/problemLanguageSupport.ts b/subprojects/frontend/src/language/problemLanguageSupport.ts
index 550532ef..65fb50dc 100644
--- a/subprojects/frontend/src/language/problemLanguageSupport.ts
+++ b/subprojects/frontend/src/language/problemLanguageSupport.ts
@@ -30,7 +30,7 @@ const parserWithMetadata = (parser as LRParser).configure({
30 'problem class enum pred rule indiv scope': t.definitionKeyword, 30 'problem class enum pred rule indiv scope': t.definitionKeyword,
31 'abstract extends refers contains opposite error default': t.modifier, 31 'abstract extends refers contains opposite error default': t.modifier,
32 'true false unknown error': t.keyword, 32 'true false unknown error': t.keyword,
33 'may must current': t.operatorKeyword, 33 'may must current count': t.operatorKeyword,
34 'new delete': t.operatorKeyword, 34 'new delete': t.operatorKeyword,
35 NotOp: t.operator, 35 NotOp: t.operator,
36 UnknownOp: t.operator, 36 UnknownOp: t.operator,