Skip to content

Commit

Permalink
Fix multiple entry points causing infinite loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Botffy committed Oct 23, 2019
1 parent c0a971e commit 1b5a9eb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/ppke/itk/xplang/lang/RootParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ private static void parseForwardDeclaration(Parser parser, State state) throws P
}

private static void parseProgram(Parser parser, State state) throws ParseError {
Program program = ProgramParser.parse(parser);
if (state.program != null) {
throw new ParseError(parser.actual().location(), ErrorCode.ENTRY_POINT_ALREADY_DEFINED);
throw new ParseError(program.location(), ErrorCode.ENTRY_POINT_ALREADY_DEFINED);
}
state.program = ProgramParser.parse(parser);
state.program = program;
}


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
**#Two programs in one file
**FirstErrorLoc:6,1
program t
ki: "hello"
program_vége
program t2
ki: "world"
program_vége

0 comments on commit 1b5a9eb

Please sign in to comment.