Use qualified enumerations in the parser and lexer

This commit is contained in:
2025-08-08 23:58:28 +03:00
parent 5d1804fbc2
commit e37f138b5d
10 changed files with 1088 additions and 1141 deletions

View File

@@ -1,25 +1,27 @@
(* This Source Code Form is subject to the terms of the Mozilla Public License,
v. 2.0. If a copy of the MPL was not distributed with this file, You can
obtain one at https://mozilla.org/MPL/2.0/. *)
program;
from FIO import Close, IsNoError, File, OpenToRead, OpenToWrite, StdErr, StdOut, WriteLine, WriteString;
from SYSTEM import ADR;
from M2RTS import HALT, ExitOnHalt;
from Lexer import Lexer, lexer_destroy, lexer_initialize;
from Parser import Parser;
from Transpiler import transpile;
from CommandLineInterface import PCommandLine, parse_command_line;
from Parser import PAstModule, parse;
from CommandLineInterface import CommandLine, parse_command_line;
from Parser import AstModule, parse;
from Strings import Length;
var
command_line: PCommandLine;
command_line: ^CommandLine;
proc compile_from_stream();
var
lexer: Lexer;
source_input: File;
source_output: File;
ast_module: PAstModule;
ast_module: ^AstModule;
begin
source_input := OpenToRead(command_line^.input);
@@ -47,12 +49,12 @@ begin
end;
if IsNoError(source_input) then
lexer_initialize(ADR(lexer), source_input);
lexer_initialize(@lexer, source_input);
ast_module := parse(ADR(lexer));
ast_module := parse(@lexer);
transpile(ast_module, StdOut, source_output, command_line^.input);
lexer_destroy(ADR(lexer));
lexer_destroy(@lexer);
Close(source_output);
Close(source_input)