Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
motion-grammar-example
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JastAdd
motion-grammar-example
Commits
69d7bf47
Commit
69d7bf47
authored
3 years ago
by
Johannes Mey
Browse files
Options
Downloads
Patches
Plain Diff
work on parser
parent
ae2df97e
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#13404
failed
3 years ago
Stage: build
Stage: test
Stage: ragdoc
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/tudresden/inf/st/mg/RobotParser.java
+79
-1
79 additions, 1 deletion
src/main/java/de/tudresden/inf/st/mg/RobotParser.java
with
79 additions
and
1 deletion
src/main/java/de/tudresden/inf/st/mg/RobotParser.java
+
79
−
1
View file @
69d7bf47
...
@@ -27,7 +27,7 @@ public final class RobotParser extends MotionGrammarParser<Tidy> {
...
@@ -27,7 +27,7 @@ public final class RobotParser extends MotionGrammarParser<Tidy> {
while
(
true
)
{
while
(
true
)
{
peekObjectAtWrongPlace
();
peekObjectAtWrongPlace
();
if
(
peekedObjectAtWrongPlace_
!=
null
)
{
if
(
peekedObjectAtWrongPlace_
!=
null
)
{
parseObject
AtWrong
Place
(
result
.
getMoveObjectToCorrectPlaceList
(),
result
.
getNumMoveObjectToCorrectPlace
());
parse
Move
Object
ToCorrect
Place
(
result
.
getMoveObjectToCorrectPlaceList
(),
result
.
getNumMoveObjectToCorrectPlace
());
}
else
{
}
else
{
break
;
break
;
}
}
...
@@ -41,6 +41,84 @@ public final class RobotParser extends MotionGrammarParser<Tidy> {
...
@@ -41,6 +41,84 @@ public final class RobotParser extends MotionGrammarParser<Tidy> {
printAST
(
"parseTidy"
,
result
);
printAST
(
"parseTidy"
,
result
);
}
}
private
void
parseMoveObjectToCorrectPlace
(
ASTNode
<?>
parent
,
int
index
)
throws
ParseException
{
MoveObjectToCorrectPlace
result
=
(
MoveObjectToCorrectPlace
)
parent
.
getChild
(
index
);
parseObjectAtWrongPlace
(
result
,
0
);
parsePickUpObject
(
result
,
1
);
parseDropObjectAtRightPlace
(
result
,
2
);
// semantic action for T1
result
.
action
(
getWorld
());
printAST
(
"parseMoveObjectToCorrectPlace"
,
result
);
}
private
void
parseDropObjectAtRightPlace
(
ASTNode
<?>
parent
,
int
index
)
throws
ParseException
{
DropObjectAtRightPlace
result
=
(
DropObjectAtRightPlace
)
parent
.
getChild
(
index
);
parseRightPlace
(
result
,
0
);
parseDrop
(
result
,
1
);
// semantic action for T1
result
.
action
(
getWorld
());
printAST
(
"parseDropObjectAtRightPlace"
,
result
);
}
private
void
parsePickUpObject
(
ASTNode
<?>
parent
,
int
index
)
throws
ParseException
{
PickUpObject
result
=
(
PickUpObject
)
parent
.
getChild
(
index
);
parseRobotIsReadyToPick
(
result
,
0
);
parsePick
(
result
,
1
);
// semantic action for T1
result
.
action
(
getWorld
());
printAST
(
"parsePickUpObject"
,
result
);
}
private
void
parseRobotIsReadyToPick
(
ASTNode
<?>
parent
,
int
index
)
throws
ParseException
{
RobotIsReadyToPick
result
;
// try to parse a T
if
(
peekRobotIsFree
())
{
result
=
new
RobotIsReallyReadyToPick
();
parent
.
setChild
(
result
,
index
);
parseRobotIsReallyReadyToPick
(
parent
,
index
);
}
else
if
(
peekRobotIsBusy
())
{
result
=
new
RobotIsNotReadyToPick
();
parent
.
setChild
(
result
,
index
);
parseRobotIsNotReadyToPick
(
parent
,
index
);
}
else
{
throw
new
ParseException
(
"RobotIsReadyToPick"
,
RobotIsFree
.
type
(),
RobotIsBusy
.
type
());
}
// semantic action for T1
result
.
action
(
getWorld
());
printAST
(
"parsePickUpObject"
,
result
);
}
private
void
parseRobotIsReallyReadyToPick
(
ASTNode
<?>
parent
,
int
index
)
throws
ParseException
{
RobotIsReallyReadyToPick
result
=
(
RobotIsReallyReadyToPick
)
parent
.
getChild
(
index
);
parseRobotIsFree
(
result
,
0
);
// semantic action for T1
result
.
action
(
getWorld
());
printAST
(
"parseRobotIsReallyReadyToPick"
,
result
);
}
private
void
parseRobotIsNotReadyToPick
(
ASTNode
<?>
parent
,
int
index
)
throws
ParseException
{
RobotIsNotReadyToPick
result
=
(
RobotIsNotReadyToPick
)
parent
.
getChild
(
index
);
parseRobotIsBusy
(
result
,
0
);
parseWait
(
result
,
1
);
parseRobotIsReadyToPick
(
result
,
2
);
// semantic action for T1
result
.
action
(
getWorld
());
printAST
(
"parseRobotIsNotReadyToPick"
,
result
);
}
private
boolean
peekObjectAtWrongPlace
()
{
private
boolean
peekObjectAtWrongPlace
()
{
peekedObjectAtWrongPlace_
=
getWorld
().
parseObjectAtWrongPlace
();
peekedObjectAtWrongPlace_
=
getWorld
().
parseObjectAtWrongPlace
();
return
peekedObjectAtWrongPlace_
!=
null
;
return
peekedObjectAtWrongPlace_
!=
null
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment