Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Naming of block constructs not well reproduced by repr methods. #397

Open
arporter opened this issue Mar 29, 2023 · 0 comments
Open

Naming of block constructs not well reproduced by repr methods. #397

arporter opened this issue Mar 29, 2023 · 0 comments

Comments

@arporter
Copy link
Member

In #392, Sergi pointed out that doing repr of a matched block construct gave confusing information on the name.
However, it turns out that this is already true of the Block_Label_Do_Construct, e.g. test_block_nonlabel_do_construct has:

obj = tcls(
    get_reader(
        """\
  foo:do i=1,10
    a = 1
  end do foo
"""
    )
)

and obj is:

Block_Nonlabel_Do_Construct(Nonlabel_Do_Stmt('DO', Loop_Control(None, (Name('i'), [Int_Literal_Constant('1', None), Int_Literal_Constant('10', None)]), None)), Assignment_Stmt(Name('a'), '=', Int_Literal_Constant('1', None)), End_Do_Stmt('DO', Name('foo')))

i.e., the name 'foo' only appears in the End_Do_Stmt and not in the Nonlabel_Do_Stmt. The difficulty is that the label ('foo' in this case) remains an attribute of the Line object constructed by the reader and is not available within the match method. This Line object is only added to an object (under the item attribute) after it has been constructed following a successful match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant