Skip to content

Commit

Permalink
Issue #50 fix (#51)
Browse files Browse the repository at this point in the history
* Fix issue #50

The new error message will be:

```
server.claro:2: Unexpected token <,>
  sup: "/",
          ^
```

Signed-off-by: Jason Steving <32336750+JasonSteving99@users.noreply.github.com>
Co-authored-by: Jason Steving <32336750+JasonSteving99@users.noreply.github.com>
  • Loading branch information
swork1 and JasonSteving99 committed Mar 13, 2024
1 parent d7297f7 commit 3b69a43
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/java/com/claro/ClaroParser.cup
Original file line number Diff line number Diff line change
Expand Up @@ -3934,6 +3934,34 @@ http_endpoints_list ::=
{:
RESULT = ImmutableMap.<IdentifierReferenceTerm, Object>builder().put(endpoint_name, path.getVal());
:}

/*Report on unexpected trailing commas.*/
| identifier:endpoint_name COLON fmt_string:path COMMA:c
{:
Symbol currSymbol = new Symbol(
-1,
cleft,
cright,
LexedValue.create(
String.valueOf(c.getVal()),
c.getCurrentInputLine(),
c.getLen())
);
report_error("Syntax error: Unexpected trailing comma", currSymbol);
:}
| identifier:endpoint_name COLON STRING:path COMMA:c
{:
Symbol currSymbol = new Symbol(
-1,
cleft,
cright,
LexedValue.create(
String.valueOf(c.getVal()),
c.getCurrentInputLine(),
c.getLen())
);
report_error("Syntax error: Unexpected trailing comma", currSymbol);
:}
;

endpoint_handlers_block_stmt ::=
Expand Down

0 comments on commit 3b69a43

Please sign in to comment.