mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Add custom semicolon insertion to odin/tokenizer and odin/parser
This commit is contained in:
@@ -283,6 +283,19 @@ tokens := [Token_Kind.COUNT]string {
|
||||
|
||||
custom_keyword_tokens: []string;
|
||||
|
||||
|
||||
is_newline :: proc(tok: Token) -> bool {
|
||||
return tok.kind == .Semicolon && tok.text == "\n";
|
||||
}
|
||||
|
||||
|
||||
token_to_string :: proc(tok: Token) -> string {
|
||||
if is_newline(tok) {
|
||||
return "newline";
|
||||
}
|
||||
return to_string(tok.kind);
|
||||
}
|
||||
|
||||
to_string :: proc(kind: Token_Kind) -> string {
|
||||
if Token_Kind.Invalid <= kind && kind < Token_Kind.COUNT {
|
||||
return tokens[kind];
|
||||
|
||||
Reference in New Issue
Block a user