Use qualified enumerations in the parser and lexer
This commit is contained in:
@@ -1,27 +1,35 @@
|
||||
(* 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;
|
||||
from Strings import CompareStr, Length;
|
||||
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;
|
||||
i := 1u;
|
||||
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
|
||||
@@ -37,7 +45,7 @@ begin
|
||||
result^.parse := true
|
||||
end;
|
||||
if CompareStr(parameter, '-o') = 0 then
|
||||
INC(i);
|
||||
i := i + 1u;
|
||||
|
||||
if i = Narg() then
|
||||
WriteString(StdErr, 'Fatal error: expecting a file name following -o.');
|
||||
|
Reference in New Issue
Block a user