Helping out sublime indexing

This commit is contained in:
Krzosa Karol
2022-09-27 15:15:23 +02:00
parent d39686c480
commit 094b10576e
4 changed files with 24 additions and 9 deletions

View File

@@ -385,7 +385,8 @@ string_to_upper_case(Allocator *arena, String s) {
return copy; return copy;
} }
FLAG32(MatchFlag){ typedef U32 MatchFlag;
enum {
MatchFlag_None=0, MatchFlag_None=0,
MatchFlag_FindLast=1, MatchFlag_FindLast=1,
MatchFlag_IgnoreCase=2, MatchFlag_IgnoreCase=2,

View File

@@ -57,8 +57,10 @@ For modules it's a bit different cause they should be distributed as valid.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
- [ ] Basic - [ ] Basic
- [ ] Calculate size and alignment of struct data types
- [ ] Pass size and alignment calculations to C ?
- [ ] Fix . operator lookups - [ ] Fix . operator lookups
- [ ] Combining casts with . operator
- [ ] Builtin data structures - [ ] Builtin data structures
- [ ] Fix Length etc. they should be function calls not operators - [ ] Fix Length etc. they should be function calls not operators
@@ -69,6 +71,11 @@ For modules it's a bit different cause they should be distributed as valid.
- [ ] Dynamic arrays - [ ] Dynamic arrays
- [ ] Hash tables - [ ] Hash tables
- [ ] C Codegen
- [ ] Function renaming to prevent colissions
- [ ] Using language construct
- [ ] Bytecode interpreter - [ ] Bytecode interpreter
- [ ] Ir - [ ] Ir
- [ ] Interpreter - [ ] Interpreter
@@ -76,8 +83,12 @@ For modules it's a bit different cause they should be distributed as valid.
- [ ] Parametric Polymorphism - [ ] Parametric Polymorphism
- [ ] Conditional compilation #if
- [ ] Improvements - [ ] Any
- [ ] Assigning to any values like ints etc. should work perhaps? But what type they should have?
- [ ] Var args using any
- [ ] Slice of Any should work well
- [ ] Probably need to give Ast_Expr a Value field, then I can express Type nicely - [ ] Probably need to give Ast_Expr a Value field, then I can express Type nicely
- [ ] I would love for String, slice, Any etc. to have their struct declarations in source files, I also would want for stuff like string.str to work without weird special cases - [ ] I would love for String, slice, Any etc. to have their struct declarations in source files, I also would want for stuff like string.str to work without weird special cases
@@ -99,7 +110,6 @@ For modules it's a bit different cause they should be distributed as valid.
- [ ] Write up on order independent declarations - [ ] Write up on order independent declarations
- [ ] constructor => thing :: (i: S32) -> {i = i, thing = 10} - [ ] constructor => thing :: (i: S32) -> {i = i, thing = 10}
- [ ] Casting to basic types by call S64(x)
- [ ] Default values in structs??? Should compound stmts bring values from default values?? Maybe not? Whats the alternative - [ ] Default values in structs??? Should compound stmts bring values from default values?? Maybe not? Whats the alternative
@ideas @ideas
@@ -108,8 +118,7 @@ For modules it's a bit different cause they should be distributed as valid.
- [ ] Rust like enum where you associate values(other structs) with keys - [ ] Rust like enum where you associate values(other structs) with keys
- [ ] Compound that zeros values - .{} , Compound that assumes defaults from struct definition - {} - [ ] Compound that zeros values - .{} , Compound that assumes defaults from struct definition - {}
- [ ] Inject stack traces into the program - [ ] Inject stack traces into the program
- [ ] Conditional compilation #if
- [ ] Polymorphism - create declaration of a polymorphic thing, when it's called just copy it, replace types and typecheck normally, when someone calls again you just search for the instantiation again
## Done ## Done

View File

@@ -345,7 +345,8 @@ try_converting_untyped_to_default_type(Operand *op){
try_converting_untyped_to_default_type(&op->value); try_converting_untyped_to_default_type(&op->value);
} }
FLAG32(Typecheck_Flag){ typedef U32 Typecheck_Flag;
enum {
TYPE_AND_EXPR_REQUIRED = 0, TYPE_AND_EXPR_REQUIRED = 0,
TYPE_CAN_BE_NULL = 1, TYPE_CAN_BE_NULL = 1,
EXPR_CAN_BE_NULL = 2 EXPR_CAN_BE_NULL = 2
@@ -1227,6 +1228,7 @@ resolve_expr(Ast_Expr *ast, Resolve_Flag flags, Ast_Type *compound_context){
Ast_Expr *expr = unpack_ast_call_expr_for_builtin(node); Ast_Expr *expr = unpack_ast_call_expr_for_builtin(node);
Operand name = resolve_expr(expr, inherit_flag(flags, AST_CANT_BE_NULL)); Operand name = resolve_expr(expr, inherit_flag(flags, AST_CANT_BE_NULL));
node->kind = AST_SIZE_OF;
if(!name.is_const){ if(!name.is_const){
compiler_error(node->pos, "SizeOf requires a constant value"); compiler_error(node->pos, "SizeOf requires a constant value");
} }
@@ -1262,6 +1264,7 @@ resolve_expr(Ast_Expr *ast, Resolve_Flag flags, Ast_Type *compound_context){
else if(expr_atom_is_equal_intern(node->name, intern_alignof)){ else if(expr_atom_is_equal_intern(node->name, intern_alignof)){
Ast_Expr *expr = unpack_ast_call_expr_for_builtin(node); Ast_Expr *expr = unpack_ast_call_expr_for_builtin(node);
Operand name = resolve_expr(expr, inherit_flag(flags, AST_CANT_BE_NULL)); Operand name = resolve_expr(expr, inherit_flag(flags, AST_CANT_BE_NULL));
node->kind = AST_ALIGN_OF;
if(!name.is_const) compiler_error(node->pos, "AlignOf requires a constant value"); if(!name.is_const) compiler_error(node->pos, "AlignOf requires a constant value");
Ast_Type *type = name.type == type_type ? name.type_val : name.type; Ast_Type *type = name.type == type_type ? name.type_val : name.type;
Value v = value_int(type->align); Value v = value_int(type->align);

View File

@@ -6,14 +6,16 @@ struct Operand{
U8 pound_strict: 1; U8 pound_strict: 1;
}; };
FLAG32(Resolve_Flag){ typedef U32 Resolve_Flag;
enum{
AST_CANT_BE_NULL = bit_flag(0), AST_CANT_BE_NULL = bit_flag(0),
AST_CAN_BE_NULL = bit_flag(1), AST_CAN_BE_NULL = bit_flag(1),
RESOLVE_TYPESPEC_COMPLETE = bit_flag(2), RESOLVE_TYPESPEC_COMPLETE = bit_flag(2),
RESOLVE_TYPESPEC = bit_flag(3), RESOLVE_TYPESPEC = bit_flag(3),
}; };
FLAG32(Search_Flag){ typedef U32 Search_Flag;
enum{
SEARCH_ONLY_CURRENT_SCOPE = bit_flag(1), SEARCH_ONLY_CURRENT_SCOPE = bit_flag(1),
}; };