Skip to content

Draft: Initial implementation of leading comments

Ondřej Čertík requested to merge certik/lfortran:leading_comment into master

This is how to implement leading comments. To make comments optional, do:

--- a/src/lfortran/parser/parser.yy
+++ b/src/lfortran/parser/parser.yy
@@ -1420,7 +1418,7 @@ sep_one
 
 sep2
     : sep2 sep2_one { $$ = $1; LIST_ADD($$, $2); }
-    | sep2_one { LIST_NEW($$); LIST_ADD($$, $1); }
+    | %empty { LIST_NEW($$); }
     ;
 
 sep2_one

Unfortunately this gets 14 real conflicts.

Merge request reports