aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2021-05-17 23:35:55 +0200
committerDanielGavin <danielgavin5@hotmail.com>2021-05-17 23:35:55 +0200
commit63feccd209b69b913f3a2fe33fa993dbe0af909f (patch)
treeb5fc2788fd29b90a9feb13c8b3b5017ee6d6d483 /src/common
parent98609fccd73cb464dd4659702319dab2fe1c61c1 (diff)
handle the parser changes in core + linux still not working
Diffstat (limited to 'src/common')
-rw-r--r--src/common/ast.odin2
-rw-r--r--src/common/position.odin10
2 files changed, 6 insertions, 6 deletions
diff --git a/src/common/ast.odin b/src/common/ast.odin
index 96e5151..9c24f03 100644
--- a/src/common/ast.odin
+++ b/src/common/ast.odin
@@ -143,7 +143,7 @@ collect_globals :: proc(file: ast.File, skip_private := false) -> []GlobalExpr {
return exprs[:];
}
-get_ast_node_string :: proc(node: ^ast.Node, src: []byte) -> string {
+get_ast_node_string :: proc(node: ^ast.Node, src: string) -> string {
return string(src[node.pos.offset:node.end.offset]);
}
diff --git a/src/common/position.odin b/src/common/position.odin
index d410ce6..41bf00a 100644
--- a/src/common/position.odin
+++ b/src/common/position.odin
@@ -91,7 +91,7 @@ get_relative_token_position :: proc(offset: int, document_text: []u8, current_st
/*
Get the range of a token in utf16 space
*/
-get_token_range :: proc(node: ast.Node, document_text: []u8) -> Range {
+get_token_range :: proc(node: ast.Node, document_text: string) -> Range {
range: Range;
go_backwards_to_endline :: proc(offset: int, document_text: []u8) -> int {
@@ -112,15 +112,15 @@ get_token_range :: proc(node: ast.Node, document_text: []u8) -> Range {
pos_offset := min(len(document_text) - 1, node.pos.offset);
end_offset := min(len(document_text) - 1, node.end.offset);
- offset := go_backwards_to_endline(pos_offset, document_text);
+ offset := go_backwards_to_endline(pos_offset, transmute([]u8)document_text);
range.start.line = node.pos.line - 1;
- range.start.character = get_character_offset_u8_to_u16(node.pos.column - 1, document_text[offset:]);
+ range.start.character = get_character_offset_u8_to_u16(node.pos.column - 1, transmute([]u8)document_text[offset:]);
- offset = go_backwards_to_endline(end_offset, document_text);
+ offset = go_backwards_to_endline(end_offset, transmute([]u8)document_text);
range.end.line = node.end.line - 1;
- range.end.character = get_character_offset_u8_to_u16(node.end.column - 1, document_text[offset:]);
+ range.end.character = get_character_offset_u8_to_u16(node.end.column - 1, transmute([]u8)document_text[offset:]);
return range;
}