Closed
Description
Description
I encountered an issue when parsing a type declaration in a Structured Text (ST) file. The declaration is as follows:
TYPE T_INTERLOCK : WORD;
END_TYPE
However, when attempting to parse it using the current configuration, I receive the following error:
Error parsing node T_INTERLOCK
in file test_files\baselib\BaseLibProj\BaseLib\POUs\HMI\Datentypen\T_INTERLOCK.TcDUT
(None:1:24: Expected '.' or '\s' or '//' or '(*(.|\n)?*)' or '{' or 'END_TYPE' => 'OCK : WORD; END_TYP')
Steps Taken:
I tried modifying the st_declaration.tx grammar in an attempt to accommodate this type declaration by adding or adjusting the TypeDef rule as follows:
TypeDef:
comments*=CommentAny?
'TYPE'
name=ID
('EXTENDS' extends=AnyType)?
':'
CommentAny*
type=AnyType
';'?
CommentAny*
'END_TYPE'
;
AnyType:
TypeStruct | TypeUnion | TypeEnum | StringType | Fqn | 'WORD'
;
However, making these changes requires modifying the source code, and I’m wondering if there's a better approach.
Metadata
Metadata
Assignees
Labels
No labels