Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
parsergenerators
cup
Commits
a24e9a93
Commit
a24e9a93
authored
Mar 25, 2021
by
Dr. Michael Petter
Browse files
added an error for duplicate labels
parent
14e2a9ba
Pipeline
#2634
failed with stage
in 4 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/cup/parser.cup
View file @
a24e9a93
...
...
@@ -124,7 +124,9 @@ action code {:
if
(
rhs_pos
>=
MAX_RHS
)
throw
new
Exception
(
"Internal Error: Productions limited to "
+
MAX_RHS
+
" symbols and actions"
);
for
(
int
i
=
0
;
i
<
rhs_pos
;
i
++)
if
(
part
.
label
()
!=null && part.label().equals(rhs_parts[i].label()))
this
.
parser
.
report_error
(
"Label '"
+
part
.
label
()+
"' for symbol #"
+
rhs_pos
+
" already used for symbol #"
+
i
+
"; compilation will fail"
,
parser
.
stack
.
peek
());
rhs_parts
[
rhs_pos
]
=
part
;
rhs_pos
++;
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment