Use qualified enumerations in the parser and lexer

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

View File

@@ -1,7 +1,8 @@
(* 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/. *)
module;
from SYSTEM import ADR, TSIZE;
from Args import GetArg, Narg;
from FIO import WriteString, WriteChar, WriteLine, StdErr;
from Storage import ALLOCATE;
@@ -10,18 +11,26 @@ from MemUtils import MemZero;
from Common import ShortString;
proc parse_command_line() -> PCommandLine;
type
CommandLine = record
input: ShortString;
output: ShortString;
lex: Bool;
parse: Bool
end;
proc parse_command_line*() -> ^CommandLine;
var
parameter: ShortString;
i: CARDINAL;
result: PCommandLine;
parsed: BOOLEAN;
i: Word;
result: ^CommandLine;
parsed: Bool;
begin
i := 1;
NEW(result);
result^.lex := false;
result^.parse := false;
MemZero(ADR(result^.input), 256);
MemZero(@result^.input, 256);
result^.output[1] := CHAR(0);
while (i < Narg()) & (result <> nil) do