Skip to content

Commit 78edcad

Browse files
author
rasmussn
committed
Fix for bug #4.
1 parent 799f31b commit 78edcad

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

src/syntax/FortranLex.sdf

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ exports
1919

2020
sorts
2121
BinaryConstant Character Comma Comment StartCommentBlock
22-
Continuation Dop EOL EOS HexConstant
22+
Continuation Dop EOL EOLOrSemicolon EOS HexConstant
2323
Icon Ident Label LblDef LblRef
2424
Letter OctalConstant
2525
Rcon ScalarIntLiteralConstant Scon
@@ -60,16 +60,21 @@ lexical syntax
6060
%%
6161
[\n] -> EOL
6262
[\r] [\n] -> EOL
63-
";" -> EOL %% semicolon acts like an EOL
63+
64+
%% semicolon acts like an EOL
65+
%%
66+
EOL -> EOLOrSemicolon
67+
";" -> EOLOrSemicolon
6468

6569
%% Everything following a ! is comment. With the \n it is an End of Statement
6670
%% Treat preprocessor directives as comments
6771
%% TODO-F08 enforce leading pound character
72+
%% TODO-F08 name # as Directive and fix
6873
%%
6974
"!" ~[\n\r]* -> Comment
7075
"#" ~[\n\r]* -> Comment
7176

72-
(Comment? EOL [\ \t]* )+ -> EOS
77+
(Comment? EOLOrSemicolon [\ \t]* )+ -> EOS
7378

7479
%% Fixed source form comment rules (beware of code starting in 1st column!)
7580
%%TODO-F08 - need different language lexer for fixed format, don't combine
@@ -80,9 +85,12 @@ lexical syntax
8085
%% commentlines at the start of a file/program are handled separately in Fortran90.sdf
8186
EOS -> StartCommentBlock
8287

83-
%% Continuation can optionally be separated by comment. The & on the next line is also optional.
88+
%% Continuation can optionally be separated by comment.
89+
%% The & on the next line is also optional.
90+
%%
8491
"&" [\ \t]* ("!" ~[\n\r]*)? EOL ( [\ \t]+ "&" )? -> Continuation
85-
Continuation -> LAYOUT
92+
Continuation -> LAYOUT
93+
Continuation "!" ~[\n\r]* EOL -> LAYOUT
8694

8795
%% Layout does NOT have a \n since that's part of EOS
8896
[\ \t] -> LAYOUT

0 commit comments

Comments
 (0)