Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SableCC STUPS
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
SableCC STUPS
Commits
ff10f5e4
Commit
ff10f5e4
authored
1 year ago
by
dgelessus
Browse files
Options
Downloads
Patches
Plain Diff
Refactor code generation for New term variable declarations
parent
a60881d9
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/sablecc/sablecc/GenerateAlternativeCodeForParser.java
+11
-28
11 additions, 28 deletions
...org/sablecc/sablecc/GenerateAlternativeCodeForParser.java
with
11 additions
and
28 deletions
src/main/java/org/sablecc/sablecc/GenerateAlternativeCodeForParser.java
+
11
−
28
View file @
ff10f5e4
...
...
@@ -152,21 +152,22 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter
}
}
public
void
inAParams
(
List
<
PTerm
>
list_param
)
{
for
(
PTerm
term
:
list_param
)
private
void
generateNewTermDeclarations
(
List
<
PTerm
>
params
)
{
try
{
macros
.
apply
(
file
,
"ParserBraceOpening"
);
for
(
PTerm
term
:
params
)
{
generateVariableDeclaration
(
term
);
}
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
"An error occured while writing to "
+
new
File
(
pkgDir
,
"Parser.java"
).
getAbsolutePath
(),
e
);
}
}
}
private
void
generateSimpleTerm
(
Node
node
,
TId
id
,
TId
simpleTermTail
)
{
...
...
@@ -247,31 +248,13 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter
@Override
public
void
inANewTerm
(
ANewTerm
node
)
{
try
{
macros
.
apply
(
file
,
"ParserBraceOpening"
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
"An error occured while writing to "
+
new
File
(
pkgDir
,
"Parser.java"
).
getAbsolutePath
(),
e
);
}
inAParams
(
node
.
getParams
());
generateNewTermDeclarations
(
node
.
getParams
());
}
@Override
public
void
inANewListTerm
(
ANewListTerm
node
)
{
try
{
macros
.
apply
(
file
,
"ParserBraceOpening"
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
"An error occured while writing to "
+
new
File
(
pkgDir
,
"Parser.java"
).
getAbsolutePath
(),
e
);
}
inAParams
(
node
.
getParams
());
generateNewTermDeclarations
(
node
.
getParams
());
}
@Override
...
...
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