Skip to content

Commit 15b8d06

Browse files
committed
remove associate parsing from F90; cleanup
1 parent 7da5f9c commit 15b8d06

File tree

2 files changed

+0
-83
lines changed

2 files changed

+0
-83
lines changed

src/Language/Fortran/Parser/Fortran90.y

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@ import Debug.Trace
145145
case { TCase _ }
146146
selectcase { TSelectCase _ }
147147
endselect { TEndSelect _ }
148-
associate { TAssociate _ }
149-
endassociate { TEndAssociate _ }
150148
default { TDefault _ }
151149
cycle { TCycle _ }
152150
exit { TExit _ }
@@ -309,7 +307,6 @@ BLOCKS :: { [ Block A0 ] } : BLOCKS BLOCK { $2 : $1 } | {- EMPTY -} { [ ] }
309307
BLOCK :: { Block A0 }
310308
: IF_BLOCK MAYBE_COMMENT NEWLINE { $1 }
311309
| CASE_BLOCK MAYBE_COMMENT NEWLINE { $1 }
312-
| ASSOCIATE_BLOCK MAYBE_COMMENT NEWLINE { $1 }
313310
| INTEGER_LITERAL STATEMENT MAYBE_COMMENT NEWLINE
314311
{ BlStatement () (getTransSpan $1 $2) (Just $1) $2 }
315312
| STATEMENT MAYBE_COMMENT NEWLINE { BlStatement () (getSpan $1) Nothing $1 }
@@ -405,60 +402,6 @@ END_SELECT :: { (Maybe (Expression A0), SrcSpan) }
405402
: maybe(INTEGER_LITERAL) endselect maybe(id)
406403
{ ($1, maybe (getSpan $2) getSpan $3) }
407404

408-
ASSOCIATE_BLOCK :: { Block A0 }
409-
: INTEGER_LITERAL id ':' associate '(' ABBREVIATIONS ')' MAYBE_COMMENT NEWLINE BLOCKS END_ASSOCIATE
410-
{ let { startSpan = getSpan $1;
411-
mLabel = Just $1;
412-
TId _ name = $2;
413-
mName = Just name;
414-
abbrevs = fromReverseList $6;
415-
body = reverse $10;
416-
(endSpan, mEndLabel) = $11;
417-
span = getTransSpan startSpan endSpan }
418-
in BlAssociate () span mLabel mName abbrevs body mEndLabel }
419-
| INTEGER_LITERAL associate '(' ABBREVIATIONS ')' MAYBE_COMMENT NEWLINE BLOCKS END_ASSOCIATE
420-
{ let { startSpan = getSpan $1;
421-
mLabel = Just $1;
422-
mName = Nothing;
423-
abbrevs = fromReverseList $4;
424-
body = reverse $8;
425-
(endSpan, mEndLabel) = $9;
426-
span = getTransSpan startSpan endSpan }
427-
in BlAssociate () span mLabel mName abbrevs body mEndLabel }
428-
| id ':' associate '(' ABBREVIATIONS ')' MAYBE_COMMENT NEWLINE BLOCKS END_ASSOCIATE
429-
{ let { startSpan = getSpan $1;
430-
TId _ name = $1;
431-
mLabel = Nothing;
432-
mName = Just name;
433-
abbrevs = fromReverseList $5;
434-
body = reverse $9;
435-
(endSpan, mEndLabel) = $10;
436-
span = getTransSpan startSpan endSpan }
437-
in BlAssociate () span mLabel mName abbrevs body mEndLabel }
438-
| associate '(' ABBREVIATIONS ')' MAYBE_COMMENT NEWLINE BLOCKS END_ASSOCIATE
439-
{ let { startSpan = getSpan $1;
440-
mLabel = Nothing;
441-
mName = Nothing;
442-
abbrevs = fromReverseList $3;
443-
body = reverse $7;
444-
(endSpan, mEndLabel) = $8;
445-
span = getTransSpan startSpan endSpan }
446-
in BlAssociate () span mLabel mName abbrevs body mEndLabel }
447-
448-
-- TODO: Copied verbatim from END_IF. Should attempt to functionalise.
449-
END_ASSOCIATE :: { (SrcSpan, Maybe (Expression A0)) }
450-
: endassociate { (getSpan $1, Nothing) }
451-
| endassociate id { (getSpan $2, Nothing) }
452-
| INTEGER_LITERAL endassociate { (getSpan $2, Just $1) }
453-
| INTEGER_LITERAL endassociate id { (getSpan $3, Just $1) }
454-
455-
-- (var (ExpValue (ValVariable)), assoc. expr)
456-
ABBREVIATIONS :: { [(ATuple Expression Expression A0)] }
457-
: ABBREVIATIONS ',' ABBREVIATION { $3 : $1 }
458-
| ABBREVIATION { [ $1 ] }
459-
ABBREVIATION :: { ATuple Expression Expression A0 }
460-
: VARIABLE '=>' EXPRESSION { ATuple () (getTransSpan $1 $3) $1 $3 }
461-
462405
MAYBE_EXPRESSION :: { Maybe (Expression A0) }
463406
: EXPRESSION { Just $1 }
464407
| {- EMPTY -} { Nothing }

src/Language/Fortran/PrettyPrint.hs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ instance IndentablePretty (Block a) where
327327
then indent i (pprint' v label <+> stDoc)
328328
else pprint' v mLabel `overlay` indent i stDoc
329329

330-
-- TODO associate
331330
pprint v (BlAssociate _ _ mLabel mName abbrevs bodies mEndLabel) i
332331
| v >= Fortran90 =
333332
labeledIndent mLabel
@@ -342,31 +341,6 @@ instance IndentablePretty (Block a) where
342341
if v >= Fortran90
343342
then indent i (pprint' v label <+> stDoc)
344343
else pprint' v mLabel `overlay` indent i stDoc
345-
{-
346-
pprint v (BlIf _ _ mLabel mName conds bodies el) i
347-
| v >= Fortran77 =
348-
labeledIndent mLabel
349-
$ (pprint' v mName <?> colon
350-
<+> "if" <+> parens (pprint' v firstCond) <+> "then" <> newline)
351-
<> pprint v firstBody nextI
352-
<> foldl' (<>) empty (map displayCondBlock restCondsBodies)
353-
<> labeledIndent el ("end if" <+> pprint' v mName <> newline)
354-
| otherwise = tooOld v "Structured if" Fortran77
355-
where
356-
((firstCond, firstBody): restCondsBodies) = zip conds bodies
357-
displayCondBlock (mCond, block) =
358-
indent i
359-
(case mCond of {
360-
Just cond -> "else if" <+> parens (pprint' v cond) <+> "then";
361-
Nothing -> "else"
362-
} <> newline) <>
363-
pprint v block nextI
364-
nextI = incIndentation i
365-
labeledIndent label stDoc =
366-
if v >= Fortran90
367-
then indent i (pprint' v label <+> stDoc)
368-
else pprint' v mLabel `overlay` indent i stDoc
369-
-}
370344

371345
pprint v (BlComment _ _ (Comment comment)) i
372346
| v >= Fortran90 = indent i (char '!' <> text comment <> newline)

0 commit comments

Comments
 (0)