From 5cf2cee691e1d6a77f781210711726f20196a4d5 Mon Sep 17 00:00:00 2001 From: Onso37 <80353484+Onso37@users.noreply.github.com> Date: Fri, 14 Aug 2026 13:44:06 +0100 Subject: [PATCH 1/5] Update array expressions on the weaver --- .../fortran/weaverspecs/artifacts.xml | 6 +- .../fortran/weaverspecs/joinPointModel.xml | 4 + .../fortran/weaver/FortranJoinpoints.java | 2 + .../specs/fortran/weaver/FortranWeaver.json | 464 +++++++++++++++++- .../joinpoints/FArraySubscriptExpr.java | 9 +- .../weaver/joinpoints/FSectionSubscript.java | 19 + .../fortran/weaver/joinpoints/FSubscript.java | 27 + 7 files changed, 523 insertions(+), 8 deletions(-) create mode 100644 FortranWeaver/src/pt/up/fe/specs/fortran/weaver/joinpoints/FSectionSubscript.java create mode 100644 FortranWeaver/src/pt/up/fe/specs/fortran/weaver/joinpoints/FSubscript.java diff --git a/FortranWeaver/resources/fortran/weaverspecs/artifacts.xml b/FortranWeaver/resources/fortran/weaverspecs/artifacts.xml index ba201705..7ce76a0d 100644 --- a/FortranWeaver/resources/fortran/weaverspecs/artifacts.xml +++ b/FortranWeaver/resources/fortran/weaverspecs/artifacts.xml @@ -107,7 +107,7 @@ - + @@ -189,4 +189,8 @@ + + + + \ No newline at end of file diff --git a/FortranWeaver/resources/fortran/weaverspecs/joinPointModel.xml b/FortranWeaver/resources/fortran/weaverspecs/joinPointModel.xml index 3f293028..c4de9e3c 100644 --- a/FortranWeaver/resources/fortran/weaverspecs/joinPointModel.xml +++ b/FortranWeaver/resources/fortran/weaverspecs/joinPointModel.xml @@ -103,4 +103,8 @@ + + + + \ No newline at end of file diff --git a/FortranWeaver/src/pt/up/fe/specs/fortran/weaver/FortranJoinpoints.java b/FortranWeaver/src/pt/up/fe/specs/fortran/weaver/FortranJoinpoints.java index 5a94bcc7..8ecd7a7a 100644 --- a/FortranWeaver/src/pt/up/fe/specs/fortran/weaver/FortranJoinpoints.java +++ b/FortranWeaver/src/pt/up/fe/specs/fortran/weaver/FortranJoinpoints.java @@ -102,6 +102,8 @@ public class FortranJoinpoints { JOINPOINT_FACTORY.put(EntityDecl.class, FEntityDecl::new); JOINPOINT_FACTORY.put(Initialization.class, FInitialization::new); JOINPOINT_FACTORY.put(ExprInitialization.class, FExprInitialization::new); + JOINPOINT_FACTORY.put(Subscript.class, FSubscript::new); + JOINPOINT_FACTORY.put(SectionSubscript.class, FSectionSubscript::new); JOINPOINT_FACTORY.put(FortranNode.class, FortranJoinpoints::defaultFactory); } diff --git a/FortranWeaver/src/pt/up/fe/specs/fortran/weaver/FortranWeaver.json b/FortranWeaver/src/pt/up/fe/specs/fortran/weaver/FortranWeaver.json index 1940bdb1..94364748 100644 --- a/FortranWeaver/src/pt/up/fe/specs/fortran/weaver/FortranWeaver.json +++ b/FortranWeaver/src/pt/up/fe/specs/fortran/weaver/FortranWeaver.json @@ -481,7 +481,7 @@ "type": "attribute", "children": [ { - "type": "expr[]", + "type": "sectionSubscript[]", "name": "subscripts" }] }, @@ -10481,6 +10481,233 @@ }] }] }, + { + "type": "joinpoint", + "name": "sectionSubscript", + "extends": "joinpoint" , + "tooltip": "Represent a generic subscript for an array", + "children": [ + { + "type": "attribute", + "tooltip": "Returns an array with the children of the node", + "children": [ + { + "type": "joinpoint[]", + "name": "children" + }] + }, + { + "type": "attribute", + "tooltip": "String with the code represented by this node", + "children": [ + { + "type": "String", + "name": "code" + }] + }, + { + "type": "attribute", + "tooltip": "true if the given node is a descendant of this node", + "children": [ + { + "type": "Boolean", + "name": "contains" + }, + { + "type": "joinpoint", + "name": "jp", + "defaultValue": "" + }] + }, + { + "type": "attribute", + "tooltip": "Returns an array with the descendants of the node", + "children": [ + { + "type": "joinpoint[]", + "name": "descendants" + }] + }, + { + "type": "attribute", + "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", + "children": [ + { + "type": "joinpoint", + "name": "getAncestor" + }, + { + "type": "String", + "name": "type", + "defaultValue": "" + }] + }, + { + "type": "attribute", + "tooltip": "Returns the index of this join point in relation to its parent", + "children": [ + { + "type": "int", + "name": "indexOfSelf" + }] + }, + { + "type": "attribute", + "tooltip": "Returns the node that came before this node, or undefined if there is none", + "children": [ + { + "type": "joinpoint", + "name": "leftJp" + }] + }, + { + "type": "attribute", + "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", + "children": [ + { + "type": "joinpoint", + "name": "parent" + }] + }, + { + "type": "attribute", + "tooltip": "Returns the node that comes after this node, or undefined if there is none", + "children": [ + { + "type": "joinpoint", + "name": "rightJp" + }] + }, + { + "type": "attribute", + "tooltip": "Returns the 'program' join point", + "children": [ + { + "type": "program", + "name": "root" + }] + }, + { + "type": "attribute", + "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", + "children": [ + { + "type": "joinpoint[]", + "name": "scopeNodes" + }] + }, + { + "type": "action", + "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", + "children": [ + { + "type": "joinpoint", + "name": "copy" + }] + }, + { + "type": "action", + "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", + "children": [ + { + "type": "joinpoint", + "name": "deepCopy" + }] + }, + { + "type": "action", + "tooltip": "Removes node associated to the joinpoint from the AST", + "children": [ + { + "type": "joinpoint", + "name": "detach" + }] + }, + { + "type": "action", + "tooltip": "Inserts the given join point after this join point", + "children": [ + { + "type": "joinpoint", + "name": "insertAfter" + }, + { + "type": "joinpoint", + "name": "node", + "defaultValue": "" + }] + }, + { + "type": "action", + "tooltip": "Overload which accepts a string", + "children": [ + { + "type": "joinpoint", + "name": "insertAfter" + }, + { + "type": "String", + "name": "code", + "defaultValue": "" + }] + }, + { + "type": "action", + "tooltip": "Inserts the given join point before this join point", + "children": [ + { + "type": "joinpoint", + "name": "insertBefore" + }, + { + "type": "joinpoint", + "name": "node", + "defaultValue": "" + }] + }, + { + "type": "action", + "tooltip": "Overload which accepts a string", + "children": [ + { + "type": "joinpoint", + "name": "insertBefore" + }, + { + "type": "String", + "name": "node", + "defaultValue": "" + }] + }, + { + "type": "action", + "tooltip": "Replaces this node with the given node", + "children": [ + { + "type": "joinpoint", + "name": "replaceWith" + }, + { + "type": "joinpoint", + "name": "node", + "defaultValue": "" + }] + }, + { + "type": "action", + "tooltip": "Overload which accepts a list of join points", + "children": [ + { + "type": "joinpoint", + "name": "replaceWith" + }, + { + "type": "joinpoint[]", + "name": "node", + "defaultValue": "" + }] + }] + }, { "type": "joinpoint", "name": "specification", @@ -11933,6 +12160,241 @@ }] }] }, + { + "type": "joinpoint", + "name": "subscript", + "extends": "sectionSubscript" , + "tooltip": "Represent an integer subscript for an array", + "children": [ + { + "type": "attribute", + "children": [ + { + "type": "expr", + "name": "expr" + }] + }, + { + "type": "attribute", + "tooltip": "Returns an array with the children of the node", + "children": [ + { + "type": "joinpoint[]", + "name": "children" + }] + }, + { + "type": "attribute", + "tooltip": "String with the code represented by this node", + "children": [ + { + "type": "String", + "name": "code" + }] + }, + { + "type": "attribute", + "tooltip": "true if the given node is a descendant of this node", + "children": [ + { + "type": "Boolean", + "name": "contains" + }, + { + "type": "joinpoint", + "name": "jp", + "defaultValue": "" + }] + }, + { + "type": "attribute", + "tooltip": "Returns an array with the descendants of the node", + "children": [ + { + "type": "joinpoint[]", + "name": "descendants" + }] + }, + { + "type": "attribute", + "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", + "children": [ + { + "type": "joinpoint", + "name": "getAncestor" + }, + { + "type": "String", + "name": "type", + "defaultValue": "" + }] + }, + { + "type": "attribute", + "tooltip": "Returns the index of this join point in relation to its parent", + "children": [ + { + "type": "int", + "name": "indexOfSelf" + }] + }, + { + "type": "attribute", + "tooltip": "Returns the node that came before this node, or undefined if there is none", + "children": [ + { + "type": "joinpoint", + "name": "leftJp" + }] + }, + { + "type": "attribute", + "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", + "children": [ + { + "type": "joinpoint", + "name": "parent" + }] + }, + { + "type": "attribute", + "tooltip": "Returns the node that comes after this node, or undefined if there is none", + "children": [ + { + "type": "joinpoint", + "name": "rightJp" + }] + }, + { + "type": "attribute", + "tooltip": "Returns the 'program' join point", + "children": [ + { + "type": "program", + "name": "root" + }] + }, + { + "type": "attribute", + "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", + "children": [ + { + "type": "joinpoint[]", + "name": "scopeNodes" + }] + }, + { + "type": "action", + "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", + "children": [ + { + "type": "joinpoint", + "name": "copy" + }] + }, + { + "type": "action", + "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", + "children": [ + { + "type": "joinpoint", + "name": "deepCopy" + }] + }, + { + "type": "action", + "tooltip": "Removes node associated to the joinpoint from the AST", + "children": [ + { + "type": "joinpoint", + "name": "detach" + }] + }, + { + "type": "action", + "tooltip": "Inserts the given join point after this join point", + "children": [ + { + "type": "joinpoint", + "name": "insertAfter" + }, + { + "type": "joinpoint", + "name": "node", + "defaultValue": "" + }] + }, + { + "type": "action", + "tooltip": "Overload which accepts a string", + "children": [ + { + "type": "joinpoint", + "name": "insertAfter" + }, + { + "type": "String", + "name": "code", + "defaultValue": "" + }] + }, + { + "type": "action", + "tooltip": "Inserts the given join point before this join point", + "children": [ + { + "type": "joinpoint", + "name": "insertBefore" + }, + { + "type": "joinpoint", + "name": "node", + "defaultValue": "" + }] + }, + { + "type": "action", + "tooltip": "Overload which accepts a string", + "children": [ + { + "type": "joinpoint", + "name": "insertBefore" + }, + { + "type": "String", + "name": "node", + "defaultValue": "" + }] + }, + { + "type": "action", + "tooltip": "Replaces this node with the given node", + "children": [ + { + "type": "joinpoint", + "name": "replaceWith" + }, + { + "type": "joinpoint", + "name": "node", + "defaultValue": "" + }] + }, + { + "type": "action", + "tooltip": "Overload which accepts a list of join points", + "children": [ + { + "type": "joinpoint", + "name": "replaceWith" + }, + { + "type": "joinpoint[]", + "name": "node", + "defaultValue": "" + }] + }] + }, { "type": "joinpoint", "name": "typeDeclarationStatement", diff --git a/FortranWeaver/src/pt/up/fe/specs/fortran/weaver/joinpoints/FArraySubscriptExpr.java b/FortranWeaver/src/pt/up/fe/specs/fortran/weaver/joinpoints/FArraySubscriptExpr.java index b02c9d60..bdc7d7b3 100644 --- a/FortranWeaver/src/pt/up/fe/specs/fortran/weaver/joinpoints/FArraySubscriptExpr.java +++ b/FortranWeaver/src/pt/up/fe/specs/fortran/weaver/joinpoints/FArraySubscriptExpr.java @@ -3,10 +3,7 @@ import pt.up.fe.specs.fortran.ast.nodes.FortranNode; import pt.up.fe.specs.fortran.ast.nodes.expr.ArraySubscriptExpr; import pt.up.fe.specs.fortran.weaver.FortranJoinpoints; -import pt.up.fe.specs.fortran.weaver.abstracts.joinpoints.AArraySubscriptExpr; -import pt.up.fe.specs.fortran.weaver.abstracts.joinpoints.ADataRef; -import pt.up.fe.specs.fortran.weaver.abstracts.joinpoints.AExecutableStatement; -import pt.up.fe.specs.fortran.weaver.abstracts.joinpoints.AExpr; +import pt.up.fe.specs.fortran.weaver.abstracts.joinpoints.*; public class FArraySubscriptExpr extends AArraySubscriptExpr { @@ -18,12 +15,12 @@ public FArraySubscriptExpr(ArraySubscriptExpr arraySubscriptExpr) { } @Override - public AExpr[] getSubscriptsArrayImpl() { + public ASectionSubscript[] getSubscriptsArrayImpl() { return arraySubscriptExpr.getSubscripts() .stream() .map(FortranJoinpoints::create) .toList() - .toArray(new AExpr[0]); + .toArray(new ASectionSubscript[0]); } @Override diff --git a/FortranWeaver/src/pt/up/fe/specs/fortran/weaver/joinpoints/FSectionSubscript.java b/FortranWeaver/src/pt/up/fe/specs/fortran/weaver/joinpoints/FSectionSubscript.java new file mode 100644 index 00000000..c6bfc9b1 --- /dev/null +++ b/FortranWeaver/src/pt/up/fe/specs/fortran/weaver/joinpoints/FSectionSubscript.java @@ -0,0 +1,19 @@ +package pt.up.fe.specs.fortran.weaver.joinpoints; + +import pt.up.fe.specs.fortran.ast.nodes.FortranNode; +import pt.up.fe.specs.fortran.ast.nodes.expr.SectionSubscript; +import pt.up.fe.specs.fortran.weaver.abstracts.joinpoints.ASectionSubscript; + +public class FSectionSubscript extends ASectionSubscript { + + private final SectionSubscript sectionSubscript; + + public FSectionSubscript(SectionSubscript sectionSubscript) { + this.sectionSubscript = sectionSubscript; + } + + @Override + public FortranNode getNode() { + return sectionSubscript; + } +} diff --git a/FortranWeaver/src/pt/up/fe/specs/fortran/weaver/joinpoints/FSubscript.java b/FortranWeaver/src/pt/up/fe/specs/fortran/weaver/joinpoints/FSubscript.java new file mode 100644 index 00000000..bad0990d --- /dev/null +++ b/FortranWeaver/src/pt/up/fe/specs/fortran/weaver/joinpoints/FSubscript.java @@ -0,0 +1,27 @@ +package pt.up.fe.specs.fortran.weaver.joinpoints; + +import pt.up.fe.specs.fortran.ast.nodes.FortranNode; +import pt.up.fe.specs.fortran.ast.nodes.expr.Subscript; +import pt.up.fe.specs.fortran.weaver.FortranJoinpoints; +import pt.up.fe.specs.fortran.weaver.abstracts.joinpoints.AExpr; +import pt.up.fe.specs.fortran.weaver.abstracts.joinpoints.ASubscript; + +public class FSubscript extends ASubscript { + + private final Subscript subscript; + + public FSubscript(Subscript subscript) { + super(new FSectionSubscript(subscript)); + this.subscript = subscript; + } + + @Override + public AExpr getExprImpl() { + return FortranJoinpoints.create(subscript.getValue(), AExpr.class); + } + + @Override + public FortranNode getNode() { + return subscript; + } +} From 53545f799314edf128285ee1c17595a45117158d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Afonso=20Vaz=20Os=C3=B3rio?= Date: Fri, 14 Aug 2026 13:46:32 +0100 Subject: [PATCH 2/5] Update Joinpoints.ts --- Fortran-JS/src-api/Joinpoints.ts | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/Fortran-JS/src-api/Joinpoints.ts b/Fortran-JS/src-api/Joinpoints.ts index 62950b1d..55783f5c 100644 --- a/Fortran-JS/src-api/Joinpoints.ts +++ b/Fortran-JS/src-api/Joinpoints.ts @@ -34,10 +34,12 @@ type PrivateMapper = { "ProgramUnit": typeof ProgramUnit, "RangeLoopControl": typeof RangeLoopControl, "RealLiteral": typeof RealLiteral, + "SectionSubscript": typeof SectionSubscript, "Statement": typeof Statement, "StatementBlock": typeof StatementBlock, "StringLiteral": typeof StringLiteral, "Subroutine": typeof Subroutine, + "Subscript": typeof Subscript, "UseStatement": typeof UseStatement, "BinaryOperator": typeof BinaryOperator, "Designator": typeof Designator, @@ -443,6 +445,18 @@ export class RealLiteral extends Literal { }; } + /** + * Represent a generic subscript for an array + */ +export class SectionSubscript extends Joinpoint { + /** + * @internal + */ + static readonly _defaultAttributeInfo: {readonly map?: DefaultAttributeMap, readonly name: string | null, readonly type?: PrivateMapper, readonly jpMapper?: typeof JoinpointMapper} = { + name: null, + }; +} + /** * Represents a Fortran statement */ @@ -486,6 +500,19 @@ export class Subroutine extends ProgramUnit { get moduleName(): string { return wrapJoinPoint(this._javaObject.getModuleName()) } } + /** + * Represent an integer subscript for an array + */ +export class Subscript extends SectionSubscript { + /** + * @internal + */ + static readonly _defaultAttributeInfo: {readonly map?: DefaultAttributeMap, readonly name: string | null, readonly type?: PrivateMapper, readonly jpMapper?: typeof JoinpointMapper} = { + name: null, + }; + get expr(): Expr { return wrapJoinPoint(this._javaObject.getExpr()) } +} + export class UseStatement extends Statement { /** * @internal @@ -786,7 +813,7 @@ export class ArraySubscriptExpr extends DataRef { static readonly _defaultAttributeInfo: {readonly map?: DefaultAttributeMap, readonly name: string | null, readonly type?: PrivateMapper, readonly jpMapper?: typeof JoinpointMapper} = { name: null, }; - get subscripts(): Expr[] { return wrapJoinPoint(this._javaObject.getSubscripts()) } + get subscripts(): SectionSubscript[] { return wrapJoinPoint(this._javaObject.getSubscripts()) } get var(): DataRef { return wrapJoinPoint(this._javaObject.getVar()) } } @@ -815,10 +842,12 @@ const JoinpointMapper = { programUnit: ProgramUnit, rangeLoopControl: RangeLoopControl, realLiteral: RealLiteral, + sectionSubscript: SectionSubscript, statement: Statement, statementBlock: StatementBlock, stringLiteral: StringLiteral, subroutine: Subroutine, + subscript: Subscript, useStatement: UseStatement, binaryOperator: BinaryOperator, designator: Designator, From 32304f33333d94980e271f66404e6a03fc091679 Mon Sep 17 00:00:00 2001 From: Onso37 <80353484+Onso37@users.noreply.github.com> Date: Fri, 14 Aug 2026 13:58:40 +0100 Subject: [PATCH 3/5] Add leading comment inits to some factory methods --- .../src/pt/up/fe/specs/fortran/ast/FortranNodeFactory.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/FortranAst/src/pt/up/fe/specs/fortran/ast/FortranNodeFactory.java b/FortranAst/src/pt/up/fe/specs/fortran/ast/FortranNodeFactory.java index cc797482..0edc7e42 100644 --- a/FortranAst/src/pt/up/fe/specs/fortran/ast/FortranNodeFactory.java +++ b/FortranAst/src/pt/up/fe/specs/fortran/ast/FortranNodeFactory.java @@ -241,6 +241,8 @@ public OmpLoopConstruct ompLoopConstruct(DoConstruct doConstruct, List Date: Fri, 14 Aug 2026 14:50:20 +0100 Subject: [PATCH 4/5] Removes testing on Node 20, fixes Ubuntu version on 26.04 --- .github/workflows/nightly.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index bafc4b08..f17bf60c 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -36,7 +36,7 @@ env: jobs: build-java: name: Build Java - runs-on: ubuntu-latest + runs-on: ubuntu-26.04 outputs: branch-exists-lara-framework: ${{ steps.Branch-lara-framework.outputs.value }} @@ -142,9 +142,8 @@ jobs: strategy: fail-fast: false matrix: - #node-version: ['latest', '22.x', '20.x'] - node-version: ['22.x', '20.x'] - os: [ubuntu-latest, windows-2022, macos-latest] + node-version: ['22.x'] + os: [ubuntu-26.04, windows-2022, macos-latest] runs-on: ${{ matrix.os }} From a45922038dbee65e9467e7eb1770a9a840069126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Bispo?= Date: Fri, 14 Aug 2026 15:00:49 +0100 Subject: [PATCH 5/5] [Fortran-JS] Updates version to 22.2.0 --- Fortran-JS/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Fortran-JS/package.json b/Fortran-JS/package.json index 7f1f3817..6986e2c1 100644 --- a/Fortran-JS/package.json +++ b/Fortran-JS/package.json @@ -1,6 +1,6 @@ { "name": "@specs-feup/metafor", - "version": "22.1.0", + "version": "22.2.0", "description": "A Fortran source-to-source compiler written in Typescript", "type": "module", "files": [