diff options
author | Kristóf Marussy <marussy@mit.bme.hu> | 2020-05-08 18:28:19 +0200 |
---|---|---|
committer | Kristóf Marussy <marussy@mit.bme.hu> | 2020-05-08 18:28:19 +0200 |
commit | 419e76265ecbdf65e960e0624be006d31ed1e191 (patch) | |
tree | dad200fe9fd0beae7adde969206b77691a51b85a /Application/org.eclipse.viatra.solver.language/src-gen/org/eclipse/viatra/solver/language/serializer/SolverLanguageSyntacticSequencer.java | |
parent | Fix check expressions in generated VIATRA (diff) | |
download | VIATRA-Generator-419e76265ecbdf65e960e0624be006d31ed1e191.tar.gz VIATRA-Generator-419e76265ecbdf65e960e0624be006d31ed1e191.tar.zst VIATRA-Generator-419e76265ecbdf65e960e0624be006d31ed1e191.zip |
Update solver language grammar
First version, still needs TokenSource and Linker to work.
Diffstat (limited to 'Application/org.eclipse.viatra.solver.language/src-gen/org/eclipse/viatra/solver/language/serializer/SolverLanguageSyntacticSequencer.java')
-rw-r--r-- | Application/org.eclipse.viatra.solver.language/src-gen/org/eclipse/viatra/solver/language/serializer/SolverLanguageSyntacticSequencer.java | 121 |
1 files changed, 82 insertions, 39 deletions
diff --git a/Application/org.eclipse.viatra.solver.language/src-gen/org/eclipse/viatra/solver/language/serializer/SolverLanguageSyntacticSequencer.java b/Application/org.eclipse.viatra.solver.language/src-gen/org/eclipse/viatra/solver/language/serializer/SolverLanguageSyntacticSequencer.java index 8a2d6f62..861f2125 100644 --- a/Application/org.eclipse.viatra.solver.language/src-gen/org/eclipse/viatra/solver/language/serializer/SolverLanguageSyntacticSequencer.java +++ b/Application/org.eclipse.viatra.solver.language/src-gen/org/eclipse/viatra/solver/language/serializer/SolverLanguageSyntacticSequencer.java | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * generated by Xtext 2.18.0.M3 | 2 | * generated by Xtext 2.21.0 |
3 | */ | 3 | */ |
4 | package org.eclipse.viatra.solver.language.serializer; | 4 | package org.eclipse.viatra.solver.language.serializer; |
5 | 5 | ||
@@ -11,7 +11,6 @@ import org.eclipse.xtext.IGrammarAccess; | |||
11 | import org.eclipse.xtext.RuleCall; | 11 | import org.eclipse.xtext.RuleCall; |
12 | import org.eclipse.xtext.nodemodel.INode; | 12 | import org.eclipse.xtext.nodemodel.INode; |
13 | import org.eclipse.xtext.serializer.analysis.GrammarAlias.AbstractElementAlias; | 13 | import org.eclipse.xtext.serializer.analysis.GrammarAlias.AbstractElementAlias; |
14 | import org.eclipse.xtext.serializer.analysis.GrammarAlias.GroupAlias; | ||
15 | import org.eclipse.xtext.serializer.analysis.GrammarAlias.TokenAlias; | 14 | import org.eclipse.xtext.serializer.analysis.GrammarAlias.TokenAlias; |
16 | import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynNavigable; | 15 | import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynNavigable; |
17 | import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynTransition; | 16 | import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynTransition; |
@@ -21,25 +20,58 @@ import org.eclipse.xtext.serializer.sequencer.AbstractSyntacticSequencer; | |||
21 | public class SolverLanguageSyntacticSequencer extends AbstractSyntacticSequencer { | 20 | public class SolverLanguageSyntacticSequencer extends AbstractSyntacticSequencer { |
22 | 21 | ||
23 | protected SolverLanguageGrammarAccess grammarAccess; | 22 | protected SolverLanguageGrammarAccess grammarAccess; |
24 | protected AbstractElementAlias match_BasicInterpretation___LeftParenthesisKeyword_1_0_RightParenthesisKeyword_1_2__q; | 23 | protected AbstractElementAlias match_AtomicExpression_LeftParenthesisKeyword_3_0_a; |
25 | protected AbstractElementAlias match_Constraint___LeftParenthesisKeyword_0_2_0_RightParenthesisKeyword_0_2_3__q; | 24 | protected AbstractElementAlias match_AtomicExpression_LeftParenthesisKeyword_3_0_p; |
26 | protected AbstractElementAlias match_PatternBody_TrueKeyword_1_0_q; | 25 | protected AbstractElementAlias match_MemberDefinition_SemicolonKeyword_5_q; |
27 | protected AbstractElementAlias match_Predicate___LeftParenthesisKeyword_2_0_RightParenthesisKeyword_2_2__q; | ||
28 | 26 | ||
29 | @Inject | 27 | @Inject |
30 | protected void init(IGrammarAccess access) { | 28 | protected void init(IGrammarAccess access) { |
31 | grammarAccess = (SolverLanguageGrammarAccess) access; | 29 | grammarAccess = (SolverLanguageGrammarAccess) access; |
32 | match_BasicInterpretation___LeftParenthesisKeyword_1_0_RightParenthesisKeyword_1_2__q = new GroupAlias(false, true, new TokenAlias(false, false, grammarAccess.getBasicInterpretationAccess().getLeftParenthesisKeyword_1_0()), new TokenAlias(false, false, grammarAccess.getBasicInterpretationAccess().getRightParenthesisKeyword_1_2())); | 30 | match_AtomicExpression_LeftParenthesisKeyword_3_0_a = new TokenAlias(true, true, grammarAccess.getAtomicExpressionAccess().getLeftParenthesisKeyword_3_0()); |
33 | match_Constraint___LeftParenthesisKeyword_0_2_0_RightParenthesisKeyword_0_2_3__q = new GroupAlias(false, true, new TokenAlias(false, false, grammarAccess.getConstraintAccess().getLeftParenthesisKeyword_0_2_0()), new TokenAlias(false, false, grammarAccess.getConstraintAccess().getRightParenthesisKeyword_0_2_3())); | 31 | match_AtomicExpression_LeftParenthesisKeyword_3_0_p = new TokenAlias(true, false, grammarAccess.getAtomicExpressionAccess().getLeftParenthesisKeyword_3_0()); |
34 | match_PatternBody_TrueKeyword_1_0_q = new TokenAlias(false, true, grammarAccess.getPatternBodyAccess().getTrueKeyword_1_0()); | 32 | match_MemberDefinition_SemicolonKeyword_5_q = new TokenAlias(false, true, grammarAccess.getMemberDefinitionAccess().getSemicolonKeyword_5()); |
35 | match_Predicate___LeftParenthesisKeyword_2_0_RightParenthesisKeyword_2_2__q = new GroupAlias(false, true, new TokenAlias(false, false, grammarAccess.getPredicateAccess().getLeftParenthesisKeyword_2_0()), new TokenAlias(false, false, grammarAccess.getPredicateAccess().getRightParenthesisKeyword_2_2())); | ||
36 | } | 33 | } |
37 | 34 | ||
38 | @Override | 35 | @Override |
39 | protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) { | 36 | protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) { |
37 | if (ruleCall.getRule() == grammarAccess.getDOTRule()) | ||
38 | return getDOTToken(semanticObject, ruleCall, node); | ||
39 | else if (ruleCall.getRule() == grammarAccess.getPLUSRule()) | ||
40 | return getPLUSToken(semanticObject, ruleCall, node); | ||
41 | else if (ruleCall.getRule() == grammarAccess.getSTARRule()) | ||
42 | return getSTARToken(semanticObject, ruleCall, node); | ||
40 | return ""; | 43 | return ""; |
41 | } | 44 | } |
42 | 45 | ||
46 | /** | ||
47 | * terminal DOT: | ||
48 | * "synthetic::dot"; | ||
49 | */ | ||
50 | protected String getDOTToken(EObject semanticObject, RuleCall ruleCall, INode node) { | ||
51 | if (node != null) | ||
52 | return getTokenText(node); | ||
53 | return "synthetic::dot"; | ||
54 | } | ||
55 | |||
56 | /** | ||
57 | * terminal PLUS: | ||
58 | * "synthetic::plus"; | ||
59 | */ | ||
60 | protected String getPLUSToken(EObject semanticObject, RuleCall ruleCall, INode node) { | ||
61 | if (node != null) | ||
62 | return getTokenText(node); | ||
63 | return "synthetic::plus"; | ||
64 | } | ||
65 | |||
66 | /** | ||
67 | * terminal STAR: | ||
68 | * "synthetic::star"; | ||
69 | */ | ||
70 | protected String getSTARToken(EObject semanticObject, RuleCall ruleCall, INode node) { | ||
71 | if (node != null) | ||
72 | return getTokenText(node); | ||
73 | return "synthetic::star"; | ||
74 | } | ||
43 | 75 | ||
44 | @Override | 76 | @Override |
45 | protected void emitUnassignedTokens(EObject semanticObject, ISynTransition transition, INode fromNode, INode toNode) { | 77 | protected void emitUnassignedTokens(EObject semanticObject, ISynTransition transition, INode fromNode, INode toNode) { |
@@ -47,60 +79,71 @@ public class SolverLanguageSyntacticSequencer extends AbstractSyntacticSequencer | |||
47 | List<INode> transitionNodes = collectNodes(fromNode, toNode); | 79 | List<INode> transitionNodes = collectNodes(fromNode, toNode); |
48 | for (AbstractElementAlias syntax : transition.getAmbiguousSyntaxes()) { | 80 | for (AbstractElementAlias syntax : transition.getAmbiguousSyntaxes()) { |
49 | List<INode> syntaxNodes = getNodesFor(transitionNodes, syntax); | 81 | List<INode> syntaxNodes = getNodesFor(transitionNodes, syntax); |
50 | if (match_BasicInterpretation___LeftParenthesisKeyword_1_0_RightParenthesisKeyword_1_2__q.equals(syntax)) | 82 | if (match_AtomicExpression_LeftParenthesisKeyword_3_0_a.equals(syntax)) |
51 | emit_BasicInterpretation___LeftParenthesisKeyword_1_0_RightParenthesisKeyword_1_2__q(semanticObject, getLastNavigableState(), syntaxNodes); | 83 | emit_AtomicExpression_LeftParenthesisKeyword_3_0_a(semanticObject, getLastNavigableState(), syntaxNodes); |
52 | else if (match_Constraint___LeftParenthesisKeyword_0_2_0_RightParenthesisKeyword_0_2_3__q.equals(syntax)) | 84 | else if (match_AtomicExpression_LeftParenthesisKeyword_3_0_p.equals(syntax)) |
53 | emit_Constraint___LeftParenthesisKeyword_0_2_0_RightParenthesisKeyword_0_2_3__q(semanticObject, getLastNavigableState(), syntaxNodes); | 85 | emit_AtomicExpression_LeftParenthesisKeyword_3_0_p(semanticObject, getLastNavigableState(), syntaxNodes); |
54 | else if (match_PatternBody_TrueKeyword_1_0_q.equals(syntax)) | 86 | else if (match_MemberDefinition_SemicolonKeyword_5_q.equals(syntax)) |
55 | emit_PatternBody_TrueKeyword_1_0_q(semanticObject, getLastNavigableState(), syntaxNodes); | 87 | emit_MemberDefinition_SemicolonKeyword_5_q(semanticObject, getLastNavigableState(), syntaxNodes); |
56 | else if (match_Predicate___LeftParenthesisKeyword_2_0_RightParenthesisKeyword_2_2__q.equals(syntax)) | ||
57 | emit_Predicate___LeftParenthesisKeyword_2_0_RightParenthesisKeyword_2_2__q(semanticObject, getLastNavigableState(), syntaxNodes); | ||
58 | else acceptNodes(getLastNavigableState(), syntaxNodes); | 88 | else acceptNodes(getLastNavigableState(), syntaxNodes); |
59 | } | 89 | } |
60 | } | 90 | } |
61 | 91 | ||
62 | /** | 92 | /** |
63 | * Ambiguous syntax: | 93 | * Ambiguous syntax: |
64 | * ('(' ')')? | 94 | * '('* |
65 | * | ||
66 | * This ambiguous syntax occurs at: | ||
67 | * symbol=Symbol (ambiguity) ':' value=TruthValue | ||
68 | */ | ||
69 | protected void emit_BasicInterpretation___LeftParenthesisKeyword_1_0_RightParenthesisKeyword_1_2__q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) { | ||
70 | acceptNodes(transition, nodes); | ||
71 | } | ||
72 | |||
73 | /** | ||
74 | * Ambiguous syntax: | ||
75 | * ('(' ')')? | ||
76 | * | 95 | * |
77 | * This ambiguous syntax occurs at: | 96 | * This ambiguous syntax occurs at: |
78 | * symbol=ModelSymbol (ambiguity) (rule end) | 97 | * (rule start) (ambiguity) '[' lowerBound=Expression |
98 | * (rule start) (ambiguity) 'count' '{' body=Expression | ||
99 | * (rule start) (ambiguity) 'empty' (rule start) | ||
100 | * (rule start) (ambiguity) 'if' condition=Expression | ||
101 | * (rule start) (ambiguity) 'inf' (rule start) | ||
102 | * (rule start) (ambiguity) op=AggregationOp | ||
103 | * (rule start) (ambiguity) op=UnaryOp | ||
104 | * (rule start) (ambiguity) referred=[NamedElement|QualifiedName] | ||
105 | * (rule start) (ambiguity) value=LogicValue | ||
106 | * (rule start) (ambiguity) value=Real | ||
107 | * (rule start) (ambiguity) value=STRING | ||
108 | * (rule start) (ambiguity) {BinaryExpression.left=} | ||
109 | * (rule start) (ambiguity) {Call.functor=} | ||
110 | * (rule start) (ambiguity) {Comparison.left=} | ||
111 | * (rule start) (ambiguity) {Conjunction.children+=} | ||
112 | * (rule start) (ambiguity) {Disjunction.children+=} | ||
113 | * (rule start) (ambiguity) {Switch.cases+=} | ||
79 | */ | 114 | */ |
80 | protected void emit_Constraint___LeftParenthesisKeyword_0_2_0_RightParenthesisKeyword_0_2_3__q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) { | 115 | protected void emit_AtomicExpression_LeftParenthesisKeyword_3_0_a(EObject semanticObject, ISynNavigable transition, List<INode> nodes) { |
81 | acceptNodes(transition, nodes); | 116 | acceptNodes(transition, nodes); |
82 | } | 117 | } |
83 | 118 | ||
84 | /** | 119 | /** |
85 | * Ambiguous syntax: | 120 | * Ambiguous syntax: |
86 | * 'true'? | 121 | * '('+ |
87 | * | 122 | * |
88 | * This ambiguous syntax occurs at: | 123 | * This ambiguous syntax occurs at: |
89 | * (rule start) (ambiguity) (rule start) | 124 | * (rule start) (ambiguity) 'count' '{' body=Expression |
125 | * (rule start) (ambiguity) 'if' condition=Expression | ||
126 | * (rule start) (ambiguity) op=AggregationOp | ||
127 | * (rule start) (ambiguity) op=UnaryOp | ||
128 | * (rule start) (ambiguity) {BinaryExpression.left=} | ||
129 | * (rule start) (ambiguity) {Comparison.left=} | ||
130 | * (rule start) (ambiguity) {Conjunction.children+=} | ||
131 | * (rule start) (ambiguity) {Disjunction.children+=} | ||
132 | * (rule start) (ambiguity) {Switch.cases+=} | ||
90 | */ | 133 | */ |
91 | protected void emit_PatternBody_TrueKeyword_1_0_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) { | 134 | protected void emit_AtomicExpression_LeftParenthesisKeyword_3_0_p(EObject semanticObject, ISynNavigable transition, List<INode> nodes) { |
92 | acceptNodes(transition, nodes); | 135 | acceptNodes(transition, nodes); |
93 | } | 136 | } |
94 | 137 | ||
95 | /** | 138 | /** |
96 | * Ambiguous syntax: | 139 | * Ambiguous syntax: |
97 | * ('(' ')')? | 140 | * ';'? |
98 | * | 141 | * |
99 | * This ambiguous syntax occurs at: | 142 | * This ambiguous syntax occurs at: |
100 | * symbol=ModelSymbol (ambiguity) ':-' 'false' '.' (rule end) | 143 | * name=ID (ambiguity) (rule end) |
101 | * symbol=ModelSymbol (ambiguity) ':-' bodies+=PatternBody | 144 | * opposite=[NamedElement|QualifiedName] (ambiguity) (rule end) |
102 | */ | 145 | */ |
103 | protected void emit_Predicate___LeftParenthesisKeyword_2_0_RightParenthesisKeyword_2_2__q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) { | 146 | protected void emit_MemberDefinition_SemicolonKeyword_5_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) { |
104 | acceptNodes(transition, nodes); | 147 | acceptNodes(transition, nodes); |
105 | } | 148 | } |
106 | 149 | ||