diff options
Diffstat (limited to 'language-web/src/main/js/language/problemLanguageSupport.ts')
-rw-r--r-- | language-web/src/main/js/language/problemLanguageSupport.ts | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/language-web/src/main/js/language/problemLanguageSupport.ts b/language-web/src/main/js/language/problemLanguageSupport.ts index 80d25d71..ab1c55f9 100644 --- a/language-web/src/main/js/language/problemLanguageSupport.ts +++ b/language-web/src/main/js/language/problemLanguageSupport.ts | |||
@@ -14,11 +14,12 @@ import { | |||
14 | foldBlockComment, | 14 | foldBlockComment, |
15 | foldConjunction, | 15 | foldConjunction, |
16 | foldDeclaration, | 16 | foldDeclaration, |
17 | foldWholeNode, | ||
17 | } from './folding'; | 18 | } from './folding'; |
18 | import { | 19 | import { |
19 | indentBlockComment, | 20 | indentBlockComment, |
20 | indentDeclaration, | 21 | indentDeclaration, |
21 | indentPredicate, | 22 | indentPredicateOrRule, |
22 | } from './indentation'; | 23 | } from './indentation'; |
23 | 24 | ||
24 | const parserWithMetadata = (parser as LRParser).configure({ | 25 | const parserWithMetadata = (parser as LRParser).configure({ |
@@ -26,9 +27,10 @@ const parserWithMetadata = (parser as LRParser).configure({ | |||
26 | styleTags({ | 27 | styleTags({ |
27 | LineComment: t.lineComment, | 28 | LineComment: t.lineComment, |
28 | BlockComment: t.blockComment, | 29 | BlockComment: t.blockComment, |
29 | 'problem class enum pred unique scope': t.definitionKeyword, | 30 | 'problem class enum pred rule unique scope': t.definitionKeyword, |
30 | 'abstract extends refers contains opposite error default': t.modifier, | 31 | 'abstract extends refers contains opposite error direct default': t.modifier, |
31 | 'true false unknown error': t.keyword, | 32 | 'true false unknown error': t.keyword, |
33 | 'new delete': t.operatorKeyword, | ||
32 | NotOp: t.keyword, | 34 | NotOp: t.keyword, |
33 | UnknownOp: t.keyword, | 35 | UnknownOp: t.keyword, |
34 | OrOp: t.keyword, | 36 | OrOp: t.keyword, |
@@ -37,19 +39,21 @@ const parserWithMetadata = (parser as LRParser).configure({ | |||
37 | StarMult: t.number, | 39 | StarMult: t.number, |
38 | String: t.string, | 40 | String: t.string, |
39 | 'RelationName/QualifiedName': t.typeName, | 41 | 'RelationName/QualifiedName': t.typeName, |
42 | 'RuleName/QualifiedName': t.macroName, | ||
40 | 'UniqueNodeName/QualifiedName': t.atom, | 43 | 'UniqueNodeName/QualifiedName': t.atom, |
41 | 'VariableName/QualifiedName': t.variableName, | 44 | 'VariableName/QualifiedName': t.variableName, |
42 | '{ }': t.brace, | 45 | '{ }': t.brace, |
43 | '( )': t.paren, | 46 | '( )': t.paren, |
44 | '[ ]': t.squareBracket, | 47 | '[ ]': t.squareBracket, |
45 | '. .. , :': t.separator, | 48 | '. .. , :': t.separator, |
46 | '<->': t.definitionOperator, | 49 | '<-> ~>': t.definitionOperator, |
47 | }), | 50 | }), |
48 | indentNodeProp.add({ | 51 | indentNodeProp.add({ |
49 | ProblemDeclaration: indentDeclaration, | 52 | ProblemDeclaration: indentDeclaration, |
50 | UniqueDeclaration: indentDeclaration, | 53 | UniqueDeclaration: indentDeclaration, |
51 | ScopeDeclaration: indentDeclaration, | 54 | ScopeDeclaration: indentDeclaration, |
52 | PredicateBody: indentPredicate, | 55 | PredicateBody: indentPredicateOrRule, |
56 | RuleBody: indentPredicateOrRule, | ||
53 | BlockComment: indentBlockComment, | 57 | BlockComment: indentBlockComment, |
54 | }), | 58 | }), |
55 | foldNodeProp.add({ | 59 | foldNodeProp.add({ |
@@ -57,7 +61,9 @@ const parserWithMetadata = (parser as LRParser).configure({ | |||
57 | EnumBody: foldInside, | 61 | EnumBody: foldInside, |
58 | ParameterList: foldInside, | 62 | ParameterList: foldInside, |
59 | PredicateBody: foldInside, | 63 | PredicateBody: foldInside, |
64 | RuleBody: foldInside, | ||
60 | Conjunction: foldConjunction, | 65 | Conjunction: foldConjunction, |
66 | Action: foldWholeNode, | ||
61 | UniqueDeclaration: foldDeclaration, | 67 | UniqueDeclaration: foldDeclaration, |
62 | ScopeDeclaration: foldDeclaration, | 68 | ScopeDeclaration: foldDeclaration, |
63 | BlockComment: foldBlockComment, | 69 | BlockComment: foldBlockComment, |
@@ -75,7 +81,7 @@ const problemLanguage = LRLanguage.define({ | |||
75 | }, | 81 | }, |
76 | line: '%', | 82 | line: '%', |
77 | }, | 83 | }, |
78 | indentOnInput: /^\s*(?:\{|\}|\(|\)|;|\.)$/, | 84 | indentOnInput: /^\s*(?:\{|\}|\(|\)|;|\.|~>)$/, |
79 | }, | 85 | }, |
80 | }); | 86 | }); |
81 | 87 | ||