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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
SableCC STUPS
Commits
db582cda
Commit
db582cda
authored
May 16, 2024
by
dgelessus
Browse files
Options
Downloads
Patches
Plain Diff
Inline a few local variables in generated Parser
parent
22f56113
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/org/sablecc/sablecc/parser/Parser.java
+8
-11
8 additions, 11 deletions
src/main/java/org/sablecc/sablecc/parser/Parser.java
src/main/resources/org/sablecc/sablecc/parser.txt
+8
-11
8 additions, 11 deletions
src/main/resources/org/sablecc/sablecc/parser.txt
with
16 additions
and
22 deletions
src/main/java/org/sablecc/sablecc/parser/Parser.java
+
8
−
11
View file @
db582cda
...
@@ -178,11 +178,9 @@ public class Parser implements IParser
...
@@ -178,11 +178,9 @@ public class Parser implements IParser
switch
(
action
)
switch
(
action
)
{
{
case
SHIFT:
case
SHIFT:
{
push
(
destination
,
Collections
.
singletonList
(
this
.
lexer
.
next
()));
List
<?>
list
=
Collections
.
singletonList
(
this
.
lexer
.
next
());
push
(
destination
,
list
);
}
break
;
break
;
case
REDUCE:
case
REDUCE:
switch
(
destination
)
switch
(
destination
)
{
{
...
@@ -1804,13 +1802,12 @@ public class Parser implements IParser
...
@@ -1804,13 +1802,12 @@ public class Parser implements IParser
throw
new
ParserException
(
lastToken
,
"["
+
lastToken
.
getLine
()
+
","
+
lastToken
.
getPos
()
+
"] Internal parser error: invalid action table REDUCE destination "
+
destination
+
", current state "
+
state
());
throw
new
ParserException
(
lastToken
,
"["
+
lastToken
.
getLine
()
+
","
+
lastToken
.
getPos
()
+
"] Internal parser error: invalid action table REDUCE destination "
+
destination
+
", current state "
+
state
());
}
}
break
;
break
;
case
ACCEPT:
case
ACCEPT:
{
EOF
eof
=
(
EOF
)
this
.
lexer
.
next
();
EOF
node2
=
(
EOF
)
this
.
lexer
.
next
();
PGrammar
top
=
(
PGrammar
)
pop
().
get
(
0
);
PGrammar
node1
=
(
PGrammar
)
pop
().
get
(
0
);
return
new
Start
(
top
,
eof
);
Start
node
=
new
Start
(
node1
,
node2
);
return
node
;
}
case
ERROR:
case
ERROR:
throw
new
ParserException
(
lastToken
,
throw
new
ParserException
(
lastToken
,
"["
+
lastToken
.
getLine
()
+
","
+
lastToken
.
getPos
()
+
"] "
,
"["
+
lastToken
.
getLine
()
+
","
+
lastToken
.
getPos
()
+
"] "
,
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/org/sablecc/sablecc/parser.txt
+
8
−
11
View file @
db582cda
...
@@ -186,11 +186,9 @@ public class Parser implements IParser
...
@@ -186,11 +186,9 @@ public class Parser implements IParser
switch(action)
switch(action)
{
{
case SHIFT:
case SHIFT:
{
push(destination, Collections.singletonList(this.lexer.next()));
List<?> list = Collections.singletonList(this.lexer.next());
push(destination, list);
}
break;
break;
case REDUCE:
case REDUCE:
switch(destination)
switch(destination)
{
{
...
@@ -212,13 +210,12 @@ Macro:ParserParseTail
...
@@ -212,13 +210,12 @@ Macro:ParserParseTail
throw new ParserException(lastToken, "[" + lastToken.getLine() + "," + lastToken.getPos() + "] Internal parser error: invalid action table REDUCE destination " + destination + ", current state " + state());
throw new ParserException(lastToken, "[" + lastToken.getLine() + "," + lastToken.getPos() + "] Internal parser error: invalid action table REDUCE destination " + destination + ", current state " + state());
}
}
break;
break;
case ACCEPT:
case ACCEPT:
{
EOF eof = (EOF) this.lexer.next();
EOF node2 = (EOF) this.lexer.next();
$0$ top = ($0$) pop().get(0);
$0$ node1 = ($0$) pop().get(0);
return new Start(top, eof);
Start node = new Start(node1, node2);
return node;
}
case ERROR:
case ERROR:
throw new ParserException(lastToken,
throw new ParserException(lastToken,
"[" + lastToken.getLine() + "," + lastToken.getPos() + "] " ,
"[" + lastToken.getLine() + "," + lastToken.getPos() + "] " ,
...
...
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