aboutsummaryrefslogtreecommitdiffstats
path: root/language-web/src/main/js/editor/problem.grammar
diff options
context:
space:
mode:
Diffstat (limited to 'language-web/src/main/js/editor/problem.grammar')
-rw-r--r--language-web/src/main/js/editor/problem.grammar23
1 files changed, 16 insertions, 7 deletions
diff --git a/language-web/src/main/js/editor/problem.grammar b/language-web/src/main/js/editor/problem.grammar
index 921cec53..cf940698 100644
--- a/language-web/src/main/js/editor/problem.grammar
+++ b/language-web/src/main/js/editor/problem.grammar
@@ -1,4 +1,3 @@
1
2@top Problem { statement* } 1@top Problem { statement* }
3 2
4statement { 3statement {
@@ -7,6 +6,7 @@ statement {
7 } | 6 } |
8 ClassDefinition { 7 ClassDefinition {
9 ckw<"abstract">? ckw<"class"> RelationName 8 ckw<"abstract">? ckw<"class"> RelationName
9 (ckw<"extends"> sep<",", RelationName>)?
10 (ClassBody { "{" ReferenceDeclaration* "}" } | ".") 10 (ClassBody { "{" ReferenceDeclaration* "}" } | ".")
11 } | 11 } |
12 EnumDefinition { 12 EnumDefinition {
@@ -21,6 +21,9 @@ statement {
21 ckw<"default">? (NotOp | UnknownOp)? RelationName 21 ckw<"default">? (NotOp | UnknownOp)? RelationName
22 ParameterList<AssertionArgument> (":" LogicValue)? "." 22 ParameterList<AssertionArgument> (":" LogicValue)? "."
23 } | 23 } |
24 NodeValueAssertion {
25 UniqueNodeName ":" Constant "."
26 } |
24 UniqueDeclaration { 27 UniqueDeclaration {
25 ckw<"unique"> sep<",", UniqueNodeName> "." 28 ckw<"unique"> sep<",", UniqueNodeName> "."
26 } | 29 } |
@@ -30,18 +33,17 @@ statement {
30} 33}
31 34
32ReferenceDeclaration { 35ReferenceDeclaration {
33 ((kw<"refers"> | kw<"contains">) !times RelationName | !plus RelationName) 36 (kw<"refers"> | kw<"contains">)?
37 RelationName
34 RelationName 38 RelationName
35 ( "[" Multiplicity? "]" )? 39 ( "[" Multiplicity? "]" )?
36 (kw<"opposite"> RelationName)? 40 (kw<"opposite"> RelationName)?
37 ";"? 41 ";"?
38} 42}
39 43
40@precedence { times @left, plus }
41
42Parameter { RelationName? VariableName } 44Parameter { RelationName? VariableName }
43 45
44Conjunction { sep1<",", Literal> } 46Conjunction { ("," | Literal)+ }
45 47
46OrOp { ";" } 48OrOp { ";" }
47 49
@@ -49,9 +51,11 @@ Literal { NotOp? Atom }
49 51
50Atom { RelationName ParameterList<Argument>? } 52Atom { RelationName ParameterList<Argument>? }
51 53
52Argument { VariableName | Real } 54Argument { VariableName | Constant }
53 55
54AssertionArgument { NodeName | StarArgument | Real } 56AssertionArgument { NodeName | StarArgument | Constant }
57
58Constant { Real | String }
55 59
56LogicValue { 60LogicValue {
57 ckw<"true"> | ckw<"false"> | ckw<"unknown"> | ckw<"error"> 61 ckw<"true"> | ckw<"false"> | ckw<"unknown"> | ckw<"error">
@@ -108,6 +112,11 @@ sep1<separator, content> { content (separator content?)* }
108 112
109 exponential { int ("e" | "E") ("+" | "-")? int } 113 exponential { int ("e" | "E") ("+" | "-")? int }
110 114
115 String {
116 "'" (![\\'\n] | "\\" ![\n] | "\\\n")+ "'" |
117 "\"" (![\\"\n] | "\\" (![\n] | "\n"))* "\""
118 }
119
111 NotOp { "!" } 120 NotOp { "!" }
112 121
113 UnknownOp { "?" } 122 UnknownOp { "?" }