diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/cctype.elna | 12 | ||||
| -rw-r--r-- | source/command_line_interface.elna | 2 | ||||
| -rw-r--r-- | source/common.elna | 2 | ||||
| -rw-r--r-- | source/cstdio.elna | 18 | ||||
| -rw-r--r-- | source/cstdlib.elna | 10 | ||||
| -rw-r--r-- | source/cstring.elna | 12 | ||||
| -rw-r--r-- | source/lexer.elna | 10 | ||||
| -rw-r--r-- | source/main.elna | 50 |
8 files changed, 58 insertions, 58 deletions
diff --git a/source/cctype.elna b/source/cctype.elna index 13dc50a..1296a10 100644 --- a/source/cctype.elna +++ b/source/cctype.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 isdigit*(c: Int ) -> Int +proc isdigit*(c: Int ): Int extern -proc isalnum*(c: Int) -> Int +proc isalnum*(c: Int): Int extern -proc isalpha*(c: Int) -> Int +proc isalpha*(c: Int): Int extern -proc isspace*(c: Int) -> Int +proc isspace*(c: Int): Int extern -proc tolower*(c: Int) -> Int +proc tolower*(c: Int): Int extern -proc toupper*(c: Int) -> Int +proc toupper*(c: Int): Int extern end. diff --git a/source/command_line_interface.elna b/source/command_line_interface.elna index eeb2103..b9006f1 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 f75751c..7790faf 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 c589200..95283a1 100644 --- a/source/cstdio.elna +++ b/source/cstdio.elna @@ -10,37 +10,37 @@ 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 +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) extern -proc ftell*(stream: ^FILE) -> Int +proc ftell*(stream: ^FILE): Int extern -proc fflush*(stream: ^FILE) -> Int +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) extern -proc puts(s: ^Char) -> Int +proc puts(s: ^Char): Int extern -proc putchar(c: Int) -> Int +proc putchar(c: Int): Int extern end. diff --git a/source/cstdlib.elna b/source/cstdlib.elna index 930246d..696e5dd 100644 --- a/source/cstdlib.elna +++ b/source/cstdlib.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 malloc(size: Word) -> Pointer +proc malloc(size: Word): Pointer 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 +proc atoi(str: ^Char): Int extern -proc exit(code: Int) -> ! +proc exit(code: Int): ! extern end. diff --git a/source/cstring.elna b/source/cstring.elna index e19658f..ec5cd7b 100644 --- a/source/cstring.elna +++ b/source/cstring.elna @@ -2,25 +2,25 @@ 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) 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 +proc strlen(ptr: ^Char): Word extern end. diff --git a/source/lexer.elna b/source/lexer.elna index b3250d0..9008139 100644 --- a/source/lexer.elna +++ b/source/lexer.elna @@ -67,7 +67,7 @@ type start_location: TextLocation; end_location: TextLocation end - TransitionAction = proc(^Lexer, ^LexerToken) + TransitionAction = proc(lexer: ^Lexer; token: ^LexerToken) Transition = record action: TransitionAction; next_state: TransitionState @@ -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 @@ -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 @@ -889,7 +889,7 @@ begin end (* Returns the last read token. *) -proc lexer_current*(lexer: ^Lexer) -> LexerToken +proc lexer_current*(lexer: ^Lexer): LexerToken var current_class: TransitionClass current_state: TransitionState @@ -921,7 +921,7 @@ begin end (* Read and return the next token. *) -proc lexer_lex*(lexer: ^Lexer) -> LexerToken +proc lexer_lex*(lexer: ^Lexer): LexerToken var result: LexerToken begin 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 |
