diff options
Diffstat (limited to 'language-web/src/main/js/editor/problem.grammar')
-rw-r--r-- | language-web/src/main/js/editor/problem.grammar | 23 |
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 | ||
4 | statement { | 3 | statement { |
@@ -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 | ||
32 | ReferenceDeclaration { | 35 | ReferenceDeclaration { |
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 | |||
42 | Parameter { RelationName? VariableName } | 44 | Parameter { RelationName? VariableName } |
43 | 45 | ||
44 | Conjunction { sep1<",", Literal> } | 46 | Conjunction { ("," | Literal)+ } |
45 | 47 | ||
46 | OrOp { ";" } | 48 | OrOp { ";" } |
47 | 49 | ||
@@ -49,9 +51,11 @@ Literal { NotOp? Atom } | |||
49 | 51 | ||
50 | Atom { RelationName ParameterList<Argument>? } | 52 | Atom { RelationName ParameterList<Argument>? } |
51 | 53 | ||
52 | Argument { VariableName | Real } | 54 | Argument { VariableName | Constant } |
53 | 55 | ||
54 | AssertionArgument { NodeName | StarArgument | Real } | 56 | AssertionArgument { NodeName | StarArgument | Constant } |
57 | |||
58 | Constant { Real | String } | ||
55 | 59 | ||
56 | LogicValue { | 60 | LogicValue { |
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 { "?" } |