Skip to content

Commit 3b69a43

Browse files
Issue #50 fix (#51)
* Fix issue #50 The new error message will be: ``` server.claro:2: Unexpected token <,> sup: "/", ^ ``` Signed-off-by: Jason Steving <[email protected]> Co-authored-by: Jason Steving <[email protected]>
1 parent d7297f7 commit 3b69a43

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/java/com/claro/ClaroParser.cup

+28
Original file line numberDiff line numberDiff line change
@@ -3934,6 +3934,34 @@ http_endpoints_list ::=
39343934
{:
39353935
RESULT = ImmutableMap.<IdentifierReferenceTerm, Object>builder().put(endpoint_name, path.getVal());
39363936
:}
3937+
3938+
/*Report on unexpected trailing commas.*/
3939+
| identifier:endpoint_name COLON fmt_string:path COMMA:c
3940+
{:
3941+
Symbol currSymbol = new Symbol(
3942+
-1,
3943+
cleft,
3944+
cright,
3945+
LexedValue.create(
3946+
String.valueOf(c.getVal()),
3947+
c.getCurrentInputLine(),
3948+
c.getLen())
3949+
);
3950+
report_error("Syntax error: Unexpected trailing comma", currSymbol);
3951+
:}
3952+
| identifier:endpoint_name COLON STRING:path COMMA:c
3953+
{:
3954+
Symbol currSymbol = new Symbol(
3955+
-1,
3956+
cleft,
3957+
cright,
3958+
LexedValue.create(
3959+
String.valueOf(c.getVal()),
3960+
c.getCurrentInputLine(),
3961+
c.getLen())
3962+
);
3963+
report_error("Syntax error: Unexpected trailing comma", currSymbol);
3964+
:}
39373965
;
39383966

39393967
endpoint_handlers_block_stmt ::=

0 commit comments

Comments
 (0)