diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2024-09-22 11:23:35 +0200 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2024-09-22 11:23:35 +0200 |
| commit | 0d1d4d86f2f210c071e6a5f26cca65d5763f2c84 (patch) | |
| tree | c5c5a2c73a0311d97c94c64c6381c0ee010a6eb4 /src | |
| parent | bd60025df3b54c22a8bcb5745b98a30f88162ddd (diff) | |
Add support to file tags in formatter
Diffstat (limited to 'src')
| -rw-r--r-- | src/odin/printer/printer.odin | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/odin/printer/printer.odin b/src/odin/printer/printer.odin index 1c5f5b2..d3b3db6 100644 --- a/src/odin/printer/printer.odin +++ b/src/odin/printer/printer.odin @@ -207,7 +207,17 @@ print_file :: proc(p: ^Printer, file: ^ast.File) -> string { p.source_position.line = 1 p.source_position.column = 1 - p.document = move_line(p, file.pkg_token.pos) + p.document = empty() + + for tag in file.tags { + p.document = cons(p.document, text(tag.text), newline(1)) + pos := tag.pos + pos.line += 1 + set_source_position(p, pos) + } + + + p.document = cons(p.document, move_line(p, file.pkg_token.pos)) p.document = cons(p.document, cons_with_nopl(text(file.pkg_token.text), text(file.pkg_name))) // Keep track of the first import in a row, to sort them later. |