Compare commits
12 Commits
dev
...
aaeda22fa3
| Author | SHA1 | Date | |
|---|---|---|---|
| aaeda22fa3 | |||
| 4b927b6be9 | |||
| 85b23f90e5 | |||
| ec31046d30 | |||
| 8bd766281e | |||
| 4053400152 | |||
| 1adb289c10 | |||
| d65c6359db | |||
| d08529a3eb | |||
| 7787d1307b | |||
| 4deb07027f | |||
| f13508262b |
37
AST.jai
37
AST.jai
@@ -20,6 +20,7 @@ AST_Kind :: enum {
|
|||||||
// Operator;
|
// Operator;
|
||||||
Call;
|
Call;
|
||||||
Struct;
|
Struct;
|
||||||
|
If;
|
||||||
CBuffer;
|
CBuffer;
|
||||||
FieldList;
|
FieldList;
|
||||||
ArgList;
|
ArgList;
|
||||||
@@ -145,12 +146,13 @@ pretty_print_children :: (parent : *AST_Node, indentation : int, builder : *Stri
|
|||||||
|
|
||||||
children := parent.children;
|
children := parent.children;
|
||||||
for child : children {
|
for child : children {
|
||||||
if it_index > 0 {
|
// if it_index > 0 {
|
||||||
indent(builder, indentation);
|
// indent(builder, indentation);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if !child continue;
|
if !child continue;
|
||||||
pretty_print_node(child, 0, builder);
|
|
||||||
|
pretty_print_node(child, indentation, builder);
|
||||||
|
|
||||||
if it_index != children.count - 1 {
|
if it_index != children.count - 1 {
|
||||||
if flags & .Separator {
|
if flags & .Separator {
|
||||||
@@ -211,10 +213,15 @@ pretty_print_binary :: (node : *AST_Node, indentation : int, builder : *String_B
|
|||||||
}
|
}
|
||||||
|
|
||||||
pretty_print_unary :: (node : *AST_Node, indentation : int, builder : *String_Builder) {
|
pretty_print_unary :: (node : *AST_Node, indentation : int, builder : *String_Builder) {
|
||||||
|
indent(builder, indentation);
|
||||||
|
op := node.token;
|
||||||
|
|
||||||
|
print_to_builder(builder, op_to_string(op));
|
||||||
|
pretty_print_children(node, 0, builder, flags = 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
print_return_node :: (node : *AST_Node, indentation : int, builder : *String_Builder) {
|
print_return_node :: (node : *AST_Node, indentation : int, builder : *String_Builder) {
|
||||||
|
indent(builder, indentation);
|
||||||
append(builder, "(return ");
|
append(builder, "(return ");
|
||||||
|
|
||||||
pretty_print_children(node, 0, builder);
|
pretty_print_children(node, 0, builder);
|
||||||
@@ -222,6 +229,25 @@ print_return_node :: (node : *AST_Node, indentation : int, builder : *String_Bui
|
|||||||
append(builder, ")");
|
append(builder, ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pretty_print_if :: (node : *AST_Node, indentation : int, builder : *String_Builder) {
|
||||||
|
indent(builder, indentation);
|
||||||
|
append(builder, "(if ");
|
||||||
|
|
||||||
|
condition := node.children[0];
|
||||||
|
pretty_print_node(condition, 0, builder);
|
||||||
|
append(builder, "\n");
|
||||||
|
|
||||||
|
body := node.children[1];
|
||||||
|
pretty_print_node(body, indentation + 1, builder);
|
||||||
|
|
||||||
|
if node.children.count == 3 {
|
||||||
|
append(builder, "\n");
|
||||||
|
pretty_print_node(node.children[2], indentation + 1, builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
append(builder, ")");
|
||||||
|
}
|
||||||
|
|
||||||
print_expression_statement :: (node : *AST_Node, indentation : int, builder : *String_Builder) {
|
print_expression_statement :: (node : *AST_Node, indentation : int, builder : *String_Builder) {
|
||||||
indent(builder, indentation);
|
indent(builder, indentation);
|
||||||
|
|
||||||
@@ -235,6 +261,9 @@ pretty_print_node :: (node : *AST_Node, indentation : int, builder : *String_Bui
|
|||||||
case .Return; {
|
case .Return; {
|
||||||
print_return_node(node, indentation, builder);
|
print_return_node(node, indentation, builder);
|
||||||
}
|
}
|
||||||
|
case .If; {
|
||||||
|
pretty_print_if(node, indentation + 2, builder);
|
||||||
|
}
|
||||||
case .Struct;
|
case .Struct;
|
||||||
case .ArgList; {
|
case .ArgList; {
|
||||||
pretty_print_arglist(node, indentation + 2, builder);
|
pretty_print_arglist(node, indentation + 2, builder);
|
||||||
|
|||||||
45
Codegen.jai
45
Codegen.jai
@@ -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__");
|
||||||
@@ -420,7 +420,10 @@ emit_node :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case .Unary; {
|
case .Unary; {
|
||||||
assert(false, "Not implemented yet: unary");
|
indent(*state.builder, indentation);
|
||||||
|
|
||||||
|
emit_operator(state, node.token.kind);
|
||||||
|
emit_node(state, node.children[0], 0);
|
||||||
}
|
}
|
||||||
case .Expression_Statement; {
|
case .Expression_Statement; {
|
||||||
emit_node(state, node.children[0], indentation);
|
emit_node(state, node.children[0], indentation);
|
||||||
@@ -450,7 +453,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 +470,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];
|
||||||
|
|
||||||
@@ -504,6 +507,22 @@ emit_declaration :: (state : *Codegen_State, node : *AST_Node) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
codegen :: (result : *Compile_Result) {
|
||||||
|
if result.had_error {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for *file : result.files {
|
||||||
|
state : Codegen_State;
|
||||||
|
init_codegen_state(*state, file.ast_root, file.semantic_check_result, .HLSL);
|
||||||
|
|
||||||
|
//@Incomplete(nb): just call the codegen function for now with old result struct
|
||||||
|
codegen_result := codegen(*state);
|
||||||
|
|
||||||
|
file.codegen_result_text = copy_string(codegen_result.result_text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
codegen :: (state : *Codegen_State) -> Codegen_Result {
|
codegen :: (state : *Codegen_State) -> Codegen_Result {
|
||||||
found_function : bool = false;
|
found_function : bool = false;
|
||||||
// found_struct : bool = false;
|
// found_struct : bool = false;
|
||||||
|
|||||||
@@ -506,14 +506,18 @@ lex :: (result : *Compile_Result) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for file : result.files {
|
for *file : result.files {
|
||||||
lexer : Lexer;
|
lexer : Lexer;
|
||||||
init_lexer_from_string(*lexer, file.file.source);
|
init_lexer_from_string(*lexer, file.file.source);
|
||||||
|
lexer.path = file.file.path;
|
||||||
token : *Token = scan_next_token(*lexer);
|
token : *Token = scan_next_token(*lexer);
|
||||||
while token && token.kind != .TOKEN_EOF {
|
while token && token.kind != .TOKEN_EOF {
|
||||||
token = scan_next_token(*lexer);
|
token = scan_next_token(*lexer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
array_copy(*file.tokens.tokens, lexer.result.tokens);
|
||||||
|
result.had_error |= lexer.result.had_error;
|
||||||
|
|
||||||
// @Incomplete(nb): Temporary until we figure out a good way of passing this stuff around
|
// @Incomplete(nb): Temporary until we figure out a good way of passing this stuff around
|
||||||
copy_messages(lexer.result.messages, *result.messages);
|
copy_messages(lexer.result.messages, *result.messages);
|
||||||
}
|
}
|
||||||
|
|||||||
48
Parsing.jai
48
Parsing.jai
@@ -264,7 +264,7 @@ error_node :: (parse_state : *Parse_State, message : string) -> *AST_Node {
|
|||||||
advance_to_sync_point :: (parse_state : *Parse_State) {
|
advance_to_sync_point :: (parse_state : *Parse_State) {
|
||||||
while true {
|
while true {
|
||||||
if parse_state.current.kind == .TOKEN_SEMICOLON || parse_state.current.kind == .TOKEN_RIGHTBRACE ||
|
if parse_state.current.kind == .TOKEN_SEMICOLON || parse_state.current.kind == .TOKEN_RIGHTBRACE ||
|
||||||
parse_state.current.kind == .TOKEN_LEFTBRACE{
|
parse_state.current.kind == .TOKEN_LEFTBRACE || parse_state.current.kind == .TOKEN_EOF {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
advance(parse_state);
|
advance(parse_state);
|
||||||
@@ -415,6 +415,8 @@ binary :: (parse_state : *Parse_State, left : *AST_Node) -> *AST_Node {
|
|||||||
|
|
||||||
if op.kind == {
|
if op.kind == {
|
||||||
case .TOKEN_PLUS; #through;
|
case .TOKEN_PLUS; #through;
|
||||||
|
case .TOKEN_PLUSEQUALS; #through;
|
||||||
|
case .TOKEN_MINUSEQUALS; #through;
|
||||||
case .TOKEN_MINUS; #through;
|
case .TOKEN_MINUS; #through;
|
||||||
case .TOKEN_STAR; #through;
|
case .TOKEN_STAR; #through;
|
||||||
case .TOKEN_SLASH; #through;
|
case .TOKEN_SLASH; #through;
|
||||||
@@ -465,6 +467,7 @@ array_access :: (parse_state : *Parse_State, left : *AST_Node) -> *AST_Node {
|
|||||||
}
|
}
|
||||||
|
|
||||||
source_location.end = parse_state.previous;
|
source_location.end = parse_state.previous;
|
||||||
|
left.source_location = source_location;
|
||||||
return left;
|
return left;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -643,9 +646,13 @@ field_declaration :: (parse_state : *Parse_State, identifier_token : *Token) ->
|
|||||||
advance(parse_state);
|
advance(parse_state);
|
||||||
node.array_field = true;
|
node.array_field = true;
|
||||||
} else {
|
} else {
|
||||||
missing_type_specifier(parse_state, identifier_token, "Expected type specifier after field name.");
|
if !check(parse_state, .TOKEN_ASSIGN) {
|
||||||
|
internal_error_message(*parse_state.result.messages, "Unimplemented error message.", parse_state.path);
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
// missing_type_specifier(parse_state, identifier_token, "Expected type specifier after field name.");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if check(parse_state, .TOKEN_AT) {
|
if check(parse_state, .TOKEN_AT) {
|
||||||
while check(parse_state, .TOKEN_AT) {
|
while check(parse_state, .TOKEN_AT) {
|
||||||
@@ -748,6 +755,30 @@ statement :: (parse_state : *Parse_State) -> *AST_Node {
|
|||||||
}
|
}
|
||||||
source_location.end = parse_state.previous;
|
source_location.end = parse_state.previous;
|
||||||
node.source_location = source_location;
|
node.source_location = source_location;
|
||||||
|
return node;
|
||||||
|
} else if match(parse_state, .TOKEN_IF) {
|
||||||
|
node := make_node(parse_state, .If);
|
||||||
|
|
||||||
|
source_location : Source_Range;
|
||||||
|
source_location.begin = parse_state.previous;
|
||||||
|
|
||||||
|
if_expression := expression(parse_state);
|
||||||
|
add_child(node, if_expression);
|
||||||
|
// consume(parse_state, .TOKEN_LEFTBRACE, "Expect '{' after if-condition.");
|
||||||
|
|
||||||
|
if_body := block(parse_state);
|
||||||
|
if if_body.children.count > 0 {
|
||||||
|
add_child(node, if_body);
|
||||||
|
}
|
||||||
|
|
||||||
|
if match(parse_state, .TOKEN_ELSE) {
|
||||||
|
else_node := else_statement(parse_state);
|
||||||
|
add_child(node, else_node);
|
||||||
|
}
|
||||||
|
|
||||||
|
source_location.end = parse_state.previous;
|
||||||
|
node.source_location = source_location;
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
} else {
|
} else {
|
||||||
return expression_statement(parse_state);
|
return expression_statement(parse_state);
|
||||||
@@ -756,6 +787,13 @@ statement :: (parse_state : *Parse_State) -> *AST_Node {
|
|||||||
return error_node(parse_state, "Couldn't parse statement.");
|
return error_node(parse_state, "Couldn't parse statement.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else_statement :: (parse_state : *Parse_State) -> *AST_Node {
|
||||||
|
if check(parse_state, .TOKEN_IF) {
|
||||||
|
return statement(parse_state);
|
||||||
|
}
|
||||||
|
return block(parse_state);
|
||||||
|
}
|
||||||
|
|
||||||
block :: (parse_state : *Parse_State) -> *AST_Node {
|
block :: (parse_state : *Parse_State) -> *AST_Node {
|
||||||
node : *AST_Node = make_node(parse_state, .Block);
|
node : *AST_Node = make_node(parse_state, .Block);
|
||||||
array_reserve(*node.children, 1024);
|
array_reserve(*node.children, 1024);
|
||||||
@@ -1060,6 +1098,10 @@ declaration :: (parse_state : *Parse_State) -> *AST_Node {
|
|||||||
}
|
}
|
||||||
|
|
||||||
parse :: (result : *Compile_Result) {
|
parse :: (result : *Compile_Result) {
|
||||||
|
if result.had_error {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for *file : result.files {
|
for *file : result.files {
|
||||||
parse_state : Parse_State;
|
parse_state : Parse_State;
|
||||||
init_parse_state(*parse_state, file.tokens.tokens, file.file.path);
|
init_parse_state(*parse_state, file.tokens.tokens, file.file.path);
|
||||||
@@ -1083,6 +1125,8 @@ parse :: (result : *Compile_Result) {
|
|||||||
file.ast_root = parse_state.result.root;
|
file.ast_root = parse_state.result.root;
|
||||||
file.ast_nodes = parse_state.result.nodes;
|
file.ast_nodes = parse_state.result.nodes;
|
||||||
copy_messages(parse_state.result.messages, *result.messages);
|
copy_messages(parse_state.result.messages, *result.messages);
|
||||||
|
|
||||||
|
result.had_error |= parse_state.result.had_error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ Semantic_Type :: enum {
|
|||||||
Texture2D :: 4;
|
Texture2D :: 4;
|
||||||
Sampler :: 5;
|
Sampler :: 5;
|
||||||
|
|
||||||
|
Bool :: 6;
|
||||||
|
|
||||||
Max_Builtin :: Sampler + 1;
|
Max_Builtin :: Sampler + 1;
|
||||||
|
|
||||||
Unit;
|
Unit;
|
||||||
@@ -77,52 +79,10 @@ Type_Variable :: struct {
|
|||||||
//@Note(niels): For constant buffers
|
//@Note(niels): For constant buffers
|
||||||
resource_index : u32;
|
resource_index : u32;
|
||||||
|
|
||||||
uf_parent : Type_Variable_Handle;
|
|
||||||
|
|
||||||
source_node : *AST_Node;
|
source_node : *AST_Node;
|
||||||
}
|
}
|
||||||
|
|
||||||
Type_Variable_Handle :: #type, distinct u32;
|
Type_Variable_Handle :: #type, distinct u32;
|
||||||
Type_Constraint_Handle :: #type, distinct u32;
|
|
||||||
|
|
||||||
Type_Constraint_Kind :: enum {
|
|
||||||
Int_Literal; // [[I]] = int
|
|
||||||
Float_Literal; // [[F]] = float
|
|
||||||
Equivalence; // [[X]] = int/float
|
|
||||||
Equality; // E1 == E2: [[E1]] = [[E2]] && [[E1 == E2]] = bool
|
|
||||||
Function_Decl; // X(X1, ..., Xn) { return E; }: [[X]] = ([[X1]], ..., [[Xn]]) -> [[E]]
|
|
||||||
Function_Call; // E(E1, ..., En): [[E]] = ([[E1]], ..., [[En]]) -> [[E(E1, ..., En)]]
|
|
||||||
}
|
|
||||||
|
|
||||||
Type_Constraint :: struct {
|
|
||||||
kind : Type_Constraint_Kind;
|
|
||||||
|
|
||||||
union {
|
|
||||||
literal : struct {
|
|
||||||
type_variable : Type_Variable_Handle;
|
|
||||||
union {
|
|
||||||
i : int;
|
|
||||||
f : float;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
equivalence : struct {
|
|
||||||
lhs : Type_Variable_Handle;
|
|
||||||
rhs : Type_Variable_Handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
function : struct {
|
|
||||||
symbol_variable : Type_Variable_Handle;
|
|
||||||
return_variable : Type_Variable_Handle;
|
|
||||||
arguments : [16]Type_Variable_Handle;
|
|
||||||
argument_count : int;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
usage_site : *AST_Node;
|
|
||||||
|
|
||||||
binary_operator : Token;
|
|
||||||
}
|
|
||||||
|
|
||||||
Scope_Stack :: struct {
|
Scope_Stack :: struct {
|
||||||
allocator : Allocator;
|
allocator : Allocator;
|
||||||
@@ -199,7 +159,6 @@ Semantic_Checker :: struct {
|
|||||||
current_scope : Scope_Handle;
|
current_scope : Scope_Handle;
|
||||||
|
|
||||||
// type_variables : [..]Type_Variable;
|
// type_variables : [..]Type_Variable;
|
||||||
constraints : [..]Type_Constraint;
|
|
||||||
|
|
||||||
current_buffer_index : u32 = 0;
|
current_buffer_index : u32 = 0;
|
||||||
current_sampler_index : u32 = 0;
|
current_sampler_index : u32 = 0;
|
||||||
@@ -342,7 +301,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)
|
||||||
@@ -359,7 +318,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);
|
||||||
@@ -373,6 +332,7 @@ no_matching_overload_found :: (checker : *Semantic_Checker, call : *AST_Node, ov
|
|||||||
record_error(checker, message, locations, false);
|
record_error(checker, message, locations, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
not_all_control_paths_return_value :: (checker : *Semantic_Checker, node : *AST_Node) {
|
not_all_control_paths_return_value :: (checker : *Semantic_Checker, node : *AST_Node) {
|
||||||
builder : String_Builder;
|
builder : String_Builder;
|
||||||
init_string_builder(*builder,, temp);
|
init_string_builder(*builder,, temp);
|
||||||
@@ -505,7 +465,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);
|
||||||
@@ -513,7 +473,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, " ");
|
||||||
@@ -530,11 +490,38 @@ Attempting to access a field on a primitive type '%'.
|
|||||||
|
|
||||||
message := builder_to_string(*builder,, temp);
|
message := builder_to_string(*builder,, temp);
|
||||||
record_error(checker, message, node.source_location, false);
|
record_error(checker, message, node.source_location, false);
|
||||||
|
|
||||||
|
white(*builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
if_condition_has_to_be_boolean_type :: (checker : *Semantic_Checker, usage_site : *AST_Node, handle : Type_Variable_Handle) {
|
||||||
|
/*
|
||||||
|
Type of expression in if condition has to be bool.
|
||||||
|
if x > 100 {
|
||||||
|
^^^^^^^
|
||||||
|
*/
|
||||||
|
|
||||||
|
builder : String_Builder;
|
||||||
|
init_string_builder(*builder,, temp);
|
||||||
|
|
||||||
|
variable := from_handle(checker, handle);
|
||||||
|
append(*builder, "Type of expression in if condition has to be bool.\n");
|
||||||
|
|
||||||
|
indent(*builder, 1);
|
||||||
|
cyan(*builder);
|
||||||
|
|
||||||
|
print_to_builder(*builder, "%\n", print_from_source_location(usage_site.source_location));
|
||||||
|
indent(*builder, 1);
|
||||||
|
|
||||||
|
message := builder_to_string(*builder,, temp);
|
||||||
|
record_error(checker, message, usage_site.source_location, false);
|
||||||
|
|
||||||
|
white(*builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
@@ -544,7 +531,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));
|
||||||
}
|
}
|
||||||
@@ -708,10 +695,9 @@ add_symbol_to_scope :: (checker : *Semantic_Checker, scope_handle : Scope_Handle
|
|||||||
new_type_variable :: (checker : *Semantic_Checker) -> *Type_Variable, Type_Variable_Handle {
|
new_type_variable :: (checker : *Semantic_Checker) -> *Type_Variable, Type_Variable_Handle {
|
||||||
variable : Type_Variable;
|
variable : Type_Variable;
|
||||||
handle := cast(Type_Variable_Handle)checker.result.type_variables.count + 1;
|
handle := cast(Type_Variable_Handle)checker.result.type_variables.count + 1;
|
||||||
variable.uf_parent = handle;
|
|
||||||
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) {
|
||||||
@@ -722,12 +708,18 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
init_semantic_checker :: (checker : *Semantic_Checker, root : *AST_Node, path : string) {
|
init_semantic_checker :: (checker : *Semantic_Checker, root : *AST_Node, path : string) {
|
||||||
|
checker.current_buffer_index = 0;
|
||||||
|
checker.current_sampler_index = 0;
|
||||||
|
checker.current_texture_index = 0;
|
||||||
|
|
||||||
|
array_reserve(*checker.result.messages, 16);
|
||||||
|
|
||||||
checker.program_root = root;
|
checker.program_root = root;
|
||||||
checker.path = path;
|
checker.path = path;
|
||||||
|
|
||||||
@@ -769,13 +761,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) {
|
||||||
@@ -810,7 +802,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 {
|
||||||
@@ -866,7 +858,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;
|
||||||
@@ -918,10 +910,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -944,7 +936,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;
|
||||||
@@ -954,7 +946,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;
|
||||||
@@ -1021,7 +1013,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;
|
||||||
}
|
}
|
||||||
@@ -1033,7 +1025,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;
|
||||||
@@ -1081,7 +1073,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);
|
||||||
@@ -1093,7 +1085,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 {
|
||||||
@@ -1103,7 +1095,7 @@ declare_function :: (checker : *Semantic_Checker, node : *AST_Node, builtin : bo
|
|||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
create_function_constraint :: (checker : *Semantic_Checker, node : *AST_Node) {
|
create_function :: (checker : *Semantic_Checker, node : *AST_Node) {
|
||||||
name_to_check := get_actual_function_name(node);
|
name_to_check := get_actual_function_name(node);
|
||||||
find_result := find_symbol(checker, name_to_check, checker.current_scope);
|
find_result := find_symbol(checker, name_to_check, checker.current_scope);
|
||||||
|
|
||||||
@@ -1117,38 +1109,24 @@ create_function_constraint :: (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.");
|
||||||
|
|
||||||
previous_scope := use_scope(checker, variable.scope);
|
previous_scope := use_scope(checker, variable.scope);
|
||||||
|
|
||||||
constraint : Type_Constraint;
|
|
||||||
constraint.kind = .Function_Decl;
|
|
||||||
constraint.function.symbol_variable = function.type_variable;
|
|
||||||
|
|
||||||
for i : 0..variable.children.count - 1 {
|
|
||||||
arg_var := variable.children[i];
|
|
||||||
|
|
||||||
if arg_var > 0 {
|
|
||||||
constraint.function.arguments[constraint.function.argument_count] = arg_var;
|
|
||||||
constraint.function.argument_count += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for child : node.children {
|
for child : node.children {
|
||||||
if child.kind == .Block {
|
if child.kind == .Block {
|
||||||
for statement : child.children {
|
for statement : child.children {
|
||||||
if statement.kind == .Return {
|
if statement.kind == .Return {
|
||||||
result_var := check_node(checker, statement);
|
result_var := check_node(checker, statement);
|
||||||
if result_var > 0 {
|
if result_var > 0 {
|
||||||
variable.return_type_variable= result_var;
|
variable.return_type_variable = result_var;
|
||||||
constraint.function.return_variable = variable.return_type_variable;
|
|
||||||
}
|
}
|
||||||
} 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1160,44 +1138,10 @@ create_function_constraint :: (checker : *Semantic_Checker, node : *AST_Node) {
|
|||||||
not_all_control_paths_return_value(checker, node);
|
not_all_control_paths_return_value(checker, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
array_add(*checker.constraints, constraint);
|
|
||||||
|
|
||||||
use_scope(checker, previous_scope);
|
use_scope(checker, previous_scope);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
create_literal_constraint :: (checker : *Semantic_Checker, value : int, type_variable : Type_Variable_Handle) {
|
|
||||||
constraint : Type_Constraint;
|
|
||||||
constraint.kind = .Int_Literal;
|
|
||||||
constraint.literal.i = value;
|
|
||||||
constraint.literal.type_variable = type_variable;
|
|
||||||
|
|
||||||
array_add(*checker.constraints, constraint);
|
|
||||||
}
|
|
||||||
|
|
||||||
create_literal_constraint :: (checker : *Semantic_Checker, value : float, type_variable : Type_Variable_Handle) -> Type_Constraint_Handle {
|
|
||||||
constraint : Type_Constraint;
|
|
||||||
constraint.kind = .Float_Literal;
|
|
||||||
constraint.literal.f = value;
|
|
||||||
constraint.literal.type_variable = type_variable;
|
|
||||||
|
|
||||||
array_add(*checker.constraints, constraint);
|
|
||||||
|
|
||||||
return cast(Type_Constraint_Handle)checker.constraints.count;
|
|
||||||
}
|
|
||||||
|
|
||||||
create_equivalence_constraint :: (checker : *Semantic_Checker, lhs : Type_Variable_Handle, rhs : Type_Variable_Handle, usage_site : *AST_Node = null) -> Type_Constraint_Handle {
|
|
||||||
constraint : Type_Constraint;
|
|
||||||
constraint.kind = .Equivalence;
|
|
||||||
constraint.equivalence.lhs = lhs;
|
|
||||||
constraint.equivalence.rhs = rhs;
|
|
||||||
constraint.usage_site = usage_site;
|
|
||||||
|
|
||||||
array_add(*checker.constraints, constraint);
|
|
||||||
|
|
||||||
return cast(Type_Constraint_Handle)checker.constraints.count;
|
|
||||||
}
|
|
||||||
|
|
||||||
create_variable :: (checker : *Semantic_Checker, node : *AST_Node, struct_field_parent : *AST_Node = null) -> Type_Variable_Handle {
|
create_variable :: (checker : *Semantic_Checker, node : *AST_Node, struct_field_parent : *AST_Node = null) -> Type_Variable_Handle {
|
||||||
find_result := find_symbol(checker, node.name, checker.current_scope);
|
find_result := find_symbol(checker, node.name, checker.current_scope);
|
||||||
// x : int;
|
// x : int;
|
||||||
@@ -1205,7 +1149,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 {
|
||||||
@@ -1222,7 +1166,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];
|
||||||
@@ -1267,7 +1211,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.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1317,18 +1261,35 @@ create_field :: (checker : *Semantic_Checker, node : *AST_Node) -> Type_Variable
|
|||||||
for child : node.children {
|
for child : node.children {
|
||||||
rhs = check_node(checker, child);
|
rhs = check_node(checker, child);
|
||||||
}
|
}
|
||||||
create_equivalence_constraint(checker, handle, rhs, node);
|
|
||||||
|
if handle == 0 || rhs == 0 {
|
||||||
|
return handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
l := from_handle(checker, handle);
|
||||||
|
r := from_handle(checker, rhs);
|
||||||
|
assert(l.type != .Unresolved_Expression && r.type != .Unresolved_Expression);
|
||||||
|
|
||||||
|
if l.type == .Unresolved_Variable {
|
||||||
|
l.type = r.type;
|
||||||
|
l.typename = r.typename;
|
||||||
|
} else {
|
||||||
|
if !types_compatible(checker, handle, rhs) {
|
||||||
|
type_mismatch(checker, l.source_node, r.source_node, rhs, handle);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
create_call_constraint :: (checker : *Semantic_Checker, node : *AST_Node, type_var : Type_Variable_Handle) {
|
check_call :: (checker : *Semantic_Checker, node : *AST_Node, type_var : Type_Variable_Handle) -> error : bool {
|
||||||
find_result := find_symbol(checker, node.name, checker.current_scope);
|
find_result := find_symbol(checker, node.name, checker.current_scope);
|
||||||
|
|
||||||
if !find_result {
|
if !find_result {
|
||||||
function_undeclared(checker, node);
|
function_undeclared(checker, node);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
overload_found := false;
|
overload_found := false;
|
||||||
@@ -1359,7 +1320,7 @@ create_call_constraint :: (checker : *Semantic_Checker, node : *AST_Node, type_v
|
|||||||
}
|
}
|
||||||
|
|
||||||
if arg_vars.count != arg_count {
|
if arg_vars.count != arg_count {
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Type_Mismatch_Data :: struct {
|
Type_Mismatch_Data :: struct {
|
||||||
@@ -1375,14 +1336,18 @@ create_call_constraint :: (checker : *Semantic_Checker, node : *AST_Node, type_v
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
function := h2tv(checker, func.type_variable);
|
function := from_handle(checker, func.type_variable);
|
||||||
|
|
||||||
if arg_count != function.children.count {
|
field_list := function.source_node.children[0];
|
||||||
|
if arg_count != field_list.children.count {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if node.children.count == 0 && function.children.count == 0 {
|
if node.children.count == 0 && function.children.count == 0 {
|
||||||
overload_found = true;
|
overload_found = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if overload_found && function.return_type_variable == 0 {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1395,7 +1360,7 @@ create_call_constraint :: (checker : *Semantic_Checker, node : *AST_Node, type_v
|
|||||||
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 };
|
||||||
@@ -1409,9 +1374,9 @@ create_call_constraint :: (checker : *Semantic_Checker, node : *AST_Node, type_v
|
|||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
@@ -1424,13 +1389,17 @@ create_call_constraint :: (checker : *Semantic_Checker, node : *AST_Node, type_v
|
|||||||
for mismatch : mismatches {
|
for mismatch : mismatches {
|
||||||
type_mismatch(checker, mismatch.lhs.node, mismatch.rhs.node, mismatch.rhs.var, mismatch.lhs.var);
|
type_mismatch(checker, mismatch.lhs.node, mismatch.rhs.node, mismatch.rhs.var, mismatch.lhs.var);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
check_node :: (checker : *Semantic_Checker, node : *AST_Node) -> Type_Variable_Handle {
|
check_node :: (checker : *Semantic_Checker, node : *AST_Node) -> Type_Variable_Handle {
|
||||||
if node.kind == {
|
if node.kind == {
|
||||||
case .Function; {
|
case .Function; {
|
||||||
create_function_constraint(checker, node);
|
create_function(checker, node);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case. Field; {
|
case. Field; {
|
||||||
@@ -1441,6 +1410,19 @@ check_node :: (checker : *Semantic_Checker, node : *AST_Node) -> Type_Variable_H
|
|||||||
field_var := create_field(checker, node);
|
field_var := create_field(checker, node);
|
||||||
return field_var;
|
return field_var;
|
||||||
}
|
}
|
||||||
|
case .Unary; {
|
||||||
|
var := check_node(checker, node.children[0]);
|
||||||
|
variable, handle := new_type_variable(checker);
|
||||||
|
type := from_handle(checker, var);
|
||||||
|
variable.type = type.type;
|
||||||
|
variable.typename = type.typename;
|
||||||
|
variable.scope = type.scope;
|
||||||
|
variable.source_node = node;
|
||||||
|
node.type_variable = handle;
|
||||||
|
add_child(variable, var);
|
||||||
|
|
||||||
|
return handle;
|
||||||
|
}
|
||||||
case .Binary; {
|
case .Binary; {
|
||||||
lhs_var := check_node(checker, node.children[0]);
|
lhs_var := check_node(checker, node.children[0]);
|
||||||
if lhs_var == 0 {
|
if lhs_var == 0 {
|
||||||
@@ -1452,7 +1434,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;
|
||||||
@@ -1466,19 +1448,27 @@ check_node :: (checker : *Semantic_Checker, node : *AST_Node) -> Type_Variable_H
|
|||||||
case .TOKEN_MINUS; #through;
|
case .TOKEN_MINUS; #through;
|
||||||
case .TOKEN_STAR; #through;
|
case .TOKEN_STAR; #through;
|
||||||
case .TOKEN_SLASH; {
|
case .TOKEN_SLASH; {
|
||||||
create_equivalence_constraint(checker, rhs_var, lhs_var, node);
|
if !types_compatible(checker, lhs_var, rhs_var, true) {
|
||||||
|
type_mismatch(checker, node, node.children[1], lhs_var, rhs_var);
|
||||||
proper_variable, rhs_handle := new_type_variable(checker);
|
return 0;
|
||||||
lhs_type_var := h2tv(checker, lhs_var);
|
}
|
||||||
proper_variable.type = lhs_type_var.type;
|
|
||||||
proper_variable.typename = lhs_type_var.typename;
|
|
||||||
proper_variable.source_node = h2tv(checker, lhs_var).source_node;
|
|
||||||
proper_variable.struct_field_parent = h2tv(checker, lhs_var).struct_field_parent;
|
|
||||||
|
|
||||||
create_equivalence_constraint(checker, handle, rhs_handle, node);
|
|
||||||
}
|
}
|
||||||
case .TOKEN_ASSIGN; {
|
case .TOKEN_ASSIGN; {
|
||||||
create_equivalence_constraint(checker, lhs_var, rhs_var, node);
|
if !types_compatible(checker, lhs_var, rhs_var, true) {
|
||||||
|
type_mismatch(checker, node.parent, node.children[1], lhs_var, rhs_var);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case .TOKEN_GREATER; #through;
|
||||||
|
case .TOKEN_GREATEREQUALS; #through;
|
||||||
|
case .TOKEN_LESS; #through;
|
||||||
|
case .TOKEN_LESSEQUALS; #through;
|
||||||
|
case .TOKEN_LOGICALOR; #through;
|
||||||
|
case .TOKEN_ISEQUAL; #through;
|
||||||
|
case .TOKEN_ISNOTEQUAL; #through;
|
||||||
|
case .TOKEN_LOGICALAND; {
|
||||||
|
variable.type = .Bool;
|
||||||
|
variable.typename = Typenames[variable.type];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return handle;
|
return handle;
|
||||||
@@ -1486,6 +1476,16 @@ check_node :: (checker : *Semantic_Checker, node : *AST_Node) -> Type_Variable_H
|
|||||||
case .Return; {
|
case .Return; {
|
||||||
return check_node(checker, node.children[0]);
|
return check_node(checker, node.children[0]);
|
||||||
}
|
}
|
||||||
|
case .If; {
|
||||||
|
cond_var := check_node(checker, node.children[0]);
|
||||||
|
|
||||||
|
if cond_var > 0 {
|
||||||
|
cond := from_handle(checker, cond_var);
|
||||||
|
if cond.type != .Bool {
|
||||||
|
if_condition_has_to_be_boolean_type(checker, node, cond_var);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
case .Variable; {
|
case .Variable; {
|
||||||
return create_variable(checker, node);
|
return create_variable(checker, node);
|
||||||
}
|
}
|
||||||
@@ -1494,7 +1494,6 @@ check_node :: (checker : *Semantic_Checker, node : *AST_Node) -> Type_Variable_H
|
|||||||
type_variable.type = .Int;
|
type_variable.type = .Int;
|
||||||
type_variable.source_node = node;
|
type_variable.source_node = node;
|
||||||
node.type_variable = handle;
|
node.type_variable = handle;
|
||||||
type_constraint := create_literal_constraint(checker, node.integer_value, handle);
|
|
||||||
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
@@ -1503,7 +1502,6 @@ check_node :: (checker : *Semantic_Checker, node : *AST_Node) -> Type_Variable_H
|
|||||||
type_variable.type = .Float;
|
type_variable.type = .Float;
|
||||||
type_variable.source_node = node;
|
type_variable.source_node = node;
|
||||||
node.type_variable = handle;
|
node.type_variable = handle;
|
||||||
type_constraint := create_literal_constraint(checker, node.float_value, handle);
|
|
||||||
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
@@ -1516,7 +1514,9 @@ check_node :: (checker : *Semantic_Checker, node : *AST_Node) -> Type_Variable_H
|
|||||||
type_variable.source_node = node;
|
type_variable.source_node = node;
|
||||||
node.type_variable = handle;
|
node.type_variable = handle;
|
||||||
|
|
||||||
create_call_constraint(checker, node, handle);
|
if check_call(checker, node, handle) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
@@ -1555,16 +1555,16 @@ traverse :: (checker : *Semantic_Checker) {
|
|||||||
traverse(checker, checker.program_root);
|
traverse(checker, checker.program_root);
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
// // }
|
||||||
|
|
||||||
return root.uf_parent;
|
// return root.uf_parent;
|
||||||
}
|
// }
|
||||||
|
|
||||||
Unification_Result :: enum {
|
Unification_Result :: enum {
|
||||||
Unification_Success;
|
Unification_Success;
|
||||||
@@ -1572,8 +1572,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;
|
||||||
@@ -1627,8 +1627,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;
|
||||||
@@ -1653,78 +1653,6 @@ types_compatible :: (checker : *Semantic_Checker, lhs : Type_Variable_Handle, rh
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
union_terms :: (checker : *Semantic_Checker, lhs_handle : Type_Variable_Handle, rhs_handle : Type_Variable_Handle, usage_site : *AST_Node) {
|
|
||||||
|
|
||||||
if !types_compatible(checker, lhs_handle, rhs_handle) {
|
|
||||||
lhs_var := h2tv(checker, lhs_handle);
|
|
||||||
rhs_var := h2tv(checker, rhs_handle);
|
|
||||||
|
|
||||||
if usage_site {
|
|
||||||
type_mismatch(checker, usage_site, rhs_var.source_node.parent, rhs_handle, lhs_handle);
|
|
||||||
} else {
|
|
||||||
type_mismatch(checker, lhs_var.source_node.parent, rhs_var.source_node.parent, rhs_handle, lhs_handle);
|
|
||||||
}
|
|
||||||
} else if lhs_handle != rhs_handle {
|
|
||||||
lhs := h2tv(checker, lhs_handle);
|
|
||||||
lhs.uf_parent = rhs_handle;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unify :: (checker : *Semantic_Checker, lhs_handle : Type_Variable_Handle, rhs_handle : Type_Variable_Handle, usage_site : *AST_Node = null) -> Unification_Result {
|
|
||||||
rep_lhs := find(checker, lhs_handle);
|
|
||||||
rep_rhs := find(checker, rhs_handle);
|
|
||||||
|
|
||||||
if rep_lhs != rep_rhs {
|
|
||||||
lhs := h2tv(checker, rep_lhs);
|
|
||||||
rhs := h2tv(checker, rep_rhs);
|
|
||||||
if !is_proper(lhs) && !is_proper(rhs) {
|
|
||||||
union_terms(checker, rep_lhs, rep_rhs, usage_site);
|
|
||||||
} else if !is_proper(lhs) && is_proper(rhs) {
|
|
||||||
union_terms(checker, rep_lhs, rep_rhs, usage_site);
|
|
||||||
} else if is_proper(lhs) && !is_proper(rhs) {
|
|
||||||
union_terms(checker, rep_rhs, rep_lhs, usage_site);
|
|
||||||
} else if is_proper(lhs) && is_proper(rhs) {
|
|
||||||
union_terms(checker, rep_lhs, rep_rhs, usage_site);
|
|
||||||
|
|
||||||
//@Incomplete(niels): Evaluate sub-terms for functions.
|
|
||||||
} else {
|
|
||||||
return .Unification_Failure;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return .Unification_Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
union_find :: (checker : *Semantic_Checker) -> bool {
|
|
||||||
for constraint : checker.constraints {
|
|
||||||
if constraint.kind == {
|
|
||||||
case .Int_Literal; {
|
|
||||||
|
|
||||||
}
|
|
||||||
case .Float_Literal; {
|
|
||||||
|
|
||||||
}
|
|
||||||
case .Equivalence; {
|
|
||||||
if !constraint.equivalence.lhs || !constraint.equivalence.rhs {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
handle_lhs := find(checker, constraint.equivalence.lhs);
|
|
||||||
handle_rhs := find(checker, constraint.equivalence.rhs);
|
|
||||||
|
|
||||||
unification_result := unify(checker, handle_lhs, handle_rhs, constraint.usage_site);
|
|
||||||
if unification_result == .Unification_Failure {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case .Function_Decl; {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// HLSL_BUILTIN :: #run -> string {
|
// HLSL_BUILTIN :: #run -> string {
|
||||||
// T := #load "hlsl_builtin.jai";
|
// T := #load "hlsl_builtin.jai";
|
||||||
|
|
||||||
@@ -1741,7 +1669,7 @@ add_hlsl_builtins :: (checker : *Semantic_Checker) {
|
|||||||
append(*sb, "/");
|
append(*sb, "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
append(*sb, "hlsl_builtin.shd");
|
append(*sb, "hlsl_builtin.ink");
|
||||||
|
|
||||||
path := builder_to_string(*sb);
|
path := builder_to_string(*sb);
|
||||||
|
|
||||||
@@ -1796,23 +1724,31 @@ add_hlsl_builtins :: (checker : *Semantic_Checker) {
|
|||||||
|
|
||||||
type_check :: (checker : *Semantic_Checker, root : *AST_Node) {
|
type_check :: (checker : *Semantic_Checker, root : *AST_Node) {
|
||||||
traverse(checker, root);
|
traverse(checker, root);
|
||||||
|
}
|
||||||
|
|
||||||
// if checker.result.had_error {
|
check :: (result : *Compile_Result) {
|
||||||
// //@Incomplete(niels): handle error...
|
if result.had_error {
|
||||||
// return checker.result;
|
return;
|
||||||
// }
|
|
||||||
uf_result := union_find(checker);
|
|
||||||
|
|
||||||
if !uf_result {
|
|
||||||
//@Incomplete(niels): handle error...
|
|
||||||
// return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for *type_variable : checker.result.type_variables {
|
for *file : result.files {
|
||||||
if type_variable.type == .Unresolved_Variable {
|
checker : Semantic_Checker;
|
||||||
rep := h2tv(checker, type_variable.uf_parent);
|
|
||||||
type_variable.type = rep.type;
|
checker.current_buffer_index = 0;
|
||||||
}
|
checker.current_sampler_index = 0;
|
||||||
|
checker.current_texture_index = 0;
|
||||||
|
array_reserve(*checker.result.messages, 16);
|
||||||
|
|
||||||
|
init_semantic_checker(*checker, file.ast_root, file.file.path);
|
||||||
|
|
||||||
|
// @Performance: Should have this built in stuff done earlier and only once
|
||||||
|
add_hlsl_builtins(*checker);
|
||||||
|
|
||||||
|
type_check(*checker, file.ast_root);
|
||||||
|
|
||||||
|
file.semantic_check_result = checker.result;
|
||||||
|
result.had_error |= checker.result.had_error;
|
||||||
|
copy_messages(checker.result.messages, *result.messages);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1821,7 +1757,6 @@ check :: (checker : *Semantic_Checker, root : *AST_Node) -> Semantic_Check_Resul
|
|||||||
checker.current_sampler_index = 0;
|
checker.current_sampler_index = 0;
|
||||||
checker.current_texture_index = 0;
|
checker.current_texture_index = 0;
|
||||||
array_reserve(*checker.result.messages, 16);
|
array_reserve(*checker.result.messages, 16);
|
||||||
array_reserve(*checker.constraints, 1024);
|
|
||||||
add_hlsl_builtins(checker);
|
add_hlsl_builtins(checker);
|
||||||
|
|
||||||
type_check(checker, root);
|
type_check(checker, root);
|
||||||
@@ -1886,7 +1821,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);
|
||||||
@@ -1905,7 +1840,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");
|
||||||
}
|
}
|
||||||
@@ -1918,7 +1853,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));
|
||||||
@@ -1956,7 +1891,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);
|
||||||
@@ -1982,7 +1917,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);
|
||||||
@@ -2019,64 +1954,6 @@ pretty_print_scope :: (checker : *Semantic_Checker, scope : *Scope, builder : *S
|
|||||||
append(builder, "]\n");
|
append(builder, "]\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
pretty_print_constraint :: (checker : *Semantic_Checker, constraint : Type_Constraint, builder : *String_Builder) {
|
|
||||||
if constraint.kind == {
|
|
||||||
case .Int_Literal; {
|
|
||||||
print_to_builder(builder, "[[%]] = int\n", constraint.literal.i);
|
|
||||||
}
|
|
||||||
case .Float_Literal; {
|
|
||||||
print_to_builder(builder, "[[%]] = float\n", constraint.literal.f);
|
|
||||||
}
|
|
||||||
case .Equivalence; {
|
|
||||||
lhs_var := h2tv(checker, constraint.equivalence.lhs);
|
|
||||||
rhs_var := h2tv(checker, constraint.equivalence.rhs);
|
|
||||||
|
|
||||||
append(builder, "[[");
|
|
||||||
print_type_variable(builder, lhs_var, checker);
|
|
||||||
append(builder, "]] = ");
|
|
||||||
if rhs_var.source_node {
|
|
||||||
append(builder, "[[");
|
|
||||||
}
|
|
||||||
|
|
||||||
print_type_variable(builder, rhs_var, checker);
|
|
||||||
if rhs_var.source_node {
|
|
||||||
append(builder, "]]");
|
|
||||||
}
|
|
||||||
append(builder, "\n");
|
|
||||||
}
|
|
||||||
case .Function_Decl; {
|
|
||||||
sym := h2tv(checker, constraint.function.symbol_variable);
|
|
||||||
print_to_builder(builder, "[[%]] =", sym.name);
|
|
||||||
append(builder, " (");
|
|
||||||
if constraint.function.argument_count > 0 {
|
|
||||||
for i : 0..constraint.function.argument_count - 1 {
|
|
||||||
arg := h2tv(checker, constraint.function.arguments[i]);
|
|
||||||
print_to_builder(builder, "[[%]]", arg.name);
|
|
||||||
|
|
||||||
if i < constraint.function.argument_count - 1 {
|
|
||||||
append(builder, ", ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
append(builder, ")");
|
|
||||||
|
|
||||||
if constraint.function.return_variable > 0 {
|
|
||||||
return_var := h2tv(checker, constraint.function.return_variable);
|
|
||||||
|
|
||||||
append(builder, " -> ");
|
|
||||||
append(builder, "[[");
|
|
||||||
|
|
||||||
print_type_variable(builder, return_var, checker);
|
|
||||||
|
|
||||||
append(builder, "]]", );
|
|
||||||
append(builder, "\n");
|
|
||||||
} else {
|
|
||||||
append(builder, " -> unit\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print_type_variable :: (builder : *String_Builder, variable : Type_Variable, checker : *Semantic_Checker) {
|
print_type_variable :: (builder : *String_Builder, variable : Type_Variable, checker : *Semantic_Checker) {
|
||||||
if variable.builtin {
|
if variable.builtin {
|
||||||
if variable.type != .Function || variable.type != .Struct {
|
if variable.type != .Function || variable.type != .Struct {
|
||||||
@@ -2160,7 +2037,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2173,68 +2050,6 @@ pretty_print_symbol_table :: (checker : *Semantic_Checker, allocator : Allocator
|
|||||||
return builder_to_string(*builder,, allocator);
|
return builder_to_string(*builder,, allocator);
|
||||||
}
|
}
|
||||||
|
|
||||||
pretty_print_type_variable :: (checker : *Semantic_Checker, type_variable : *Type_Variable, builder : *String_Builder) {
|
|
||||||
rep := type_variable.uf_parent;
|
|
||||||
if type_variable.name.count > 0 {
|
|
||||||
append(builder, "[[");
|
|
||||||
print_type_variable(builder, type_variable, checker);
|
|
||||||
append(builder, "]] = ");
|
|
||||||
rep_var := h2tv(checker, rep);
|
|
||||||
if is_proper(type_variable) {
|
|
||||||
print_to_builder(builder, proper_type_to_string(checker, type_variable, temp));
|
|
||||||
} else if type_variable.type == .Struct || type_variable.type == .Properties ||
|
|
||||||
type_variable.type == .CBuffer {
|
|
||||||
if type_variable.kind == .Declaration {
|
|
||||||
append(builder, "{");
|
|
||||||
|
|
||||||
for 0..type_variable.children.count - 1 {
|
|
||||||
child_handle := type_variable.children[it];
|
|
||||||
child := h2tv(checker, child_handle);
|
|
||||||
print_to_builder(builder, child.name);
|
|
||||||
append(builder, " : ");
|
|
||||||
print_to_builder(builder, type_to_string(child));
|
|
||||||
|
|
||||||
if it < type_variable.children.count - 1 {
|
|
||||||
append(builder, ", ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
append(builder, "}");
|
|
||||||
} else if type_variable.typename.count > 0 {
|
|
||||||
print_to_builder(builder, "%", type_variable.typename);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
print_from_source_location(builder, rep_var.source_node.source_location);
|
|
||||||
}
|
|
||||||
append(builder, "\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pretty_print_type_variables :: (checker : *Semantic_Checker, allocator : Allocator) -> string {
|
|
||||||
builder : String_Builder;
|
|
||||||
|
|
||||||
init_string_builder(*builder,, allocator);
|
|
||||||
|
|
||||||
for *type_variable : checker.result.type_variables {
|
|
||||||
if type_variable.builtin continue;
|
|
||||||
|
|
||||||
pretty_print_type_variable(checker, type_variable, *builder);
|
|
||||||
}
|
|
||||||
|
|
||||||
return builder_to_string(*builder,, allocator);
|
|
||||||
}
|
|
||||||
|
|
||||||
pretty_print_type_constraints :: (checker : *Semantic_Checker, allocator : Allocator) -> string {
|
|
||||||
builder : String_Builder;
|
|
||||||
init_string_builder(*builder,, allocator);
|
|
||||||
|
|
||||||
for *constraint : checker.constraints {
|
|
||||||
pretty_print_constraint(checker, constraint, *builder);
|
|
||||||
}
|
|
||||||
|
|
||||||
return builder_to_string(*builder,, allocator);
|
|
||||||
}
|
|
||||||
|
|
||||||
#scope_module
|
#scope_module
|
||||||
|
|
||||||
#import "ncore";
|
#import "ncore";
|
||||||
|
|||||||
25
Test.jai
25
Test.jai
@@ -2,6 +2,7 @@
|
|||||||
//~ nbr: General improvements
|
//~ nbr: General improvements
|
||||||
//
|
//
|
||||||
// [x] Print out all failed tests in a list at the end
|
// [x] Print out all failed tests in a list at the end
|
||||||
|
// [ ] Use new compiler API with Compile_Result and Compiled_File instead
|
||||||
// [ ] Use unix (posix? bash? ascii?) color codes for errors
|
// [ ] Use unix (posix? bash? ascii?) color codes for errors
|
||||||
// [ ] Print golden file as green and new output as red
|
// [ ] Print golden file as green and new output as red
|
||||||
|
|
||||||
@@ -21,7 +22,7 @@ COMPILED_FOLDER :: "compiled";
|
|||||||
SEMANTIC_ANALYSIS_FOLDER :: "semant";
|
SEMANTIC_ANALYSIS_FOLDER :: "semant";
|
||||||
TESTS_FOLDER :: "test";
|
TESTS_FOLDER :: "test";
|
||||||
|
|
||||||
SHADER_EXTENSION :: "shd";
|
SHADER_EXTENSION :: "ink";
|
||||||
SUITE_EXTENSION :: "suite";
|
SUITE_EXTENSION :: "suite";
|
||||||
|
|
||||||
Stage_Flags :: enum_flags u16 {
|
Stage_Flags :: enum_flags u16 {
|
||||||
@@ -308,10 +309,6 @@ run_semantic_analysis_test :: (file_path : string, root : *AST_Node, output_type
|
|||||||
result_text = report_messages(checker.result.messages);
|
result_text = report_messages(checker.result.messages);
|
||||||
} else {
|
} else {
|
||||||
result_text = pretty_print_symbol_table(*checker, temp);
|
result_text = pretty_print_symbol_table(*checker, temp);
|
||||||
constraints := pretty_print_type_constraints(*checker, temp);
|
|
||||||
type_vars := pretty_print_type_variables(*checker, temp);
|
|
||||||
// print("Constraints\n%\n", constraints);
|
|
||||||
// print("Solution\n%\n", type_vars);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if output_type & .StdOut {
|
if output_type & .StdOut {
|
||||||
@@ -415,6 +412,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);
|
||||||
@@ -588,9 +587,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;
|
||||||
|
|
||||||
@@ -608,7 +610,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);
|
||||||
}
|
}
|
||||||
@@ -705,7 +706,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; {
|
||||||
@@ -727,9 +728,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; {
|
||||||
@@ -748,7 +751,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);
|
||||||
@@ -758,7 +760,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);
|
||||||
|
|
||||||
@@ -766,6 +767,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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
10
first.jai
10
first.jai
@@ -16,6 +16,16 @@ build :: () {
|
|||||||
|
|
||||||
options.write_added_strings = true;
|
options.write_added_strings = true;
|
||||||
|
|
||||||
|
args := options.compile_time_command_line;
|
||||||
|
|
||||||
|
for arg : args {
|
||||||
|
if arg == {
|
||||||
|
case "check"; {
|
||||||
|
options.output_type = .NO_OUTPUT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
new_path: [..] string;
|
new_path: [..] string;
|
||||||
array_add(*new_path, ..options.import_path);
|
array_add(*new_path, ..options.import_path);
|
||||||
array_add(*new_path, "modules");
|
array_add(*new_path, "modules");
|
||||||
|
|||||||
@@ -74,8 +74,24 @@ int4x4 :: struct {
|
|||||||
|
|
||||||
//~ nbr: Constructors
|
//~ nbr: Constructors
|
||||||
#foreign float2 :: (float, float) -> float2;
|
#foreign float2 :: (float, float) -> float2;
|
||||||
|
#foreign float2 :: (float2) -> float2;
|
||||||
|
#foreign float2 :: (float) -> float2;
|
||||||
|
|
||||||
#foreign float3 :: (float, float, float) -> float3;
|
#foreign float3 :: (float, float, float) -> float3;
|
||||||
|
#foreign float3 :: (float3) -> float3;
|
||||||
|
#foreign float3 :: (float2, float) -> float3;
|
||||||
|
#foreign float3 :: (float, float2) -> float3;
|
||||||
|
#foreign float3 :: (float) -> float3;
|
||||||
|
|
||||||
#foreign float4 :: (float, float, float, float) -> float4;
|
#foreign float4 :: (float, float, float, float) -> float4;
|
||||||
|
#foreign float4 :: (float4) -> float4;
|
||||||
|
#foreign float4 :: (float2, float2) -> float4;
|
||||||
|
#foreign float4 :: (float2, float, float) -> float4;
|
||||||
|
#foreign float4 :: (float, float2, float) -> float4;
|
||||||
|
#foreign float4 :: (float, float, float2) -> float4;
|
||||||
|
#foreign float4 :: (float3, float) -> float4;
|
||||||
|
#foreign float4 :: (float, float3) -> float4;
|
||||||
|
#foreign float4 :: (float) -> float4;
|
||||||
|
|
||||||
//~ nbr: Vectors
|
//~ nbr: Vectors
|
||||||
#foreign cross :: (float3, float3) -> float3;
|
#foreign cross :: (float3, float3) -> float3;
|
||||||
@@ -83,6 +99,10 @@ int4x4 :: struct {
|
|||||||
#foreign distance :: (float3, float3) -> float;
|
#foreign distance :: (float3, float3) -> float;
|
||||||
#foreign distance :: (float4, float4) -> float;
|
#foreign distance :: (float4, float4) -> float;
|
||||||
|
|
||||||
|
#foreign length :: (float2) -> float;
|
||||||
|
#foreign length :: (float3) -> float;
|
||||||
|
#foreign length :: (float4) -> float;
|
||||||
|
|
||||||
#foreign dot :: (float2, float2) -> float;
|
#foreign dot :: (float2, float2) -> float;
|
||||||
#foreign dot :: (float3, float3) -> float;
|
#foreign dot :: (float3, float3) -> float;
|
||||||
#foreign dot :: (float4, float4) -> float;
|
#foreign dot :: (float4, float4) -> float;
|
||||||
@@ -260,3 +280,8 @@ int4x4 :: struct {
|
|||||||
#foreign atan2 :: (float4x4, float4x4) -> float4x4;
|
#foreign atan2 :: (float4x4, float4x4) -> float4x4;
|
||||||
|
|
||||||
#foreign sample :: (Texture2D, Sampler, float2) -> float4;
|
#foreign sample :: (Texture2D, Sampler, float2) -> float4;
|
||||||
|
|
||||||
|
#foreign lerp :: (float, float, float) -> float;
|
||||||
|
#foreign lerp :: (float2, float2, float) -> float2;
|
||||||
|
#foreign lerp :: (float3, float3, float) -> float3;
|
||||||
|
#foreign lerp :: (float4, float4, float) -> float4;
|
||||||
149
module.jai
149
module.jai
@@ -146,6 +146,27 @@ Compiled_File :: struct {
|
|||||||
tokens : Token_Stream;
|
tokens : Token_Stream;
|
||||||
ast_root : *AST_Node;
|
ast_root : *AST_Node;
|
||||||
ast_nodes : [..]AST_Node;
|
ast_nodes : [..]AST_Node;
|
||||||
|
|
||||||
|
codegen_result_text : string;
|
||||||
|
|
||||||
|
semantic_check_result : Semantic_Check_Result;
|
||||||
|
|
||||||
|
vertex_entry_point : struct {
|
||||||
|
name : string;
|
||||||
|
|
||||||
|
input : [..]Field;
|
||||||
|
}
|
||||||
|
|
||||||
|
pixel_entry_point : struct {
|
||||||
|
name : string;
|
||||||
|
|
||||||
|
return_value : Field;
|
||||||
|
}
|
||||||
|
|
||||||
|
properties : Properties;
|
||||||
|
|
||||||
|
max_constant_buffers :: 16;
|
||||||
|
cbuffers : Static_Array(Constant_Buffer, max_constant_buffers);
|
||||||
}
|
}
|
||||||
|
|
||||||
Compile_Result :: struct {
|
Compile_Result :: struct {
|
||||||
@@ -279,10 +300,10 @@ 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 :: (type_variables : []Type_Variable, scope_stack : Scope_Stack, variable : *Type_Variable) -> Field {
|
||||||
field : Field;
|
field : Field;
|
||||||
|
|
||||||
field.name = variable.name;
|
field.name = variable.name;
|
||||||
@@ -315,14 +336,14 @@ type_variable_to_field :: (checker : *Semantic_Checker, variable : *Type_Variabl
|
|||||||
case .Struct; {
|
case .Struct; {
|
||||||
type.kind = Field_Kind.Struct;
|
type.kind = Field_Kind.Struct;
|
||||||
|
|
||||||
find_result := find_symbol(checker, variable.typename, xx 1);
|
find_result := find_symbol(scope_stack, 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(type_variables, 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(type_variables, scope_stack, child);
|
||||||
array_add(*type.children, child_field);
|
array_add(*type.children, child_field);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -350,7 +371,7 @@ type_variable_to_field :: (checker : *Semantic_Checker, variable : *Type_Variabl
|
|||||||
}
|
}
|
||||||
field_hint.kind = .Target;
|
field_hint.kind = .Target;
|
||||||
} else {
|
} else {
|
||||||
// @Incomplete(nb): custo hints
|
field_hint.custom_hint_name = copy_string(hint.ident_value);
|
||||||
}
|
}
|
||||||
array_add(*field.hints, field_hint);
|
array_add(*field.hints, field_hint);
|
||||||
}
|
}
|
||||||
@@ -360,6 +381,14 @@ type_variable_to_field :: (checker : *Semantic_Checker, variable : *Type_Variabl
|
|||||||
return field;
|
return field;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type_variable_to_field :: (type_variables : []Type_Variable, scope_stack : Scope_Stack, variable : Type_Variable_Handle) -> Field {
|
||||||
|
return type_variable_to_field(type_variables, scope_stack, from_handle(type_variables, variable));
|
||||||
|
}
|
||||||
|
|
||||||
|
type_variable_to_field :: (checker : *Semantic_Checker, variable : *Type_Variable) -> Field {
|
||||||
|
return type_variable_to_field(checker.result.type_variables, checker.result.scope_stack, variable);
|
||||||
|
}
|
||||||
|
|
||||||
compile_file :: (compiler : *Shader_Compiler, paths : []string) -> Compile_Result {
|
compile_file :: (compiler : *Shader_Compiler, paths : []string) -> Compile_Result {
|
||||||
result : Compile_Result;
|
result : Compile_Result;
|
||||||
|
|
||||||
@@ -368,9 +397,97 @@ compile_file :: (compiler : *Shader_Compiler, paths : []string) -> Compile_Resul
|
|||||||
}
|
}
|
||||||
|
|
||||||
lex(*result);
|
lex(*result);
|
||||||
// parse(*result);
|
parse(*result);
|
||||||
// check(*result);
|
check(*result);
|
||||||
// codegen(*result);
|
codegen(*result);
|
||||||
|
|
||||||
|
if result.had_error {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
for *file : result.files {
|
||||||
|
check_result := file.semantic_check_result;
|
||||||
|
if check_result.vertex_entry_point {
|
||||||
|
file.vertex_entry_point.name = check_result.vertex_entry_point.name;
|
||||||
|
|
||||||
|
type_variable := from_handle(check_result.type_variables, check_result.vertex_entry_point.type_variable);
|
||||||
|
assert(type_variable.type == .Function);
|
||||||
|
|
||||||
|
node := type_variable.source_node;
|
||||||
|
if node.children.count > 0 {
|
||||||
|
if node.children[0].kind == .FieldList {
|
||||||
|
field_list := node.children[0];
|
||||||
|
for child : field_list.children {
|
||||||
|
tv := from_handle(check_result.type_variables, child.type_variable);
|
||||||
|
field := type_variable_to_field(check_result.type_variables, check_result.scope_stack, tv);
|
||||||
|
array_add(*file.vertex_entry_point.input, field);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for buffer_variable : to_array(*check_result.constant_buffers) {
|
||||||
|
variable := from_handle(check_result.type_variables, buffer_variable);
|
||||||
|
|
||||||
|
cb := array_add(*file.cbuffers);
|
||||||
|
|
||||||
|
for i : 0..variable.children.count - 1 {
|
||||||
|
child := variable.children[i];
|
||||||
|
field : Property_Field;
|
||||||
|
field.base_field = type_variable_to_field(check_result.type_variables, check_result.scope_stack, from_handle(check_result.type_variables, child));
|
||||||
|
array_add(*cb.fields, field);
|
||||||
|
}
|
||||||
|
|
||||||
|
cb.buffer_index = variable.resource_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
find_result := find_symbol(*check_result.scope_stack, check_result.property_name, xx 1);
|
||||||
|
if find_result {
|
||||||
|
property_variable := from_handle(check_result.type_variables, find_result.type_variable);
|
||||||
|
|
||||||
|
for i : 0..property_variable.children.count - 1 {
|
||||||
|
child := property_variable.children[i];
|
||||||
|
field := type_variable_to_field(check_result.type_variables, check_result.scope_stack, from_handle(check_result.type_variables, child));
|
||||||
|
prop_field : Property_Field;
|
||||||
|
prop_field.base_field = field;
|
||||||
|
array_add(*file.properties.fields, prop_field);
|
||||||
|
}
|
||||||
|
file.properties.buffer_index = property_variable.resource_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
if check_result.pixel_entry_point {
|
||||||
|
file.pixel_entry_point.name = check_result.pixel_entry_point.name;
|
||||||
|
|
||||||
|
type_variable := from_handle(check_result.type_variables, check_result.pixel_entry_point.type_variable);
|
||||||
|
assert(type_variable.type == .Function);
|
||||||
|
|
||||||
|
field := type_variable_to_field(check_result.type_variables, check_result.scope_stack, type_variable.return_type_variable);
|
||||||
|
for hint : type_variable.source_node.hint_tokens {
|
||||||
|
field_hint : Field_Hint;
|
||||||
|
|
||||||
|
if hint.ident_value == "position" {
|
||||||
|
// @Incomplete(nb): Should be a lookup table somewhere
|
||||||
|
field_hint.kind = .Position;
|
||||||
|
} else if starts_with(hint.ident_value, "target") {
|
||||||
|
// @Incomplete(nb): Should be a lookup table somewhere
|
||||||
|
index_str : string;
|
||||||
|
index_str.data = *hint.ident_value.data[7];
|
||||||
|
index_str.count = 1;
|
||||||
|
|
||||||
|
result, ok, remainder := string_to_int(index_str);
|
||||||
|
if ok {
|
||||||
|
field_hint.target_index = result;
|
||||||
|
}
|
||||||
|
field_hint.kind = .Target;
|
||||||
|
} else {
|
||||||
|
// @Incomplete(nb): custom hints
|
||||||
|
}
|
||||||
|
array_add(*field.hints, field_hint);
|
||||||
|
}
|
||||||
|
|
||||||
|
file.pixel_entry_point.return_value = field;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -435,7 +552,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 +560,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 +569,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 +585,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 +600,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);
|
||||||
|
|||||||
@@ -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
|
||||||
18
test/codegen/constant_buffer.golden
Normal file
18
test/codegen/constant_buffer.golden
Normal 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);
|
||||||
|
}
|
||||||
|
|
||||||
17
test/codegen/custom_hint.golden
Normal file
17
test/codegen/custom_hint.golden
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
cbuffer __PROPERTIES : register(b0)
|
||||||
|
{
|
||||||
|
float __PROPERTIES__time;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float4 vs_main(float3 pos : POSITION) : SV_POSITION
|
||||||
|
{
|
||||||
|
return float4(pos.x, pos.y, pos.z, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
float4 ps_main(float4 pos : SV_POSITION) : SV_TARGET
|
||||||
|
{
|
||||||
|
float t = __PROPERTIES__time;
|
||||||
|
return float4(1, 1, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
24
test/codegen/inferred_types.golden
Normal file
24
test/codegen/inferred_types.golden
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
float bar();
|
||||||
|
float foo();
|
||||||
|
|
||||||
|
float bar()
|
||||||
|
{
|
||||||
|
return 5.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
float foo()
|
||||||
|
{
|
||||||
|
return bar();
|
||||||
|
}
|
||||||
|
|
||||||
|
float4 vs_main(float3 pos : POSITION) : SV_POSITION
|
||||||
|
{
|
||||||
|
float f = 2.0f;
|
||||||
|
int i = 10;
|
||||||
|
f = foo();
|
||||||
|
float2 v2 = float2(2, 2);
|
||||||
|
float3 v3 = float3(2, 2, 3);
|
||||||
|
float4 v4 = float4(4, 5, 6, 7);
|
||||||
|
return float4(1, 1, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
10
test/codegen/unary.golden
Normal file
10
test/codegen/unary.golden
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
float4 vs_vs_main(float3 position : POSITION) : SV_POSITION
|
||||||
|
{
|
||||||
|
return float4(position.x, position.y, position.z, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
float4 ps_ps_main(float4 position : SV_POSITION) : SV_TARGET
|
||||||
|
{
|
||||||
|
return float4(0.5f, -1, 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,20 +1,22 @@
|
|||||||
test/assign_arithmetic_expression.shd codegen
|
test/assign_arithmetic_expression.ink codegen
|
||||||
test/basic_property_and_return_value.shd codegen
|
test/basic_property_and_return_value.ink codegen
|
||||||
test/complicated_computation.shd codegen
|
test/complicated_computation.ink codegen
|
||||||
test/constant_buffer.shd codegen
|
test/constant_buffer.ink codegen
|
||||||
test/empty_struct.shd codegen
|
test/empty_struct.ink codegen
|
||||||
test/empty_vertex_main.shd codegen
|
test/empty_vertex_main.ink codegen
|
||||||
test/empty_vertex_main_with_position_parameter.shd codegen
|
test/empty_vertex_main_with_position_parameter.ink codegen
|
||||||
test/field_assignment.shd codegen
|
test/field_assignment.ink codegen
|
||||||
test/function_call.shd codegen
|
test/function_call.ink codegen
|
||||||
test/function_call_out_of_order_declaration.shd codegen
|
test/function_call_out_of_order_declaration.ink codegen
|
||||||
test/function_call_return.shd codegen
|
test/function_call_return.ink codegen
|
||||||
test/meta_block.shd codegen
|
test/inferred_types.ink codegen
|
||||||
test/multiple_functions.shd codegen
|
test/meta_block.ink codegen
|
||||||
test/multiple_semicolons_everywhere.shd codegen
|
test/multiple_functions.ink codegen
|
||||||
test/pass_and_access_struct_fields_in_functions.shd codegen
|
test/multiple_semicolons_everywhere.ink codegen
|
||||||
test/passthrough.shd codegen
|
test/pass_and_access_struct_fields_in_functions.ink codegen
|
||||||
test/property_rename.shd codegen
|
test/passthrough.ink codegen
|
||||||
test/simple_struct_access.shd codegen
|
test/property_rename.ink codegen
|
||||||
test/struct_within_struct.shd codegen
|
test/simple_struct_access.ink codegen
|
||||||
test/use_builtin_functions.shd codegen
|
test/struct_within_struct.ink codegen
|
||||||
|
test/unary.ink codegen
|
||||||
|
test/use_builtin_functions.ink codegen
|
||||||
|
|||||||
39
test/colorful_circle.ink
Normal file
39
test/colorful_circle.ink
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
prop :: properties {
|
||||||
|
time : float @time;
|
||||||
|
resolution : float2 @resolution;
|
||||||
|
}
|
||||||
|
|
||||||
|
vertex main :: (pos : float3 @position) -> float4 @position {
|
||||||
|
return float4(pos, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
pixel main :: (pos : float4 @outposition) -> float4 @target {
|
||||||
|
p := float2(2.0 * pos.x - prop.resolution.x, 2.0 * pos.y - prop.resolution.y) / prop.resolution.y;
|
||||||
|
tau := 3.1415926535 * 2.0;
|
||||||
|
a := atan(p.x, p.y);
|
||||||
|
r := length(p) * 0.75;
|
||||||
|
|
||||||
|
uv := float2(a / tau, r);
|
||||||
|
|
||||||
|
x_col := (uv.x - (p.time / 3.0)) * 3.0;
|
||||||
|
x_col = mod(x_col, 3.0);
|
||||||
|
hor_colour := float3(0.25, 0.25, 0.25);
|
||||||
|
|
||||||
|
if x_col < 1.0 {
|
||||||
|
horColour.r += 1.0 - xCol;
|
||||||
|
horColour.g += xCol;
|
||||||
|
} else if x_col < 2.0 {
|
||||||
|
xCol -= 1.0;
|
||||||
|
horColour.g += 1.0 - xCol;
|
||||||
|
horColour.b += xCol;
|
||||||
|
} else {
|
||||||
|
x_col -= 2.0;
|
||||||
|
hor_colour.b += 1.0 - x_col;
|
||||||
|
hor_colour.r += x_col;
|
||||||
|
}
|
||||||
|
|
||||||
|
uv = (2.0 * uv) - 1.0;
|
||||||
|
beam_width = (0.7+0.5*cos(uv.x*10.0*tau*0.15*clamp(floor(5.0 + 10.0*cos(iTime)), 0.0, 10.0))) * abs(1.0 / (30.0 * uv.y));
|
||||||
|
hor_beam = float3(beam_width);
|
||||||
|
result := float4(((hor_beam) * hor_colour), 1.0);
|
||||||
|
}
|
||||||
@@ -1,20 +1,22 @@
|
|||||||
test/assign_arithmetic_expression.shd compile
|
test/assign_arithmetic_expression.ink compile
|
||||||
test/basic_property_and_return_value.shd compile
|
test/basic_property_and_return_value.ink compile
|
||||||
test/complicated_computation.shd compile
|
test/complicated_computation.ink compile
|
||||||
test/empty_struct.shd compile
|
test/empty_struct.ink compile
|
||||||
test/empty_vertex_main.shd compile
|
test/empty_vertex_main.ink compile
|
||||||
test/empty_vertex_main_with_position_parameter.shd compile
|
test/empty_vertex_main_with_position_parameter.ink compile
|
||||||
test/field_assignment.shd compile
|
test/field_assignment.ink compile
|
||||||
test/float_suffix.shd compile
|
test/float_suffix.ink compile
|
||||||
test/function_call.shd compile
|
test/function_call.ink compile
|
||||||
test/function_call_out_of_order_declaration.shd compile
|
test/function_call_out_of_order_declaration.ink compile
|
||||||
test/function_call_return.shd compile
|
test/function_call_return.ink compile
|
||||||
test/functions_with_same_name.shd compile
|
test/functions_with_same_name.ink compile
|
||||||
test/meta_block.shd compile
|
test/inferred_types.ink compile
|
||||||
test/multiple_functions.shd compile
|
test/meta_block.ink compile
|
||||||
test/multiple_semicolons_everywhere.shd compile
|
test/multiple_functions.ink compile
|
||||||
test/pass_and_access_struct_fields_in_functions.shd compile
|
test/multiple_semicolons_everywhere.ink compile
|
||||||
test/passthrough.shd compile
|
test/pass_and_access_struct_fields_in_functions.ink compile
|
||||||
test/simple_struct_access.shd compile
|
test/passthrough.ink compile
|
||||||
test/struct_within_struct.shd compile
|
test/simple_struct_access.ink compile
|
||||||
test/use_builtin_functions.shd compile
|
test/struct_within_struct.ink compile
|
||||||
|
test/unary.ink compile
|
||||||
|
test/use_builtin_functions.ink compile
|
||||||
12
test/custom_hint.ink
Normal file
12
test/custom_hint.ink
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
p :: properties {
|
||||||
|
time : float @time;
|
||||||
|
}
|
||||||
|
|
||||||
|
vertex main :: (pos : float3 @position) -> float4 @position {
|
||||||
|
return float4(pos.x, pos.y, pos.z, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
pixel main :: (pos : float4 @outposition) -> float4 @target {
|
||||||
|
t := p.time;
|
||||||
|
return float4(1, 1, 1, 1);
|
||||||
|
}
|
||||||
6
test/float_if_cond.ink
Normal file
6
test/float_if_cond.ink
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
vertex main :: (pos : float3 @position) -> float4 @position {
|
||||||
|
if 1.0 {
|
||||||
|
return float4(pos, 1.0);
|
||||||
|
}
|
||||||
|
return float4(0.0);
|
||||||
|
}
|
||||||
17
test/inferred_types.ink
Normal file
17
test/inferred_types.ink
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
bar :: () -> float {
|
||||||
|
return 5.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
foo :: () -> float {
|
||||||
|
return bar();
|
||||||
|
}
|
||||||
|
|
||||||
|
vertex main :: (pos : float3 @position) -> float4 @position {
|
||||||
|
f := 2.0;
|
||||||
|
i := 10;
|
||||||
|
f = foo();
|
||||||
|
v2 := float2(2, 2);
|
||||||
|
v3 := float3(2, 2, 3);
|
||||||
|
v4 := float4(4, 5, 6, 7);
|
||||||
|
return float4(1, 1, 1, 1);
|
||||||
|
}
|
||||||
297
test/lex/colorful_circle.golden
Normal file
297
test/lex/colorful_circle.golden
Normal file
@@ -0,0 +1,297 @@
|
|||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 0 ; length = 4 line = 1 ; column = 0 ; value ='prop'; }
|
||||||
|
{kind = TOKEN_DOUBLECOLON; ; index = 5 ; length = 2 line = 1 ; column = 5 ; value ='::'; }
|
||||||
|
{kind = TOKEN_PROPERTIES; ; index = 8 ; length = 10 line = 1 ; column = 8 ; value ='properties'; }
|
||||||
|
{kind = TOKEN_LEFTBRACE; ; index = 19 ; length = 1 line = 1 ; column = 19 ; value ='{'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 23 ; length = 4 line = 2 ; column = 0 ; value ='time'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 28 ; length = 1 line = 2 ; column = 5 ; value =':'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 30 ; length = 5 line = 2 ; column = 7 ; value ='float'; }
|
||||||
|
{kind = TOKEN_AT; ; index = 36 ; length = 1 line = 2 ; column = 13 ; value ='@'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 37 ; length = 4 line = 2 ; column = 14 ; value ='time'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 41 ; length = 1 line = 2 ; column = 18 ; value =';'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 45 ; length = 10 line = 3 ; column = 0 ; value ='resolution'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 56 ; length = 1 line = 3 ; column = 11 ; value =':'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 58 ; length = 6 line = 3 ; column = 13 ; value ='float2'; }
|
||||||
|
{kind = TOKEN_AT; ; index = 65 ; length = 1 line = 3 ; column = 20 ; value ='@'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 66 ; length = 10 line = 3 ; column = 21 ; value ='resolution'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 76 ; length = 1 line = 3 ; column = 31 ; value =';'; }
|
||||||
|
{kind = TOKEN_RIGHTBRACE; ; index = 79 ; length = 1 line = 4 ; column = 0 ; value ='}'; }
|
||||||
|
{kind = TOKEN_VERTEX; ; index = 84 ; length = 6 line = 6 ; column = 0 ; value ='vertex'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 91 ; length = 4 line = 6 ; column = 7 ; value ='main'; }
|
||||||
|
{kind = TOKEN_DOUBLECOLON; ; index = 96 ; length = 2 line = 6 ; column = 12 ; value ='::'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 99 ; length = 1 line = 6 ; column = 15 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 100 ; length = 3 line = 6 ; column = 16 ; value ='pos'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 104 ; length = 1 line = 6 ; column = 20 ; value =':'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 106 ; length = 6 line = 6 ; column = 22 ; value ='float3'; }
|
||||||
|
{kind = TOKEN_AT; ; index = 113 ; length = 1 line = 6 ; column = 29 ; value ='@'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 114 ; length = 8 line = 6 ; column = 30 ; value ='position'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 122 ; length = 1 line = 6 ; column = 38 ; value =')'; }
|
||||||
|
{kind = TOKEN_ARROW; ; index = 124 ; length = 2 line = 6 ; column = 40 ; value ='->'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 127 ; length = 6 line = 6 ; column = 43 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_AT; ; index = 134 ; length = 1 line = 6 ; column = 50 ; value ='@'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 135 ; length = 8 line = 6 ; column = 51 ; value ='position'; }
|
||||||
|
{kind = TOKEN_LEFTBRACE; ; index = 144 ; length = 1 line = 6 ; column = 60 ; value ='{'; }
|
||||||
|
{kind = TOKEN_RETURN; ; index = 148 ; length = 6 line = 7 ; column = 0 ; value ='return'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 155 ; length = 6 line = 7 ; column = 7 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 161 ; length = 1 line = 7 ; column = 13 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 162 ; length = 3 line = 7 ; column = 14 ; value ='pos'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 165 ; length = 1 line = 7 ; column = 17 ; value =','; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 167 ; length = 3 line = 7 ; column = 19 ; value ='1'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 170 ; length = 1 line = 7 ; column = 22 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 171 ; length = 1 line = 7 ; column = 23 ; value =';'; }
|
||||||
|
{kind = TOKEN_RIGHTBRACE; ; index = 174 ; length = 1 line = 8 ; column = 0 ; value ='}'; }
|
||||||
|
{kind = TOKEN_PIXEL; ; index = 179 ; length = 5 line = 10 ; column = 0 ; value ='pixel'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 185 ; length = 4 line = 10 ; column = 6 ; value ='main'; }
|
||||||
|
{kind = TOKEN_DOUBLECOLON; ; index = 190 ; length = 2 line = 10 ; column = 11 ; value ='::'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 193 ; length = 1 line = 10 ; column = 14 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 194 ; length = 3 line = 10 ; column = 15 ; value ='pos'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 198 ; length = 1 line = 10 ; column = 19 ; value =':'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 200 ; length = 6 line = 10 ; column = 21 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_AT; ; index = 207 ; length = 1 line = 10 ; column = 28 ; value ='@'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 208 ; length = 11 line = 10 ; column = 29 ; value ='outposition'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 219 ; length = 1 line = 10 ; column = 40 ; value =')'; }
|
||||||
|
{kind = TOKEN_ARROW; ; index = 221 ; length = 2 line = 10 ; column = 42 ; value ='->'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 224 ; length = 6 line = 10 ; column = 45 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_AT; ; index = 231 ; length = 1 line = 10 ; column = 52 ; value ='@'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 232 ; length = 6 line = 10 ; column = 53 ; value ='target'; }
|
||||||
|
{kind = TOKEN_LEFTBRACE; ; index = 239 ; length = 1 line = 10 ; column = 60 ; value ='{'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 243 ; length = 1 line = 11 ; column = 0 ; value ='p'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 245 ; length = 1 line = 11 ; column = 2 ; value =':'; }
|
||||||
|
{kind = TOKEN_ASSIGN; ; index = 246 ; length = 1 line = 11 ; column = 3 ; value ='='; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 248 ; length = 6 line = 11 ; column = 5 ; value ='float2'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 254 ; length = 1 line = 11 ; column = 11 ; value ='('; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 255 ; length = 3 line = 11 ; column = 12 ; value ='2'; }
|
||||||
|
{kind = TOKEN_STAR; ; index = 259 ; length = 1 line = 11 ; column = 16 ; value ='*'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 261 ; length = 3 line = 11 ; column = 18 ; value ='pos'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 264 ; length = 1 line = 11 ; column = 21 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 265 ; length = 1 line = 11 ; column = 22 ; value ='x'; }
|
||||||
|
{kind = TOKEN_MINUS; ; index = 267 ; length = 1 line = 11 ; column = 24 ; value ='-'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 269 ; length = 4 line = 11 ; column = 26 ; value ='prop'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 273 ; length = 1 line = 11 ; column = 30 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 274 ; length = 10 line = 11 ; column = 31 ; value ='resolution'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 284 ; length = 1 line = 11 ; column = 41 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 285 ; length = 1 line = 11 ; column = 42 ; value ='x'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 286 ; length = 1 line = 11 ; column = 43 ; value =','; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 288 ; length = 3 line = 11 ; column = 45 ; value ='2'; }
|
||||||
|
{kind = TOKEN_STAR; ; index = 292 ; length = 1 line = 11 ; column = 49 ; value ='*'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 294 ; length = 3 line = 11 ; column = 51 ; value ='pos'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 297 ; length = 1 line = 11 ; column = 54 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 298 ; length = 1 line = 11 ; column = 55 ; value ='y'; }
|
||||||
|
{kind = TOKEN_MINUS; ; index = 300 ; length = 1 line = 11 ; column = 57 ; value ='-'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 302 ; length = 4 line = 11 ; column = 59 ; value ='prop'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 306 ; length = 1 line = 11 ; column = 63 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 307 ; length = 10 line = 11 ; column = 64 ; value ='resolution'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 317 ; length = 1 line = 11 ; column = 74 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 318 ; length = 1 line = 11 ; column = 75 ; value ='y'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 319 ; length = 1 line = 11 ; column = 76 ; value =')'; }
|
||||||
|
{kind = TOKEN_SLASH; ; index = 321 ; length = 1 line = 11 ; column = 78 ; value ='/'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 323 ; length = 4 line = 11 ; column = 80 ; value ='prop'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 327 ; length = 1 line = 11 ; column = 84 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 328 ; length = 10 line = 11 ; column = 85 ; value ='resolution'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 338 ; length = 1 line = 11 ; column = 95 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 339 ; length = 1 line = 11 ; column = 96 ; value ='y'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 340 ; length = 1 line = 11 ; column = 97 ; value =';'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 344 ; length = 3 line = 12 ; column = 0 ; value ='tau'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 348 ; length = 1 line = 12 ; column = 4 ; value =':'; }
|
||||||
|
{kind = TOKEN_ASSIGN; ; index = 349 ; length = 1 line = 12 ; column = 5 ; value ='='; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 351 ; length = 12 line = 12 ; column = 7 ; value ='3.141593'; }
|
||||||
|
{kind = TOKEN_STAR; ; index = 364 ; length = 1 line = 12 ; column = 20 ; value ='*'; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 366 ; length = 3 line = 12 ; column = 22 ; value ='2'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 369 ; length = 1 line = 12 ; column = 25 ; value =';'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 373 ; length = 1 line = 13 ; column = 0 ; value ='a'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 375 ; length = 1 line = 13 ; column = 2 ; value =':'; }
|
||||||
|
{kind = TOKEN_ASSIGN; ; index = 376 ; length = 1 line = 13 ; column = 3 ; value ='='; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 378 ; length = 4 line = 13 ; column = 5 ; value ='atan'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 382 ; length = 1 line = 13 ; column = 9 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 383 ; length = 1 line = 13 ; column = 10 ; value ='p'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 384 ; length = 1 line = 13 ; column = 11 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 385 ; length = 1 line = 13 ; column = 12 ; value ='x'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 386 ; length = 1 line = 13 ; column = 13 ; value =','; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 388 ; length = 1 line = 13 ; column = 15 ; value ='p'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 389 ; length = 1 line = 13 ; column = 16 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 390 ; length = 1 line = 13 ; column = 17 ; value ='y'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 391 ; length = 1 line = 13 ; column = 18 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 392 ; length = 1 line = 13 ; column = 19 ; value =';'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 396 ; length = 1 line = 14 ; column = 0 ; value ='r'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 398 ; length = 1 line = 14 ; column = 2 ; value =':'; }
|
||||||
|
{kind = TOKEN_ASSIGN; ; index = 399 ; length = 1 line = 14 ; column = 3 ; value ='='; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 401 ; length = 6 line = 14 ; column = 5 ; value ='length'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 407 ; length = 1 line = 14 ; column = 11 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 408 ; length = 1 line = 14 ; column = 12 ; value ='p'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 409 ; length = 1 line = 14 ; column = 13 ; value =')'; }
|
||||||
|
{kind = TOKEN_STAR; ; index = 411 ; length = 1 line = 14 ; column = 15 ; value ='*'; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 413 ; length = 4 line = 14 ; column = 17 ; value ='0.75'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 417 ; length = 1 line = 14 ; column = 21 ; value =';'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 423 ; length = 2 line = 16 ; column = 0 ; value ='uv'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 426 ; length = 1 line = 16 ; column = 3 ; value =':'; }
|
||||||
|
{kind = TOKEN_ASSIGN; ; index = 427 ; length = 1 line = 16 ; column = 4 ; value ='='; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 429 ; length = 6 line = 16 ; column = 6 ; value ='float2'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 435 ; length = 1 line = 16 ; column = 12 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 436 ; length = 1 line = 16 ; column = 13 ; value ='a'; }
|
||||||
|
{kind = TOKEN_SLASH; ; index = 438 ; length = 1 line = 16 ; column = 15 ; value ='/'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 440 ; length = 3 line = 16 ; column = 17 ; value ='tau'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 443 ; length = 1 line = 16 ; column = 20 ; value =','; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 445 ; length = 1 line = 16 ; column = 22 ; value ='r'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 446 ; length = 1 line = 16 ; column = 23 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 447 ; length = 1 line = 16 ; column = 24 ; value =';'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 453 ; length = 5 line = 18 ; column = 0 ; value ='x_col'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 459 ; length = 1 line = 18 ; column = 6 ; value =':'; }
|
||||||
|
{kind = TOKEN_ASSIGN; ; index = 460 ; length = 1 line = 18 ; column = 7 ; value ='='; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 462 ; length = 1 line = 18 ; column = 9 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 463 ; length = 2 line = 18 ; column = 10 ; value ='uv'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 465 ; length = 1 line = 18 ; column = 12 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 466 ; length = 1 line = 18 ; column = 13 ; value ='x'; }
|
||||||
|
{kind = TOKEN_MINUS; ; index = 468 ; length = 1 line = 18 ; column = 15 ; value ='-'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 470 ; length = 1 line = 18 ; column = 17 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 471 ; length = 1 line = 18 ; column = 18 ; value ='p'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 472 ; length = 1 line = 18 ; column = 19 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 473 ; length = 4 line = 18 ; column = 20 ; value ='time'; }
|
||||||
|
{kind = TOKEN_SLASH; ; index = 478 ; length = 1 line = 18 ; column = 25 ; value ='/'; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 480 ; length = 3 line = 18 ; column = 27 ; value ='3'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 483 ; length = 1 line = 18 ; column = 30 ; value =')'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 484 ; length = 1 line = 18 ; column = 31 ; value =')'; }
|
||||||
|
{kind = TOKEN_STAR; ; index = 486 ; length = 1 line = 18 ; column = 33 ; value ='*'; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 488 ; length = 3 line = 18 ; column = 35 ; value ='3'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 491 ; length = 1 line = 18 ; column = 38 ; value =';'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 495 ; length = 5 line = 19 ; column = 0 ; value ='x_col'; }
|
||||||
|
{kind = TOKEN_ASSIGN; ; index = 501 ; length = 1 line = 19 ; column = 6 ; value ='='; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 503 ; length = 3 line = 19 ; column = 8 ; value ='mod'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 506 ; length = 1 line = 19 ; column = 11 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 507 ; length = 5 line = 19 ; column = 12 ; value ='x_col'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 512 ; length = 1 line = 19 ; column = 17 ; value =','; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 514 ; length = 3 line = 19 ; column = 19 ; value ='3'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 517 ; length = 1 line = 19 ; column = 22 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 518 ; length = 1 line = 19 ; column = 23 ; value =';'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 522 ; length = 10 line = 20 ; column = 0 ; value ='hor_colour'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 533 ; length = 1 line = 20 ; column = 11 ; value =':'; }
|
||||||
|
{kind = TOKEN_ASSIGN; ; index = 534 ; length = 1 line = 20 ; column = 12 ; value ='='; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 536 ; length = 6 line = 20 ; column = 14 ; value ='float3'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 542 ; length = 1 line = 20 ; column = 20 ; value ='('; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 543 ; length = 4 line = 20 ; column = 21 ; value ='0.25'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 547 ; length = 1 line = 20 ; column = 25 ; value =','; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 549 ; length = 4 line = 20 ; column = 27 ; value ='0.25'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 553 ; length = 1 line = 20 ; column = 31 ; value =','; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 555 ; length = 4 line = 20 ; column = 33 ; value ='0.25'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 559 ; length = 1 line = 20 ; column = 37 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 560 ; length = 1 line = 20 ; column = 38 ; value =';'; }
|
||||||
|
{kind = TOKEN_IF; ; index = 567 ; length = 2 line = 22 ; column = 0 ; value ='if'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 570 ; length = 5 line = 22 ; column = 3 ; value ='x_col'; }
|
||||||
|
{kind = TOKEN_LESS; ; index = 576 ; length = 1 line = 22 ; column = 9 ; value ='<'; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 578 ; length = 3 line = 22 ; column = 11 ; value ='1'; }
|
||||||
|
{kind = TOKEN_LEFTBRACE; ; index = 582 ; length = 1 line = 22 ; column = 15 ; value ='{'; }
|
||||||
|
{kind = TOKEN_RIGHTBRACE; ; index = 587 ; length = 1 line = 24 ; column = 0 ; value ='}'; }
|
||||||
|
{kind = TOKEN_ELSE; ; index = 589 ; length = 4 line = 24 ; column = 2 ; value ='else'; }
|
||||||
|
{kind = TOKEN_IF; ; index = 594 ; length = 2 line = 24 ; column = 7 ; value ='if'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 597 ; length = 5 line = 24 ; column = 10 ; value ='x_col'; }
|
||||||
|
{kind = TOKEN_LESS; ; index = 603 ; length = 1 line = 24 ; column = 16 ; value ='<'; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 605 ; length = 3 line = 24 ; column = 18 ; value ='2'; }
|
||||||
|
{kind = TOKEN_LEFTBRACE; ; index = 609 ; length = 1 line = 24 ; column = 22 ; value ='{'; }
|
||||||
|
{kind = TOKEN_RIGHTBRACE; ; index = 615 ; length = 1 line = 26 ; column = 0 ; value ='}'; }
|
||||||
|
{kind = TOKEN_ELSE; ; index = 617 ; length = 4 line = 26 ; column = 2 ; value ='else'; }
|
||||||
|
{kind = TOKEN_LEFTBRACE; ; index = 622 ; length = 1 line = 26 ; column = 7 ; value ='{'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 626 ; length = 5 line = 27 ; column = 0 ; value ='x_col'; }
|
||||||
|
{kind = TOKEN_MINUSEQUALS; ; index = 632 ; length = 2 line = 27 ; column = 6 ; value ='-='; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 635 ; length = 3 line = 27 ; column = 9 ; value ='2'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 638 ; length = 1 line = 27 ; column = 12 ; value =';'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 642 ; length = 10 line = 28 ; column = 0 ; value ='hor_colour'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 652 ; length = 1 line = 28 ; column = 10 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 653 ; length = 1 line = 28 ; column = 11 ; value ='b'; }
|
||||||
|
{kind = TOKEN_PLUSEQUALS; ; index = 655 ; length = 2 line = 28 ; column = 13 ; value ='+='; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 658 ; length = 3 line = 28 ; column = 16 ; value ='1'; }
|
||||||
|
{kind = TOKEN_MINUS; ; index = 662 ; length = 1 line = 28 ; column = 20 ; value ='-'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 664 ; length = 5 line = 28 ; column = 22 ; value ='x_col'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 669 ; length = 1 line = 28 ; column = 27 ; value =';'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 673 ; length = 10 line = 29 ; column = 0 ; value ='hor_colour'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 683 ; length = 1 line = 29 ; column = 10 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 684 ; length = 1 line = 29 ; column = 11 ; value ='r'; }
|
||||||
|
{kind = TOKEN_PLUSEQUALS; ; index = 686 ; length = 2 line = 29 ; column = 13 ; value ='+='; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 689 ; length = 5 line = 29 ; column = 16 ; value ='x_col'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 694 ; length = 1 line = 29 ; column = 21 ; value =';'; }
|
||||||
|
{kind = TOKEN_RIGHTBRACE; ; index = 697 ; length = 1 line = 30 ; column = 0 ; value ='}'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 702 ; length = 2 line = 32 ; column = 0 ; value ='uv'; }
|
||||||
|
{kind = TOKEN_ASSIGN; ; index = 705 ; length = 1 line = 32 ; column = 3 ; value ='='; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 707 ; length = 1 line = 32 ; column = 5 ; value ='('; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 708 ; length = 3 line = 32 ; column = 6 ; value ='2'; }
|
||||||
|
{kind = TOKEN_STAR; ; index = 712 ; length = 1 line = 32 ; column = 10 ; value ='*'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 714 ; length = 2 line = 32 ; column = 12 ; value ='uv'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 716 ; length = 1 line = 32 ; column = 14 ; value =')'; }
|
||||||
|
{kind = TOKEN_MINUS; ; index = 718 ; length = 1 line = 32 ; column = 16 ; value ='-'; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 720 ; length = 3 line = 32 ; column = 18 ; value ='1'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 723 ; length = 1 line = 32 ; column = 21 ; value =';'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 726 ; length = 10 line = 33 ; column = 0 ; value ='beam_width'; }
|
||||||
|
{kind = TOKEN_ASSIGN; ; index = 737 ; length = 1 line = 33 ; column = 11 ; value ='='; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 739 ; length = 1 line = 33 ; column = 13 ; value ='('; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 740 ; length = 3 line = 33 ; column = 14 ; value ='0.7'; }
|
||||||
|
{kind = TOKEN_PLUS; ; index = 743 ; length = 1 line = 33 ; column = 17 ; value ='+'; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 744 ; length = 3 line = 33 ; column = 18 ; value ='0.5'; }
|
||||||
|
{kind = TOKEN_STAR; ; index = 747 ; length = 1 line = 33 ; column = 21 ; value ='*'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 748 ; length = 3 line = 33 ; column = 22 ; value ='cos'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 751 ; length = 1 line = 33 ; column = 25 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 752 ; length = 2 line = 33 ; column = 26 ; value ='uv'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 754 ; length = 1 line = 33 ; column = 28 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 755 ; length = 1 line = 33 ; column = 29 ; value ='x'; }
|
||||||
|
{kind = TOKEN_STAR; ; index = 756 ; length = 1 line = 33 ; column = 30 ; value ='*'; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 757 ; length = 4 line = 33 ; column = 31 ; value ='10'; }
|
||||||
|
{kind = TOKEN_STAR; ; index = 761 ; length = 1 line = 33 ; column = 35 ; value ='*'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 762 ; length = 3 line = 33 ; column = 36 ; value ='tau'; }
|
||||||
|
{kind = TOKEN_STAR; ; index = 765 ; length = 1 line = 33 ; column = 39 ; value ='*'; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 766 ; length = 4 line = 33 ; column = 40 ; value ='0.15'; }
|
||||||
|
{kind = TOKEN_STAR; ; index = 770 ; length = 1 line = 33 ; column = 44 ; value ='*'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 771 ; length = 5 line = 33 ; column = 45 ; value ='clamp'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 776 ; length = 1 line = 33 ; column = 50 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 777 ; length = 5 line = 33 ; column = 51 ; value ='floor'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 782 ; length = 1 line = 33 ; column = 56 ; value ='('; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 783 ; length = 3 line = 33 ; column = 57 ; value ='5'; }
|
||||||
|
{kind = TOKEN_PLUS; ; index = 787 ; length = 1 line = 33 ; column = 61 ; value ='+'; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 789 ; length = 4 line = 33 ; column = 63 ; value ='10'; }
|
||||||
|
{kind = TOKEN_STAR; ; index = 793 ; length = 1 line = 33 ; column = 67 ; value ='*'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 794 ; length = 3 line = 33 ; column = 68 ; value ='cos'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 797 ; length = 1 line = 33 ; column = 71 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 798 ; length = 5 line = 33 ; column = 72 ; value ='iTime'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 803 ; length = 1 line = 33 ; column = 77 ; value =')'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 804 ; length = 1 line = 33 ; column = 78 ; value =')'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 805 ; length = 1 line = 33 ; column = 79 ; value =','; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 807 ; length = 3 line = 33 ; column = 81 ; value ='0'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 810 ; length = 1 line = 33 ; column = 84 ; value =','; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 812 ; length = 4 line = 33 ; column = 86 ; value ='10'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 816 ; length = 1 line = 33 ; column = 90 ; value =')'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 817 ; length = 1 line = 33 ; column = 91 ; value =')'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 818 ; length = 1 line = 33 ; column = 92 ; value =')'; }
|
||||||
|
{kind = TOKEN_STAR; ; index = 820 ; length = 1 line = 33 ; column = 94 ; value ='*'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 822 ; length = 3 line = 33 ; column = 96 ; value ='abs'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 825 ; length = 1 line = 33 ; column = 99 ; value ='('; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 826 ; length = 3 line = 33 ; column = 100 ; value ='1'; }
|
||||||
|
{kind = TOKEN_SLASH; ; index = 830 ; length = 1 line = 33 ; column = 104 ; value ='/'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 832 ; length = 1 line = 33 ; column = 106 ; value ='('; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 833 ; length = 4 line = 33 ; column = 107 ; value ='30'; }
|
||||||
|
{kind = TOKEN_STAR; ; index = 838 ; length = 1 line = 33 ; column = 112 ; value ='*'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 840 ; length = 2 line = 33 ; column = 114 ; value ='uv'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 842 ; length = 1 line = 33 ; column = 116 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 843 ; length = 1 line = 33 ; column = 117 ; value ='y'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 844 ; length = 1 line = 33 ; column = 118 ; value =')'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 845 ; length = 1 line = 33 ; column = 119 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 846 ; length = 1 line = 33 ; column = 120 ; value =';'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 849 ; length = 8 line = 34 ; column = 0 ; value ='hor_beam'; }
|
||||||
|
{kind = TOKEN_ASSIGN; ; index = 858 ; length = 1 line = 34 ; column = 9 ; value ='='; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 860 ; length = 6 line = 34 ; column = 11 ; value ='float3'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 866 ; length = 1 line = 34 ; column = 17 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 867 ; length = 10 line = 34 ; column = 18 ; value ='beam_width'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 877 ; length = 1 line = 34 ; column = 28 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 878 ; length = 1 line = 34 ; column = 29 ; value =';'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 881 ; length = 6 line = 35 ; column = 0 ; value ='result'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 888 ; length = 1 line = 35 ; column = 7 ; value =':'; }
|
||||||
|
{kind = TOKEN_ASSIGN; ; index = 889 ; length = 1 line = 35 ; column = 8 ; value ='='; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 891 ; length = 6 line = 35 ; column = 10 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 897 ; length = 1 line = 35 ; column = 16 ; value ='('; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 898 ; length = 1 line = 35 ; column = 17 ; value ='('; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 899 ; length = 1 line = 35 ; column = 18 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 900 ; length = 8 line = 35 ; column = 19 ; value ='hor_beam'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 908 ; length = 1 line = 35 ; column = 27 ; value =')'; }
|
||||||
|
{kind = TOKEN_STAR; ; index = 910 ; length = 1 line = 35 ; column = 29 ; value ='*'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 912 ; length = 10 line = 35 ; column = 31 ; value ='hor_colour'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 922 ; length = 1 line = 35 ; column = 41 ; value =')'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 923 ; length = 1 line = 35 ; column = 42 ; value =','; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 925 ; length = 3 line = 35 ; column = 44 ; value ='1'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 928 ; length = 1 line = 35 ; column = 47 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 929 ; length = 1 line = 35 ; column = 48 ; value =';'; }
|
||||||
|
{kind = TOKEN_RIGHTBRACE; ; index = 932 ; length = 1 line = 36 ; column = 0 ; value ='}'; }
|
||||||
|
{kind = TOKEN_EOF; ; index = 935 ; length = 0 line = 37 ; column = 0 ; value =''; }
|
||||||
@@ -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 =''; }
|
||||||
|
|||||||
81
test/lex/custom_hint.golden
Normal file
81
test/lex/custom_hint.golden
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 0 ; length = 1 line = 1 ; column = 0 ; value ='p'; }
|
||||||
|
{kind = TOKEN_DOUBLECOLON; ; index = 2 ; length = 2 line = 1 ; column = 2 ; value ='::'; }
|
||||||
|
{kind = TOKEN_PROPERTIES; ; index = 5 ; length = 10 line = 1 ; column = 5 ; value ='properties'; }
|
||||||
|
{kind = TOKEN_LEFTBRACE; ; index = 16 ; length = 1 line = 1 ; column = 16 ; value ='{'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 20 ; length = 4 line = 2 ; column = 0 ; value ='time'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 25 ; length = 1 line = 2 ; column = 5 ; value =':'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 27 ; length = 5 line = 2 ; column = 7 ; value ='float'; }
|
||||||
|
{kind = TOKEN_AT; ; index = 33 ; length = 1 line = 2 ; column = 13 ; value ='@'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 34 ; length = 4 line = 2 ; column = 14 ; value ='time'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 38 ; length = 1 line = 2 ; column = 18 ; value =';'; }
|
||||||
|
{kind = TOKEN_RIGHTBRACE; ; index = 41 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
|
||||||
|
{kind = TOKEN_VERTEX; ; index = 46 ; length = 6 line = 5 ; column = 0 ; value ='vertex'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 53 ; length = 4 line = 5 ; column = 7 ; value ='main'; }
|
||||||
|
{kind = TOKEN_DOUBLECOLON; ; index = 58 ; length = 2 line = 5 ; column = 12 ; value ='::'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 61 ; length = 1 line = 5 ; column = 15 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 62 ; length = 3 line = 5 ; column = 16 ; value ='pos'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 66 ; length = 1 line = 5 ; column = 20 ; value =':'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 68 ; length = 6 line = 5 ; column = 22 ; value ='float3'; }
|
||||||
|
{kind = TOKEN_AT; ; index = 75 ; length = 1 line = 5 ; column = 29 ; value ='@'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 76 ; length = 8 line = 5 ; column = 30 ; value ='position'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 84 ; length = 1 line = 5 ; column = 38 ; value =')'; }
|
||||||
|
{kind = TOKEN_ARROW; ; index = 86 ; length = 2 line = 5 ; column = 40 ; value ='->'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 89 ; length = 6 line = 5 ; column = 43 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_AT; ; index = 96 ; length = 1 line = 5 ; column = 50 ; value ='@'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 97 ; length = 8 line = 5 ; column = 51 ; value ='position'; }
|
||||||
|
{kind = TOKEN_LEFTBRACE; ; index = 106 ; length = 1 line = 5 ; column = 60 ; value ='{'; }
|
||||||
|
{kind = TOKEN_RETURN; ; index = 110 ; length = 6 line = 6 ; column = 0 ; value ='return'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 117 ; length = 6 line = 6 ; column = 7 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 123 ; length = 1 line = 6 ; column = 13 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 124 ; length = 3 line = 6 ; column = 14 ; value ='pos'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 127 ; length = 1 line = 6 ; column = 17 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 128 ; length = 1 line = 6 ; column = 18 ; value ='x'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 129 ; length = 1 line = 6 ; column = 19 ; value =','; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 131 ; length = 3 line = 6 ; column = 21 ; value ='pos'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 134 ; length = 1 line = 6 ; column = 24 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 135 ; length = 1 line = 6 ; column = 25 ; value ='y'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 136 ; length = 1 line = 6 ; column = 26 ; value =','; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 138 ; length = 3 line = 6 ; column = 28 ; value ='pos'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 141 ; length = 1 line = 6 ; column = 31 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 142 ; length = 1 line = 6 ; column = 32 ; value ='z'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 143 ; length = 1 line = 6 ; column = 33 ; value =','; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 145 ; length = 3 line = 6 ; column = 35 ; value ='1'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 148 ; length = 1 line = 6 ; column = 38 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 149 ; length = 1 line = 6 ; column = 39 ; value =';'; }
|
||||||
|
{kind = TOKEN_RIGHTBRACE; ; index = 152 ; length = 1 line = 7 ; column = 0 ; value ='}'; }
|
||||||
|
{kind = TOKEN_PIXEL; ; index = 157 ; length = 5 line = 9 ; column = 0 ; value ='pixel'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 163 ; length = 4 line = 9 ; column = 6 ; value ='main'; }
|
||||||
|
{kind = TOKEN_DOUBLECOLON; ; index = 168 ; length = 2 line = 9 ; column = 11 ; value ='::'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 171 ; length = 1 line = 9 ; column = 14 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 172 ; length = 3 line = 9 ; column = 15 ; value ='pos'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 176 ; length = 1 line = 9 ; column = 19 ; value =':'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 178 ; length = 6 line = 9 ; column = 21 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_AT; ; index = 185 ; length = 1 line = 9 ; column = 28 ; value ='@'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 186 ; length = 11 line = 9 ; column = 29 ; value ='outposition'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 197 ; length = 1 line = 9 ; column = 40 ; value =')'; }
|
||||||
|
{kind = TOKEN_ARROW; ; index = 199 ; length = 2 line = 9 ; column = 42 ; value ='->'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 202 ; length = 6 line = 9 ; column = 45 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_AT; ; index = 209 ; length = 1 line = 9 ; column = 52 ; value ='@'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 210 ; length = 6 line = 9 ; column = 53 ; value ='target'; }
|
||||||
|
{kind = TOKEN_LEFTBRACE; ; index = 217 ; length = 1 line = 9 ; column = 60 ; value ='{'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 221 ; length = 1 line = 10 ; column = 0 ; value ='t'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 223 ; length = 1 line = 10 ; column = 2 ; value =':'; }
|
||||||
|
{kind = TOKEN_ASSIGN; ; index = 224 ; length = 1 line = 10 ; column = 3 ; value ='='; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 226 ; length = 1 line = 10 ; column = 5 ; value ='p'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 227 ; length = 1 line = 10 ; column = 6 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 228 ; length = 4 line = 10 ; column = 7 ; value ='time'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 232 ; length = 1 line = 10 ; column = 11 ; value =';'; }
|
||||||
|
{kind = TOKEN_RETURN; ; index = 236 ; length = 6 line = 11 ; column = 0 ; value ='return'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 243 ; length = 6 line = 11 ; column = 7 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 249 ; length = 1 line = 11 ; column = 13 ; value ='('; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 250 ; length = 1 line = 11 ; column = 14 ; value ='1'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 251 ; length = 1 line = 11 ; column = 15 ; value =','; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 253 ; length = 1 line = 11 ; column = 17 ; value ='1'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 254 ; length = 1 line = 11 ; column = 18 ; value =','; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 256 ; length = 1 line = 11 ; column = 20 ; value ='1'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 257 ; length = 1 line = 11 ; column = 21 ; value =','; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 259 ; length = 1 line = 11 ; column = 23 ; value ='1'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 260 ; length = 1 line = 11 ; column = 24 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 261 ; length = 1 line = 11 ; column = 25 ; value =';'; }
|
||||||
|
{kind = TOKEN_RIGHTBRACE; ; index = 264 ; length = 1 line = 12 ; column = 0 ; value ='}'; }
|
||||||
|
{kind = TOKEN_EOF; ; index = 267 ; length = 0 line = 13 ; column = 0 ; value =''; }
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
[1;37mtest/float_suffix.shd:2,12: [31merror: [37mWe don't use 'f' suffixes for floating point values.
|
[1;37mtest/float_suffix.ink:2,12: [31merror: [37mWe don't use 'f' suffixes for floating point values.
|
||||||
[36m x : float = 2.0f
|
[36m x : float = 2.0f
|
||||||
^^^^
|
^^^^
|
||||||
[37m
|
[37m
|
||||||
105
test/lex/inferred_types.golden
Normal file
105
test/lex/inferred_types.golden
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 0 ; length = 3 line = 1 ; column = 0 ; value ='bar'; }
|
||||||
|
{kind = TOKEN_DOUBLECOLON; ; index = 4 ; length = 2 line = 1 ; column = 4 ; value ='::'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 7 ; length = 1 line = 1 ; column = 7 ; value ='('; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 8 ; length = 1 line = 1 ; column = 8 ; value =')'; }
|
||||||
|
{kind = TOKEN_ARROW; ; index = 10 ; length = 2 line = 1 ; column = 10 ; value ='->'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 13 ; length = 5 line = 1 ; column = 13 ; value ='float'; }
|
||||||
|
{kind = TOKEN_LEFTBRACE; ; index = 19 ; length = 1 line = 1 ; column = 19 ; value ='{'; }
|
||||||
|
{kind = TOKEN_RETURN; ; index = 23 ; length = 6 line = 2 ; column = 0 ; value ='return'; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 30 ; length = 3 line = 2 ; column = 7 ; value ='5'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 33 ; length = 1 line = 2 ; column = 10 ; value =';'; }
|
||||||
|
{kind = TOKEN_RIGHTBRACE; ; index = 36 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 41 ; length = 3 line = 5 ; column = 0 ; value ='foo'; }
|
||||||
|
{kind = TOKEN_DOUBLECOLON; ; index = 45 ; length = 2 line = 5 ; column = 4 ; value ='::'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 48 ; length = 1 line = 5 ; column = 7 ; value ='('; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 49 ; length = 1 line = 5 ; column = 8 ; value =')'; }
|
||||||
|
{kind = TOKEN_ARROW; ; index = 51 ; length = 2 line = 5 ; column = 10 ; value ='->'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 54 ; length = 5 line = 5 ; column = 13 ; value ='float'; }
|
||||||
|
{kind = TOKEN_LEFTBRACE; ; index = 60 ; length = 1 line = 5 ; column = 19 ; value ='{'; }
|
||||||
|
{kind = TOKEN_RETURN; ; index = 64 ; length = 6 line = 6 ; column = 0 ; value ='return'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 71 ; length = 3 line = 6 ; column = 7 ; value ='bar'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 74 ; length = 1 line = 6 ; column = 10 ; value ='('; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 75 ; length = 1 line = 6 ; column = 11 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 76 ; length = 1 line = 6 ; column = 12 ; value =';'; }
|
||||||
|
{kind = TOKEN_RIGHTBRACE; ; index = 79 ; length = 1 line = 7 ; column = 0 ; value ='}'; }
|
||||||
|
{kind = TOKEN_VERTEX; ; index = 84 ; length = 6 line = 9 ; column = 0 ; value ='vertex'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 91 ; length = 4 line = 9 ; column = 7 ; value ='main'; }
|
||||||
|
{kind = TOKEN_DOUBLECOLON; ; index = 96 ; length = 2 line = 9 ; column = 12 ; value ='::'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 99 ; length = 1 line = 9 ; column = 15 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 100 ; length = 3 line = 9 ; column = 16 ; value ='pos'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 104 ; length = 1 line = 9 ; column = 20 ; value =':'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 106 ; length = 6 line = 9 ; column = 22 ; value ='float3'; }
|
||||||
|
{kind = TOKEN_AT; ; index = 113 ; length = 1 line = 9 ; column = 29 ; value ='@'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 114 ; length = 8 line = 9 ; column = 30 ; value ='position'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 122 ; length = 1 line = 9 ; column = 38 ; value =')'; }
|
||||||
|
{kind = TOKEN_ARROW; ; index = 124 ; length = 2 line = 9 ; column = 40 ; value ='->'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 127 ; length = 6 line = 9 ; column = 43 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_AT; ; index = 134 ; length = 1 line = 9 ; column = 50 ; value ='@'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 135 ; length = 8 line = 9 ; column = 51 ; value ='position'; }
|
||||||
|
{kind = TOKEN_LEFTBRACE; ; index = 144 ; length = 1 line = 9 ; column = 60 ; value ='{'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 151 ; length = 1 line = 10 ; column = 3 ; value ='f'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 153 ; length = 1 line = 10 ; column = 5 ; value =':'; }
|
||||||
|
{kind = TOKEN_ASSIGN; ; index = 154 ; length = 1 line = 10 ; column = 6 ; value ='='; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 156 ; length = 3 line = 10 ; column = 8 ; value ='2'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 159 ; length = 1 line = 10 ; column = 11 ; value =';'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 166 ; length = 1 line = 11 ; column = 3 ; value ='i'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 168 ; length = 1 line = 11 ; column = 5 ; value =':'; }
|
||||||
|
{kind = TOKEN_ASSIGN; ; index = 169 ; length = 1 line = 11 ; column = 6 ; value ='='; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 171 ; length = 2 line = 11 ; column = 8 ; value ='10'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 173 ; length = 1 line = 11 ; column = 10 ; value =';'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 180 ; length = 1 line = 12 ; column = 3 ; value ='f'; }
|
||||||
|
{kind = TOKEN_ASSIGN; ; index = 182 ; length = 1 line = 12 ; column = 5 ; value ='='; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 184 ; length = 3 line = 12 ; column = 7 ; value ='foo'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 187 ; length = 1 line = 12 ; column = 10 ; value ='('; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 188 ; length = 1 line = 12 ; column = 11 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 189 ; length = 1 line = 12 ; column = 12 ; value =';'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 196 ; length = 2 line = 13 ; column = 3 ; value ='v2'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 199 ; length = 1 line = 13 ; column = 6 ; value =':'; }
|
||||||
|
{kind = TOKEN_ASSIGN; ; index = 200 ; length = 1 line = 13 ; column = 7 ; value ='='; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 202 ; length = 6 line = 13 ; column = 9 ; value ='float2'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 208 ; length = 1 line = 13 ; column = 15 ; value ='('; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 209 ; length = 1 line = 13 ; column = 16 ; value ='2'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 210 ; length = 1 line = 13 ; column = 17 ; value =','; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 212 ; length = 1 line = 13 ; column = 19 ; value ='2'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 213 ; length = 1 line = 13 ; column = 20 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 214 ; length = 1 line = 13 ; column = 21 ; value =';'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 221 ; length = 2 line = 14 ; column = 3 ; value ='v3'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 224 ; length = 1 line = 14 ; column = 6 ; value =':'; }
|
||||||
|
{kind = TOKEN_ASSIGN; ; index = 225 ; length = 1 line = 14 ; column = 7 ; value ='='; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 227 ; length = 6 line = 14 ; column = 9 ; value ='float3'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 233 ; length = 1 line = 14 ; column = 15 ; value ='('; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 234 ; length = 1 line = 14 ; column = 16 ; value ='2'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 235 ; length = 1 line = 14 ; column = 17 ; value =','; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 237 ; length = 1 line = 14 ; column = 19 ; value ='2'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 238 ; length = 1 line = 14 ; column = 20 ; value =','; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 240 ; length = 1 line = 14 ; column = 22 ; value ='3'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 241 ; length = 1 line = 14 ; column = 23 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 242 ; length = 1 line = 14 ; column = 24 ; value =';'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 249 ; length = 2 line = 15 ; column = 3 ; value ='v4'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 252 ; length = 1 line = 15 ; column = 6 ; value =':'; }
|
||||||
|
{kind = TOKEN_ASSIGN; ; index = 253 ; length = 1 line = 15 ; column = 7 ; value ='='; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 255 ; length = 6 line = 15 ; column = 9 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 261 ; length = 1 line = 15 ; column = 15 ; value ='('; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 262 ; length = 1 line = 15 ; column = 16 ; value ='4'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 263 ; length = 1 line = 15 ; column = 17 ; value =','; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 265 ; length = 1 line = 15 ; column = 19 ; value ='5'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 266 ; length = 1 line = 15 ; column = 20 ; value =','; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 268 ; length = 1 line = 15 ; column = 22 ; value ='6'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 269 ; length = 1 line = 15 ; column = 23 ; value =','; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 271 ; length = 1 line = 15 ; column = 25 ; value ='7'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 272 ; length = 1 line = 15 ; column = 26 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 273 ; length = 1 line = 15 ; column = 27 ; value =';'; }
|
||||||
|
{kind = TOKEN_RETURN; ; index = 280 ; length = 6 line = 16 ; column = 3 ; value ='return'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 287 ; length = 6 line = 16 ; column = 10 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 293 ; length = 1 line = 16 ; column = 16 ; value ='('; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 294 ; length = 1 line = 16 ; column = 17 ; value ='1'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 295 ; length = 1 line = 16 ; column = 18 ; value =','; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 297 ; length = 1 line = 16 ; column = 20 ; value ='1'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 298 ; length = 1 line = 16 ; column = 21 ; value =','; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 300 ; length = 1 line = 16 ; column = 23 ; value ='1'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 301 ; length = 1 line = 16 ; column = 24 ; value =','; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 303 ; length = 1 line = 16 ; column = 26 ; value ='1'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 304 ; length = 1 line = 16 ; column = 27 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 305 ; length = 1 line = 16 ; column = 28 ; value =';'; }
|
||||||
|
{kind = TOKEN_RIGHTBRACE; ; index = 308 ; length = 1 line = 17 ; column = 0 ; value ='}'; }
|
||||||
|
{kind = TOKEN_EOF; ; index = 309 ; length = 0 line = 17 ; column = 1 ; value =''; }
|
||||||
@@ -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 =''; }
|
||||||
|
|||||||
65
test/lex/simple_else_if.golden
Normal file
65
test/lex/simple_else_if.golden
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
{kind = TOKEN_VERTEX; ; index = 0 ; length = 6 line = 1 ; column = 0 ; value ='vertex'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 7 ; length = 4 line = 1 ; column = 7 ; value ='main'; }
|
||||||
|
{kind = TOKEN_DOUBLECOLON; ; index = 12 ; length = 2 line = 1 ; column = 12 ; value ='::'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 15 ; length = 1 line = 1 ; column = 15 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 16 ; length = 3 line = 1 ; column = 16 ; value ='pos'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 20 ; length = 1 line = 1 ; column = 20 ; value =':'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 22 ; length = 6 line = 1 ; column = 22 ; value ='float3'; }
|
||||||
|
{kind = TOKEN_AT; ; index = 29 ; length = 1 line = 1 ; column = 29 ; value ='@'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 30 ; length = 8 line = 1 ; column = 30 ; value ='position'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 38 ; length = 1 line = 1 ; column = 38 ; value =')'; }
|
||||||
|
{kind = TOKEN_ARROW; ; index = 40 ; length = 2 line = 1 ; column = 40 ; value ='->'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 43 ; length = 6 line = 1 ; column = 43 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_AT; ; index = 50 ; length = 1 line = 1 ; column = 50 ; value ='@'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 51 ; length = 8 line = 1 ; column = 51 ; value ='position'; }
|
||||||
|
{kind = TOKEN_LEFTBRACE; ; index = 60 ; length = 1 line = 1 ; column = 60 ; value ='{'; }
|
||||||
|
{kind = TOKEN_IF; ; index = 64 ; length = 2 line = 2 ; column = 0 ; value ='if'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 67 ; length = 3 line = 2 ; column = 3 ; value ='pos'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 70 ; length = 1 line = 2 ; column = 6 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 71 ; length = 1 line = 2 ; column = 7 ; value ='x'; }
|
||||||
|
{kind = TOKEN_GREATER; ; index = 73 ; length = 1 line = 2 ; column = 9 ; value ='>'; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 75 ; length = 3 line = 2 ; column = 11 ; value ='100'; }
|
||||||
|
{kind = TOKEN_LEFTBRACE; ; index = 79 ; length = 1 line = 2 ; column = 15 ; value ='{'; }
|
||||||
|
{kind = TOKEN_RETURN; ; index = 84 ; length = 6 line = 3 ; column = 0 ; value ='return'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 91 ; length = 6 line = 3 ; column = 7 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 97 ; length = 1 line = 3 ; column = 13 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 98 ; length = 3 line = 3 ; column = 14 ; value ='pos'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 101 ; length = 1 line = 3 ; column = 17 ; value =','; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 103 ; length = 3 line = 3 ; column = 19 ; value ='1'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 106 ; length = 1 line = 3 ; column = 22 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 107 ; length = 1 line = 3 ; column = 23 ; value =';'; }
|
||||||
|
{kind = TOKEN_RIGHTBRACE; ; index = 111 ; length = 1 line = 4 ; column = 0 ; value ='}'; }
|
||||||
|
{kind = TOKEN_ELSE; ; index = 113 ; length = 4 line = 4 ; column = 2 ; value ='else'; }
|
||||||
|
{kind = TOKEN_IF; ; index = 118 ; length = 2 line = 4 ; column = 7 ; value ='if'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 121 ; length = 3 line = 4 ; column = 10 ; value ='pos'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 124 ; length = 1 line = 4 ; column = 13 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 125 ; length = 1 line = 4 ; column = 14 ; value ='x'; }
|
||||||
|
{kind = TOKEN_GREATER; ; index = 127 ; length = 1 line = 4 ; column = 16 ; value ='>'; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 129 ; length = 2 line = 4 ; column = 18 ; value ='50'; }
|
||||||
|
{kind = TOKEN_LEFTBRACE; ; index = 132 ; length = 1 line = 4 ; column = 21 ; value ='{'; }
|
||||||
|
{kind = TOKEN_RETURN; ; index = 137 ; length = 6 line = 5 ; column = 0 ; value ='return'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 144 ; length = 6 line = 5 ; column = 7 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 150 ; length = 1 line = 5 ; column = 13 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 151 ; length = 3 line = 5 ; column = 14 ; value ='pos'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 154 ; length = 1 line = 5 ; column = 17 ; value =','; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 156 ; length = 3 line = 5 ; column = 19 ; value ='1'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 159 ; length = 1 line = 5 ; column = 22 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 160 ; length = 1 line = 5 ; column = 23 ; value =';'; }
|
||||||
|
{kind = TOKEN_RIGHTBRACE; ; index = 164 ; length = 1 line = 6 ; column = 0 ; value ='}'; }
|
||||||
|
{kind = TOKEN_ELSE; ; index = 166 ; length = 4 line = 6 ; column = 2 ; value ='else'; }
|
||||||
|
{kind = TOKEN_LEFTBRACE; ; index = 171 ; length = 1 line = 6 ; column = 7 ; value ='{'; }
|
||||||
|
{kind = TOKEN_RETURN; ; index = 176 ; length = 6 line = 7 ; column = 0 ; value ='return'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 183 ; length = 6 line = 7 ; column = 7 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 189 ; length = 1 line = 7 ; column = 13 ; value ='('; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 190 ; length = 3 line = 7 ; column = 14 ; value ='1'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 193 ; length = 1 line = 7 ; column = 17 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 194 ; length = 1 line = 7 ; column = 18 ; value =';'; }
|
||||||
|
{kind = TOKEN_RIGHTBRACE; ; index = 198 ; length = 1 line = 8 ; column = 0 ; value ='}'; }
|
||||||
|
{kind = TOKEN_RETURN; ; index = 202 ; length = 6 line = 9 ; column = 0 ; value ='return'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 209 ; length = 6 line = 9 ; column = 7 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 215 ; length = 1 line = 9 ; column = 13 ; value ='('; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 216 ; length = 3 line = 9 ; column = 14 ; value ='0'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 219 ; length = 1 line = 9 ; column = 17 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 220 ; length = 1 line = 9 ; column = 18 ; value =';'; }
|
||||||
|
{kind = TOKEN_RIGHTBRACE; ; index = 223 ; length = 1 line = 10 ; column = 0 ; value ='}'; }
|
||||||
|
{kind = TOKEN_EOF; ; index = 228 ; length = 0 line = 12 ; column = 0 ; value =''; }
|
||||||
46
test/lex/simple_if_else.golden
Normal file
46
test/lex/simple_if_else.golden
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{kind = TOKEN_VERTEX; ; index = 0 ; length = 6 line = 1 ; column = 0 ; value ='vertex'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 7 ; length = 4 line = 1 ; column = 7 ; value ='main'; }
|
||||||
|
{kind = TOKEN_DOUBLECOLON; ; index = 12 ; length = 2 line = 1 ; column = 12 ; value ='::'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 15 ; length = 1 line = 1 ; column = 15 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 16 ; length = 3 line = 1 ; column = 16 ; value ='pos'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 20 ; length = 1 line = 1 ; column = 20 ; value =':'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 22 ; length = 6 line = 1 ; column = 22 ; value ='float3'; }
|
||||||
|
{kind = TOKEN_AT; ; index = 29 ; length = 1 line = 1 ; column = 29 ; value ='@'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 30 ; length = 8 line = 1 ; column = 30 ; value ='position'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 38 ; length = 1 line = 1 ; column = 38 ; value =')'; }
|
||||||
|
{kind = TOKEN_ARROW; ; index = 40 ; length = 2 line = 1 ; column = 40 ; value ='->'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 43 ; length = 6 line = 1 ; column = 43 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_AT; ; index = 50 ; length = 1 line = 1 ; column = 50 ; value ='@'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 51 ; length = 8 line = 1 ; column = 51 ; value ='position'; }
|
||||||
|
{kind = TOKEN_LEFTBRACE; ; index = 60 ; length = 1 line = 1 ; column = 60 ; value ='{'; }
|
||||||
|
{kind = TOKEN_IF; ; index = 64 ; length = 2 line = 2 ; column = 0 ; value ='if'; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 67 ; length = 1 line = 2 ; column = 3 ; value ='0'; }
|
||||||
|
{kind = TOKEN_GREATER; ; index = 69 ; length = 1 line = 2 ; column = 5 ; value ='>'; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 71 ; length = 3 line = 2 ; column = 7 ; value ='100'; }
|
||||||
|
{kind = TOKEN_LEFTBRACE; ; index = 75 ; length = 1 line = 2 ; column = 11 ; value ='{'; }
|
||||||
|
{kind = TOKEN_RETURN; ; index = 80 ; length = 6 line = 3 ; column = 0 ; value ='return'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 87 ; length = 6 line = 3 ; column = 7 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 93 ; length = 1 line = 3 ; column = 13 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 94 ; length = 3 line = 3 ; column = 14 ; value ='pos'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 97 ; length = 1 line = 3 ; column = 17 ; value =','; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 99 ; length = 3 line = 3 ; column = 19 ; value ='1'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 102 ; length = 1 line = 3 ; column = 22 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 103 ; length = 1 line = 3 ; column = 23 ; value =';'; }
|
||||||
|
{kind = TOKEN_RIGHTBRACE; ; index = 107 ; length = 1 line = 4 ; column = 0 ; value ='}'; }
|
||||||
|
{kind = TOKEN_ELSE; ; index = 109 ; length = 4 line = 4 ; column = 2 ; value ='else'; }
|
||||||
|
{kind = TOKEN_LEFTBRACE; ; index = 114 ; length = 1 line = 4 ; column = 7 ; value ='{'; }
|
||||||
|
{kind = TOKEN_RETURN; ; index = 119 ; length = 6 line = 5 ; column = 0 ; value ='return'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 126 ; length = 6 line = 5 ; column = 7 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 132 ; length = 1 line = 5 ; column = 13 ; value ='('; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 133 ; length = 3 line = 5 ; column = 14 ; value ='1'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 136 ; length = 1 line = 5 ; column = 17 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 137 ; length = 1 line = 5 ; column = 18 ; value =';'; }
|
||||||
|
{kind = TOKEN_RIGHTBRACE; ; index = 141 ; length = 1 line = 6 ; column = 0 ; value ='}'; }
|
||||||
|
{kind = TOKEN_RETURN; ; index = 145 ; length = 6 line = 7 ; column = 0 ; value ='return'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 152 ; length = 6 line = 7 ; column = 7 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 158 ; length = 1 line = 7 ; column = 13 ; value ='('; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 159 ; length = 3 line = 7 ; column = 14 ; value ='0'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 162 ; length = 1 line = 7 ; column = 17 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 163 ; length = 1 line = 7 ; column = 18 ; value =';'; }
|
||||||
|
{kind = TOKEN_RIGHTBRACE; ; index = 166 ; length = 1 line = 8 ; column = 0 ; value ='}'; }
|
||||||
|
{kind = TOKEN_EOF; ; index = 169 ; length = 0 line = 9 ; column = 0 ; value =''; }
|
||||||
64
test/lex/unary.golden
Normal file
64
test/lex/unary.golden
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
{kind = TOKEN_VERTEX; ; index = 0 ; length = 6 line = 1 ; column = 0 ; value ='vertex'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 7 ; length = 7 line = 1 ; column = 7 ; value ='vs_main'; }
|
||||||
|
{kind = TOKEN_DOUBLECOLON; ; index = 15 ; length = 2 line = 1 ; column = 15 ; value ='::'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 18 ; length = 1 line = 1 ; column = 18 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 19 ; length = 8 line = 1 ; column = 19 ; value ='position'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 28 ; length = 1 line = 1 ; column = 28 ; value =':'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 30 ; length = 6 line = 1 ; column = 30 ; value ='float3'; }
|
||||||
|
{kind = TOKEN_AT; ; index = 37 ; length = 1 line = 1 ; column = 37 ; value ='@'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 38 ; length = 8 line = 1 ; column = 38 ; value ='position'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 46 ; length = 1 line = 1 ; column = 46 ; value =')'; }
|
||||||
|
{kind = TOKEN_ARROW; ; index = 48 ; length = 2 line = 1 ; column = 48 ; value ='->'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 51 ; length = 6 line = 1 ; column = 51 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_AT; ; index = 58 ; length = 1 line = 1 ; column = 58 ; value ='@'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 59 ; length = 8 line = 1 ; column = 59 ; value ='position'; }
|
||||||
|
{kind = TOKEN_LEFTBRACE; ; index = 68 ; length = 1 line = 1 ; column = 68 ; value ='{'; }
|
||||||
|
{kind = TOKEN_RETURN; ; index = 75 ; length = 6 line = 2 ; column = 3 ; value ='return'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 82 ; length = 6 line = 2 ; column = 10 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 88 ; length = 1 line = 2 ; column = 16 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 89 ; length = 8 line = 2 ; column = 17 ; value ='position'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 97 ; length = 1 line = 2 ; column = 25 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 98 ; length = 1 line = 2 ; column = 26 ; value ='x'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 99 ; length = 1 line = 2 ; column = 27 ; value =','; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 101 ; length = 8 line = 2 ; column = 29 ; value ='position'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 109 ; length = 1 line = 2 ; column = 37 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 110 ; length = 1 line = 2 ; column = 38 ; value ='y'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 111 ; length = 1 line = 2 ; column = 39 ; value =','; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 113 ; length = 8 line = 2 ; column = 41 ; value ='position'; }
|
||||||
|
{kind = TOKEN_DOT; ; index = 121 ; length = 1 line = 2 ; column = 49 ; value ='.'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 122 ; length = 1 line = 2 ; column = 50 ; value ='z'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 123 ; length = 1 line = 2 ; column = 51 ; value =','; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 125 ; length = 3 line = 2 ; column = 53 ; value ='1'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 128 ; length = 1 line = 2 ; column = 56 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 129 ; length = 1 line = 2 ; column = 57 ; value =';'; }
|
||||||
|
{kind = TOKEN_RIGHTBRACE; ; index = 132 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
|
||||||
|
{kind = TOKEN_PIXEL; ; index = 137 ; length = 5 line = 5 ; column = 0 ; value ='pixel'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 143 ; length = 7 line = 5 ; column = 6 ; value ='ps_main'; }
|
||||||
|
{kind = TOKEN_DOUBLECOLON; ; index = 151 ; length = 2 line = 5 ; column = 14 ; value ='::'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 154 ; length = 1 line = 5 ; column = 17 ; value ='('; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 155 ; length = 8 line = 5 ; column = 18 ; value ='position'; }
|
||||||
|
{kind = TOKEN_COLON; ; index = 164 ; length = 1 line = 5 ; column = 27 ; value =':'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 166 ; length = 6 line = 5 ; column = 29 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_AT; ; index = 173 ; length = 1 line = 5 ; column = 36 ; value ='@'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 174 ; length = 11 line = 5 ; column = 37 ; value ='outposition'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 185 ; length = 1 line = 5 ; column = 48 ; value =')'; }
|
||||||
|
{kind = TOKEN_ARROW; ; index = 187 ; length = 2 line = 5 ; column = 50 ; value ='->'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 190 ; length = 6 line = 5 ; column = 53 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_AT; ; index = 197 ; length = 1 line = 5 ; column = 60 ; value ='@'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 198 ; length = 6 line = 5 ; column = 61 ; value ='target'; }
|
||||||
|
{kind = TOKEN_LEFTBRACE; ; index = 205 ; length = 1 line = 5 ; column = 68 ; value ='{'; }
|
||||||
|
{kind = TOKEN_RETURN; ; index = 211 ; length = 6 line = 6 ; column = 2 ; value ='return'; }
|
||||||
|
{kind = TOKEN_IDENTIFIER; ; index = 218 ; length = 6 line = 6 ; column = 9 ; value ='float4'; }
|
||||||
|
{kind = TOKEN_LEFTPAREN; ; index = 224 ; length = 1 line = 6 ; column = 15 ; value ='('; }
|
||||||
|
{kind = TOKEN_FLOATLITERAL; ; index = 225 ; length = 3 line = 6 ; column = 16 ; value ='0.5'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 228 ; length = 1 line = 6 ; column = 19 ; value =','; }
|
||||||
|
{kind = TOKEN_MINUS; ; index = 230 ; length = 1 line = 6 ; column = 21 ; value ='-'; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 231 ; length = 1 line = 6 ; column = 22 ; value ='1'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 232 ; length = 1 line = 6 ; column = 23 ; value =','; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 234 ; length = 1 line = 6 ; column = 25 ; value ='0'; }
|
||||||
|
{kind = TOKEN_COMMA; ; index = 235 ; length = 1 line = 6 ; column = 26 ; value =','; }
|
||||||
|
{kind = TOKEN_INTLITERAL; ; index = 237 ; length = 1 line = 6 ; column = 28 ; value ='1'; }
|
||||||
|
{kind = TOKEN_RIGHTPAREN; ; index = 238 ; length = 1 line = 6 ; column = 29 ; value =')'; }
|
||||||
|
{kind = TOKEN_SEMICOLON; ; index = 239 ; length = 1 line = 6 ; column = 30 ; value =';'; }
|
||||||
|
{kind = TOKEN_RIGHTBRACE; ; index = 242 ; length = 1 line = 7 ; column = 0 ; value ='}'; }
|
||||||
|
{kind = TOKEN_EOF; ; index = 243 ; length = 0 line = 7 ; column = 1 ; value =''; }
|
||||||
@@ -1,33 +1,35 @@
|
|||||||
test/assign_arithmetic_expression.shd lex
|
test/assign_arithmetic_expression.ink lex
|
||||||
test/basic_property_and_return_value.shd lex
|
test/basic_property_and_return_value.ink lex
|
||||||
test/complicated_computation.shd lex
|
test/complicated_computation.ink lex
|
||||||
test/constant_buffer.shd lex
|
test/constant_buffer.ink lex
|
||||||
test/empty_struct.shd lex
|
test/empty_struct.ink lex
|
||||||
test/empty_vertex_main.shd lex
|
test/empty_vertex_main.ink lex
|
||||||
test/empty_vertex_main_with_position_parameter.shd lex
|
test/empty_vertex_main_with_position_parameter.ink lex
|
||||||
test/field_assignment.shd lex
|
test/field_assignment.ink lex
|
||||||
test/field_without_type_specifier.shd lex
|
test/field_without_type_specifier.ink lex
|
||||||
test/float_suffix.shd lex
|
test/float_suffix.ink lex
|
||||||
test/function_call.shd lex
|
test/function_call.ink lex
|
||||||
test/function_call_out_of_order_declaration.shd lex
|
test/function_call_out_of_order_declaration.ink lex
|
||||||
test/function_call_return.shd lex
|
test/function_call_return.ink lex
|
||||||
test/functions_with_same_name.shd lex
|
test/functions_with_same_name.ink lex
|
||||||
test/function_with_int_return.shd lex
|
test/function_with_int_return.ink lex
|
||||||
test/meta_block.shd lex
|
test/inferred_types.ink lex
|
||||||
test/multiple_functions.shd lex
|
test/meta_block.ink lex
|
||||||
test/multiple_semicolons_everywhere.shd lex
|
test/multiple_functions.ink lex
|
||||||
test/pass_and_access_struct_fields_in_functions.shd lex
|
test/multiple_semicolons_everywhere.ink lex
|
||||||
test/passthrough.shd lex
|
test/pass_and_access_struct_fields_in_functions.ink lex
|
||||||
test/property_rename.shd lex
|
test/passthrough.ink lex
|
||||||
test/redeclared_variable.shd lex
|
test/property_rename.ink lex
|
||||||
test/simple_struct_access.shd lex
|
test/redeclared_variable.ink lex
|
||||||
test/struct_access_primitive_type.shd lex
|
test/simple_struct_access.ink lex
|
||||||
test/struct_within_struct.shd lex
|
test/struct_access_primitive_type.ink lex
|
||||||
test/type_as_variable_name.shd lex
|
test/struct_within_struct.ink lex
|
||||||
test/undeclared_function.shd lex
|
test/type_as_variable_name.ink lex
|
||||||
test/undeclared_symbol.shd lex
|
test/unary.ink lex
|
||||||
test/unknown_overload.shd lex
|
test/undeclared_function.ink lex
|
||||||
test/use_builtin_functions.shd lex
|
test/undeclared_symbol.ink lex
|
||||||
test/wrong_argument_count.shd lex
|
test/unknown_overload.ink lex
|
||||||
test/wrong_multiply.shd lex
|
test/use_builtin_functions.ink lex
|
||||||
test/wrong_type_for_function.shd lex
|
test/wrong_argument_count.ink lex
|
||||||
|
test/wrong_multiply.ink lex
|
||||||
|
test/wrong_type_for_function.ink lex
|
||||||
|
|||||||
14
test/parse/constant_buffer.golden
Normal file
14
test/parse/constant_buffer.golden
Normal 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))))
|
||||||
12
test/parse/custom_hint.golden
Normal file
12
test/parse/custom_hint.golden
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
(program
|
||||||
|
(properties p
|
||||||
|
[(:= time float (@time))])
|
||||||
|
|
||||||
|
(fun vertex vs_main -> float4 (@position)
|
||||||
|
[(:= pos float3 (@position))]
|
||||||
|
(return (float4 pos.x pos.y pos.z 1)))
|
||||||
|
|
||||||
|
(fun pixel ps_main -> float4 (@target)
|
||||||
|
[(:= pos float4 (@outposition))]
|
||||||
|
(:= t p.time)
|
||||||
|
(return (float4 1 1 1 1))))
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
[1;37mtest/field_without_type_specifier.shd:2,0: [31merror: [37mExpected type specifier after field name.
|
(program
|
||||||
[96mx := 5.0;
|
(fun vertex vs_main
|
||||||
^
|
[]
|
||||||
[36m[37m
|
(:= x 5)))
|
||||||
18
test/parse/inferred_types.golden
Normal file
18
test/parse/inferred_types.golden
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
(program
|
||||||
|
(fun bar -> float
|
||||||
|
[]
|
||||||
|
(return 5))
|
||||||
|
|
||||||
|
(fun foo -> float
|
||||||
|
[]
|
||||||
|
(return (bar)))
|
||||||
|
|
||||||
|
(fun vertex vs_main -> float4 (@position)
|
||||||
|
[(:= pos float3 (@position))]
|
||||||
|
(:= f 2)
|
||||||
|
(:= i 10)
|
||||||
|
(= f (foo))
|
||||||
|
(:= v2 (float2 2 2))
|
||||||
|
(:= v3 (float3 2 2 3))
|
||||||
|
(:= v4 (float4 4 5 6 7))
|
||||||
|
(return (float4 1 1 1 1))))
|
||||||
11
test/parse/property_rename.golden
Normal file
11
test/parse/property_rename.golden
Normal 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)))
|
||||||
9
test/parse/simple_else_if.golden
Normal file
9
test/parse/simple_else_if.golden
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
(program
|
||||||
|
(fun vertex vs_main -> float4 (@position)
|
||||||
|
[(:= pos float3 (@position))]
|
||||||
|
(if (> pos.x 100)
|
||||||
|
(return (float4 pos 1))
|
||||||
|
(if (> pos.x 50)
|
||||||
|
(return (float4 pos 1))
|
||||||
|
(return (float4 1))))
|
||||||
|
(return (float4 0))))
|
||||||
8
test/parse/unary.golden
Normal file
8
test/parse/unary.golden
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
(program
|
||||||
|
(fun vertex vs_vs_main -> float4 (@position)
|
||||||
|
[(:= position float3 (@position))]
|
||||||
|
(return (float4 position.x position.y position.z 1)))
|
||||||
|
|
||||||
|
(fun pixel ps_ps_main -> float4 (@target)
|
||||||
|
[(:= position float4 (@outposition))]
|
||||||
|
(return (float4 0.5 -1 0 1))))
|
||||||
@@ -1,33 +1,35 @@
|
|||||||
test/assign_arithmetic_expression.shd parse
|
test/assign_arithmetic_expression.ink parse
|
||||||
test/basic_property_and_return_value.shd parse
|
test/basic_property_and_return_value.ink parse
|
||||||
test/complicated_computation.shd parse
|
test/complicated_computation.ink parse
|
||||||
test/constant_buffer.shd parse
|
test/constant_buffer.ink parse
|
||||||
test/empty_struct.shd parse
|
test/empty_struct.ink parse
|
||||||
test/empty_vertex_main.shd parse
|
test/empty_vertex_main.ink parse
|
||||||
test/empty_vertex_main_with_position_parameter.shd parse
|
test/empty_vertex_main_with_position_parameter.ink parse
|
||||||
test/field_assignment.shd parse
|
test/field_assignment.ink parse
|
||||||
test/field_without_type_specifier.shd parse
|
test/field_without_type_specifier.ink parse
|
||||||
test/float_suffix.shd parse
|
test/float_suffix.ink parse
|
||||||
test/function_call.shd parse
|
test/function_call.ink parse
|
||||||
test/function_call_out_of_order_declaration.shd parse
|
test/function_call_out_of_order_declaration.ink parse
|
||||||
test/function_call_return.shd parse
|
test/function_call_return.ink parse
|
||||||
test/functions_with_same_name.shd parse
|
test/functions_with_same_name.ink parse
|
||||||
test/function_with_int_return.shd parse
|
test/function_with_int_return.ink parse
|
||||||
test/meta_block.shd parse
|
test/inferred_types.ink parse
|
||||||
test/multiple_functions.shd parse
|
test/meta_block.ink parse
|
||||||
test/multiple_semicolons_everywhere.shd parse
|
test/multiple_functions.ink parse
|
||||||
test/pass_and_access_struct_fields_in_functions.shd parse
|
test/multiple_semicolons_everywhere.ink parse
|
||||||
test/passthrough.shd parse
|
test/pass_and_access_struct_fields_in_functions.ink parse
|
||||||
test/property_rename.shd parse
|
test/passthrough.ink parse
|
||||||
test/redeclared_variable.shd parse
|
test/property_rename.ink parse
|
||||||
test/simple_struct_access.shd parse
|
test/redeclared_variable.ink parse
|
||||||
test/struct_access_primitive_type.shd parse
|
test/simple_struct_access.ink parse
|
||||||
test/struct_within_struct.shd parse
|
test/struct_access_primitive_type.ink parse
|
||||||
test/type_as_variable_name.shd parse
|
test/struct_within_struct.ink parse
|
||||||
test/undeclared_function.shd parse
|
test/type_as_variable_name.ink parse
|
||||||
test/undeclared_symbol.shd parse
|
test/unary.ink parse
|
||||||
test/unknown_overload.shd parse
|
test/undeclared_function.ink parse
|
||||||
test/use_builtin_functions.shd parse
|
test/undeclared_symbol.ink parse
|
||||||
test/wrong_argument_count.shd parse
|
test/unknown_overload.ink parse
|
||||||
test/wrong_multiply.shd parse
|
test/use_builtin_functions.ink parse
|
||||||
test/wrong_type_for_function.shd parse
|
test/wrong_argument_count.ink parse
|
||||||
|
test/wrong_multiply.ink parse
|
||||||
|
test/wrong_type_for_function.ink parse
|
||||||
|
|||||||
15
test/semant/custom_hint.golden
Normal file
15
test/semant/custom_hint.golden
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
scope (global) [
|
||||||
|
[pixel__ps_main] : (pos : float4) -> float4
|
||||||
|
[vertex__vs_main] : (pos : float3) -> float4
|
||||||
|
[p] : {time : float}
|
||||||
|
scope (p) [
|
||||||
|
[time] : float
|
||||||
|
]
|
||||||
|
scope (vertex__vs_main) [
|
||||||
|
[pos] : float3
|
||||||
|
]
|
||||||
|
scope (pixel__ps_main) [
|
||||||
|
[t] : float
|
||||||
|
[pos] : float4
|
||||||
|
]
|
||||||
|
]
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
[1;37mtest/functions_with_same_name.shd:2,0: [31merror: [37mRedeclaration of 'foo'
|
[1;37mtest/functions_with_same_name.ink:2,0: [31merror: [37mRedeclaration of 'foo'
|
||||||
[96m foo :: () {
|
[96m foo :: () {
|
||||||
^^^
|
^^^
|
||||||
|
|
||||||
[97mtest/functions_with_same_name.shd:1,0: info: Here is the first declaration of 'foo'
|
[97mtest/functions_with_same_name.ink:1,0: info: Here is the first declaration of 'foo'
|
||||||
[96m foo :: () {
|
[96m foo :: () {
|
||||||
^^^
|
^^^
|
||||||
[36m[37m
|
[36m[37m
|
||||||
15
test/semant/inferred_types.golden
Normal file
15
test/semant/inferred_types.golden
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
scope (global) [
|
||||||
|
[foo] : () -> float
|
||||||
|
[vertex__vs_main] : (pos : float3) -> float4
|
||||||
|
[bar] : () -> float
|
||||||
|
scope (bar) []
|
||||||
|
scope (foo) []
|
||||||
|
scope (vertex__vs_main) [
|
||||||
|
[v2] : float2
|
||||||
|
[i] : int
|
||||||
|
[v4] : float4
|
||||||
|
[pos] : float3
|
||||||
|
[v3] : float3
|
||||||
|
[f] : float
|
||||||
|
]
|
||||||
|
]
|
||||||
12
test/semant/property_rename.golden
Normal file
12
test/semant/property_rename.golden
Normal 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) []
|
||||||
|
]
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
[1;37mtest/redeclared_variable.shd:3,0: [31merror: [37mRedeclaration of 'x'
|
[1;37mtest/redeclared_variable.ink:3,0: [31merror: [37mRedeclaration of 'x'
|
||||||
[96m x : float = 5.0
|
[96m x : float = 5.0
|
||||||
^
|
^
|
||||||
|
|
||||||
[97mtest/redeclared_variable.shd:2,0: info: Here is the first declaration of 'x'
|
[97mtest/redeclared_variable.ink:2,0: info: Here is the first declaration of 'x'
|
||||||
[96m x : float = 1.0
|
[96m x : float = 1.0
|
||||||
^
|
^
|
||||||
[36m[37m
|
[36m[37m
|
||||||
6
test/semant/simple_else_if.golden
Normal file
6
test/semant/simple_else_if.golden
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
scope (global) [
|
||||||
|
[vertex__vs_main] : (pos : float3) -> float4
|
||||||
|
scope (vertex__vs_main) [
|
||||||
|
[pos] : float3
|
||||||
|
]
|
||||||
|
]
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
[1;37mtest/struct_access_primitive_type.shd:3,0: [31merror: [37mAttempting to access a field on a primitive type 'int'.
|
[1;37mtest/struct_access_primitive_type.ink:3,0: [31merror: [37mAttempting to access a field on a primitive type 'int'.
|
||||||
[96mx.d = 4;
|
[96mx.d = 4;
|
||||||
^
|
^
|
||||||
declaration:
|
declaration:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[1;37mtest/type_as_variable_name.shd:2,0: [31merror: [37mInvalid variable name 'int'
|
[1;37mtest/type_as_variable_name.ink:2,0: [31merror: [37mInvalid variable name 'int'
|
||||||
[36m int : float = 4.0
|
[36m int : float = 4.0
|
||||||
^^^
|
^^^
|
||||||
[37m
|
[37m
|
||||||
10
test/semant/unary.golden
Normal file
10
test/semant/unary.golden
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
scope (global) [
|
||||||
|
[pixel__ps_ps_main] : (position : float4) -> float4
|
||||||
|
[vertex__vs_vs_main] : (position : float3) -> float4
|
||||||
|
scope (vertex__vs_vs_main) [
|
||||||
|
[position] : float3
|
||||||
|
]
|
||||||
|
scope (pixel__ps_ps_main) [
|
||||||
|
[position] : float4
|
||||||
|
]
|
||||||
|
]
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
[1;37mtest/undeclared_function.shd:2,0: [31merror: [37mAttempt to call undeclared function 'foo'.
|
[1;37mtest/undeclared_function.ink:2,0: [31merror: [37mAttempt to call undeclared function 'foo'.
|
||||||
|
|
||||||
[96m foo();
|
[96m foo();
|
||||||
^^^
|
^^^
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[1;37mtest/undeclared_symbol.shd:2,10: [31merror: [37mUse of undeclared symbol 'f'
|
[1;37mtest/undeclared_symbol.ink:2,10: [31merror: [37mUse of undeclared symbol 'f'
|
||||||
[96m b : int = f;
|
[96m b : int = f;
|
||||||
^
|
^
|
||||||
[36m[37m
|
[36m[37m
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
[1;37mtest/unknown_overload.shd:6,0: [31merror: [37mProcedure call did not match any of the possible overloads for 'foo'
|
[1;37mtest/unknown_overload.ink:6,0: [31merror: [37mProcedure call did not match any of the possible overloads for 'foo'
|
||||||
[96m found:
|
[96m found:
|
||||||
foo(v, v);
|
foo(v, v);
|
||||||
^^^
|
^^^
|
||||||
@@ -7,10 +7,10 @@
|
|||||||
[96m foo(v, v);
|
[96m foo(v, v);
|
||||||
^
|
^
|
||||||
[97m Possible overloads:
|
[97m Possible overloads:
|
||||||
[96m foo :: (v1 : float3, v2 : float3) { (test/unknown_overload.shd:1)
|
[96m foo :: (v1 : float3, v2 : float3) { (test/unknown_overload.ink:1)
|
||||||
[96m foo :: (v1 : float2, v2 : float2, v3 : float2) { (test/unknown_overload.shd:2)
|
[96m foo :: (v1 : float2, v2 : float2, v3 : float2) { (test/unknown_overload.ink:2)
|
||||||
|
|
||||||
[36m[37m[1;37mtest/unknown_overload.shd:6,4: [31merror: [37mType mismatch. Expected float3 got float
|
[36m[37m[1;37mtest/unknown_overload.ink:6,4: [31merror: [37mType mismatch. Expected float3 got float
|
||||||
[96m found:
|
[96m found:
|
||||||
foo(v, v);
|
foo(v, v);
|
||||||
^
|
^
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
got:
|
got:
|
||||||
v : float = 2.0
|
v : float = 2.0
|
||||||
|
|
||||||
[36m[37m[1;37mtest/unknown_overload.shd:6,7: [31merror: [37mType mismatch. Expected float3 got float
|
[36m[37m[1;37mtest/unknown_overload.ink:6,7: [31merror: [37mType mismatch. Expected float3 got float
|
||||||
[96m found:
|
[96m found:
|
||||||
foo(v, v);
|
foo(v, v);
|
||||||
^
|
^
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
[1;37mtest/wrong_argument_count.shd:5,19: [31merror: [37mUse of undeclared symbol 'w'
|
[1;37mtest/wrong_argument_count.ink:5,19: [31merror: [37mUse of undeclared symbol 'w'
|
||||||
[96m return x * y * z * w;
|
[96m return x * y * z * w;
|
||||||
^
|
^
|
||||||
[36m[37m[1;37mtest/wrong_argument_count.shd:9,0: [31merror: [37mProcedure call did not match any of the possible overloads for 'foo'
|
[36m[37m[1;37mtest/wrong_argument_count.ink:9,0: [31merror: [37mProcedure call did not match any of the possible overloads for 'foo'
|
||||||
[96m found:
|
[96m found:
|
||||||
foo(2.0, 3.0);
|
foo(2.0, 3.0);
|
||||||
^^^
|
^^^
|
||||||
[97m Possible overloads:
|
[97m Possible overloads:
|
||||||
[96m foo :: (x : float, y : float, z : float) -> float { (test/wrong_argument_count.shd:1)
|
[96m foo :: (x : float, y : float, z : float) -> float { (test/wrong_argument_count.ink:1)
|
||||||
[97m Not enough arguments: Wanted 3, got 2.
|
[97m Not enough arguments: Wanted 3, got 2.
|
||||||
|
|
||||||
[96m foo :: (x : float, y : float, z : float, w : float) -> float { (test/wrong_argument_count.shd:4)
|
[96m foo :: (x : float, y : float, z : float, w : float) -> float { (test/wrong_argument_count.ink:4)
|
||||||
[97m Not enough arguments: Wanted 4, got 2.
|
[97m Not enough arguments: Wanted 4, got 2.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[1;37mtest/wrong_multiply.shd:4,34: [31merror: [37mType mismatch. Expected float got float2
|
[1;37mtest/wrong_multiply.ink:4,34: [31merror: [37mType mismatch. Expected float got float2
|
||||||
[96m found:
|
[96m found:
|
||||||
result : float4 = float4(1.0, foo * res, 0.0, 1.0);
|
result : float4 = float4(1.0, foo * res, 0.0, 1.0);
|
||||||
^
|
^
|
||||||
@@ -6,6 +6,6 @@
|
|||||||
float
|
float
|
||||||
|
|
||||||
got:
|
got:
|
||||||
res : float2 = float2(2.0, 2.0);
|
res : float2 = float2(2.0, 2.0)
|
||||||
|
|
||||||
[36m[37m
|
[36m[37m
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
[1;37mtest/wrong_type_for_function.shd:11,17: [31merror: [37mProcedure call did not match any of the possible overloads for 'float4'
|
[1;37mtest/wrong_type_for_function.ink:11,17: [31merror: [37mProcedure call did not match any of the possible overloads for 'float4'
|
||||||
[96m found:
|
[96m 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 @@
|
|||||||
[96m color : float4 = float4(y, 1.0, 1.0, 1.0);
|
[96m color : float4 = float4(y, 1.0, 1.0, 1.0);
|
||||||
^
|
^
|
||||||
[97m Possible overloads:
|
[97m Possible overloads:
|
||||||
[96m foreign float4 :: (float, float, float, float) -> float4; (test/wrong_type_for_function.shd:78)
|
[96m foreign float4 :: (float, float, float, float) -> float4; (test/wrong_type_for_function.ink:78)
|
||||||
|
|
||||||
[36m[37m[1;37mtest/wrong_type_for_function.shd:11,24: [31merror: [37mType mismatch. Expected float got float2
|
[36m[37m[1;37mtest/wrong_type_for_function.ink:11,24: [31merror: [37mType mismatch. Expected float got float2
|
||||||
[96m found:
|
[96m found:
|
||||||
color : float4 = float4(y, 1.0, 1.0, 1.0);
|
color : float4 = float4(y, 1.0, 1.0, 1.0);
|
||||||
^
|
^
|
||||||
|
|||||||
@@ -1,30 +1,32 @@
|
|||||||
test/assign_arithmetic_expression.shd semant
|
test/assign_arithmetic_expression.ink semant
|
||||||
test/basic_property_and_return_value.shd semant
|
test/basic_property_and_return_value.ink semant
|
||||||
test/complicated_computation.shd semant
|
test/complicated_computation.ink semant
|
||||||
test/constant_buffer.shd semant
|
test/constant_buffer.ink semant
|
||||||
test/empty_struct.shd semant
|
test/empty_struct.ink semant
|
||||||
test/empty_vertex_main.shd semant
|
test/empty_vertex_main.ink semant
|
||||||
test/empty_vertex_main_with_position_parameter.shd semant
|
test/empty_vertex_main_with_position_parameter.ink semant
|
||||||
test/field_assignment.shd semant
|
test/field_assignment.ink semant
|
||||||
test/function_call.shd semant
|
test/function_call.ink semant
|
||||||
test/function_call_out_of_order_declaration.shd semant
|
test/function_call_out_of_order_declaration.ink semant
|
||||||
test/function_call_return.shd semant
|
test/function_call_return.ink semant
|
||||||
test/functions_with_same_name.shd semant
|
test/functions_with_same_name.ink semant
|
||||||
test/function_with_int_return.shd semant
|
test/function_with_int_return.ink semant
|
||||||
test/multiple_functions.shd semant
|
test/inferred_types.ink semant
|
||||||
test/multiple_semicolons_everywhere.shd semant
|
test/multiple_functions.ink semant
|
||||||
test/pass_and_access_struct_fields_in_functions.shd semant
|
test/multiple_semicolons_everywhere.ink semant
|
||||||
test/passthrough.shd semant
|
test/pass_and_access_struct_fields_in_functions.ink semant
|
||||||
test/property_rename.shd semant
|
test/passthrough.ink semant
|
||||||
test/redeclared_variable.shd semant
|
test/property_rename.ink semant
|
||||||
test/simple_struct_access.shd semant
|
test/redeclared_variable.ink semant
|
||||||
test/struct_access_primitive_type.shd semant
|
test/simple_struct_access.ink semant
|
||||||
test/struct_within_struct.shd semant
|
test/struct_access_primitive_type.ink semant
|
||||||
test/type_as_variable_name.shd semant
|
test/struct_within_struct.ink semant
|
||||||
test/undeclared_function.shd semant
|
test/type_as_variable_name.ink semant
|
||||||
test/undeclared_symbol.shd semant
|
test/unary.ink semant
|
||||||
test/unknown_overload.shd semant
|
test/undeclared_function.ink semant
|
||||||
test/use_builtin_functions.shd semant
|
test/undeclared_symbol.ink semant
|
||||||
test/wrong_argument_count.shd semant
|
test/unknown_overload.ink semant
|
||||||
test/wrong_multiply.shd semant
|
test/use_builtin_functions.ink semant
|
||||||
test/wrong_type_for_function.shd semant
|
test/wrong_argument_count.ink semant
|
||||||
|
test/wrong_multiply.ink semant
|
||||||
|
test/wrong_type_for_function.ink semant
|
||||||
|
|||||||
11
test/simple_else_if.ink
Normal file
11
test/simple_else_if.ink
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
vertex main :: (pos : float3 @position) -> float4 @position {
|
||||||
|
if pos.x > 100 {
|
||||||
|
return float4(pos, 1.0);
|
||||||
|
} else if pos.x > 50 {
|
||||||
|
return float4(pos, 1.0);
|
||||||
|
} else {
|
||||||
|
return float4(1.0);
|
||||||
|
}
|
||||||
|
return float4(0.0);
|
||||||
|
}
|
||||||
|
|
||||||
6
test/simple_if.ink
Normal file
6
test/simple_if.ink
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
vertex main :: (pos : float3 @position) -> float4 @position {
|
||||||
|
if 0 > 100 {
|
||||||
|
return float4(pos, 1.0);
|
||||||
|
}
|
||||||
|
return float4(0.0);
|
||||||
|
}
|
||||||
8
test/simple_if_else.ink
Normal file
8
test/simple_if_else.ink
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
vertex main :: (pos : float3 @position) -> float4 @position {
|
||||||
|
if 0 > 100 {
|
||||||
|
return float4(pos, 1.0);
|
||||||
|
} else {
|
||||||
|
return float4(1.0);
|
||||||
|
}
|
||||||
|
return float4(0.0);
|
||||||
|
}
|
||||||
7
test/unary.ink
Normal file
7
test/unary.ink
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
vertex vs_main :: (position : float3 @position) -> float4 @position {
|
||||||
|
return float4(position.x, position.y, position.z, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
pixel ps_main :: (position : float4 @outposition) -> float4 @target {
|
||||||
|
return float4(0.5, -1, 0, 1);
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user