adapap / OWScript

Python-like scripting language which transpiles into Overwatch Workshop script rulesets.
MIT License
37 stars 2 forks source link

Parser goes into invalid state when doing operations after an implicit Vector #36

Closed netux closed 4 years ago

netux commented 4 years ago

Remember #29? Remember this comment? This is similar to that.

It seems to happen algabraic operations; from my tests: add, subtract, multiply and divide.

Example

Rule "Vector vs Compare"
    Event
        On Each Player
        All
        All

    Actions
        <0, 1, 2> + Event Player.pos

errors with

Error: Line 8
        <0, 1, 2> + Event Player.pos
                                    ^
Expected token of type COMPARE, but received NEWLINE

After some debugging, I identified the problematic line is Parser.py:519

        self.eat('COMMA')
     >> node.children.append(self.expr())
        self.eat('COMPARE')

the call to expr() triggers a call to compare() which in turn eats the closing > of the vector, and takes whatever is next (the "+ Event Player.pos" in the example) with it too