klauer / blark

Beckhoff TwinCAT ST (IEC 61131-3) code parsing in Python using Lark (Earley)
https://klauer.github.io/blark/
GNU General Public License v2.0
42 stars 5 forks source link

Syntax Parsing Failure - Accessing an Attribute on a Dereferenced Pointer Returned from a Method Doesn't Work #93

Closed engineerjoe440 closed 9 months ago

engineerjoe440 commented 9 months ago

Ok... here's yet another interesting one...

filename := _directoryFileList.Item(_i)^.ToString();
                                        ^
Expected one of:
        * LOGICAL_AND_THEN
        * LOGICAL_XOR
        * LOGICAL_OR
        * MULTIPLY_OPERATOR
        * LOGICAL_OR_ELSE
        * EQUALS_OP
        * SEMICOLON
        * ASSIGNMENT
        * LOGICAL_AND
        * ADD_OPERATOR
        * COMPARE_OP

Seems like blark doesn't like the fact that we're accessing some attribute from whatever that dereferenced structure is supposed to be.

Thank you for all of your help and welcomeness, as ever!

klauer commented 9 months ago

Turns out this is a bit of an oversight from https://github.com/klauer/blark/pull/55 - chained function calls should have been supported at the expression level as well as at the statement level.

PR on the way...