increpare / PuzzleScript

Open Source HTML5 Puzzle Game Engine
MIT License
903 stars 159 forks source link

parser accepts seemingly malformed rule #530

Closed bitonic closed 3 years ago

bitonic commented 5 years ago

When specifying rule, multiple [s can be used. See line 51 in https://www.puzzlescript.net/editor.html?hack=8a074039d585d4ef54c077d741bb45df for an example. I'd expect this to not be possible.

bitonic commented 5 years ago

Even more interesting example at line 790 here: https://www.puzzlescript.net/editor.html?hack=d42bf2a870aab3a2deca6132ff6ebad5 :

late left [spring][bunnyl no moved |no cre no flower] -> [[spring]|bunnyl moved] 

we do get a warning:

line 790 : Invalid token BUNNYL. Object names should only be used within cells (square brackets).
line 790 : Invalid token MOVED. Object names should only be used within cells (square brackets).

looking at the debug output, we get

RIGHT [ spring ] [ no spring no sblock no ablock no wblock no mblock no crat no glass no ice no sdoor no adoor no mdoor no wdoor no swmir no semir no nwmir no nemir no bunnyl no bunnyr no bunnyd no bunnyu no diag no diago no flower | bunnyl no moved ] -> [ spring ] [ | ] 

so it seems that the double [ before spring invalidates the later part of the rule somehow.