OASIS-learn-study / minecraft-storeys-maker

Minecraft extension to make your own stories in, with and for Minecraft - it's like being a movie director!
https://www.learn.study
GNU Affero General Public License v3.0
15 stars 10 forks source link

Story DSL ending with text without newline makes parser get stuck #333

Closed vorburger closed 2 years ago

vorburger commented 2 years ago

While testing the comment about how to reproduce #301 while reviewing #332, I found that adding "La Fin." at the end of dynamic-test.story WITHOUT a CR / LF (?), that makes the parser get "stuck" and loop infinitely somewhere - a DOS! 😈

vorburger commented 2 years ago

In #332 @edewit also removed the following from StoryParserTest which we should add back when we fix this bug:

@Test public void blanks() throws SyntaxErrorException {
    Story story = getStoryParser().parse("   \n \r\n  ");
    assertThat(story.getActionsList(), hasSize(1));
}
vorburger commented 2 years ago

@edewit this is likey related to why you added \n to inline JS? That's perhaps a bigger problem than the EOF...

As-is now (with #332) it could be confusing how a .story gets "broken" if you forget the \n in a return "hello".

edewit commented 2 years ago

The fix for the empty line will fix this as well