diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-07-07 21:39:57 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-07-07 21:39:57 +0200 |
| commit | 79521d91b2bb85652fd29f5c44279338d55c757f (patch) | |
| tree | d3b5b73177f63fd5ff684a8aba6f7b9af84dab27 /source/main.elna | |
| parent | 470bfba45661d19558c0bf43b7819696a925ecb4 (diff) | |
| download | elna-79521d91b2bb85652fd29f5c44279338d55c757f.tar.gz | |
Allow multiple parameters with same type
Diffstat (limited to 'source/main.elna')
| -rw-r--r-- | source/main.elna | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/source/main.elna b/source/main.elna index 468556d..aeaba2f 100644 --- a/source/main.elna +++ b/source/main.elna @@ -20,9 +20,9 @@ type position: TextLocation; input: Pointer; - empty: proc(Pointer) -> Bool; - advance: proc(Pointer); - head: proc(Pointer) -> Char + empty: proc(stream: Pointer): Bool; + advance: proc(stream: Pointer); + head: proc(stream: Pointer): Char end Token* = record kind: LexerKind; @@ -41,19 +41,19 @@ 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 -proc string_dup(origin: String) -> String +proc string_dup(origin: String): String var copy: ^Char begin @@ -63,7 +63,7 @@ begin return String(copy, origin.length) end -proc string_buffer_new() -> StringBuffer +proc string_buffer_new(): StringBuffer var result: StringBuffer begin @@ -89,7 +89,7 @@ begin buffer^.size := buffer^.size - count end -proc string_buffer_clear(buffer: ^StringBuffer) -> String +proc string_buffer_clear(buffer: ^StringBuffer): String var result: String begin @@ -102,7 +102,7 @@ end Source code stream procedures. *) -proc read_source(filename: ^Char) -> ^SourceFile +proc read_source(filename: ^Char): ^SourceFile var result: ^SourceFile file_handle: ^FILE @@ -118,7 +118,7 @@ begin return result end -proc source_file_empty(source_input: Pointer) -> Bool +proc source_file_empty(source_input: Pointer): Bool var source_file: ^SourceFile begin @@ -132,7 +132,7 @@ begin return source_file^.size = 0u end -proc source_file_head(source_input: Pointer) -> Char +proc source_file_head(source_input: Pointer): Char var source_file: ^SourceFile begin @@ -150,11 +150,11 @@ begin source_file^.index := source_file^.index + 1u end -proc source_code_empty(source_code: ^SourceCode) -> Bool +proc source_code_empty(source_code: ^SourceCode): Bool return source_code^.empty(source_code^.input) end -proc source_code_head(source_code: SourceCode) -> Char +proc source_code_head(source_code: SourceCode): Char return source_code.head(source_code.input) 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 @@ -232,7 +232,7 @@ begin end (* Checker whether the character is allowed in an identificator. *) -proc lexer_is_ident(char: Char) -> Bool +proc lexer_is_ident(char: Char): Bool return isalnum(cast(char: Int)) <> 0 or char = '_' end @@ -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 @@ -326,7 +326,7 @@ begin end (* Categorize an identifier. *) -proc lexer_categorize(token_content: String) -> Token +proc lexer_categorize(token_content: String): Token var current_token: Token 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 @@ -580,7 +580,7 @@ begin end (* Split the source text into tokens. *) -proc lexer_text(source_code: SourceCode) -> Tokenizer +proc lexer_text(source_code: SourceCode): Tokenizer var current_token: Token token_buffer: StringBuffer @@ -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 |
