diff options
| author | Alasdair | 2020-08-13 11:27:31 +0100 |
|---|---|---|
| committer | Alasdair | 2020-08-13 15:47:21 +0100 |
| commit | 40625c16f7573398252ccf040ef49d398d64d5bd (patch) | |
| tree | 378aba617a045c866c53d8938ce13f92562e06cf /src/parser.mly | |
| parent | 2736af39811331502c7f5bc7e2bd8f590f1f9b2a (diff) | |
Preserve file structure through initial check
Insert $file_start and $file_end pragmas in the AST, as well as
$include_start and $include_end pragmas so we can reconstruct the
original file structure later if needed, provided nothing like
topological sorting has been done.
Have the Lexer produce a list of comments whenever it parses a file,
which can the be attached to the nearest nodes in the abstract syntax
tree.
Diffstat (limited to 'src/parser.mly')
| -rw-r--r-- | src/parser.mly | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/parser.mly b/src/parser.mly index 70f6f225..6c90e463 100644 --- a/src/parser.mly +++ b/src/parser.mly @@ -224,7 +224,7 @@ let rec desugar_rchain chain s e = %type <Parse_ast.atyp> typ_eof %type <Parse_ast.exp> exp_eof %type <Parse_ast.def> def_eof -%type <Parse_ast.defs> file +%type <Parse_ast.def list> file %% @@ -1480,18 +1480,14 @@ defs_list: | def { [$1] } | def defs_list - { $1::$2 } + { $1 :: $2 } def_eof: | def Eof { $1 } -defs: - | defs_list - { (Defs $1) } - file: - | defs Eof + | defs_list Eof { $1 } | Eof - { (Defs []) } + { [] } |
