aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/language/problemLanguageSupport.ts
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2024-05-17 17:13:21 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2024-05-26 17:22:31 +0200
commit378d97f41ab9bf1a3dc2136f340bb57d263ea474 (patch)
tree55e4002d0bfb00392f4ab9538f804ee241c9d84e /subprojects/frontend/src/language/problemLanguageSupport.ts
parentchore(deps): bump dependencies (diff)
downloadrefinery-378d97f41ab9bf1a3dc2136f340bb57d263ea474.tar.gz
refinery-378d97f41ab9bf1a3dc2136f340bb57d263ea474.tar.zst
refinery-378d97f41ab9bf1a3dc2136f340bb57d263ea474.zip
feat: rule parsing
Diffstat (limited to 'subprojects/frontend/src/language/problemLanguageSupport.ts')
-rw-r--r--subprojects/frontend/src/language/problemLanguageSupport.ts21
1 files changed, 14 insertions, 7 deletions
diff --git a/subprojects/frontend/src/language/problemLanguageSupport.ts b/subprojects/frontend/src/language/problemLanguageSupport.ts
index dd5d6347..ae998d20 100644
--- a/subprojects/frontend/src/language/problemLanguageSupport.ts
+++ b/subprojects/frontend/src/language/problemLanguageSupport.ts
@@ -14,7 +14,12 @@ import {
14} from '@codemirror/language'; 14} from '@codemirror/language';
15import { styleTags, tags as t } from '@lezer/highlight'; 15import { styleTags, tags as t } from '@lezer/highlight';
16 16
17import { foldBlockComment, foldConjunction, foldDeclaration } from './folding'; 17import {
18 foldBlockComment,
19 foldConjunction,
20 foldDeclaration,
21 foldWholeNode,
22} from './folding';
18import { 23import {
19 indentBlockComment, 24 indentBlockComment,
20 indentDeclaration, 25 indentDeclaration,
@@ -30,11 +35,13 @@ const parserWithMetadata = parser.configure({
30 'module problem class enum pred fn scope': t.definitionKeyword, 35 'module problem class enum pred fn scope': t.definitionKeyword,
31 'import as declare atom multi': t.definitionKeyword, 36 'import as declare atom multi': t.definitionKeyword,
32 'extern datatype aggregator': t.definitionKeyword, 37 'extern datatype aggregator': t.definitionKeyword,
38 rule: t.definitionKeyword,
33 'abstract extends refers contains container opposite': t.modifier, 39 'abstract extends refers contains container opposite': t.modifier,
34 default: t.modifier, 40 default: t.modifier,
41 'propagation decision': t.modifier,
35 'true false unknown error': t.keyword, 42 'true false unknown error': t.keyword,
43 'candidate may must': t.operatorKeyword,
36 'count in is': t.operatorKeyword, 44 'count in is': t.operatorKeyword,
37 // 'new delete': t.keyword,
38 NotOp: t.operator, 45 NotOp: t.operator,
39 UnknownOp: t.operator, 46 UnknownOp: t.operator,
40 OrOp: t.separator, 47 OrOp: t.separator,
@@ -45,7 +52,7 @@ const parserWithMetadata = parser.configure({
45 'RelationName/QualifiedName': t.typeName, 52 'RelationName/QualifiedName': t.typeName,
46 'DatatypeName/QualifiedName': t.keyword, 53 'DatatypeName/QualifiedName': t.keyword,
47 'AggregatorName/QualifiedName': t.operatorKeyword, 54 'AggregatorName/QualifiedName': t.operatorKeyword,
48 // 'RuleName/QualifiedName': t.typeName, 55 'RuleName/QualifiedName': t.typeName,
49 'AtomNodeName/QualifiedName': t.atom, 56 'AtomNodeName/QualifiedName': t.atom,
50 'VariableName/QualifiedName': t.variableName, 57 'VariableName/QualifiedName': t.variableName,
51 'ModuleName/QualifiedName': t.typeName, 58 'ModuleName/QualifiedName': t.typeName,
@@ -62,7 +69,7 @@ const parserWithMetadata = parser.configure({
62 ScopeDeclaration: indentDeclaration, 69 ScopeDeclaration: indentDeclaration,
63 PredicateBody: indentPredicateOrRule, 70 PredicateBody: indentPredicateOrRule,
64 // FunctionBody: indentPredicateOrRule, 71 // FunctionBody: indentPredicateOrRule,
65 // RuleBody: indentPredicateOrRule, 72 RuleBody: indentPredicateOrRule,
66 BlockComment: indentBlockComment, 73 BlockComment: indentBlockComment,
67 }), 74 }),
68 foldNodeProp.add({ 75 foldNodeProp.add({
@@ -71,9 +78,9 @@ const parserWithMetadata = parser.configure({
71 ParameterList: foldInside, 78 ParameterList: foldInside,
72 PredicateBody: foldInside, 79 PredicateBody: foldInside,
73 // FunctionBody: foldInside, 80 // FunctionBody: foldInside,
74 // RuleBody: foldInside, 81 RuleBody: foldInside,
75 Conjunction: foldConjunction, 82 Conjunction: foldConjunction,
76 // Consequent: foldWholeNode, 83 Consequent: foldWholeNode,
77 AtomDeclaration: foldDeclaration, 84 AtomDeclaration: foldDeclaration,
78 NodeDeclaration: foldDeclaration, 85 NodeDeclaration: foldDeclaration,
79 ScopeDeclaration: foldDeclaration, 86 ScopeDeclaration: foldDeclaration,
@@ -92,7 +99,7 @@ const problemLanguage = LRLanguage.define({
92 }, 99 },
93 line: '%', 100 line: '%',
94 }, 101 },
95 indentOnInput: /^\s*(?:\{|\}|\(|\)|->|;|\.)$/, 102 indentOnInput: /^\s*(?:\{|\}|\(|\)|->|==>|;|\.)$/,
96 }, 103 },
97}); 104});
98 105