Skip to content
Snippets Groups Projects
Commit dfe243ce authored by Johannes Mey's avatar Johannes Mey
Browse files

some (unused) changes to templates

parent 35cc165d
No related branches found
No related tags found
1 merge request!1festival updatesfestival updatesfestival updatesfestival updatesfestival
......@@ -4,14 +4,14 @@ genPackage: "de.tudresden.inf.st.mg.jastadd.model"
targetType: "Tidy"
tokenContext:
context: false # default value
contextType: false # default value
peek: true # default value
worldParserArguments: [ ] # default value
tokens:
- name: "EmptyTable"
- name: "NotEmptyTable"
- name: "ObjectAtWrongPlace"
context: "Tidy"
- name: "AvailableObject"
contextType: "Tidy"
- name: "RobotIsReadyToPickToken"
- name: "RobotIsNotReadyToPickToken"
- name: "RobotIsReadyToDropToken"
......@@ -28,6 +28,7 @@ tokenContext:
worldParserArguments:
- argument: "object()"
peek: false
- name: "MisplacedObject"
ruleContext:
constructObject: false # default value
......@@ -47,7 +48,7 @@ ruleContext:
peekToken: "EmptyTable"
- componentName: "MoveObjectToCorrectPlace"
list: true
peekToken: "ObjectAtWrongPlace"
peekToken: "MisplacedObject"
peekContext: "result"
- componentName: "WaitForEmptyTable"
list: true
......@@ -57,7 +58,7 @@ ruleContext:
- ruleName: "MoveObjectToCorrectPlace"
constructObject: true
components:
- componentName: "ObjectAtWrongPlace"
- componentName: "MisplacedObject"
token: true
index: 0
additionalArgs: ", parent.containingTidy()"
......@@ -88,9 +89,6 @@ ruleContext:
components:
- componentName: "RobotIsReadyToDrop"
index: 0
- componentName: "RightPlace"
token: true
index: 1
- ruleName: "PickUpObject"
constructObject: true
components:
......
......@@ -26,13 +26,13 @@ public final class {{{name}}} extends MotionGrammarParser<{{{targetType}}}> {
{{#peek}}
private {{{name}}} peeked{{{name}}}_ = null;
private boolean peek{{{name}}}({{#context}}{{{context}}} context{{/context}}) {
peeked{{{name}}}_ = getWorld().parse{{{name}}}({{#context}}context{{/context}}{{#worldParserArguments}}parent.{{{argument}}}{{/worldParserArguments}});
private boolean peek{{{name}}}({{#contextType}}{{{contextType}}} context{{/contextType}}) {
peeked{{{name}}}_ = getWorld().parse{{{name}}}({{#contextType}}context{{/contextType}}{{#worldParserArguments}}parent.{{{argument}}}{{/worldParserArguments}});
return peeked{{{name}}}_ != null;
}
{{/peek}}
private void parse{{{name}}}(ASTNode<?> parent, int index{{#context}}, {{{context}}} context{{/context}}) throws ParseException {
private void parse{{{name}}}(ASTNode<?> parent, int index{{#contextType}}, {{{contextType}}} context{{/contextType}}) throws ParseException {
{{{name}}} result;
{{#peek}}
......@@ -40,14 +40,14 @@ public final class {{{name}}} extends MotionGrammarParser<{{{targetType}}}> {
result = peeked{{{name}}}_;
peeked{{{name}}}_ = null; // TODO check if all peeked values are actually parsed afterwards
} else {
result = getWorld().parse{{{name}}}({{#context}}context{{/context}}{{#worldParserArguments}}parent.{{{argument}}}{{/worldParserArguments}});
result = getWorld().parse{{{name}}}({{#contextType}}context{{/contextType}}{{#worldParserArguments}}parent.{{{argument}}}{{/worldParserArguments}});
if (result == null) {
throw new ParseException({{{name}}}.type());
}
}
{{/peek}}
{{^peek}}
result = getWorld().parse{{{name}}}({{#context}}context{{/context}}{{#worldParserArguments}}parent.{{{argument}}}{{/worldParserArguments}});
result = getWorld().parse{{{name}}}({{#contextType}}context{{/contextType}}{{#worldParserArguments}}parent.{{{argument}}}{{/worldParserArguments}});
if (result == null) {
throw new ParseException({{{name}}}.type());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment