Skip to content

Commit a37c6ba

Browse files
author
rasmussn
committed
Added Text portion to statements in order to disambiguate statements from blank lines.
1 parent 0e50ed5 commit a37c6ba

3 files changed

Lines changed: 19 additions & 13 deletions

File tree

fortran/syntax/FixedForm.rtg

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ regular tree grammar
3232
CommentChar -> comchar(COMMENTCHAR)
3333
BangChar -> comchar(BANGCHAR)
3434
Eol -> eol(EOL)
35+
Text -> CHARS
3536
StmtBlock -> StmtBlock(Stmt,ListStarOfFollowLine0)
36-
Stmt -> LabeledStmt(LABELTAB,NoChar,CHARS,Eol)
37-
Stmt -> LabeledStmt(LABEL,StartChar,CHARS,Eol)
38-
Stmt -> Stmt(TABSTART,NoChar,CHARS,Eol)
39-
Stmt -> Stmt(START,StartChar,CHARS,Eol)
37+
Stmt -> LabeledStmt(LABELTAB,NoChar,Text,Eol)
38+
Stmt -> LabeledStmt(LABEL,StartChar,Text,Eol)
39+
Stmt -> Stmt(TABSTART,NoChar,Text,Eol)
40+
Stmt -> Stmt(START,StartChar,Text,Eol)
4041
Continuation -> Continuation(START,ContChar,CHARS,Eol)
4142
CommentLine -> FreeFormComment(WS,BangChar,CHARS,Eol)
4243
CommentLine -> Comment(CommentChar,CHARS,Eol)

fortran/syntax/FixedForm.sdf

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ exports
99
STARTCHAR CONTCHAR COMMENTCHAR BANGCHAR PRECHAR
1010
StartChar ContChar CommentChar BangChar PreChar NoChar Eol OptWS
1111
BlankLine CommentLine Continuation FollowLine PreprocessLine Stmt
12-
InitialComment StmtBlock File
12+
InitialComment StmtBlock File Text
1313

1414
context-free start-symbols
1515

@@ -106,15 +106,19 @@ exports
106106

107107
START ContChar CHARS Eol -> Continuation {cons("Continuation")}
108108

109-
START StartChar CHARS Eol -> Stmt {cons("Stmt")}
110-
TABSTART NoChar CHARS Eol -> Stmt {cons("Stmt")}
109+
START StartChar Text Eol -> Stmt {cons("Stmt")}
110+
TABSTART NoChar Text Eol -> Stmt {cons("Stmt")}
111111

112-
LABEL StartChar CHARS Eol -> Stmt {cons("LabeledStmt")}
113-
LABELTAB NoChar CHARS Eol -> Stmt {cons("LabeledStmt")}
112+
LABEL StartChar Text Eol -> Stmt {cons("LabeledStmt")}
113+
LABELTAB NoChar Text Eol -> Stmt {cons("LabeledStmt")}
114114

115115
Stmt FollowLine* -> StmtBlock {cons("StmtBlock")}
116116

117117

118+
CHARS -> Text
119+
WS -> Text {reject}
120+
% empty % -> Text {reject}
121+
118122
EOL -> Eol {cons("eol")}
119123

120124
BANGCHAR -> BangChar {cons("comchar")}

fortran/syntax/FixedForm.str

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ signature
1111
comchar : COMMENTCHAR -> CommentChar
1212
comchar : BANGCHAR -> BangChar
1313
eol : EOL -> Eol
14+
: CHARS -> Text
1415
StmtBlock : Stmt * List(FollowLine) -> StmtBlock
15-
LabeledStmt : LABELTAB * NoChar * CHARS * Eol -> Stmt
16-
LabeledStmt : LABEL * StartChar * CHARS * Eol -> Stmt
17-
Stmt : TABSTART * NoChar * CHARS * Eol -> Stmt
18-
Stmt : START * StartChar * CHARS * Eol -> Stmt
16+
LabeledStmt : LABELTAB * NoChar * Text * Eol -> Stmt
17+
LabeledStmt : LABEL * StartChar * Text * Eol -> Stmt
18+
Stmt : TABSTART * NoChar * Text * Eol -> Stmt
19+
Stmt : START * StartChar * Text * Eol -> Stmt
1920
Continuation : START * ContChar * CHARS * Eol -> Continuation
2021
FreeFormComment : WS * BangChar * CHARS * Eol -> CommentLine
2122
Comment : CommentChar * CHARS * Eol -> CommentLine

0 commit comments

Comments
 (0)