Support one hardcoded import
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
obtain one at https://mozilla.org/MPL/2.0/. *)
|
||||
program;
|
||||
|
||||
import dummy;
|
||||
import Common, Lexer;
|
||||
|
||||
const
|
||||
SEEK_SET* := 0;
|
||||
@ -80,13 +80,9 @@ type
|
||||
_module,
|
||||
_import
|
||||
);
|
||||
Position* = record
|
||||
line: Word;
|
||||
column: Word
|
||||
end;
|
||||
Location* = record
|
||||
first: Position;
|
||||
last: Position
|
||||
first: TextLocation;
|
||||
last: TextLocation
|
||||
end;
|
||||
SourceFile* = record
|
||||
buffer: [1024]Char;
|
||||
@ -94,14 +90,13 @@ type
|
||||
size: Word;
|
||||
index: Word
|
||||
end;
|
||||
FILE* = record end;
|
||||
StringBuffer* = record
|
||||
data: Pointer;
|
||||
size: Word;
|
||||
capacity: Word
|
||||
end;
|
||||
SourceCode = record
|
||||
position: Position;
|
||||
position: TextLocation;
|
||||
|
||||
input: Pointer;
|
||||
empty: proc(Pointer) -> Bool;
|
||||
@ -123,7 +118,7 @@ type
|
||||
lex: Bool;
|
||||
parse: Bool
|
||||
end;
|
||||
Lexer* = record
|
||||
Tokenizer* = record
|
||||
length: Word;
|
||||
data: ^Token
|
||||
end;
|
||||
@ -592,7 +587,7 @@ begin
|
||||
return current_token
|
||||
end;
|
||||
|
||||
proc lexer_add_token(lexer: ^Lexer, token: Token);
|
||||
proc lexer_add_token(lexer: ^Tokenizer, token: Token);
|
||||
var
|
||||
new_length: Word;
|
||||
begin
|
||||
@ -778,13 +773,13 @@ begin
|
||||
end;
|
||||
|
||||
(* Split the source text into tokens. *)
|
||||
proc lexer_text(source_code: SourceCode) -> Lexer;
|
||||
proc lexer_text(source_code: SourceCode) -> Tokenizer;
|
||||
var
|
||||
current_token: Token;
|
||||
token_buffer: StringBuffer;
|
||||
lexer: Lexer;
|
||||
lexer: Tokenizer;
|
||||
begin
|
||||
lexer := Lexer(0u, nil);
|
||||
lexer := Tokenizer(0u, nil);
|
||||
token_buffer := string_buffer_new();
|
||||
|
||||
lexer_spaces(@source_code);
|
||||
@ -1024,7 +1019,7 @@ end;
|
||||
proc compile_in_stages(command_line: ^CommandLine, source_code: SourceCode) -> Int;
|
||||
var
|
||||
return_code: Int;
|
||||
lexer: Lexer;
|
||||
lexer: Tokenizer;
|
||||
begin
|
||||
return_code := 0;
|
||||
|
||||
@ -1068,7 +1063,7 @@ begin
|
||||
fclose(source_file^.handle)
|
||||
end;
|
||||
|
||||
source_code.position := Position(1u, 1u);
|
||||
source_code.position := TextLocation(1u, 1u);
|
||||
source_code.input := cast(source_file: Pointer);
|
||||
source_code.empty := source_file_empty;
|
||||
source_code.head := source_file_head;
|
||||
|
Reference in New Issue
Block a user