aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/language
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2022-10-04 01:12:01 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2022-10-04 01:12:01 +0200
commit4a3cdd67cd1b5c6d407c5702a1c50a19bc17fc20 (patch)
tree8cdac92902a75c5d1808a2a876382f0c987298c0 /subprojects/frontend/src/language
parentfeat(frontend): enable cross-origin isolation (diff)
downloadrefinery-4a3cdd67cd1b5c6d407c5702a1c50a19bc17fc20.tar.gz
refinery-4a3cdd67cd1b5c6d407c5702a1c50a19bc17fc20.tar.zst
refinery-4a3cdd67cd1b5c6d407c5702a1c50a19bc17fc20.zip
refactor(language): disable rule parsing
Rules have too complex semantics to implement in the first prototype.
Diffstat (limited to 'subprojects/frontend/src/language')
-rw-r--r--subprojects/frontend/src/language/folding.ts2
-rw-r--r--subprojects/frontend/src/language/problem.grammar24
-rw-r--r--subprojects/frontend/src/language/problemLanguageSupport.ts21
3 files changed, 21 insertions, 26 deletions
diff --git a/subprojects/frontend/src/language/folding.ts b/subprojects/frontend/src/language/folding.ts
index 9d1c04a3..4dabfa27 100644
--- a/subprojects/frontend/src/language/folding.ts
+++ b/subprojects/frontend/src/language/folding.ts
@@ -103,7 +103,7 @@ function foldWithSibling(node: SyntaxNode): FoldRange | null {
103 return null; 103 return null;
104} 104}
105 105
106export function foldWholeNode(node: SyntaxNode): FoldRange { 106function foldWholeNode(node: SyntaxNode): FoldRange {
107 return { 107 return {
108 from: node.from, 108 from: node.from,
109 to: node.to, 109 to: node.to,
diff --git a/subprojects/frontend/src/language/problem.grammar b/subprojects/frontend/src/language/problem.grammar
index 7feb6bfe..1e1ef70f 100644
--- a/subprojects/frontend/src/language/problem.grammar
+++ b/subprojects/frontend/src/language/problem.grammar
@@ -25,11 +25,11 @@ statement {
25 RelationName ParameterList<Parameter>? 25 RelationName ParameterList<Parameter>?
26 PredicateBody { ("<->" sep<OrOp, Conjunction>)? "." } 26 PredicateBody { ("<->" sep<OrOp, Conjunction>)? "." }
27 } | 27 } |
28 RuleDefinition { 28 //RuleDefinition {
29 ckw<"rule"> 29 // ckw<"rule">
30 RuleName ParameterList<Parameter>? 30 // RuleName ParameterList<Parameter>?
31 RuleBody { ":" sep<OrOp, Conjunction> "==>" sep<OrOp, Consequent> "." } 31 // RuleBody { ":" sep<OrOp, Conjunction> "==>" sep<OrOp, Consequent> "." }
32 } | 32 //} |
33 Assertion { 33 Assertion {
34 ckw<"default">? (NotOp | UnknownOp)? RelationName 34 ckw<"default">? (NotOp | UnknownOp)? RelationName
35 ParameterList<AssertionArgument> (":" LogicValue)? "." 35 ParameterList<AssertionArgument> (":" LogicValue)? "."
@@ -73,13 +73,13 @@ Literal {
73 73
74Atom { RelationName "+"? ParameterList<Argument> } 74Atom { RelationName "+"? ParameterList<Argument> }
75 75
76Consequent { ("," | Action)+ } 76//Consequent { ("," | Action)+ }
77 77
78Action { 78//Action {
79 ckw<"new"> VariableName ("<:" VariableName)? | 79// ckw<"new"> VariableName ("<:" VariableName)? |
80 ckw<"delete"> VariableName | 80// ckw<"delete"> VariableName |
81 Literal 81// Literal
82} 82//}
83 83
84Argument { VariableName | Constant } 84Argument { VariableName | Constant }
85 85
@@ -101,7 +101,7 @@ Multiplicity { (IntMult "..")? (IntMult | StarMult)}
101 101
102RelationName { QualifiedName } 102RelationName { QualifiedName }
103 103
104RuleName { QualifiedName } 104//RuleName { QualifiedName }
105 105
106IndividualNodeName { QualifiedName } 106IndividualNodeName { QualifiedName }
107 107
diff --git a/subprojects/frontend/src/language/problemLanguageSupport.ts b/subprojects/frontend/src/language/problemLanguageSupport.ts
index 03a7c4cc..a96b5402 100644
--- a/subprojects/frontend/src/language/problemLanguageSupport.ts
+++ b/subprojects/frontend/src/language/problemLanguageSupport.ts
@@ -8,12 +8,7 @@ import {
8} from '@codemirror/language'; 8} from '@codemirror/language';
9import { styleTags, tags as t } from '@lezer/highlight'; 9import { styleTags, tags as t } from '@lezer/highlight';
10 10
11import { 11import { foldBlockComment, foldConjunction, foldDeclaration } from './folding';
12 foldBlockComment,
13 foldConjunction,
14 foldDeclaration,
15 foldWholeNode,
16} from './folding';
17import { 12import {
18 indentBlockComment, 13 indentBlockComment,
19 indentDeclaration, 14 indentDeclaration,
@@ -26,12 +21,12 @@ const parserWithMetadata = parser.configure({
26 styleTags({ 21 styleTags({
27 LineComment: t.lineComment, 22 LineComment: t.lineComment,
28 BlockComment: t.blockComment, 23 BlockComment: t.blockComment,
29 'problem class enum pred rule indiv scope': t.definitionKeyword, 24 'problem class enum pred indiv scope': t.definitionKeyword,
30 'abstract extends refers contains container opposite': t.modifier, 25 'abstract extends refers contains container opposite': t.modifier,
31 'default error contained containment': t.modifier, 26 'default error contained containment': t.modifier,
32 'true false unknown error': t.operatorKeyword, 27 'true false unknown error': t.operatorKeyword,
33 'may must current count': t.operatorKeyword, 28 'may must current count': t.operatorKeyword,
34 'new delete': t.keyword, 29 // 'new delete': t.keyword,
35 NotOp: t.operator, 30 NotOp: t.operator,
36 UnknownOp: t.operator, 31 UnknownOp: t.operator,
37 OrOp: t.separator, 32 OrOp: t.separator,
@@ -40,7 +35,7 @@ const parserWithMetadata = parser.configure({
40 StarMult: t.number, 35 StarMult: t.number,
41 String: t.string, 36 String: t.string,
42 'RelationName/QualifiedName': t.typeName, 37 'RelationName/QualifiedName': t.typeName,
43 'RuleName/QualifiedName': t.typeName, 38 // 'RuleName/QualifiedName': t.typeName,
44 'IndividualNodeName/QualifiedName': t.atom, 39 'IndividualNodeName/QualifiedName': t.atom,
45 'VariableName/QualifiedName': t.variableName, 40 'VariableName/QualifiedName': t.variableName,
46 '{ }': t.brace, 41 '{ }': t.brace,
@@ -54,7 +49,7 @@ const parserWithMetadata = parser.configure({
54 UniqueDeclaration: indentDeclaration, 49 UniqueDeclaration: indentDeclaration,
55 ScopeDeclaration: indentDeclaration, 50 ScopeDeclaration: indentDeclaration,
56 PredicateBody: indentPredicateOrRule, 51 PredicateBody: indentPredicateOrRule,
57 RuleBody: indentPredicateOrRule, 52 // RuleBody: indentPredicateOrRule,
58 BlockComment: indentBlockComment, 53 BlockComment: indentBlockComment,
59 }), 54 }),
60 foldNodeProp.add({ 55 foldNodeProp.add({
@@ -62,9 +57,9 @@ const parserWithMetadata = parser.configure({
62 EnumBody: foldInside, 57 EnumBody: foldInside,
63 ParameterList: foldInside, 58 ParameterList: foldInside,
64 PredicateBody: foldInside, 59 PredicateBody: foldInside,
65 RuleBody: foldInside, 60 // RuleBody: foldInside,
66 Conjunction: foldConjunction, 61 Conjunction: foldConjunction,
67 Consequent: foldWholeNode, 62 // Consequent: foldWholeNode,
68 UniqueDeclaration: foldDeclaration, 63 UniqueDeclaration: foldDeclaration,
69 ScopeDeclaration: foldDeclaration, 64 ScopeDeclaration: foldDeclaration,
70 BlockComment: foldBlockComment, 65 BlockComment: foldBlockComment,
@@ -82,7 +77,7 @@ const problemLanguage = LRLanguage.define({
82 }, 77 },
83 line: '%', 78 line: '%',
84 }, 79 },
85 indentOnInput: /^\s*(?:\{|\}|\(|\)|;|\.|==>)$/, 80 indentOnInput: /^\s*(?:\{|\}|\(|\)|;|\.)$/,
86 }, 81 },
87}); 82});
88 83