@@ -194,16 +194,16 @@ PROGRAM_UNITS :: { [ ProgramUnit A0 ] }
194
194
| maybe (LABEL_IN_6COLUMN ) PROGRAM_UNIT maybe (NEWLINE ) { [ $ 2 ] }
195
195
196
196
PROGRAM_UNIT :: { ProgramUnit A0 }
197
- : program NAME NEWLINE BLOCKS ENDPROG
198
- { PUMain () (getTransSpan $ 1 $ 5 ) (Just $ 2 ) (reverse $ 4 ) Nothing }
199
- | TYPE_SPEC function NAME MAYBE_ARGUMENTS NEWLINE BLOCKS ENDFUN
200
- { PUFunction () (getTransSpan $ 1 $ 7 ) (Just $ 1 ) emptyPrefixSuffix $ 3 $ 4 Nothing (reverse $ 6 ) Nothing }
201
- | function NAME MAYBE_ARGUMENTS NEWLINE BLOCKS ENDFUN
202
- { PUFunction () (getTransSpan $ 1 $ 6 ) Nothing emptyPrefixSuffix $ 2 $ 3 Nothing (reverse $ 5 ) Nothing }
203
- | subroutine NAME MAYBE_ARGUMENTS NEWLINE BLOCKS ENDSUB
204
- { PUSubroutine () (getTransSpan $ 1 $ 6 ) emptyPrefixSuffix $ 2 $ 3 (reverse $ 5 ) Nothing }
205
- | blockData NEWLINE BLOCKS END { PUBlockData () (getTransSpan $ 1 $ 4 ) Nothing (reverse $ 3 ) }
206
- | blockData NAME NEWLINE BLOCKS END { PUBlockData () (getTransSpan $ 1 $ 5 ) (Just $ 2 ) (reverse $ 4 ) }
197
+ : program NAME BLOCKS NEWLINE ENDPROG
198
+ { PUMain () (getTransSpan $ 1 $ 5 ) (Just $ 2 ) (reverse $ 3 ) Nothing }
199
+ | TYPE_SPEC function NAME MAYBE_ARGUMENTS BLOCKS NEWLINE ENDFUN
200
+ { PUFunction () (getTransSpan $ 1 $ 7 ) (Just $ 1 ) emptyPrefixSuffix $ 3 $ 4 Nothing (reverse $ 5 ) Nothing }
201
+ | function NAME MAYBE_ARGUMENTS BLOCKS NEWLINE ENDFUN
202
+ { PUFunction () (getTransSpan $ 1 $ 6 ) Nothing emptyPrefixSuffix $ 2 $ 3 Nothing (reverse $ 4 ) Nothing }
203
+ | subroutine NAME MAYBE_ARGUMENTS BLOCKS NEWLINE ENDSUB
204
+ { PUSubroutine () (getTransSpan $ 1 $ 6 ) emptyPrefixSuffix $ 2 $ 3 (reverse $ 4 ) Nothing }
205
+ | blockData BLOCKS NEWLINE END { PUBlockData () (getTransSpan $ 1 $ 4 ) Nothing (reverse $ 2 ) }
206
+ | blockData NAME BLOCKS NEWLINE END { PUBlockData () (getTransSpan $ 1 $ 5 ) (Just $ 2 ) (reverse $ 3 ) }
207
207
| comment { let (TComment s c) = $ 1 in PUComment () s (Comment c) }
208
208
209
209
END :: { Token }
@@ -236,38 +236,36 @@ MAYBE_ID :: { Maybe Name }
236
236
NAME :: { Name } : id { let (TId _ name ) = $ 1 in name }
237
237
238
238
INCLUDES :: { [ Block A0 ] }
239
- : maybe (NEWLINE ) list( BLOCK ) { $ 2 }
239
+ : BLOCKS maybe (NEWLINE ) { $ 1 }
240
240
241
241
BLOCKS :: { [ Block A0 ] }
242
- : BLOCKS BLOCK { $ 2 : $ 1 }
242
+ : BLOCKS NEWLINE BLOCK { $ 3 : $ 1 }
243
+ | BLOCK { [ $ 1 ] }
243
244
| {- EMPTY -} { [ ] }
244
245
245
246
BLOCK :: { Block A0 }
246
- : IF_BLOCK NEWLINE { $ 1 }
247
- | LABEL_IN_6COLUMN STATEMENT NEWLINE { BlStatement () (getTransSpan $ 1 $ 2 ) (Just $ 1 ) $ 2 }
248
- | STATEMENT NEWLINE { BlStatement () (getSpan $ 1 ) Nothing $ 1 }
249
- | COMMENT_BLOCK { $ 1 }
247
+ : IF_BLOCK { $ 1 }
248
+ | LABEL_IN_6COLUMN STATEMENT { BlStatement () (getTransSpan $ 1 $ 2 ) (Just $ 1 ) $ 2 }
249
+ | STATEMENT { BlStatement () (getSpan $ 1 ) Nothing $ 1 }
250
+ | comment { let ( TComment s c) = $ 1 in BlComment () s ( Comment c) }
250
251
251
252
IF_BLOCK :: { Block A0 }
252
- : if ' (' EXPRESSION ' )' then NEWLINE BLOCKS ELSE_BLOCKS
253
+ : if ' (' EXPRESSION ' )' then BLOCKS NEWLINE ELSE_BLOCKS
253
254
{ let (clauses, elseBlock, endSpan, endLabel) = $ 8
254
- in BlIf () (getTransSpan $ 1 endSpan) Nothing Nothing (($ 3 , reverse $ 7 ) :| clauses) elseBlock endLabel }
255
- | LABEL_IN_6COLUMN if ' (' EXPRESSION ' )' then NEWLINE BLOCKS ELSE_BLOCKS
255
+ in BlIf () (getTransSpan $ 1 endSpan) Nothing Nothing (($ 3 , reverse $ 6 ) :| clauses) elseBlock endLabel }
256
+ | LABEL_IN_6COLUMN if ' (' EXPRESSION ' )' then BLOCKS NEWLINE ELSE_BLOCKS
256
257
{ let (clauses, elseBlock, endSpan, endLabel) = $ 9
257
- in BlIf () (getTransSpan $ 1 endSpan) (Just $ 1 ) Nothing (($ 4 , reverse $ 8 ) :| clauses) elseBlock endLabel }
258
+ in BlIf () (getTransSpan $ 1 endSpan) (Just $ 1 ) Nothing (($ 4 , reverse $ 7 ) :| clauses) elseBlock endLabel }
258
259
259
260
ELSE_BLOCKS :: { ([(Expression A0 , [Block A0 ])], Maybe [Block A0 ], SrcSpan , Maybe (Expression A0 )) }
260
- : maybe (LABEL_IN_6COLUMN ) elsif ' (' EXPRESSION ' )' then NEWLINE BLOCKS ELSE_BLOCKS
261
+ : maybe (LABEL_IN_6COLUMN ) elsif ' (' EXPRESSION ' )' then BLOCKS NEWLINE ELSE_BLOCKS
261
262
{ let (clauses, elseBlock, endSpan, endLabel) = $ 9
262
- in (($ 4 , reverse $ 8 ) : clauses, elseBlock, endSpan, endLabel) }
263
- | maybe (LABEL_IN_6COLUMN ) else NEWLINE BLOCKS maybe (LABEL_IN_6COLUMN ) endif
264
- { ([] , Just (reverse $ 4 ), getSpan $ 6 , $ 5 ) }
263
+ in (($ 4 , reverse $ 7 ) : clauses, elseBlock, endSpan, endLabel) }
264
+ | maybe (LABEL_IN_6COLUMN ) else BLOCKS NEWLINE maybe (LABEL_IN_6COLUMN ) endif
265
+ { ([] , Just (reverse $ 3 ), getSpan $ 6 , $ 5 ) }
265
266
| maybe (LABEL_IN_6COLUMN ) endif
266
267
{ ([] , Nothing , getSpan $ 2 , $ 1 ) }
267
268
268
- COMMENT_BLOCK :: { Block A0 }
269
- : comment NEWLINE { let (TComment s c) = $ 1 in BlComment () s (Comment c) }
270
-
271
269
NEWLINE :: { Token }
272
270
: NEWLINE newline { $ 1 }
273
271
| newline { $ 1 }
0 commit comments