aboutsummaryrefslogtreecommitdiff
path: root/src/common/types.odin
blob: c99bc3c35d4e3c810c9f88369ea11cacaf11295c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package common

import "core:odin/ast"
import "core:odin/tokenizer"

Error :: enum {
	None                 = 0,
	ParseError           = -32700,
	InvalidRequest       = -32600,
	MethodNotFound       = -32601,
	InvalidParams        = -32602,
	InternalError        = -32603,
	serverErrorStart     = -32099,
	serverErrorEnd       = -32000,
	ServerNotInitialized = -32002,
	UnknownErrorCode     = -32001,
	RequestCancelled     = -32800,
	ContentModified      = -32801,
}

WorkspaceFolder :: struct {
	name: string,
	uri:  string,
}

Package :: struct {
	name: string, //the entire absolute path to the directory
	base: string,
}

Document :: struct {
	uri:              Uri,
	text:             []u8,
	used_text:        int, //allow for the text to be reallocated with more data than needed
	client_owned:     bool,
	diagnosed_errors: bool,
	ast:              ast.File,
	imports:          []Package,
	package_name:     string,
	allocator:        ^Scratch_Allocator, //because parser does not support freeing I use arena allocators for each document
	operating_on:     int, //atomic
}

parser_warning_handler :: proc(pos: tokenizer.Pos, msg: string, args: ..any) {
}