aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2026-07-06 10:44:15 +0200
committerEugen Wissner <belka@caraus.de>2026-07-07 00:47:59 +0200
commit470bfba45661d19558c0bf43b7819696a925ecb4 (patch)
tree44eef131a3edca1cc5489fa45851a5d5685ec530 /source
parent8ea930783d15c04bbe9a027eaf19ca10e2cd87c0 (diff)
downloadelna-470bfba45661d19558c0bf43b7819696a925ecb4.tar.gz
Fix compiler crashing on syntax errors
after error reporting.
Diffstat (limited to 'source')
-rw-r--r--source/command_line_interface.elna2
-rw-r--r--source/common.elna2
-rw-r--r--source/cstdio.elna8
-rw-r--r--source/cstdlib.elna4
-rw-r--r--source/cstring.elna12
-rw-r--r--source/lexer.elna24
-rw-r--r--source/main.elna34
7 files changed, 43 insertions, 43 deletions
diff --git a/source/command_line_interface.elna b/source/command_line_interface.elna
index 78e1cf5..eeb2103 100644
--- a/source/command_line_interface.elna
+++ b/source/command_line_interface.elna
@@ -15,7 +15,7 @@ type
parse: Bool
end
-proc parse_command_line*(argc: Int, argv: ^^Char) -> ^CommandLine
+proc parse_command_line*(argc: Int; argv: ^^Char) -> ^CommandLine
var
parameter: ^Char
i: Int
diff --git a/source/common.elna b/source/common.elna
index 33a79b8..f75751c 100644
--- a/source/common.elna
+++ b/source/common.elna
@@ -11,7 +11,7 @@ type
column: Word
end
-proc write*(fd: Int, buf: Pointer, Word: Int) -> Int
+proc write*(fd: Int; buf: Pointer; Word: Int) -> Int
extern
proc write_s*(value: String)
diff --git a/source/cstdio.elna b/source/cstdio.elna
index b86014f..c589200 100644
--- a/source/cstdio.elna
+++ b/source/cstdio.elna
@@ -10,13 +10,13 @@ var
stdout*: ^FILE := extern
stderr*: ^FILE := extern
-proc fopen*(pathname: ^Char, mode: ^Char) -> ^FILE
+proc fopen*(pathname: ^Char; mode: ^Char) -> ^FILE
extern
proc fclose*(stream: ^FILE) -> Int
extern
-proc fseek*(stream: ^FILE, off: Int, whence: Int) -> Int
+proc fseek*(stream: ^FILE; off: Int; whence: Int) -> Int
extern
proc rewind*(stream: ^FILE)
@@ -28,10 +28,10 @@ extern
proc fflush*(stream: ^FILE) -> Int
extern
-proc fread*(ptr: Pointer, size: Word, nmemb: Word, stream: ^FILE) -> Word
+proc fread*(ptr: Pointer; size: Word; nmemb: Word; stream: ^FILE) -> Word
extern
-proc fwrite*(ptr: Pointer, size: Word, nitems: Word, stream: ^FILE) -> Word
+proc fwrite*(ptr: Pointer; size: Word; nitems: Word; stream: ^FILE) -> Word
extern
proc perror(s: ^Char)
diff --git a/source/cstdlib.elna b/source/cstdlib.elna
index 3346440..930246d 100644
--- a/source/cstdlib.elna
+++ b/source/cstdlib.elna
@@ -8,10 +8,10 @@ extern
proc free(ptr: Pointer)
extern
-proc calloc(nmemb: Word, size: Word) -> Pointer
+proc calloc(nmemb: Word; size: Word) -> Pointer
extern
-proc realloc(ptr: Pointer, size: Word) -> Pointer
+proc realloc(ptr: Pointer; size: Word) -> Pointer
extern
proc atoi(str: ^Char) -> Int
diff --git a/source/cstring.elna b/source/cstring.elna
index ef04e59..e19658f 100644
--- a/source/cstring.elna
+++ b/source/cstring.elna
@@ -2,22 +2,22 @@
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/. *)
-proc memset(ptr: Pointer, c: Int, n: Word) -> ^Char
+proc memset(ptr: Pointer; c: Int; n: Word) -> ^Char
extern
-proc memcpy(dst: Pointer, src: Pointer, n: Word)
+proc memcpy(dst: Pointer; src: Pointer; n: Word)
extern
-proc strcmp(s1: ^Char, s2: ^Char) -> Int
+proc strcmp(s1: ^Char; s2: ^Char) -> Int
extern
-proc strncmp(s1: ^Char, s2: ^Char, n: Word) -> Int
+proc strncmp(s1: ^Char; s2: ^Char; n: Word) -> Int
extern
-proc strncpy(dst: ^Char, src: ^Char, dsize: Word) -> ^Char
+proc strncpy(dst: ^Char; src: ^Char; dsize: Word) -> ^Char
extern
-proc strcpy(dst: ^Char, src: ^Char) -> ^Char
+proc strcpy(dst: ^Char; src: ^Char) -> ^Char
extern
proc strlen(ptr: ^Char) -> Word
diff --git a/source/lexer.elna b/source/lexer.elna
index e6fc38c..b3250d0 100644
--- a/source/lexer.elna
+++ b/source/lexer.elna
@@ -298,7 +298,7 @@ begin
end
end
-proc compare_keyword(keyword: String, token_start: BufferPosition, token_end: ^Char) -> Bool
+proc compare_keyword(keyword: String; token_start: BufferPosition; token_end: ^Char) -> Bool
var
result: Bool
index: Word
@@ -321,7 +321,7 @@ begin
end
(* Reached the end of file. *)
-proc transition_action_eof(lexer: ^Lexer, token: ^LexerToken)
+proc transition_action_eof(lexer: ^Lexer; token: ^LexerToken)
begin
token^.kind := LexerKind.unknown
end
@@ -332,14 +332,14 @@ begin
end
(* Add the character to the token currently read and advance to the next character. *)
-proc transition_action_accumulate(lexer: ^Lexer, token: ^LexerToken)
+proc transition_action_accumulate(lexer: ^Lexer; token: ^LexerToken)
begin
increment(@lexer^.current)
end
(* The current character is not a part of the token. Finish the token already
* read. Don't advance to the next character. *)
-proc transition_action_finalize(lexer: ^Lexer, token: ^LexerToken)
+proc transition_action_finalize(lexer: ^Lexer; token: ^LexerToken)
begin
if lexer^.start.iterator^ = ':' then
token^.kind := LexerKind.colon
@@ -362,7 +362,7 @@ begin
end
(* An action for tokens containing multiple characters. *)
-proc transition_action_composite(lexer: ^Lexer, token: ^LexerToken)
+proc transition_action_composite(lexer: ^Lexer; token: ^LexerToken)
begin
if lexer^.start.iterator^ = '<' then
if lexer^.current.iterator^ = '>' then
@@ -385,7 +385,7 @@ begin
end
(* Skip a space. *)
-proc transition_action_skip(lexer: ^Lexer, token: ^LexerToken)
+proc transition_action_skip(lexer: ^Lexer; token: ^LexerToken)
begin
increment(@lexer^.start);
@@ -397,7 +397,7 @@ begin
end
(* Delimited string action. *)
-proc transition_action_delimited(lexer: ^Lexer, token: ^LexerToken)
+proc transition_action_delimited(lexer: ^Lexer; token: ^LexerToken)
var
text_length: Word
begin
@@ -424,7 +424,7 @@ begin
end
(* Finalize keyword or identifier. *)
-proc transition_action_key_id(lexer: ^Lexer, token: ^LexerToken)
+proc transition_action_key_id(lexer: ^Lexer; token: ^LexerToken)
begin
token^.kind := LexerKind.identifier;
@@ -518,7 +518,7 @@ end
(* Action for tokens containing only one character. The character cannot be
* followed by other characters forming a composite token. *)
-proc transition_action_single(lexer: ^Lexer, token: ^LexerToken)
+proc transition_action_single(lexer: ^Lexer; token: ^LexerToken)
begin
if lexer^.current.iterator^ = '&' then
token^.kind := LexerKind.and
@@ -569,7 +569,7 @@ begin
end
(* Handle an integer literal. *)
-proc transition_action_integer(lexer: ^Lexer, token: ^LexerToken)
+proc transition_action_integer(lexer: ^Lexer; token: ^LexerToken)
var
buffer: String
integer_length: Word
@@ -585,7 +585,7 @@ begin
token^.value.integerKind := atoi(@token^.value.identifierKind[2])
end
-proc set_default_transition(current_state: TransitionState, default_action: TransitionAction, next_state: TransitionState) -> Int
+proc set_default_transition(current_state: TransitionState; default_action: TransitionAction; next_state: TransitionState) -> Int
var
default_transition: Transition
state_index: Int
@@ -878,7 +878,7 @@ begin
transitions[state_index][cast(TransitionClass.x: Int) + 1].next_state := TransitionState.finish
end
-proc lexer_make*(lexer: ^Lexer, input: ^FILE)
+proc lexer_make*(lexer: ^Lexer; input: ^FILE)
begin
lexer^.input := input;
lexer^.length := 0u;
diff --git a/source/main.elna b/source/main.elna
index db5e76f..468556d 100644
--- a/source/main.elna
+++ b/source/main.elna
@@ -41,15 +41,15 @@ type
(*
Standard procedures.
*)
-proc reallocarray(ptr: Pointer, n: Word, size: Word) -> Pointer
+proc reallocarray(ptr: Pointer; n: Word; size: Word) -> Pointer
return realloc(ptr, n * size)
end
-proc substring(string: String, start: Word, count: Word) -> String
+proc substring(string: String; start: Word; count: Word) -> String
return String(string.ptr + start, count)
end
-proc open_substring(string: String, start: Word) -> String
+proc open_substring(string: String; start: Word) -> String
return substring(string, start, string.length - start)
end
@@ -74,7 +74,7 @@ begin
return result
end
-proc string_buffer_push(buffer: ^StringBuffer, char: Char)
+proc string_buffer_push(buffer: ^StringBuffer; char: Char)
begin
if buffer^.size >= buffer^.capacity then
buffer^.capacity := buffer^.capacity + 1024u;
@@ -84,7 +84,7 @@ begin
buffer^.size := buffer^.size + 1u
end
-proc string_buffer_pop(buffer: ^StringBuffer, count: Word)
+proc string_buffer_pop(buffer: ^StringBuffer; count: Word)
begin
buffer^.size := buffer^.size - count
end
@@ -170,7 +170,7 @@ begin
source_code^.position.column := 0u
end
-proc source_code_expect(source_code: ^SourceCode, expected: Char) -> Bool
+proc source_code_expect(source_code: ^SourceCode; expected: Char) -> Bool
return ~source_code_empty(source_code) & source_code_head(source_code^) = expected
end
@@ -178,7 +178,7 @@ end
Token procedures.
*)
-proc lexer_escape(escape: Char, result: ^Char) -> Bool
+proc lexer_escape(escape: Char; result: ^Char) -> Bool
var
successful: Bool
begin
@@ -236,7 +236,7 @@ proc lexer_is_ident(char: Char) -> Bool
return isalnum(cast(char: Int)) <> 0 or char = '_'
end
-proc lexer_identifier(source_code: ^SourceCode, token_content: ^StringBuffer)
+proc lexer_identifier(source_code: ^SourceCode; token_content: ^StringBuffer)
var
content_length: Word
begin
@@ -246,7 +246,7 @@ begin
end
end
-proc lexer_comment(source_code: ^SourceCode, token_content: ^StringBuffer) -> Bool
+proc lexer_comment(source_code: ^SourceCode; token_content: ^StringBuffer) -> Bool
var
trailing: Word
begin
@@ -269,7 +269,7 @@ begin
return trailing = 2u
end
-proc lexer_character(source_code: ^SourceCode, token_content: ^Char) -> Bool
+proc lexer_character(source_code: ^SourceCode; token_content: ^Char) -> Bool
var
successful: Bool
begin
@@ -291,7 +291,7 @@ begin
return successful
end
-proc lexer_string(source_code: ^SourceCode, token_content: ^StringBuffer) -> Bool
+proc lexer_string(source_code: ^SourceCode; token_content: ^StringBuffer) -> Bool
var
token_end, constructed_string: ^Char
token_length: Word
@@ -314,7 +314,7 @@ begin
return is_valid
end
-proc lexer_number(source_code: ^SourceCode, token_content: ^Int)
+proc lexer_number(source_code: ^SourceCode; token_content: ^Int)
begin
token_content^ := 0;
@@ -394,7 +394,7 @@ begin
return current_token
end
-proc lexer_add_token(lexer: ^Tokenizer, token: Token)
+proc lexer_add_token(lexer: ^Tokenizer; token: Token)
var
new_length: Word
begin
@@ -405,7 +405,7 @@ begin
end
(* Read the next token from the input. *)
-proc lexer_next(source_code: SourceCode, token_buffer: ^StringBuffer) -> Token
+proc lexer_next(source_code: SourceCode; token_buffer: ^StringBuffer) -> Token
var
current_token: Token
first_char: Char
@@ -611,7 +611,7 @@ end
Parser.
*)
-proc parse(tokens: ^Token, tokens_size: Word)
+proc parse(tokens: ^Token; tokens_size: Word)
var
current_token: ^Token
i: Word := 0u
@@ -773,7 +773,7 @@ end
Compilation entry.
*)
-proc compile_in_stages(command_line: ^CommandLine, source_code: SourceCode) -> Int
+proc compile_in_stages(command_line: ^CommandLine; source_code: SourceCode) -> Int
var
return_code: Int := 0
lexer: Tokenizer
@@ -788,7 +788,7 @@ begin
return return_code
end
-proc process(argc: Int, argv: ^^Char) -> Int
+proc process(argc: Int; argv: ^^Char) -> Int
var
tokens: ^Token
tokens_size: Word