From 0086191e5fd3ac6e3d876f2989803837d8af469e Mon Sep 17 00:00:00 2001 From: Joe Stanley Date: Mon, 6 May 2024 10:50:24 -0700 Subject: [PATCH] further exploration and troubleshooting --- blark/iec.lark | 6 +++++- blark/transform.py | 12 +++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/blark/iec.lark b/blark/iec.lark index 0cf366a..f23918d 100644 --- a/blark/iec.lark +++ b/blark/iec.lark @@ -350,7 +350,11 @@ structure_type_declaration: structure_type_name_declaration [ extends ] ":" [ in initialized_structure: structure_type_name ":=" structure_initialization // I think we need to have var1_list used, here -- need to play around with that some more -structure_element_declaration: structure_element_name [ incomplete_location ] ":" ( initialized_structure | array_spec_init | simple_spec_init | subrange_spec_init | enumerated_spec_init | function_call ) +structure_element_declaration: struct_var1_list ":" ( initialized_structure | array_spec_init | simple_spec_init | subrange_spec_init | enumerated_spec_init | function_call ) + +_struct_var1: structure_element_name [ incomplete_location ] + +struct_var1_list: _struct_var1 ( "," _struct_var1 )* union_element_declaration: structure_element_name ":" ( array_specification | simple_specification | indirect_simple_specification | subrange_specification | enumerated_specification ) diff --git a/blark/transform.py b/blark/transform.py index c0a747f..67a1488 100644 --- a/blark/transform.py +++ b/blark/transform.py @@ -1954,8 +1954,7 @@ class StructureElementDeclaration: iValue1 AT %I* : INT := 5; sValue1 : STRING[10] := 'test'; """ - name: lark.Token - location: Optional[IncompleteLocation] + variables: List[DeclaredVariable] init: Union[ StructureInitialization, ArrayTypeInitialization, @@ -1968,11 +1967,6 @@ class StructureElementDeclaration: ] meta: Optional[Meta] = meta_field() - @property - def variables(self) -> List[str]: - """API compat: list of variable names.""" - return [self.name] - @property def value(self) -> str: """The initialization value, if applicable.""" @@ -4577,6 +4571,10 @@ def full_subrange(self): def var1_list(self, *items: DeclaredVariable) -> List[DeclaredVariable]: return list(items) + @_annotator_method_wrapper + def struct_var1_list(self, *items: DeclaredVariable) -> List[DeclaredVariable]: + return list(items) + @_annotator_method_wrapper def fb_decl_name_list(self, *items: lark.Token) -> List[lark.Token]: return list(items)