From 2e05dbecdae31d30e1498748aa400b5874bc53c1 Mon Sep 17 00:00:00 2001 From: Raoul Hidalgo Charman Date: Fri, 28 Jul 2023 13:16:57 +0100 Subject: [PATCH] Fix data group and pointer span Previously it grabbed the span across the keyword and the reversed list which meant it only got the span until the end of first list, even if each list had the correct span. --- src/Language/Fortran/Parser/Fixed/Fortran77.y | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Language/Fortran/Parser/Fixed/Fortran77.y b/src/Language/Fortran/Parser/Fixed/Fortran77.y index 5b93615b..8e3a27d4 100644 --- a/src/Language/Fortran/Parser/Fixed/Fortran77.y +++ b/src/Language/Fortran/Parser/Fixed/Fortran77.y @@ -467,8 +467,12 @@ NONEXECUTABLE_STATEMENT :: { Statement A0 } | dimension INITIALIZED_ARRAY_DECLARATORS { StDimension () (getTransSpan $1 $2) (aReverse $2) } | common COMMON_GROUPS { StCommon () (getTransSpan $1 $2) (aReverse $2) } | equivalence EQUIVALENCE_GROUPS { StEquivalence () (getTransSpan $1 $2) (aReverse $2) } -| pointer POINTER_LIST { StPointer () (getTransSpan $1 $2) (fromReverseList $2) } -| data DATA_GROUPS { StData () (getTransSpan $1 $2) (fromReverseList $2) } +| pointer POINTER_LIST + { let pl = fromReverseList $2 + in StPointer () (getTransSpan $1 pl) pl } +| data DATA_GROUPS + { let dgs = fromReverseList $2 + in StData () (getTransSpan $1 dgs) dgs } | automatic INITIALIZED_DECLARATORS { StAutomatic () (getTransSpan $1 $2) (aReverse $2) } | static INITIALIZED_DECLARATORS { StStatic () (getTransSpan $1 $2) (aReverse $2) } -- Following is a fake node to make arbitrary FORMAT statements parsable.