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

Modelling of parameters in 'REWIND', 'OPEN', 'INQUIRE' and other statements #226

Open
lsafina opened this issue May 16, 2024 · 3 comments
Open

Comments

@lsafina
Copy link
Contributor

lsafina commented May 16, 2024

Currently for statements like

REWIND (UNIT=3, IOSTAT=CODE, ERR=100)
inquire(unit=xunit,form=zform,err=10,iostat=zios)
OPEN(8, FILE='projectA/data.test', ERR=99)
...

parameters are modelled as FASTFortranAssignmentStatement, which does not work for the cases like err=10 when the right part of the expression is an instance of FASTFortranLabelReference which is not a subclass of FASTFortranExpression expected there.

Possible solutions:

  1. make FASTFortranLabelReference inherit FASTFortranExpression
  2. allow FASTFortranAssignmentStatement to have FASTFortranLabelReference in the right side. (Requires changes in FAST-Core!)
  3. when FASTFortranLabelReference used as parameter, recreate is as FASTFortranIntegerLiteral
  4. design some new type of entities or reuse existent ones to model such parameters
@NicolasAnquetil
Copy link
Contributor

It seems strange to me that it is a FASTFortranLabelReference.

In my old (2 weeks) image, it is an Integer literal
here is a screenshot of test SyntaxJsonToFASTTests >> testRewindStatementIOParameters.

There seems to be some regression there, no?

image

@lsafina
Copy link
Contributor Author

lsafina commented May 17, 2024

Yes, it has been changed as a start_pos was added to a label reference.

Before the rule <110b:label_ref> = %unsigned_int_constant was returning $ptext ("%unsigned_int_constant") which was then treated as an integer in pharo.

Now it returns an object with start_pos

$LIST( <110b:label_ref>)
{
  $LIST( <110b:label_ref>) = ast_label_ref(
    LOCATION(0),
    $ptext ("%unsigned_int_constant")
  );
}

and in pharo creates a FASTFortranLabelReference

visitLabelReference: aNode
^ self visitJsonMap: aNode keys: #( start_pos label )

visitLabelReference: aNode
	| data |
	
	data := super visitLabelReference: aNode.
	
	^(self newEntity: FASTFortranLabelReference withPosition: data)
		label: (aNode at: #label) ;
		yourself

@lsafina
Copy link
Contributor Author

lsafina commented May 21, 2024

Number 3 on the level of visitControlInfoValue

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

2 participants