Fix some tests and do some cleanup.

This commit is contained in:
2025-01-01 23:06:53 +01:00
parent f13508262b
commit 4deb07027f
70 changed files with 439 additions and 361 deletions

View File

@@ -88,14 +88,14 @@ dx11_type_to_string :: (type_variable : Type_Variable) -> string {
emit_field :: (state : *Codegen_State, node : *AST_Node, indentation : int) { emit_field :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
find_result := find_symbol(state.scope_stack, node.name, state.current_scope); find_result := find_symbol(state.scope_stack, node.name, state.current_scope);
field := h2tv(state.type_variables, find_result.type_variable); field := from_handle(state.type_variables, find_result.type_variable);
indent(state, indentation); indent(state, indentation);
print_to_builder(*state.builder, "% ", dx11_type_to_string(field)); print_to_builder(*state.builder, "% ", dx11_type_to_string(field));
if field.struct_field_parent { if field.struct_field_parent {
parent_tv := h2tv(state.type_variables, field.struct_field_parent.type_variable); parent_tv := from_handle(state.type_variables, field.struct_field_parent.type_variable);
if parent_tv.typename == "properties" { if parent_tv.typename == "properties" {
append(*state.builder, "__PROPERTIES__"); append(*state.builder, "__PROPERTIES__");
@@ -119,7 +119,7 @@ emit_field :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
} }
for i :0..field.children.count - 1 { for i :0..field.children.count - 1 {
child := h2tv(state.type_variables, field.children[i]); child := from_handle(state.type_variables, field.children[i]);
emit_node(state, child.source_node, 0); emit_node(state, child.source_node, 0);
} }
@@ -198,7 +198,7 @@ emit_properties :: (state : *Codegen_State, node : *AST_Node, indentation : int)
} }
assert(find_result != null, "Attempting to generate undeclared properties buffer. This should never happen at this stage."); assert(find_result != null, "Attempting to generate undeclared properties buffer. This should never happen at this stage.");
variable := h2tv(state.type_variables, find_result.type_variable); variable := from_handle(state.type_variables, find_result.type_variable);
print_to_builder(*state.builder, "cbuffer __PROPERTIES : register(b%) \n{\n", variable.resource_index); print_to_builder(*state.builder, "cbuffer __PROPERTIES : register(b%) \n{\n", variable.resource_index);
@@ -210,7 +210,7 @@ emit_properties :: (state : *Codegen_State, node : *AST_Node, indentation : int)
for child : node.children { for child : node.children {
if child.kind == .FieldList { if child.kind == .FieldList {
for field : child.children { for field : child.children {
tv := h2tv(state.type_variables, field.type_variable); tv := from_handle(state.type_variables, field.type_variable);
if tv.type == .Sampler || tv.type == .Texture2D { if tv.type == .Sampler || tv.type == .Texture2D {
array_add(*resources, field); array_add(*resources, field);
continue; continue;
@@ -250,12 +250,12 @@ emit_function :: (state : *Codegen_State, node : *AST_Node, indentation : int, e
} }
for func : find_result.functions { for func : find_result.functions {
function_variable := h2tv(state.type_variables, func.type_variable); function_variable := from_handle(state.type_variables, func.type_variable);
indent(state, indentation); indent(state, indentation);
if function_variable.return_type_variable { if function_variable.return_type_variable {
return_variable := h2tv(state.type_variables, function_variable.return_type_variable); return_variable := from_handle(state.type_variables, function_variable.return_type_variable);
print_to_builder(*state.builder, "% ", dx11_type_to_string(return_variable)); print_to_builder(*state.builder, "% ", dx11_type_to_string(return_variable));
} else { } else {
append(*state.builder, "void "); append(*state.builder, "void ");
@@ -379,12 +379,12 @@ emit_node :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
case .Variable; { case .Variable; {
indent(*state.builder, indentation); indent(*state.builder, indentation);
type_var := h2tv(state.type_variables, node.type_variable); type_var := from_handle(state.type_variables, node.type_variable);
is_properties := type_var.typename == "properties"; is_properties := type_var.typename == "properties";
if !is_properties { if !is_properties {
if type_var.struct_field_parent { if type_var.struct_field_parent {
parent_tv := h2tv(state.type_variables, type_var.struct_field_parent.type_variable); parent_tv := from_handle(state.type_variables, type_var.struct_field_parent.type_variable);
if parent_tv.typename == "properties" { if parent_tv.typename == "properties" {
append(*state.builder, "__PROPERTIES__"); append(*state.builder, "__PROPERTIES__");
@@ -450,7 +450,7 @@ emit_struct :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
print_to_builder(*state.builder, "struct %", node.name); print_to_builder(*state.builder, "struct %", node.name);
current_scope := state.current_scope; current_scope := state.current_scope;
state.current_scope = h2tv(state.type_variables, node.type_variable).scope; state.current_scope = from_handle(state.type_variables, node.type_variable).scope;
field_list := node.children[0]; field_list := node.children[0];
@@ -467,11 +467,11 @@ emit_struct :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
} }
emit_cbuffer :: (state : *Codegen_State, node : *AST_Node, indentation : int) { emit_cbuffer :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
variable := h2tv(state.type_variables, node.type_variable); variable := from_handle(state.type_variables, node.type_variable);
print_to_builder(*state.builder, "cbuffer % : register(b%)", variable.name, variable.resource_index); print_to_builder(*state.builder, "cbuffer % : register(b%)", variable.name, variable.resource_index);
current_scope := state.current_scope; current_scope := state.current_scope;
state.current_scope = h2tv(state.type_variables, node.type_variable).scope; state.current_scope = from_handle(state.type_variables, node.type_variable).scope;
field_list := node.children[0]; field_list := node.children[0];

View File

@@ -299,7 +299,7 @@ no_matching_overload_found :: (checker : *Semantic_Checker, call : *AST_Node, ov
append(*builder, "Possible overloads:\n"); append(*builder, "Possible overloads:\n");
for func : overloads.functions { for func : overloads.functions {
func_var := h2tv(checker, func.type_variable); func_var := from_handle(checker, func.type_variable);
cyan(*builder); cyan(*builder);
// foo :: (f : float) {} (file_path:line_num) // foo :: (f : float) {} (file_path:line_num)
@@ -316,7 +316,7 @@ no_matching_overload_found :: (checker : *Semantic_Checker, call : *AST_Node, ov
arg_list := call.children[0]; arg_list := call.children[0];
indent(*builder, 2); indent(*builder, 2);
func_var := h2tv(checker, func.type_variable); func_var := from_handle(checker, func.type_variable);
if arg_list.children.count != func_var.children.count { if arg_list.children.count != func_var.children.count {
print_to_builder(*builder, "Not enough arguments: Wanted %, got %.\n\n", func_var.children.count, arg_list.children.count); print_to_builder(*builder, "Not enough arguments: Wanted %, got %.\n\n", func_var.children.count, arg_list.children.count);
@@ -462,7 +462,7 @@ Attempting to access a field on a primitive type '%'.
builder : String_Builder; builder : String_Builder;
init_string_builder(*builder,, temp); init_string_builder(*builder,, temp);
variable := h2tv(checker, handle); variable := from_handle(checker, handle);
print_to_builder(*builder, "Attempting to access a field on a primitive type '%'.\n", proper_type_to_string(checker, variable)); print_to_builder(*builder, "Attempting to access a field on a primitive type '%'.\n", proper_type_to_string(checker, variable));
indent(*builder, 1); indent(*builder, 1);
@@ -470,7 +470,7 @@ Attempting to access a field on a primitive type '%'.
print_to_builder(*builder, "%\n", print_from_source_location(node.source_location)); print_to_builder(*builder, "%\n", print_from_source_location(node.source_location));
indent(*builder, 1); indent(*builder, 1);
node_variable := h2tv(checker, node.type_variable); node_variable := from_handle(checker, node.type_variable);
for 0..node.name.count - 1 { for 0..node.name.count - 1 {
append(*builder, " "); append(*builder, " ");
@@ -490,8 +490,8 @@ Attempting to access a field on a primitive type '%'.
} }
type_mismatch :: (checker : *Semantic_Checker, usage_site : *AST_Node, expect_node : *AST_Node, expect : Type_Variable_Handle, got : Type_Variable_Handle) { type_mismatch :: (checker : *Semantic_Checker, usage_site : *AST_Node, expect_node : *AST_Node, expect : Type_Variable_Handle, got : Type_Variable_Handle) {
expect_var := h2tv(checker, expect); expect_var := from_handle(checker, expect);
got_var := h2tv(checker, got); got_var := from_handle(checker, got);
builder : String_Builder; builder : String_Builder;
init_string_builder(*builder,, temp); init_string_builder(*builder,, temp);
@@ -501,7 +501,7 @@ type_mismatch :: (checker : *Semantic_Checker, usage_site : *AST_Node, expect_no
for i: 0..got_var.children.count - 1{ for i: 0..got_var.children.count - 1{
child_handle := got_var.children[i]; child_handle := got_var.children[i];
child := h2tv(checker, child_handle); child := from_handle(checker, child_handle);
print_to_builder(*builder, "% : %", child.name, type_to_string(child)); print_to_builder(*builder, "% : %", child.name, type_to_string(child));
} }
@@ -667,7 +667,7 @@ new_type_variable :: (checker : *Semantic_Checker) -> *Type_Variable, Type_Varia
handle := cast(Type_Variable_Handle)checker.result.type_variables.count + 1; handle := cast(Type_Variable_Handle)checker.result.type_variables.count + 1;
array_add(*checker.result.type_variables, variable); array_add(*checker.result.type_variables, variable);
return h2tv(checker, handle), handle; return from_handle(checker, handle), handle;
} }
add_child :: (variable : *Type_Variable, child : Type_Variable_Handle) { add_child :: (variable : *Type_Variable, child : Type_Variable_Handle) {
@@ -678,7 +678,7 @@ add_child :: (variable : *Type_Variable, child : Type_Variable_Handle) {
} }
add_child :: (checker : *Semantic_Checker, handle : Type_Variable_Handle, child : Type_Variable_Handle) { add_child :: (checker : *Semantic_Checker, handle : Type_Variable_Handle, child : Type_Variable_Handle) {
variable := h2tv(checker, handle); variable := from_handle(checker, handle);
assert(variable.children.count < Type_Variable.MAX_TYPE_VARIABLE_CHILDREN); assert(variable.children.count < Type_Variable.MAX_TYPE_VARIABLE_CHILDREN);
array_add(*variable.children, child); array_add(*variable.children, child);
} }
@@ -725,13 +725,13 @@ find_symbol :: (name : string, checker : *Semantic_Checker, containing_scope : *
return find_symbol(checker, name, checker.current_scope, containing_scope); return find_symbol(checker, name, checker.current_scope, containing_scope);
} }
h2tv :: (variables : []Type_Variable, handle : Type_Variable_Handle) -> *Type_Variable { from_handle :: (variables : []Type_Variable, handle : Type_Variable_Handle) -> *Type_Variable {
assert(handle > 0 && xx handle <= variables.count, tprint("Invalid handle: %. Range is: 1-%", handle, variables.count - 1)); assert(handle > 0 && xx handle <= variables.count, tprint("Invalid handle: %. Range is: 1-%", handle, variables.count - 1));
return *variables[handle - 1]; return *variables[handle - 1];
} }
h2tv :: (checker : *Semantic_Checker, handle : Type_Variable_Handle) -> *Type_Variable { from_handle :: (checker : *Semantic_Checker, handle : Type_Variable_Handle) -> *Type_Variable {
return h2tv(checker.result.type_variables, handle); return from_handle(checker.result.type_variables, handle);
} }
proper_type_to_string :: (builder : *String_Builder, checker : *Semantic_Checker, var : Type_Variable) { proper_type_to_string :: (builder : *String_Builder, checker : *Semantic_Checker, var : Type_Variable) {
@@ -766,7 +766,7 @@ proper_type_to_string :: (builder : *String_Builder, checker : *Semantic_Checker
if var.return_type_variable > 0 { if var.return_type_variable > 0 {
append(builder, " -> ", ); append(builder, " -> ", );
return_var := h2tv(checker, var.return_type_variable); return_var := from_handle(checker, var.return_type_variable);
if is_proper(return_var) { if is_proper(return_var) {
proper_type_to_string(builder, checker, return_var); proper_type_to_string(builder, checker, return_var);
} else { } else {
@@ -822,7 +822,7 @@ get_type_from_identifier :: (checker : *Semantic_Checker, scope : Scope_Handle,
symbol := find_symbol(checker, type_string, scope); symbol := find_symbol(checker, type_string, scope);
if symbol { if symbol {
symbol_var := h2tv(checker, symbol.type_variable); symbol_var := from_handle(checker, symbol.type_variable);
if symbol_var.type == .Struct { if symbol_var.type == .Struct {
if typename { if typename {
typename.* = symbol_var.typename; typename.* = symbol_var.typename;
@@ -874,10 +874,10 @@ declare_struct :: (checker : *Semantic_Checker, node : *AST_Node, name : string)
for child : node.children { for child : node.children {
if child.kind == .FieldList { if child.kind == .FieldList {
for field : child.children { for field : child.children {
type_var := check_node(checker, field); type_var := create_field(checker, field);
if type_var > 0 { if type_var > 0 {
h2tv(checker, type_var).scope = scope_handle; from_handle(checker, type_var).scope = scope_handle;
add_child(checker, handle, type_var); add_child(checker, handle, type_var);
} }
} }
@@ -900,7 +900,7 @@ declare_properties :: (checker : *Semantic_Checker, node : *AST_Node) -> Type_Va
checker.result.property_name = name; checker.result.property_name = name;
} }
type_var := declare_struct(checker, node, name); type_var := declare_struct(checker, node, name);
var := h2tv(checker, type_var); var := from_handle(checker, type_var);
var.type = .Properties; var.type = .Properties;
var.typename = "properties"; var.typename = "properties";
var.resource_index = checker.current_buffer_index; var.resource_index = checker.current_buffer_index;
@@ -910,7 +910,7 @@ declare_properties :: (checker : *Semantic_Checker, node : *AST_Node) -> Type_Va
declare_cbuffer :: (checker : *Semantic_Checker, node : *AST_Node) -> Type_Variable_Handle { declare_cbuffer :: (checker : *Semantic_Checker, node : *AST_Node) -> Type_Variable_Handle {
type_var := declare_struct(checker, node); type_var := declare_struct(checker, node);
var := h2tv(checker, type_var); var := from_handle(checker, type_var);
var.type = .CBuffer; var.type = .CBuffer;
var.resource_index = checker.current_buffer_index; var.resource_index = checker.current_buffer_index;
checker.current_buffer_index += 1; checker.current_buffer_index += 1;
@@ -977,7 +977,7 @@ declare_function :: (checker : *Semantic_Checker, node : *AST_Node, builtin : bo
field_list := node.children[0]; field_list := node.children[0];
for function : find_result.functions { for function : find_result.functions {
func_var := h2tv(checker, function.type_variable); func_var := from_handle(checker, function.type_variable);
if func_var.source_node.children[0].children.count != field_list.children.count { if func_var.source_node.children[0].children.count != field_list.children.count {
continue; continue;
} }
@@ -989,7 +989,7 @@ declare_function :: (checker : *Semantic_Checker, node : *AST_Node, builtin : bo
typename : string; typename : string;
arg_type := get_type_from_identifier(checker, checker.current_scope, node_child, *typename); arg_type := get_type_from_identifier(checker, checker.current_scope, node_child, *typename);
other_arg := h2tv(checker, arg); other_arg := from_handle(checker, arg);
if arg_type != other_arg.type { if arg_type != other_arg.type {
all_same = false; all_same = false;
@@ -1037,7 +1037,7 @@ declare_function :: (checker : *Semantic_Checker, node : *AST_Node, builtin : bo
type_var := check_node(checker, field); type_var := check_node(checker, field);
if type_var > 0 { if type_var > 0 {
if builtin { if builtin {
var := h2tv(checker, type_var); var := from_handle(checker, type_var);
var.builtin = true; var.builtin = true;
} }
add_child(checker, handle, type_var); add_child(checker, handle, type_var);
@@ -1049,7 +1049,7 @@ declare_function :: (checker : *Semantic_Checker, node : *AST_Node, builtin : bo
if builtin && node.token.ident_value.count > 0 { if builtin && node.token.ident_value.count > 0 {
return_var, return_handle := new_type_variable(checker); return_var, return_handle := new_type_variable(checker);
return_var.type = get_type_from_identifier(checker, checker.current_scope, node, *return_var.typename); return_var.type = get_type_from_identifier(checker, checker.current_scope, node, *return_var.typename);
h2tv(checker, handle).return_type_variable= return_handle; from_handle(checker, handle).return_type_variable= return_handle;
} }
if !builtin { if !builtin {
@@ -1073,7 +1073,7 @@ create_function :: (checker : *Semantic_Checker, node : *AST_Node) {
} }
for function : find_result.functions { for function : find_result.functions {
variable := h2tv(checker, function.type_variable); variable := from_handle(checker, function.type_variable);
assert(variable.scope > 0, "Declared function is missing scope."); assert(variable.scope > 0, "Declared function is missing scope.");
@@ -1090,7 +1090,7 @@ create_function :: (checker : *Semantic_Checker, node : *AST_Node) {
} else { } else {
result_var := check_node(checker, statement); result_var := check_node(checker, statement);
if result_var > 0 { if result_var > 0 {
stm := h2tv(checker, result_var); stm := from_handle(checker, result_var);
add_child(variable, result_var); add_child(variable, result_var);
} }
} }
@@ -1113,7 +1113,7 @@ create_variable :: (checker : *Semantic_Checker, node : *AST_Node, struct_field_
if find_result { if find_result {
node.type_variable = find_result.type_variable; node.type_variable = find_result.type_variable;
variable := h2tv(checker, find_result.type_variable); variable := from_handle(checker, find_result.type_variable);
variable.struct_field_parent = struct_field_parent; variable.struct_field_parent = struct_field_parent;
if get_scope(checker, checker.current_scope).kind == .Struct { if get_scope(checker, checker.current_scope).kind == .Struct {
@@ -1130,7 +1130,7 @@ create_variable :: (checker : *Semantic_Checker, node : *AST_Node, struct_field_
lookup_name = variable.name; lookup_name = variable.name;
} }
struct_symbol := find_symbol(checker, lookup_name, checker.current_scope); struct_symbol := find_symbol(checker, lookup_name, checker.current_scope);
type_variable := h2tv(checker, struct_symbol.type_variable); type_variable := from_handle(checker, struct_symbol.type_variable);
previous_scope := use_scope(checker, type_variable.scope); previous_scope := use_scope(checker, type_variable.scope);
child := node.children[0]; child := node.children[0];
@@ -1175,7 +1175,7 @@ create_field :: (checker : *Semantic_Checker, node : *AST_Node) -> Type_Variable
if variable.is_array { if variable.is_array {
size_node := node.children[0]; size_node := node.children[0];
size_var := check_node(checker, size_node); size_var := check_node(checker, size_node);
if h2tv(checker, size_var).type != .Int { if from_handle(checker, size_var).type != .Int {
//@Incomplete(niels): Type mismatch here. With integral type required message. //@Incomplete(niels): Type mismatch here. With integral type required message.
} }
} }
@@ -1230,8 +1230,8 @@ create_field :: (checker : *Semantic_Checker, node : *AST_Node) -> Type_Variable
return handle; return handle;
} }
l := h2tv(checker, handle); l := from_handle(checker, handle);
r := h2tv(checker, rhs); r := from_handle(checker, rhs);
assert(l.type != .Unresolved_Expression && r.type != .Unresolved_Expression); assert(l.type != .Unresolved_Expression && r.type != .Unresolved_Expression);
if !types_compatible(checker, handle, rhs) { if !types_compatible(checker, handle, rhs) {
@@ -1295,7 +1295,7 @@ check_call :: (checker : *Semantic_Checker, node : *AST_Node, type_var : Type_Va
break; break;
} }
function := h2tv(checker, func.type_variable); function := from_handle(checker, func.type_variable);
if arg_count != function.children.count { if arg_count != function.children.count {
continue; continue;
@@ -1318,7 +1318,7 @@ check_call :: (checker : *Semantic_Checker, node : *AST_Node, type_var : Type_Va
if all_args_match { if all_args_match {
arg_node = arg.node; arg_node = arg.node;
} }
fun_param := h2tv(checker, function_param); fun_param := from_handle(checker, function_param);
mismatch : Type_Mismatch_Data; mismatch : Type_Mismatch_Data;
mismatch.lhs = arg; mismatch.lhs = arg;
mismatch.rhs = .{ function_param, fun_param.source_node }; mismatch.rhs = .{ function_param, fun_param.source_node };
@@ -1333,8 +1333,8 @@ check_call :: (checker : *Semantic_Checker, node : *AST_Node, type_var : Type_Va
if overload_found { if overload_found {
if function.return_type_variable > 0 { if function.return_type_variable > 0 {
return_var := h2tv(checker, function.return_type_variable); return_var := from_handle(checker, function.return_type_variable);
constrained_var := h2tv(checker, type_var); constrained_var := from_handle(checker, type_var);
constrained_var.type = return_var.type; constrained_var.type = return_var.type;
constrained_var.typename = return_var.typename; constrained_var.typename = return_var.typename;
} }
@@ -1379,7 +1379,7 @@ check_node :: (checker : *Semantic_Checker, node : *AST_Node) -> Type_Variable_H
} }
variable, handle := new_type_variable(checker); variable, handle := new_type_variable(checker);
lhs_type := h2tv(checker, lhs_var); lhs_type := from_handle(checker, lhs_var);
variable.type = lhs_type.type; variable.type = lhs_type.type;
variable.typename = lhs_type.typename; variable.typename = lhs_type.typename;
variable.scope = lhs_type.scope; variable.scope = lhs_type.scope;
@@ -1482,7 +1482,7 @@ traverse :: (checker : *Semantic_Checker) {
// find :: (checker : *Semantic_Checker, root_handle : Type_Variable_Handle) -> Type_Variable_Handle { // find :: (checker : *Semantic_Checker, root_handle : Type_Variable_Handle) -> Type_Variable_Handle {
// assert(root_handle > 0); // assert(root_handle > 0);
// root := h2tv(checker, root_handle); // root := from_handle(checker, root_handle);
// // if root.uf_parent != root_handle { // // if root.uf_parent != root_handle {
// // root.uf_parent = find(checker, root.uf_parent); // // root.uf_parent = find(checker, root.uf_parent);
@@ -1497,8 +1497,8 @@ Unification_Result :: enum {
} }
types_compatible :: (checker : *Semantic_Checker, lhs : Type_Variable_Handle, rhs : Type_Variable_Handle, param_matching : bool = false) -> bool { types_compatible :: (checker : *Semantic_Checker, lhs : Type_Variable_Handle, rhs : Type_Variable_Handle, param_matching : bool = false) -> bool {
lhs_var := h2tv(checker, lhs); lhs_var := from_handle(checker, lhs);
rhs_var := h2tv(checker, rhs); rhs_var := from_handle(checker, rhs);
if lhs_var.type == { if lhs_var.type == {
case .Int; #through; case .Int; #through;
@@ -1552,8 +1552,8 @@ types_compatible :: (checker : *Semantic_Checker, lhs : Type_Variable_Handle, rh
return false; return false;
} }
lhs_struct_var := h2tv(checker, lhs_struct.type_variable); lhs_struct_var := from_handle(checker, lhs_struct.type_variable);
rhs_struct_var := h2tv(checker, rhs_struct.type_variable); rhs_struct_var := from_handle(checker, rhs_struct.type_variable);
if lhs_struct_var.children.count != rhs_struct_var.children.count { if lhs_struct_var.children.count != rhs_struct_var.children.count {
return false; return false;
@@ -1720,7 +1720,7 @@ pretty_print_function :: (checker : *Semantic_Checker, builder : *String_Builder
for child : function.source_node.children { for child : function.source_node.children {
if child.kind == .FieldList { if child.kind == .FieldList {
for field : child.children { for field : child.children {
tv := h2tv(checker, field.type_variable); tv := from_handle(checker, field.type_variable);
if tv.type != .Function { if tv.type != .Function {
if tv.builtin { if tv.builtin {
print_to_builder(builder, "%", tv.name); print_to_builder(builder, "%", tv.name);
@@ -1739,7 +1739,7 @@ pretty_print_function :: (checker : *Semantic_Checker, builder : *String_Builder
} }
if function.return_type_variable> 0 { if function.return_type_variable> 0 {
print_to_builder(builder, ") -> %\n", type_to_string(h2tv(checker, function.return_type_variable))); print_to_builder(builder, ") -> %\n", type_to_string(from_handle(checker, function.return_type_variable)));
} else { } else {
append(builder, ")\n"); append(builder, ")\n");
} }
@@ -1752,7 +1752,7 @@ pretty_print_struct :: (checker : *Semantic_Checker, builder : *String_Builder,
for 0..struct_type.children.count - 1 { for 0..struct_type.children.count - 1 {
child_handle := struct_type.children[it]; child_handle := struct_type.children[it];
child := h2tv(checker, child_handle); child := from_handle(checker, child_handle);
print_to_builder(builder, child.name); print_to_builder(builder, child.name);
append(builder, " : "); append(builder, " : ");
print_to_builder(builder, type_to_string(child)); print_to_builder(builder, type_to_string(child));
@@ -1790,7 +1790,7 @@ pretty_print_scope :: (checker : *Semantic_Checker, scope : *Scope, builder : *S
if value.functions.count > 0 { if value.functions.count > 0 {
for func : value.functions { for func : value.functions {
type_variable := h2tv(checker, func.type_variable); type_variable := from_handle(checker, func.type_variable);
if type_variable.type == { if type_variable.type == {
case .Function; { case .Function; {
pretty_print_function(checker, builder, key, type_variable, 1); pretty_print_function(checker, builder, key, type_variable, 1);
@@ -1816,7 +1816,7 @@ pretty_print_scope :: (checker : *Semantic_Checker, scope : *Scope, builder : *S
} }
} }
} else { } else {
type_variable := h2tv(checker, value.type_variable); type_variable := from_handle(checker, value.type_variable);
if type_variable.type == { if type_variable.type == {
case .Function; { case .Function; {
pretty_print_function(checker, builder, key, type_variable, 1); pretty_print_function(checker, builder, key, type_variable, 1);
@@ -1936,7 +1936,7 @@ print_type_variable :: (builder : *String_Builder, variable : Type_Variable, che
} }
print_type_variable :: (builder : *String_Builder, checker : *Semantic_Checker, handle : Type_Variable_Handle) { print_type_variable :: (builder : *String_Builder, checker : *Semantic_Checker, handle : Type_Variable_Handle) {
variable := h2tv(checker, handle); variable := from_handle(checker, handle);
print_type_variable(builder, variable, checker); print_type_variable(builder, variable, checker);
} }

View File

@@ -21,7 +21,7 @@ COMPILED_FOLDER :: "compiled";
SEMANTIC_ANALYSIS_FOLDER :: "semant"; SEMANTIC_ANALYSIS_FOLDER :: "semant";
TESTS_FOLDER :: "test"; TESTS_FOLDER :: "test";
SHADER_EXTENSION :: "shd"; SHADER_EXTENSION :: "inx";
SUITE_EXTENSION :: "suite"; SUITE_EXTENSION :: "suite";
Stage_Flags :: enum_flags u16 { Stage_Flags :: enum_flags u16 {
@@ -411,6 +411,8 @@ run_compile_test :: (path : string, output_type : Output_Type = 0) -> Result, Co
compiler : Shader_Compiler; compiler : Shader_Compiler;
result : Result; result : Result;
compilation_result := compile_file(*compiler, path); compilation_result := compile_file(*compiler, path);
print("\n");
if compilation_result.had_error { if compilation_result.had_error {
result.type = .Failed; result.type = .Failed;
result.info_text = tprint("Failed compiling: %\n", path); result.info_text = tprint("Failed compiling: %\n", path);
@@ -584,9 +586,12 @@ read_suite :: (file_path : string, suite : *Test_Suite) -> bool {
} }
if line.count == 1 { if line.count == 1 {
log_error("Invalid line - % - %\n", it_index + 1, line); line = split(split_line, "\t");
if line.count == 1 {
log_error("Invalid line - % - \n", it_index + 1);
continue; continue;
} }
}
test_case_path := line[0]; test_case_path := line[0];
stage_flags : Stage_Flags; stage_flags : Stage_Flags;
@@ -604,7 +609,6 @@ read_suite :: (file_path : string, suite : *Test_Suite) -> bool {
stage_flags |= .Compile; stage_flags |= .Compile;
} }
} }
test_case := make_test_case(test_case_path, stage_flags); test_case := make_test_case(test_case_path, stage_flags);
array_add(*suite.test_cases, test_case); array_add(*suite.test_cases, test_case);
} }
@@ -701,7 +705,7 @@ main :: () {
} else if arg == "-output" { } else if arg == "-output" {
output_type |= .StdOut; output_type |= .StdOut;
} else { } else {
print("%Unknown argument %\n", red(), arg); print("%Unknown argument % %\n", red(), arg, reset_color());
} }
} }
case .Run_Test; { case .Run_Test; {
@@ -723,9 +727,11 @@ main :: () {
path := copy_string(arg); path := copy_string(arg);
test_case := make_test_case(path, 0); test_case := make_test_case(path, 0);
array_add(*current_suite.test_cases, test_case); array_add(*current_suite.test_cases, test_case);
} else {
print("%Invalid file as argument % %\n", red(), arg, reset_color());
} }
} else { } else {
print("%Unknown argument %\n", red, arg); print("%Unknown argument % %\n", red(), arg, reset_color());
} }
} }
case .None; { case .None; {
@@ -744,7 +750,6 @@ main :: () {
array_add(*suites, suite); array_add(*suites, suite);
current_suite = *suites[0]; current_suite = *suites[0];
} }
arg_parse_state = .Run_Test; arg_parse_state = .Run_Test;
path := copy_string(arg); path := copy_string(arg);
test_case := make_test_case(path, 0); test_case := make_test_case(path, 0);
@@ -754,7 +759,6 @@ main :: () {
log_error("Unable to run a suite while already running test."); log_error("Unable to run a suite while already running test.");
continue; continue;
} }
arg_parse_state = .Run_Suite; arg_parse_state = .Run_Suite;
path := copy_string(arg); path := copy_string(arg);
@@ -762,6 +766,8 @@ main :: () {
read_suite(path, *suite); read_suite(path, *suite);
array_add(*suites, suite); array_add(*suites, suite);
current_suite = *suites[0]; current_suite = *suites[0];
} else {
print("%Invalid file as argument % %\n", red(), arg, reset_color());
} }
} }
} }

View File

@@ -279,7 +279,7 @@ pretty_print_field :: (builder : *String_Builder, field : *Field) {
} }
type_variable_to_field :: (checker : *Semantic_Checker, variable : Type_Variable_Handle) -> Field { type_variable_to_field :: (checker : *Semantic_Checker, variable : Type_Variable_Handle) -> Field {
return type_variable_to_field(checker, h2tv(checker, variable)); return type_variable_to_field(checker, from_handle(checker, variable));
} }
type_variable_to_field :: (checker : *Semantic_Checker, variable : *Type_Variable) -> Field { type_variable_to_field :: (checker : *Semantic_Checker, variable : *Type_Variable) -> Field {
@@ -318,11 +318,11 @@ type_variable_to_field :: (checker : *Semantic_Checker, variable : *Type_Variabl
find_result := find_symbol(checker, variable.typename, xx 1); find_result := find_symbol(checker, variable.typename, xx 1);
assert(find_result != null, "Internal compiler error\n"); assert(find_result != null, "Internal compiler error\n");
type_var := h2tv(checker, find_result.type_variable); type_var := from_handle(checker, find_result.type_variable);
for i : 0..type_var.children.count - 1 { for i : 0..type_var.children.count - 1 {
child := type_var.children[i]; child := type_var.children[i];
child_field := type_variable_to_field(checker, h2tv(checker, child)); child_field := type_variable_to_field(checker, from_handle(checker, child));
array_add(*type.children, child_field); array_add(*type.children, child_field);
} }
@@ -435,7 +435,7 @@ compile_file :: (compiler : *Shader_Compiler, path : string) -> Compilation_Resu
if checker.result.vertex_entry_point { if checker.result.vertex_entry_point {
variant.vertex_entry_point.name = checker.result.vertex_entry_point.name; variant.vertex_entry_point.name = checker.result.vertex_entry_point.name;
type_variable := h2tv(*checker, checker.result.vertex_entry_point.type_variable); type_variable := from_handle(*checker, checker.result.vertex_entry_point.type_variable);
assert(type_variable.type == .Function); assert(type_variable.type == .Function);
node := type_variable.source_node; node := type_variable.source_node;
@@ -443,7 +443,7 @@ compile_file :: (compiler : *Shader_Compiler, path : string) -> Compilation_Resu
if node.children[0].kind == .FieldList { if node.children[0].kind == .FieldList {
field_list := node.children[0]; field_list := node.children[0];
for child : field_list.children { for child : field_list.children {
tv := h2tv(*checker, child.type_variable); tv := from_handle(*checker, child.type_variable);
field := type_variable_to_field(*checker, tv); field := type_variable_to_field(*checker, tv);
array_add(*variant.vertex_entry_point.input, field); array_add(*variant.vertex_entry_point.input, field);
} }
@@ -452,14 +452,14 @@ compile_file :: (compiler : *Shader_Compiler, path : string) -> Compilation_Resu
} }
for buffer_variable : to_array(*check_result.constant_buffers) { for buffer_variable : to_array(*check_result.constant_buffers) {
variable := h2tv(check_result.type_variables, buffer_variable); variable := from_handle(check_result.type_variables, buffer_variable);
cb := array_add(*result.collection.cbuffers); cb := array_add(*result.collection.cbuffers);
for i : 0..variable.children.count - 1 { for i : 0..variable.children.count - 1 {
child := variable.children[i]; child := variable.children[i];
field : Property_Field; field : Property_Field;
field.base_field = type_variable_to_field(*checker, h2tv(*checker, child));; field.base_field = type_variable_to_field(*checker, from_handle(*checker, child));;
array_add(*cb.fields, field); array_add(*cb.fields, field);
} }
@@ -468,11 +468,11 @@ compile_file :: (compiler : *Shader_Compiler, path : string) -> Compilation_Resu
find_result := find_symbol(*check_result.scope_stack, check_result.property_name, xx 1); find_result := find_symbol(*check_result.scope_stack, check_result.property_name, xx 1);
if find_result { if find_result {
property_variable := h2tv(check_result.type_variables, find_result.type_variable); property_variable := from_handle(check_result.type_variables, find_result.type_variable);
for i : 0..property_variable.children.count - 1 { for i : 0..property_variable.children.count - 1 {
child := property_variable.children[i]; child := property_variable.children[i];
field := type_variable_to_field(*checker, h2tv(*checker, child)); field := type_variable_to_field(*checker, from_handle(*checker, child));
prop_field : Property_Field; prop_field : Property_Field;
prop_field.base_field = field; prop_field.base_field = field;
array_add(*result.collection.properties.fields, prop_field); array_add(*result.collection.properties.fields, prop_field);
@@ -483,7 +483,7 @@ compile_file :: (compiler : *Shader_Compiler, path : string) -> Compilation_Resu
if checker.result.pixel_entry_point { if checker.result.pixel_entry_point {
variant.pixel_entry_point.name = checker.result.pixel_entry_point.name; variant.pixel_entry_point.name = checker.result.pixel_entry_point.name;
type_variable := h2tv(*checker, checker.result.pixel_entry_point.type_variable); type_variable := from_handle(*checker, checker.result.pixel_entry_point.type_variable);
assert(type_variable.type == .Function); assert(type_variable.type == .Function);
field := type_variable_to_field(*checker, type_variable.return_type_variable); field := type_variable_to_field(*checker, type_variable.return_type_variable);

View File

@@ -1,12 +1,12 @@
test/assign_arithmetic_expression.shd lex parse test/assign_arithmetic_expression.inx lex parse
test/empty_vertex_main.shd lex parse test/empty_vertex_main.inx lex parse
test/empty_vertex_main_with_position_parameter.shd lex parse test/empty_vertex_main_with_position_parameter.inx lex parse
test/meta_block.shd lex parse test/meta_block.inx lex parse
test/basic_property_and_return_value.shd lex parse test/basic_property_and_return_value.inx lex parse
test/function_call_return.shd lex parse test/function_call_return.inx lex parse
test/struct_field_access_test.shd lex parse test/struct_field_access_test.inx lex parse
test/pass_and_access_struct_fields_in_functions.shd lex parse test/pass_and_access_struct_fields_in_functions.inx lex parse
test/field_without_type_specifier.shd lex parse test/field_without_type_specifier.inx lex parse
test/functions_with_same_name.shd lex parse test/functions_with_same_name.inx lex parse
test/function_with_int_return.shd lex parse test/function_with_int_return.inx lex parse
test/type_as_variable_name.shd lex parse test/type_as_variable_name.inx lex parse

View File

@@ -0,0 +1,18 @@
cbuffer camera : register(b0)
{
float4x4 projection;
float4x4 view;
}
float4 vs_main(float4 pos : POSITION) : SV_POSITION
{
float4 mv = mul(camera.view, pos);
float4 mvp = mul(camera.projection, mv);
return mvp;
}
float4 ps_main() : SV_TARGET
{
return float4(0.5f, 0.5f, 0.5f, 1.0f);
}

View File

@@ -1,8 +1,9 @@
cbuffer __PROPERTIES : register(b0) cbuffer __PROPERTIES : register(b0)
{ {
float4 color; float4 __PROPERTIES__color;
} }
float4 vs_main(float4 pos : POSITION) : SV_POSITION float4 vs_main(float4 pos : POSITION) : SV_POSITION
{ {
return pos; return pos;
@@ -10,6 +11,6 @@ float4 vs_main(float4 pos : POSITION) : SV_POSITION
float4 ps_main() : SV_TARGET float4 ps_main() : SV_TARGET
{ {
return color; return __PROPERTIES__color;
} }

View File

@@ -1,20 +1,20 @@
test/assign_arithmetic_expression.shd codegen test/assign_arithmetic_expression.inx codegen
test/basic_property_and_return_value.shd codegen test/basic_property_and_return_value.inx codegen
test/complicated_computation.shd codegen test/complicated_computation.inx codegen
test/constant_buffer.shd codegen test/constant_buffer.inx codegen
test/empty_struct.shd codegen test/empty_struct.inx codegen
test/empty_vertex_main.shd codegen test/empty_vertex_main.inx codegen
test/empty_vertex_main_with_position_parameter.shd codegen test/empty_vertex_main_with_position_parameter.inx codegen
test/field_assignment.shd codegen test/field_assignment.inx codegen
test/function_call.shd codegen test/function_call.inx codegen
test/function_call_out_of_order_declaration.shd codegen test/function_call_out_of_order_declaration.inx codegen
test/function_call_return.shd codegen test/function_call_return.inx codegen
test/meta_block.shd codegen test/meta_block.inx codegen
test/multiple_functions.shd codegen test/multiple_functions.inx codegen
test/multiple_semicolons_everywhere.shd codegen test/multiple_semicolons_everywhere.inx codegen
test/pass_and_access_struct_fields_in_functions.shd codegen test/pass_and_access_struct_fields_in_functions.inx codegen
test/passthrough.shd codegen test/passthrough.inx codegen
test/property_rename.shd codegen test/property_rename.inx codegen
test/simple_struct_access.shd codegen test/simple_struct_access.inx codegen
test/struct_within_struct.shd codegen test/struct_within_struct.inx codegen
test/use_builtin_functions.shd codegen test/use_builtin_functions.inx codegen

View File

@@ -1,20 +1,20 @@
test/assign_arithmetic_expression.shd compile test/assign_arithmetic_expression.inx compile
test/basic_property_and_return_value.shd compile test/basic_property_and_return_value.inx compile
test/complicated_computation.shd compile test/complicated_computation.inx compile
test/empty_struct.shd compile test/empty_struct.inx compile
test/empty_vertex_main.shd compile test/empty_vertex_main.inx compile
test/empty_vertex_main_with_position_parameter.shd compile test/empty_vertex_main_with_position_parameter.inx compile
test/field_assignment.shd compile test/field_assignment.inx compile
test/float_suffix.shd compile test/float_suffix.inx compile
test/function_call.shd compile test/function_call.inx compile
test/function_call_out_of_order_declaration.shd compile test/function_call_out_of_order_declaration.inx compile
test/function_call_return.shd compile test/function_call_return.inx compile
test/functions_with_same_name.shd compile test/functions_with_same_name.inx compile
test/meta_block.shd compile test/meta_block.inx compile
test/multiple_functions.shd compile test/multiple_functions.inx compile
test/multiple_semicolons_everywhere.shd compile test/multiple_semicolons_everywhere.inx compile
test/pass_and_access_struct_fields_in_functions.shd compile test/pass_and_access_struct_fields_in_functions.inx compile
test/passthrough.shd compile test/passthrough.inx compile
test/simple_struct_access.shd compile test/simple_struct_access.inx compile
test/struct_within_struct.shd compile test/struct_within_struct.inx compile
test/use_builtin_functions.shd compile test/use_builtin_functions.inx compile

View File

@@ -1,66 +1,82 @@
{kind = TOKEN_IDENTIFIER; ; index = 0 ; length = 11 line = 1 ; column = 0 ; value ='Camera_Data'; } {kind = TOKEN_IDENTIFIER; ; index = 0 ; length = 6 line = 1 ; column = 0 ; value ='camera'; }
{kind = TOKEN_DOUBLECOLON; ; index = 12 ; length = 2 line = 1 ; column = 12 ; value ='::'; } {kind = TOKEN_DOUBLECOLON; ; index = 7 ; length = 2 line = 1 ; column = 7 ; value ='::'; }
{kind = TOKEN_CONSTANT_BUFFER; ; index = 15 ; length = 15 line = 1 ; column = 15 ; value ='constant_buffer'; } {kind = TOKEN_CONSTANT_BUFFER; ; index = 10 ; length = 15 line = 1 ; column = 10 ; value ='constant_buffer'; }
{kind = TOKEN_LEFTBRACE; ; index = 31 ; length = 1 line = 1 ; column = 31 ; value ='{'; } {kind = TOKEN_LEFTBRACE; ; index = 26 ; length = 1 line = 1 ; column = 26 ; value ='{'; }
{kind = TOKEN_IDENTIFIER; ; index = 35 ; length = 10 line = 2 ; column = 0 ; value ='projection'; } {kind = TOKEN_IDENTIFIER; ; index = 30 ; length = 10 line = 2 ; column = 0 ; value ='projection'; }
{kind = TOKEN_COLON; ; index = 46 ; length = 1 line = 2 ; column = 11 ; value =':'; } {kind = TOKEN_COLON; ; index = 41 ; length = 1 line = 2 ; column = 11 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 48 ; length = 8 line = 2 ; column = 13 ; value ='float4x4'; } {kind = TOKEN_IDENTIFIER; ; index = 43 ; length = 8 line = 2 ; column = 13 ; value ='float4x4'; }
{kind = TOKEN_SEMICOLON; ; index = 56 ; length = 1 line = 2 ; column = 21 ; value =';'; } {kind = TOKEN_SEMICOLON; ; index = 51 ; length = 1 line = 2 ; column = 21 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 60 ; length = 4 line = 3 ; column = 0 ; value ='view'; } {kind = TOKEN_IDENTIFIER; ; index = 55 ; length = 4 line = 3 ; column = 0 ; value ='view'; }
{kind = TOKEN_COLON; ; index = 71 ; length = 1 line = 3 ; column = 11 ; value =':'; } {kind = TOKEN_COLON; ; index = 66 ; length = 1 line = 3 ; column = 11 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 73 ; length = 8 line = 3 ; column = 13 ; value ='float4x4'; } {kind = TOKEN_IDENTIFIER; ; index = 68 ; length = 8 line = 3 ; column = 13 ; value ='float4x4'; }
{kind = TOKEN_SEMICOLON; ; index = 81 ; length = 1 line = 3 ; column = 21 ; value =';'; } {kind = TOKEN_SEMICOLON; ; index = 76 ; length = 1 line = 3 ; column = 21 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 84 ; length = 1 line = 4 ; column = 0 ; value ='}'; } {kind = TOKEN_RIGHTBRACE; ; index = 79 ; length = 1 line = 4 ; column = 0 ; value ='}'; }
{kind = TOKEN_VERTEX; ; index = 89 ; length = 6 line = 6 ; column = 0 ; value ='vertex'; } {kind = TOKEN_VERTEX; ; index = 84 ; length = 6 line = 6 ; column = 0 ; value ='vertex'; }
{kind = TOKEN_IDENTIFIER; ; index = 96 ; length = 4 line = 6 ; column = 7 ; value ='main'; } {kind = TOKEN_IDENTIFIER; ; index = 91 ; length = 4 line = 6 ; column = 7 ; value ='main'; }
{kind = TOKEN_DOUBLECOLON; ; index = 101 ; length = 2 line = 6 ; column = 12 ; value ='::'; } {kind = TOKEN_DOUBLECOLON; ; index = 96 ; length = 2 line = 6 ; column = 12 ; value ='::'; }
{kind = TOKEN_LEFTPAREN; ; index = 104 ; length = 1 line = 6 ; column = 15 ; value ='('; } {kind = TOKEN_LEFTPAREN; ; index = 99 ; length = 1 line = 6 ; column = 15 ; value ='('; }
{kind = TOKEN_IDENTIFIER; ; index = 105 ; length = 3 line = 6 ; column = 16 ; value ='pos'; } {kind = TOKEN_IDENTIFIER; ; index = 100 ; length = 3 line = 6 ; column = 16 ; value ='pos'; }
{kind = TOKEN_COLON; ; index = 109 ; length = 1 line = 6 ; column = 20 ; value =':'; } {kind = TOKEN_COLON; ; index = 104 ; length = 1 line = 6 ; column = 20 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 111 ; length = 6 line = 6 ; column = 22 ; value ='float4'; } {kind = TOKEN_IDENTIFIER; ; index = 106 ; length = 6 line = 6 ; column = 22 ; value ='float4'; }
{kind = TOKEN_AT; ; index = 118 ; length = 1 line = 6 ; column = 29 ; value ='@'; } {kind = TOKEN_AT; ; index = 113 ; length = 1 line = 6 ; column = 29 ; value ='@'; }
{kind = TOKEN_IDENTIFIER; ; index = 119 ; length = 8 line = 6 ; column = 30 ; value ='position'; } {kind = TOKEN_IDENTIFIER; ; index = 114 ; length = 8 line = 6 ; column = 30 ; value ='position'; }
{kind = TOKEN_RIGHTPAREN; ; index = 127 ; length = 1 line = 6 ; column = 38 ; value =')'; } {kind = TOKEN_RIGHTPAREN; ; index = 122 ; length = 1 line = 6 ; column = 38 ; value =')'; }
{kind = TOKEN_ARROW; ; index = 129 ; length = 2 line = 6 ; column = 40 ; value ='->'; } {kind = TOKEN_ARROW; ; index = 124 ; length = 2 line = 6 ; column = 40 ; value ='->'; }
{kind = TOKEN_IDENTIFIER; ; index = 132 ; length = 6 line = 6 ; column = 43 ; value ='float4'; } {kind = TOKEN_IDENTIFIER; ; index = 127 ; length = 6 line = 6 ; column = 43 ; value ='float4'; }
{kind = TOKEN_AT; ; index = 139 ; length = 1 line = 6 ; column = 50 ; value ='@'; } {kind = TOKEN_AT; ; index = 134 ; length = 1 line = 6 ; column = 50 ; value ='@'; }
{kind = TOKEN_IDENTIFIER; ; index = 140 ; length = 8 line = 6 ; column = 51 ; value ='position'; } {kind = TOKEN_IDENTIFIER; ; index = 135 ; length = 8 line = 6 ; column = 51 ; value ='position'; }
{kind = TOKEN_LEFTBRACE; ; index = 149 ; length = 1 line = 6 ; column = 60 ; value ='{'; } {kind = TOKEN_LEFTBRACE; ; index = 144 ; length = 1 line = 6 ; column = 60 ; value ='{'; }
{kind = TOKEN_RETURN; ; index = 153 ; length = 6 line = 7 ; column = 0 ; value ='return'; } {kind = TOKEN_IDENTIFIER; ; index = 148 ; length = 2 line = 7 ; column = 0 ; value ='mv'; }
{kind = TOKEN_IDENTIFIER; ; index = 160 ; length = 3 line = 7 ; column = 7 ; value ='mul'; } {kind = TOKEN_COLON; ; index = 151 ; length = 1 line = 7 ; column = 3 ; value =':'; }
{kind = TOKEN_LEFTPAREN; ; index = 163 ; length = 1 line = 7 ; column = 10 ; value ='('; } {kind = TOKEN_IDENTIFIER; ; index = 153 ; length = 6 line = 7 ; column = 5 ; value ='float4'; }
{kind = TOKEN_IDENTIFIER; ; index = 164 ; length = 10 line = 7 ; column = 11 ; value ='projection'; } {kind = TOKEN_ASSIGN; ; index = 160 ; length = 1 line = 7 ; column = 12 ; value ='='; }
{kind = TOKEN_COMMA; ; index = 174 ; length = 1 line = 7 ; column = 21 ; value =','; } {kind = TOKEN_IDENTIFIER; ; index = 162 ; length = 3 line = 7 ; column = 14 ; value ='mul'; }
{kind = TOKEN_IDENTIFIER; ; index = 176 ; length = 3 line = 7 ; column = 23 ; value ='mul'; } {kind = TOKEN_LEFTPAREN; ; index = 165 ; length = 1 line = 7 ; column = 17 ; value ='('; }
{kind = TOKEN_LEFTPAREN; ; index = 179 ; length = 1 line = 7 ; column = 26 ; value ='('; } {kind = TOKEN_IDENTIFIER; ; index = 166 ; length = 6 line = 7 ; column = 18 ; value ='camera'; }
{kind = TOKEN_IDENTIFIER; ; index = 180 ; length = 4 line = 7 ; column = 27 ; value ='view'; } {kind = TOKEN_DOT; ; index = 172 ; length = 1 line = 7 ; column = 24 ; value ='.'; }
{kind = TOKEN_COMMA; ; index = 184 ; length = 1 line = 7 ; column = 31 ; value =','; } {kind = TOKEN_IDENTIFIER; ; index = 173 ; length = 4 line = 7 ; column = 25 ; value ='view'; }
{kind = TOKEN_IDENTIFIER; ; index = 186 ; length = 3 line = 7 ; column = 33 ; value ='pos'; } {kind = TOKEN_COMMA; ; index = 177 ; length = 1 line = 7 ; column = 29 ; value =','; }
{kind = TOKEN_RIGHTPAREN; ; index = 189 ; length = 1 line = 7 ; column = 36 ; value =')'; } {kind = TOKEN_IDENTIFIER; ; index = 179 ; length = 3 line = 7 ; column = 31 ; value ='pos'; }
{kind = TOKEN_RIGHTPAREN; ; index = 190 ; length = 1 line = 7 ; column = 37 ; value =')'; } {kind = TOKEN_RIGHTPAREN; ; index = 182 ; length = 1 line = 7 ; column = 34 ; value =')'; }
{kind = TOKEN_SEMICOLON; ; index = 191 ; length = 1 line = 7 ; column = 38 ; value =';'; } {kind = TOKEN_SEMICOLON; ; index = 183 ; length = 1 line = 7 ; column = 35 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 194 ; length = 1 line = 8 ; column = 0 ; value ='}'; } {kind = TOKEN_IDENTIFIER; ; index = 187 ; length = 3 line = 8 ; column = 0 ; value ='mvp'; }
{kind = TOKEN_PIXEL; ; index = 199 ; length = 5 line = 10 ; column = 0 ; value ='pixel'; } {kind = TOKEN_COLON; ; index = 191 ; length = 1 line = 8 ; column = 4 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 205 ; length = 4 line = 10 ; column = 6 ; value ='main'; } {kind = TOKEN_IDENTIFIER; ; index = 193 ; length = 6 line = 8 ; column = 6 ; value ='float4'; }
{kind = TOKEN_DOUBLECOLON; ; index = 210 ; length = 2 line = 10 ; column = 11 ; value ='::'; } {kind = TOKEN_ASSIGN; ; index = 200 ; length = 1 line = 8 ; column = 13 ; value ='='; }
{kind = TOKEN_LEFTPAREN; ; index = 213 ; length = 1 line = 10 ; column = 14 ; value ='('; } {kind = TOKEN_IDENTIFIER; ; index = 202 ; length = 3 line = 8 ; column = 15 ; value ='mul'; }
{kind = TOKEN_RIGHTPAREN; ; index = 214 ; length = 1 line = 10 ; column = 15 ; value =')'; } {kind = TOKEN_LEFTPAREN; ; index = 205 ; length = 1 line = 8 ; column = 18 ; value ='('; }
{kind = TOKEN_ARROW; ; index = 216 ; length = 2 line = 10 ; column = 17 ; value ='->'; } {kind = TOKEN_IDENTIFIER; ; index = 206 ; length = 6 line = 8 ; column = 19 ; value ='camera'; }
{kind = TOKEN_IDENTIFIER; ; index = 219 ; length = 6 line = 10 ; column = 20 ; value ='float4'; } {kind = TOKEN_DOT; ; index = 212 ; length = 1 line = 8 ; column = 25 ; value ='.'; }
{kind = TOKEN_AT; ; index = 226 ; length = 1 line = 10 ; column = 27 ; value ='@'; } {kind = TOKEN_IDENTIFIER; ; index = 213 ; length = 10 line = 8 ; column = 26 ; value ='projection'; }
{kind = TOKEN_IDENTIFIER; ; index = 227 ; length = 6 line = 10 ; column = 28 ; value ='target'; } {kind = TOKEN_COMMA; ; index = 223 ; length = 1 line = 8 ; column = 36 ; value =','; }
{kind = TOKEN_LEFTBRACE; ; index = 234 ; length = 1 line = 10 ; column = 35 ; value ='{'; } {kind = TOKEN_IDENTIFIER; ; index = 225 ; length = 2 line = 8 ; column = 38 ; value ='mv'; }
{kind = TOKEN_RETURN; ; index = 238 ; length = 6 line = 11 ; column = 0 ; value ='return'; } {kind = TOKEN_RIGHTPAREN; ; index = 227 ; length = 1 line = 8 ; column = 40 ; value =')'; }
{kind = TOKEN_IDENTIFIER; ; index = 245 ; length = 5 line = 11 ; column = 7 ; value ='float'; } {kind = TOKEN_SEMICOLON; ; index = 228 ; length = 1 line = 8 ; column = 41 ; value =';'; }
{kind = TOKEN_LEFTPAREN; ; index = 250 ; length = 1 line = 11 ; column = 12 ; value ='('; } {kind = TOKEN_RETURN; ; index = 232 ; length = 6 line = 9 ; column = 0 ; value ='return'; }
{kind = TOKEN_FLOATLITERAL; ; index = 251 ; length = 3 line = 11 ; column = 13 ; value ='0.5'; } {kind = TOKEN_IDENTIFIER; ; index = 239 ; length = 3 line = 9 ; column = 7 ; value ='mvp'; }
{kind = TOKEN_COMMA; ; index = 254 ; length = 1 line = 11 ; column = 16 ; value =','; } {kind = TOKEN_SEMICOLON; ; index = 242 ; length = 1 line = 9 ; column = 10 ; value =';'; }
{kind = TOKEN_FLOATLITERAL; ; index = 256 ; length = 3 line = 11 ; column = 18 ; value ='0.5'; } {kind = TOKEN_RIGHTBRACE; ; index = 245 ; length = 1 line = 10 ; column = 0 ; value ='}'; }
{kind = TOKEN_COMMA; ; index = 259 ; length = 1 line = 11 ; column = 21 ; value =','; } {kind = TOKEN_PIXEL; ; index = 250 ; length = 5 line = 12 ; column = 0 ; value ='pixel'; }
{kind = TOKEN_FLOATLITERAL; ; index = 261 ; length = 3 line = 11 ; column = 23 ; value ='0.5'; } {kind = TOKEN_IDENTIFIER; ; index = 256 ; length = 4 line = 12 ; column = 6 ; value ='main'; }
{kind = TOKEN_COMMA; ; index = 264 ; length = 1 line = 11 ; column = 26 ; value =','; } {kind = TOKEN_DOUBLECOLON; ; index = 261 ; length = 2 line = 12 ; column = 11 ; value ='::'; }
{kind = TOKEN_FLOATLITERAL; ; index = 266 ; length = 3 line = 11 ; column = 28 ; value ='1'; } {kind = TOKEN_LEFTPAREN; ; index = 264 ; length = 1 line = 12 ; column = 14 ; value ='('; }
{kind = TOKEN_RIGHTPAREN; ; index = 269 ; length = 1 line = 11 ; column = 31 ; value =')'; } {kind = TOKEN_RIGHTPAREN; ; index = 265 ; length = 1 line = 12 ; column = 15 ; value =')'; }
{kind = TOKEN_SEMICOLON; ; index = 270 ; length = 1 line = 11 ; column = 32 ; value =';'; } {kind = TOKEN_ARROW; ; index = 267 ; length = 2 line = 12 ; column = 17 ; value ='->'; }
{kind = TOKEN_RIGHTBRACE; ; index = 273 ; length = 1 line = 12 ; column = 0 ; value ='}'; } {kind = TOKEN_IDENTIFIER; ; index = 270 ; length = 6 line = 12 ; column = 20 ; value ='float4'; }
{kind = TOKEN_EOF; ; index = 276 ; length = 0 line = 13 ; column = 0 ; value =''; } {kind = TOKEN_AT; ; index = 277 ; length = 1 line = 12 ; column = 27 ; value ='@'; }
{kind = TOKEN_IDENTIFIER; ; index = 278 ; length = 6 line = 12 ; column = 28 ; value ='target'; }
{kind = TOKEN_LEFTBRACE; ; index = 285 ; length = 1 line = 12 ; column = 35 ; value ='{'; }
{kind = TOKEN_RETURN; ; index = 289 ; length = 6 line = 13 ; column = 0 ; value ='return'; }
{kind = TOKEN_IDENTIFIER; ; index = 296 ; length = 6 line = 13 ; column = 7 ; value ='float4'; }
{kind = TOKEN_LEFTPAREN; ; index = 302 ; length = 1 line = 13 ; column = 13 ; value ='('; }
{kind = TOKEN_FLOATLITERAL; ; index = 303 ; length = 3 line = 13 ; column = 14 ; value ='0.5'; }
{kind = TOKEN_COMMA; ; index = 306 ; length = 1 line = 13 ; column = 17 ; value =','; }
{kind = TOKEN_FLOATLITERAL; ; index = 308 ; length = 3 line = 13 ; column = 19 ; value ='0.5'; }
{kind = TOKEN_COMMA; ; index = 311 ; length = 1 line = 13 ; column = 22 ; value =','; }
{kind = TOKEN_FLOATLITERAL; ; index = 313 ; length = 3 line = 13 ; column = 24 ; value ='0.5'; }
{kind = TOKEN_COMMA; ; index = 316 ; length = 1 line = 13 ; column = 27 ; value =','; }
{kind = TOKEN_FLOATLITERAL; ; index = 318 ; length = 3 line = 13 ; column = 29 ; value ='1'; }
{kind = TOKEN_RIGHTPAREN; ; index = 321 ; length = 1 line = 13 ; column = 32 ; value =')'; }
{kind = TOKEN_SEMICOLON; ; index = 322 ; length = 1 line = 13 ; column = 33 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 325 ; length = 1 line = 14 ; column = 0 ; value ='}'; }
{kind = TOKEN_EOF; ; index = 328 ; length = 0 line = 15 ; column = 0 ; value =''; }

View File

@@ -1,4 +1,4 @@
test/float_suffix.shd:2,12: error: We don't use 'f' suffixes for floating point values. test/float_suffix.inx:2,12: error: We don't use 'f' suffixes for floating point values.
 x : float = 2.0f  x : float = 2.0f
^^^^ ^^^^
 

View File

@@ -1,45 +1,45 @@
{kind = TOKEN_IDENTIFIER; ; index = 0 ; length = 5 line = 1 ; column = 0 ; value ='props'; } {kind = TOKEN_IDENTIFIER; ; index = 0 ; length = 5 line = 1 ; column = 0 ; value ='props'; }
{kind = TOKEN_COLON; ; index = 6 ; length = 1 line = 1 ; column = 6 ; value =':'; } {kind = TOKEN_DOUBLECOLON; ; index = 6 ; length = 2 line = 1 ; column = 6 ; value ='::'; }
{kind = TOKEN_PROPERTIES; ; index = 8 ; length = 10 line = 1 ; column = 8 ; value ='properties'; } {kind = TOKEN_PROPERTIES; ; index = 9 ; length = 10 line = 1 ; column = 9 ; value ='properties'; }
{kind = TOKEN_LEFTBRACE; ; index = 19 ; length = 1 line = 1 ; column = 19 ; value ='{'; } {kind = TOKEN_LEFTBRACE; ; index = 20 ; length = 1 line = 1 ; column = 20 ; value ='{'; }
{kind = TOKEN_IDENTIFIER; ; index = 23 ; length = 5 line = 2 ; column = 0 ; value ='color'; } {kind = TOKEN_IDENTIFIER; ; index = 24 ; length = 5 line = 2 ; column = 0 ; value ='color'; }
{kind = TOKEN_COLON; ; index = 29 ; length = 1 line = 2 ; column = 6 ; value =':'; } {kind = TOKEN_COLON; ; index = 30 ; length = 1 line = 2 ; column = 6 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 31 ; length = 6 line = 2 ; column = 8 ; value ='float4'; } {kind = TOKEN_IDENTIFIER; ; index = 32 ; length = 6 line = 2 ; column = 8 ; value ='float4'; }
{kind = TOKEN_SEMICOLON; ; index = 37 ; length = 1 line = 2 ; column = 14 ; value =';'; } {kind = TOKEN_SEMICOLON; ; index = 38 ; length = 1 line = 2 ; column = 14 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 40 ; length = 1 line = 3 ; column = 0 ; value ='}'; } {kind = TOKEN_RIGHTBRACE; ; index = 41 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
{kind = TOKEN_VERTEX; ; index = 45 ; length = 6 line = 5 ; column = 0 ; value ='vertex'; } {kind = TOKEN_VERTEX; ; index = 46 ; length = 6 line = 5 ; column = 0 ; value ='vertex'; }
{kind = TOKEN_IDENTIFIER; ; index = 52 ; length = 4 line = 5 ; column = 7 ; value ='main'; } {kind = TOKEN_IDENTIFIER; ; index = 53 ; length = 4 line = 5 ; column = 7 ; value ='main'; }
{kind = TOKEN_DOUBLECOLON; ; index = 57 ; length = 2 line = 5 ; column = 12 ; value ='::'; } {kind = TOKEN_DOUBLECOLON; ; index = 58 ; length = 2 line = 5 ; column = 12 ; value ='::'; }
{kind = TOKEN_LEFTPAREN; ; index = 60 ; length = 1 line = 5 ; column = 15 ; value ='('; } {kind = TOKEN_LEFTPAREN; ; index = 61 ; length = 1 line = 5 ; column = 15 ; value ='('; }
{kind = TOKEN_IDENTIFIER; ; index = 61 ; length = 3 line = 5 ; column = 16 ; value ='pos'; } {kind = TOKEN_IDENTIFIER; ; index = 62 ; length = 3 line = 5 ; column = 16 ; value ='pos'; }
{kind = TOKEN_COLON; ; index = 65 ; length = 1 line = 5 ; column = 20 ; value =':'; } {kind = TOKEN_COLON; ; index = 66 ; length = 1 line = 5 ; column = 20 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 67 ; length = 6 line = 5 ; column = 22 ; value ='float4'; } {kind = TOKEN_IDENTIFIER; ; index = 68 ; length = 6 line = 5 ; column = 22 ; value ='float4'; }
{kind = TOKEN_AT; ; index = 74 ; length = 1 line = 5 ; column = 29 ; value ='@'; } {kind = TOKEN_AT; ; index = 75 ; length = 1 line = 5 ; column = 29 ; value ='@'; }
{kind = TOKEN_IDENTIFIER; ; index = 75 ; length = 8 line = 5 ; column = 30 ; value ='position'; } {kind = TOKEN_IDENTIFIER; ; index = 76 ; length = 8 line = 5 ; column = 30 ; value ='position'; }
{kind = TOKEN_RIGHTPAREN; ; index = 83 ; length = 1 line = 5 ; column = 38 ; value =')'; } {kind = TOKEN_RIGHTPAREN; ; index = 84 ; length = 1 line = 5 ; column = 38 ; value =')'; }
{kind = TOKEN_ARROW; ; index = 85 ; length = 2 line = 5 ; column = 40 ; value ='->'; } {kind = TOKEN_ARROW; ; index = 86 ; length = 2 line = 5 ; column = 40 ; value ='->'; }
{kind = TOKEN_IDENTIFIER; ; index = 88 ; length = 6 line = 5 ; column = 43 ; value ='float4'; } {kind = TOKEN_IDENTIFIER; ; index = 89 ; length = 6 line = 5 ; column = 43 ; value ='float4'; }
{kind = TOKEN_AT; ; index = 95 ; length = 1 line = 5 ; column = 50 ; value ='@'; } {kind = TOKEN_AT; ; index = 96 ; length = 1 line = 5 ; column = 50 ; value ='@'; }
{kind = TOKEN_IDENTIFIER; ; index = 96 ; length = 8 line = 5 ; column = 51 ; value ='position'; } {kind = TOKEN_IDENTIFIER; ; index = 97 ; length = 8 line = 5 ; column = 51 ; value ='position'; }
{kind = TOKEN_LEFTBRACE; ; index = 105 ; length = 1 line = 5 ; column = 60 ; value ='{'; } {kind = TOKEN_LEFTBRACE; ; index = 106 ; length = 1 line = 5 ; column = 60 ; value ='{'; }
{kind = TOKEN_RETURN; ; index = 109 ; length = 6 line = 6 ; column = 0 ; value ='return'; } {kind = TOKEN_RETURN; ; index = 110 ; length = 6 line = 6 ; column = 0 ; value ='return'; }
{kind = TOKEN_IDENTIFIER; ; index = 116 ; length = 3 line = 6 ; column = 7 ; value ='pos'; } {kind = TOKEN_IDENTIFIER; ; index = 117 ; length = 3 line = 6 ; column = 7 ; value ='pos'; }
{kind = TOKEN_SEMICOLON; ; index = 119 ; length = 1 line = 6 ; column = 10 ; value =';'; } {kind = TOKEN_SEMICOLON; ; index = 120 ; length = 1 line = 6 ; column = 10 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 122 ; length = 1 line = 7 ; column = 0 ; value ='}'; } {kind = TOKEN_RIGHTBRACE; ; index = 123 ; length = 1 line = 7 ; column = 0 ; value ='}'; }
{kind = TOKEN_PIXEL; ; index = 127 ; length = 5 line = 9 ; column = 0 ; value ='pixel'; } {kind = TOKEN_PIXEL; ; index = 128 ; length = 5 line = 9 ; column = 0 ; value ='pixel'; }
{kind = TOKEN_IDENTIFIER; ; index = 133 ; length = 4 line = 9 ; column = 6 ; value ='main'; } {kind = TOKEN_IDENTIFIER; ; index = 134 ; length = 4 line = 9 ; column = 6 ; value ='main'; }
{kind = TOKEN_DOUBLECOLON; ; index = 138 ; length = 2 line = 9 ; column = 11 ; value ='::'; } {kind = TOKEN_DOUBLECOLON; ; index = 139 ; length = 2 line = 9 ; column = 11 ; value ='::'; }
{kind = TOKEN_LEFTPAREN; ; index = 141 ; length = 1 line = 9 ; column = 14 ; value ='('; } {kind = TOKEN_LEFTPAREN; ; index = 142 ; length = 1 line = 9 ; column = 14 ; value ='('; }
{kind = TOKEN_RIGHTPAREN; ; index = 142 ; length = 1 line = 9 ; column = 15 ; value =')'; } {kind = TOKEN_RIGHTPAREN; ; index = 143 ; length = 1 line = 9 ; column = 15 ; value =')'; }
{kind = TOKEN_ARROW; ; index = 144 ; length = 2 line = 9 ; column = 17 ; value ='->'; } {kind = TOKEN_ARROW; ; index = 145 ; length = 2 line = 9 ; column = 17 ; value ='->'; }
{kind = TOKEN_IDENTIFIER; ; index = 147 ; length = 6 line = 9 ; column = 20 ; value ='float4'; } {kind = TOKEN_IDENTIFIER; ; index = 148 ; length = 6 line = 9 ; column = 20 ; value ='float4'; }
{kind = TOKEN_AT; ; index = 154 ; length = 1 line = 9 ; column = 27 ; value ='@'; } {kind = TOKEN_AT; ; index = 155 ; length = 1 line = 9 ; column = 27 ; value ='@'; }
{kind = TOKEN_IDENTIFIER; ; index = 155 ; length = 7 line = 9 ; column = 28 ; value ='target0'; } {kind = TOKEN_IDENTIFIER; ; index = 156 ; length = 7 line = 9 ; column = 28 ; value ='target0'; }
{kind = TOKEN_LEFTBRACE; ; index = 163 ; length = 1 line = 9 ; column = 36 ; value ='{'; } {kind = TOKEN_LEFTBRACE; ; index = 164 ; length = 1 line = 9 ; column = 36 ; value ='{'; }
{kind = TOKEN_RETURN; ; index = 169 ; length = 6 line = 10 ; column = 2 ; value ='return'; } {kind = TOKEN_RETURN; ; index = 170 ; length = 6 line = 10 ; column = 2 ; value ='return'; }
{kind = TOKEN_IDENTIFIER; ; index = 176 ; length = 5 line = 10 ; column = 9 ; value ='props'; } {kind = TOKEN_IDENTIFIER; ; index = 177 ; length = 5 line = 10 ; column = 9 ; value ='props'; }
{kind = TOKEN_DOT; ; index = 181 ; length = 1 line = 10 ; column = 14 ; value ='.'; } {kind = TOKEN_DOT; ; index = 182 ; length = 1 line = 10 ; column = 14 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 182 ; length = 5 line = 10 ; column = 15 ; value ='color'; } {kind = TOKEN_IDENTIFIER; ; index = 183 ; length = 5 line = 10 ; column = 15 ; value ='color'; }
{kind = TOKEN_SEMICOLON; ; index = 187 ; length = 1 line = 10 ; column = 20 ; value =';'; } {kind = TOKEN_SEMICOLON; ; index = 188 ; length = 1 line = 10 ; column = 20 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 190 ; length = 1 line = 11 ; column = 0 ; value ='}'; } {kind = TOKEN_RIGHTBRACE; ; index = 191 ; length = 1 line = 11 ; column = 0 ; value ='}'; }
{kind = TOKEN_EOF; ; index = 193 ; length = 0 line = 12 ; column = 0 ; value =''; } {kind = TOKEN_EOF; ; index = 194 ; length = 0 line = 12 ; column = 0 ; value =''; }

View File

@@ -1,33 +1,33 @@
test/assign_arithmetic_expression.shd lex test/assign_arithmetic_expression.inx lex
test/basic_property_and_return_value.shd lex test/basic_property_and_return_value.inx lex
test/complicated_computation.shd lex test/complicated_computation.inx lex
test/constant_buffer.shd lex test/constant_buffer.inx lex
test/empty_struct.shd lex test/empty_struct.inx lex
test/empty_vertex_main.shd lex test/empty_vertex_main.inx lex
test/empty_vertex_main_with_position_parameter.shd lex test/empty_vertex_main_with_position_parameter.inx lex
test/field_assignment.shd lex test/field_assignment.inx lex
test/field_without_type_specifier.shd lex test/field_without_type_specifier.inx lex
test/float_suffix.shd lex test/float_suffix.inx lex
test/function_call.shd lex test/function_call.inx lex
test/function_call_out_of_order_declaration.shd lex test/function_call_out_of_order_declaration.inx lex
test/function_call_return.shd lex test/function_call_return.inx lex
test/functions_with_same_name.shd lex test/functions_with_same_name.inx lex
test/function_with_int_return.shd lex test/function_with_int_return.inx lex
test/meta_block.shd lex test/meta_block.inx lex
test/multiple_functions.shd lex test/multiple_functions.inx lex
test/multiple_semicolons_everywhere.shd lex test/multiple_semicolons_everywhere.inx lex
test/pass_and_access_struct_fields_in_functions.shd lex test/pass_and_access_struct_fields_in_functions.inx lex
test/passthrough.shd lex test/passthrough.inx lex
test/property_rename.shd lex test/property_rename.inx lex
test/redeclared_variable.shd lex test/redeclared_variable.inx lex
test/simple_struct_access.shd lex test/simple_struct_access.inx lex
test/struct_access_primitive_type.shd lex test/struct_access_primitive_type.inx lex
test/struct_within_struct.shd lex test/struct_within_struct.inx lex
test/type_as_variable_name.shd lex test/type_as_variable_name.inx lex
test/undeclared_function.shd lex test/undeclared_function.inx lex
test/undeclared_symbol.shd lex test/undeclared_symbol.inx lex
test/unknown_overload.shd lex test/unknown_overload.inx lex
test/use_builtin_functions.shd lex test/use_builtin_functions.inx lex
test/wrong_argument_count.shd lex test/wrong_argument_count.inx lex
test/wrong_multiply.shd lex test/wrong_multiply.inx lex
test/wrong_type_for_function.shd lex test/wrong_type_for_function.inx lex

View File

@@ -0,0 +1,14 @@
(program
(constant_buffer camera
[(:= projection float4x4)
(:= view float4x4)])
(fun vertex vs_main -> float4 (@position)
[(:= pos float4 (@position))]
(:= mv float4 (mul camera.view pos))
(:= mvp float4 (mul camera.projection mv))
(return mvp))
(fun pixel ps_main -> float4 (@target)
[]
(return (float4 0.5 0.5 0.5 1))))

View File

@@ -1,4 +1,4 @@
test/field_without_type_specifier.shd:2,0: error: Expected type specifier after field name. test/field_without_type_specifier.inx:2,0: error: Expected type specifier after field name.
x := 5.0; x := 5.0;
^ ^
 

View File

@@ -0,0 +1,11 @@
(program
(properties props
[(:= color float4)])
(fun vertex vs_main -> float4 (@position)
[(:= pos float4 (@position))]
(return pos))
(fun pixel ps_main -> float4 (@target0)
[]
(return props.color)))

View File

@@ -1,33 +1,33 @@
test/assign_arithmetic_expression.shd parse test/assign_arithmetic_expression.inx parse
test/basic_property_and_return_value.shd parse test/basic_property_and_return_value.inx parse
test/complicated_computation.shd parse test/complicated_computation.inx parse
test/constant_buffer.shd parse test/constant_buffer.inx parse
test/empty_struct.shd parse test/empty_struct.inx parse
test/empty_vertex_main.shd parse test/empty_vertex_main.inx parse
test/empty_vertex_main_with_position_parameter.shd parse test/empty_vertex_main_with_position_parameter.inx parse
test/field_assignment.shd parse test/field_assignment.inx parse
test/field_without_type_specifier.shd parse test/field_without_type_specifier.inx parse
test/float_suffix.shd parse test/float_suffix.inx parse
test/function_call.shd parse test/function_call.inx parse
test/function_call_out_of_order_declaration.shd parse test/function_call_out_of_order_declaration.inx parse
test/function_call_return.shd parse test/function_call_return.inx parse
test/functions_with_same_name.shd parse test/functions_with_same_name.inx parse
test/function_with_int_return.shd parse test/function_with_int_return.inx parse
test/meta_block.shd parse test/meta_block.inx parse
test/multiple_functions.shd parse test/multiple_functions.inx parse
test/multiple_semicolons_everywhere.shd parse test/multiple_semicolons_everywhere.inx parse
test/pass_and_access_struct_fields_in_functions.shd parse test/pass_and_access_struct_fields_in_functions.inx parse
test/passthrough.shd parse test/passthrough.inx parse
test/property_rename.shd parse test/property_rename.inx parse
test/redeclared_variable.shd parse test/redeclared_variable.inx parse
test/simple_struct_access.shd parse test/simple_struct_access.inx parse
test/struct_access_primitive_type.shd parse test/struct_access_primitive_type.inx parse
test/struct_within_struct.shd parse test/struct_within_struct.inx parse
test/type_as_variable_name.shd parse test/type_as_variable_name.inx parse
test/undeclared_function.shd parse test/undeclared_function.inx parse
test/undeclared_symbol.shd parse test/undeclared_symbol.inx parse
test/unknown_overload.shd parse test/unknown_overload.inx parse
test/use_builtin_functions.shd parse test/use_builtin_functions.inx parse
test/wrong_argument_count.shd parse test/wrong_argument_count.inx parse
test/wrong_multiply.shd parse test/wrong_multiply.inx parse
test/wrong_type_for_function.shd parse test/wrong_type_for_function.inx parse

View File

@@ -1,8 +1,8 @@
test/functions_with_same_name.shd:2,0: error: Redeclaration of 'foo' test/functions_with_same_name.inx:2,0: error: Redeclaration of 'foo'
 foo :: () {  foo :: () {
^^^ ^^^
test/functions_with_same_name.shd:1,0: info: Here is the first declaration of 'foo' test/functions_with_same_name.inx:1,0: info: Here is the first declaration of 'foo'
 foo :: () {  foo :: () {
^^^ ^^^
 

View File

@@ -0,0 +1,12 @@
scope (global) [
[pixel__ps_main] : () -> float4
[vertex__vs_main] : (pos : float4) -> float4
[props] : {color : float4}
scope (props) [
[color] : float4
]
scope (vertex__vs_main) [
[pos] : float4
]
scope (pixel__ps_main) []
]

View File

@@ -1,8 +1,8 @@
test/redeclared_variable.shd:3,0: error: Redeclaration of 'x' test/redeclared_variable.inx:3,0: error: Redeclaration of 'x'
 x : float = 5.0  x : float = 5.0
^ ^
test/redeclared_variable.shd:2,0: info: Here is the first declaration of 'x' test/redeclared_variable.inx:2,0: info: Here is the first declaration of 'x'
 x : float = 1.0  x : float = 1.0
^ ^
 

View File

@@ -1,4 +1,4 @@
test/struct_access_primitive_type.shd:3,0: error: Attempting to access a field on a primitive type 'int'. test/struct_access_primitive_type.inx:3,0: error: Attempting to access a field on a primitive type 'int'.
x.d = 4; x.d = 4;
^ ^
declaration: declaration:

View File

@@ -1,4 +1,4 @@
test/type_as_variable_name.shd:2,0: error: Invalid variable name 'int' test/type_as_variable_name.inx:2,0: error: Invalid variable name 'int'
 int : float = 4.0  int : float = 4.0
^^^ ^^^
 

View File

@@ -1,4 +1,4 @@
test/undeclared_function.shd:2,0: error: Attempt to call undeclared function 'foo'. test/undeclared_function.inx:2,0: error: Attempt to call undeclared function 'foo'.
 foo();  foo();
^^^ ^^^

View File

@@ -1,4 +1,4 @@
test/undeclared_symbol.shd:2,10: error: Use of undeclared symbol 'f' test/undeclared_symbol.inx:2,10: error: Use of undeclared symbol 'f'
 b : int = f;  b : int = f;
^ ^
 

View File

@@ -1,4 +1,4 @@
test/unknown_overload.shd:6,0: error: Procedure call did not match any of the possible overloads for 'foo' test/unknown_overload.inx:6,0: error: Procedure call did not match any of the possible overloads for 'foo'
 found:  found:
foo(v, v); foo(v, v);
^^^ ^^^
@@ -7,10 +7,10 @@
 foo(v, v);  foo(v, v);
^ ^
 Possible overloads:  Possible overloads:
 foo :: (v1 : float3, v2 : float3) { (test/unknown_overload.shd:1)  foo :: (v1 : float3, v2 : float3) { (test/unknown_overload.inx:1)
 foo :: (v1 : float2, v2 : float2, v3 : float2) { (test/unknown_overload.shd:2)  foo :: (v1 : float2, v2 : float2, v3 : float2) { (test/unknown_overload.inx:2)
test/unknown_overload.shd:6,4: error: Type mismatch. Expected float3 got float test/unknown_overload.inx:6,4: error: Type mismatch. Expected float3 got float
 found:  found:
foo(v, v); foo(v, v);
^ ^
@@ -20,7 +20,7 @@
got: got:
v : float = 2.0 v : float = 2.0
test/unknown_overload.shd:6,7: error: Type mismatch. Expected float3 got float test/unknown_overload.inx:6,7: error: Type mismatch. Expected float3 got float
 found:  found:
foo(v, v); foo(v, v);
^ ^

View File

@@ -1,15 +1,15 @@
test/wrong_argument_count.shd:5,19: error: Use of undeclared symbol 'w' test/wrong_argument_count.inx:5,19: error: Use of undeclared symbol 'w'
 return x * y * z * w;  return x * y * z * w;
^ ^
test/wrong_argument_count.shd:9,0: error: Procedure call did not match any of the possible overloads for 'foo' test/wrong_argument_count.inx:9,0: error: Procedure call did not match any of the possible overloads for 'foo'
 found:  found:
foo(2.0, 3.0); foo(2.0, 3.0);
^^^ ^^^
 Possible overloads:  Possible overloads:
 foo :: (x : float, y : float, z : float) -> float { (test/wrong_argument_count.shd:1)  foo :: (x : float, y : float, z : float) -> float { (test/wrong_argument_count.inx:1)
 Not enough arguments: Wanted 3, got 2.  Not enough arguments: Wanted 3, got 2.
 foo :: (x : float, y : float, z : float, w : float) -> float { (test/wrong_argument_count.shd:4)  foo :: (x : float, y : float, z : float, w : float) -> float { (test/wrong_argument_count.inx:4)
 Not enough arguments: Wanted 4, got 2.  Not enough arguments: Wanted 4, got 2.

View File

@@ -1,4 +1,4 @@
test/wrong_multiply.shd:4,34: error: Type mismatch. Expected float got float2 test/wrong_multiply.inx:4,34: error: Type mismatch. Expected float got float2
 found:  found:
result : float4 = float4(1.0, foo * res, 0.0, 1.0); result : float4 = float4(1.0, foo * res, 0.0, 1.0);
^ ^

View File

@@ -1,4 +1,4 @@
test/wrong_type_for_function.shd:11,17: error: Procedure call did not match any of the possible overloads for 'float4' test/wrong_type_for_function.inx:11,17: error: Procedure call did not match any of the possible overloads for 'float4'
 found:  found:
color : float4 = float4(y, 1.0, 1.0, 1.0); color : float4 = float4(y, 1.0, 1.0, 1.0);
^^^^^^ ^^^^^^
@@ -7,9 +7,9 @@
 color : float4 = float4(y, 1.0, 1.0, 1.0);  color : float4 = float4(y, 1.0, 1.0, 1.0);
^ ^
 Possible overloads:  Possible overloads:
 foreign float4 :: (float, float, float, float) -> float4; (test/wrong_type_for_function.shd:78)  foreign float4 :: (float, float, float, float) -> float4; (test/wrong_type_for_function.inx:78)
test/wrong_type_for_function.shd:11,24: error: Type mismatch. Expected float got float2 test/wrong_type_for_function.inx:11,24: error: Type mismatch. Expected float got float2
 found:  found:
color : float4 = float4(y, 1.0, 1.0, 1.0); color : float4 = float4(y, 1.0, 1.0, 1.0);
^ ^

View File

@@ -1,30 +1,30 @@
test/assign_arithmetic_expression.shd semant test/assign_arithmetic_expression.inx semant
test/basic_property_and_return_value.shd semant test/basic_property_and_return_value.inx semant
test/complicated_computation.shd semant test/complicated_computation.inx semant
test/constant_buffer.shd semant test/constant_buffer.inx semant
test/empty_struct.shd semant test/empty_struct.inx semant
test/empty_vertex_main.shd semant test/empty_vertex_main.inx semant
test/empty_vertex_main_with_position_parameter.shd semant test/empty_vertex_main_with_position_parameter.inx semant
test/field_assignment.shd semant test/field_assignment.inx semant
test/function_call.shd semant test/function_call.inx semant
test/function_call_out_of_order_declaration.shd semant test/function_call_out_of_order_declaration.inx semant
test/function_call_return.shd semant test/function_call_return.inx semant
test/functions_with_same_name.shd semant test/functions_with_same_name.inx semant
test/function_with_int_return.shd semant test/function_with_int_return.inx semant
test/multiple_functions.shd semant test/multiple_functions.inx semant
test/multiple_semicolons_everywhere.shd semant test/multiple_semicolons_everywhere.inx semant
test/pass_and_access_struct_fields_in_functions.shd semant test/pass_and_access_struct_fields_in_functions.inx semant
test/passthrough.shd semant test/passthrough.inx semant
test/property_rename.shd semant test/property_rename.inx semant
test/redeclared_variable.shd semant test/redeclared_variable.inx semant
test/simple_struct_access.shd semant test/simple_struct_access.inx semant
test/struct_access_primitive_type.shd semant test/struct_access_primitive_type.inx semant
test/struct_within_struct.shd semant test/struct_within_struct.inx semant
test/type_as_variable_name.shd semant test/type_as_variable_name.inx semant
test/undeclared_function.shd semant test/undeclared_function.inx semant
test/undeclared_symbol.shd semant test/undeclared_symbol.inx semant
test/unknown_overload.shd semant test/unknown_overload.inx semant
test/use_builtin_functions.shd semant test/use_builtin_functions.inx semant
test/wrong_argument_count.shd semant test/wrong_argument_count.inx semant
test/wrong_multiply.shd semant test/wrong_multiply.inx semant
test/wrong_type_for_function.shd semant test/wrong_type_for_function.inx semant

View File

@@ -2,5 +2,5 @@ vertex main :: (pos : float4 @position) -> float4 @position {
res : float2 = float2(2.0, 2.0); res : float2 = float2(2.0, 2.0);
foo : float = 1.0; foo : float = 1.0;
result : float4 = float4(1.0, foo * res, 0.0, 1.0); result : float4 = float4(1.0, foo * res, 0.0, 1.0);
return float4(1,1,1,1); return result;
} }