Skip to content

Commit

Permalink
Merge pull request #66 from moosetechnology/export-main-program
Browse files Browse the repository at this point in the history
Export main program
  • Loading branch information
NicolasAnquetil committed Nov 17, 2023
2 parents 3d60e83 + 44cb551 commit 19724a8
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,22 @@ FASTFortranExporterVisitorTest >> testImplicitStatement [
'
]

{ #category : #'tests - statements' }
FASTFortranExporterVisitorTest >> testMainProgram [
| node |
node := FASTFortranProgramMain new
name: 'BLAH' ;
statementBlock: FASTFortranStatementBlock new
yourself.

self
assertExport: node
equals:
' program BLAH
end
'
]

{ #category : #'tests - statements' }
FASTFortranExporterVisitorTest >> testOneDeclarationCharacterType [
| stmt |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ FASTFortranDifferentialValidator >> getASTFromString: string [

{ #category : #utilities }
FASTFortranDifferentialValidator >> getTopLevelNodes: model [
"the model is actually a collection of AST (and their should be only one actually)"

^model allWithSubTypesOf: FamixF77ProgramUnit
^model
]

{ #category : #initialization }
Expand All @@ -36,5 +37,9 @@ FASTFortranDifferentialValidator >> isSourceFile: aFileReference [
{ #category : #utilities }
FASTFortranDifferentialValidator >> reExportAST: ast [

^ast accept: FASTFortranExporterVisitor new
| visitor |
visitor := FASTFortranExporterVisitor new.

ast accept: visitor.
^visitor stream contents
]
11 changes: 11 additions & 0 deletions src/FAST-Fortran-Visitors/FASTFortranExporterVisitor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,17 @@ FASTFortranExporterVisitor >> visitFASTFortranModel: aFASTFortranModel [
^self stream
]

{ #category : #'visiting - programUnits' }
FASTFortranExporterVisitor >> visitFASTFortranProgramMain: aFASTFortranProgramMain [

self
sixSpaces ;
<< 'program ' ;
<< aFASTFortranProgramMain name.
self newLine.
self visitFASTFortranTBehaviouralEntity: aFASTFortranProgramMain
]

{ #category : #'visiting - expressions' }
FASTFortranExporterVisitor >> visitFASTFortranRealType: aFASTFortranType [
self << 'real'
Expand Down

0 comments on commit 19724a8

Please sign in to comment.