Compare commits
92 Commits
262f0d632a
...
new-builti
| Author | SHA1 | Date | |
|---|---|---|---|
| d5476b54d7 | |||
| 622ce388fa | |||
| b0653b6563 | |||
| d6ea2e4c2f | |||
| 361a310ed1 | |||
| 78e6d6146e | |||
| 79ec6cc42f | |||
| 9461fe626f | |||
| ceafd197f5 | |||
| f4a9592f26 | |||
| 9cf51a1534 | |||
| 11c936ba7f | |||
| 4924b01eac | |||
| 603b625e21 | |||
| 9e0728f952 | |||
| 94fc3a4dad | |||
| 14f8b20d5f | |||
| 4825623c73 | |||
| da87209690 | |||
| e0908a67c0 | |||
| ab711b5610 | |||
| f6801e3eeb | |||
| 4f37ed03c0 | |||
| 5b2e2e936b | |||
| b491a56409 | |||
| 45f67e16a8 | |||
| 01ffe9c73d | |||
| 382d790c5b | |||
| 27933e599a | |||
| b7e34a22b2 | |||
| c36712b3ed | |||
| 6b6c7bce62 | |||
| e356c5a3a9 | |||
| 5ec2186a42 | |||
| af3e298b29 | |||
| af42b61ed6 | |||
| cd167d1560 | |||
| 8ce8651d6b | |||
| 42c5baa846 | |||
| 45ea54cf93 | |||
| b4d119230b | |||
| a72a9ff50d | |||
| 41d1dd406d | |||
| bc69a39570 | |||
| aaeda22fa3 | |||
| 4b927b6be9 | |||
| 85b23f90e5 | |||
| ec31046d30 | |||
| 8bd766281e | |||
| 4053400152 | |||
| 1adb289c10 | |||
| d65c6359db | |||
| d08529a3eb | |||
| 7787d1307b | |||
| 4deb07027f | |||
| f13508262b | |||
| 90fb1a035e | |||
| e365067354 | |||
| 243d83663a | |||
| 3f93e1a92d | |||
| fca325b761 | |||
| d3aa4fffeb | |||
| 6eba51cc8c | |||
| 5b237d34de | |||
| ff668b6c95 | |||
| c84516d39f | |||
| 517209c886 | |||
| d01fca146c | |||
| d9dfcc6354 | |||
| c8cd15456d | |||
| c225217676 | |||
| b2ee560145 | |||
| b475357cf9 | |||
| 76994b2567 | |||
| 0471dbe7d7 | |||
| c5758bd023 | |||
| ae54f1374e | |||
| 22b70f88b6 | |||
| 7a07c32cd2 | |||
| 92c1f593c2 | |||
| 274cb379b4 | |||
| 884444d25b | |||
| be4115b502 | |||
| 402d9d67a4 | |||
| 1bf829d42f | |||
| 3bbbc1d556 | |||
| d2614b3ba9 | |||
| d5fdaca1ca | |||
| 98f979a368 | |||
| 781f63cd69 | |||
| 1be5072cbe | |||
| a9a67e3fac |
6
.gitmodules
vendored
Normal file
6
.gitmodules
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
[submodule "modules/nbrutil"]
|
||||
path = modules/ncore
|
||||
url = git@git.nbross.com:nielsbross/NCore.git
|
||||
[submodule "modules/tracy"]
|
||||
path = modules/tracy
|
||||
url = https://github.com/rluba/jai-tracy.git
|
||||
263
AST.jai
263
AST.jai
@@ -14,12 +14,17 @@ AST_Kind :: enum {
|
||||
Meta;
|
||||
Instance;
|
||||
//==
|
||||
// Directives
|
||||
If_Directive;
|
||||
|
||||
// Hint;
|
||||
// Type;
|
||||
// Operator;
|
||||
Call;
|
||||
Struct;
|
||||
If;
|
||||
For;
|
||||
CBuffer;
|
||||
FieldList;
|
||||
ArgList;
|
||||
Variable;
|
||||
@@ -39,7 +44,8 @@ AST_Node :: struct {
|
||||
|
||||
// @Note(niels): Children nodes can be interpreted as anything useful.
|
||||
// for an if-statement we would have at most 2 children
|
||||
// a property block has a child node for each field declaration etc.
|
||||
// a property block has a field list child node which has
|
||||
// a child node for each field declaration etc.
|
||||
children : [..]*AST_Node;
|
||||
parent : *AST_Node;
|
||||
|
||||
@@ -52,7 +58,7 @@ AST_Node :: struct {
|
||||
|
||||
token : Token;
|
||||
|
||||
assignment : bool;
|
||||
array_field : bool;
|
||||
|
||||
source_location : Source_Range;
|
||||
|
||||
@@ -69,22 +75,25 @@ AST_Node :: struct {
|
||||
pixel_entry_point : bool;
|
||||
}
|
||||
|
||||
|
||||
// ===========================================================
|
||||
// Pretty printing
|
||||
pretty_print_call :: (node : *AST_Node, indentation : int, builder : *String_Builder) {
|
||||
indent(builder, indentation);
|
||||
pretty_print_call :: (node : *AST_Node, indentation : int, builder : *String_Builder, skip_indent := false) {
|
||||
if !skip_indent {
|
||||
indent(builder, indentation);
|
||||
}
|
||||
append(builder, "(");
|
||||
append(builder, node.name);
|
||||
if node.children.count > 0 {
|
||||
append(builder, " ");
|
||||
pretty_print_children(node.children[0], indentation, builder, flags = 0);
|
||||
pretty_print_children(node.children[0], indentation, builder, flags = 0, skip_indent = true);
|
||||
}
|
||||
append(builder, ")");
|
||||
}
|
||||
|
||||
pretty_print_arglist :: (node : *AST_Node, indentation : int, builder : *String_Builder) {
|
||||
indent(builder, indentation);
|
||||
pretty_print_arglist :: (node : *AST_Node, indentation : int, builder : *String_Builder, skip_indent := false) {
|
||||
if !skip_indent {
|
||||
indent(builder, indentation);
|
||||
}
|
||||
append(builder, "[");
|
||||
|
||||
pretty_print_children(node, indentation + 1, builder, flags = .NewLine);
|
||||
@@ -92,8 +101,10 @@ pretty_print_arglist :: (node : *AST_Node, indentation : int, builder : *String_
|
||||
append(builder, "]");
|
||||
}
|
||||
|
||||
pretty_print_fieldlist :: (node : *AST_Node, indentation : int, builder : *String_Builder) {
|
||||
indent(builder, indentation);
|
||||
pretty_print_fieldlist :: (node : *AST_Node, indentation : int, builder : *String_Builder, skip_indent := false) {
|
||||
if !skip_indent {
|
||||
indent(builder, indentation);
|
||||
}
|
||||
|
||||
append(builder, "[");
|
||||
pretty_print_children(node, indentation + 1, builder, flags = .NewLine);
|
||||
@@ -101,11 +112,22 @@ pretty_print_fieldlist :: (node : *AST_Node, indentation : int, builder : *Strin
|
||||
append(builder, "]");
|
||||
}
|
||||
|
||||
pretty_print_field :: (node : *AST_Node, indentation : int, builder : *String_Builder) {
|
||||
pretty_print_field :: (node : *AST_Node, indentation : int, builder : *String_Builder, skip_indent := false) {
|
||||
if !skip_indent {
|
||||
indent(builder, indentation);
|
||||
}
|
||||
print_to_builder(builder, tprint("(:= %", node.name));
|
||||
|
||||
if node.kind != .Unnamed_Field && node.token.ident_value.count > 0 {
|
||||
print_to_builder(builder, tprint(" %", node.token.ident_value));
|
||||
if node.array_field {
|
||||
append(builder, " [");
|
||||
pretty_print_node(node.children[0], indentation, builder, true);
|
||||
append(builder, "].");
|
||||
print_to_builder(builder, "%", node.token.ident_value);
|
||||
} else {
|
||||
print_to_builder(builder, " %", node.token.ident_value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for hint : node.hint_tokens {
|
||||
@@ -114,33 +136,70 @@ pretty_print_field :: (node : *AST_Node, indentation : int, builder : *String_Bu
|
||||
}
|
||||
}
|
||||
|
||||
if node.children.count > 0 {
|
||||
if !node.array_field && node.children.count > 0 {
|
||||
append(builder, " ");
|
||||
pretty_print_children(node, indentation, builder);
|
||||
pretty_print_node(node.children[0], indentation, builder, true);
|
||||
}
|
||||
|
||||
append(builder, ")");
|
||||
}
|
||||
|
||||
Children_Print_Flags :: enum_flags {
|
||||
NewLine :: 1 << 0;
|
||||
Separator :: 1 << 1;
|
||||
Space :: 1 << 2;
|
||||
NewLine :: 1 << 0;
|
||||
Separator :: 1 << 1;
|
||||
Space :: 1 << 2;
|
||||
Dont_Skip_Indent_On_First :: 1 << 3;
|
||||
}
|
||||
|
||||
pretty_print_children :: (parent : *AST_Node, indentation : int, builder : *String_Builder, flags : Children_Print_Flags = .Separator) {
|
||||
pretty_print_block :: (node : *AST_Node, indentation : int, builder : *String_Builder, skip_indent := false) {
|
||||
if node.children.count == 0 {
|
||||
if !skip_indent {
|
||||
indent(builder, indentation);
|
||||
}
|
||||
append(builder, "()");
|
||||
} else {
|
||||
flags := Children_Print_Flags.NewLine;
|
||||
if !skip_indent {
|
||||
flags |= .Dont_Skip_Indent_On_First;
|
||||
}
|
||||
pretty_print_children(node, indentation, builder, flags);
|
||||
}
|
||||
}
|
||||
|
||||
pretty_print_children :: (parent : *AST_Node, indentation : int, builder : *String_Builder, flags : Children_Print_Flags = .Separator, skip_indent := false) {
|
||||
if !parent {
|
||||
return;
|
||||
}
|
||||
|
||||
children := parent.children;
|
||||
for child : children {
|
||||
if it_index > 0 {
|
||||
indent(builder, indentation);
|
||||
}
|
||||
// if it_index > 0 {
|
||||
// indent(builder, indentation);
|
||||
// }
|
||||
|
||||
if !child continue;
|
||||
pretty_print_node(child, 0, builder);
|
||||
|
||||
|
||||
ind := indentation;
|
||||
if flags & .Dont_Skip_Indent_On_First {
|
||||
ind = indentation;
|
||||
} else {
|
||||
if it_index == 0 {
|
||||
ind = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if skip_indent{
|
||||
ind = 0;
|
||||
}
|
||||
// skip := ifx it_index > 0 then false else true;
|
||||
|
||||
if child.kind == .Function {
|
||||
pretty_print_declaration(child, ind, builder);
|
||||
} else {
|
||||
pretty_print_node(child, ind, builder);
|
||||
}
|
||||
|
||||
|
||||
if it_index != children.count - 1 {
|
||||
if flags & .Separator {
|
||||
@@ -166,6 +225,16 @@ op_to_string :: (oper : Token) -> string {
|
||||
return "*";
|
||||
case .TOKEN_SLASH;
|
||||
return "/";
|
||||
case .TOKEN_MINUSEQUALS;
|
||||
return "-=";
|
||||
case .TOKEN_PLUSEQUALS;
|
||||
return "+=";
|
||||
case .TOKEN_DIVEQUALS;
|
||||
return "/=";
|
||||
case .TOKEN_TIMESEQUALS;
|
||||
return "*=";
|
||||
case .TOKEN_MODEQUALS;
|
||||
return "%=";
|
||||
case .TOKEN_ISEQUAL;
|
||||
return "==";
|
||||
case .TOKEN_ASSIGN;
|
||||
@@ -188,99 +257,173 @@ op_to_string :: (oper : Token) -> string {
|
||||
return "";
|
||||
}
|
||||
|
||||
pretty_print_binary :: (node : *AST_Node, indentation : int, builder : *String_Builder) {
|
||||
indent(builder, indentation);
|
||||
pretty_print_binary :: (node : *AST_Node, indentation : int, builder : *String_Builder, skip_indent := false) {
|
||||
if !skip_indent {
|
||||
indent(builder, indentation);
|
||||
}
|
||||
append(builder, "(");
|
||||
op := node.token;
|
||||
|
||||
print_to_builder(builder, op_to_string(op));
|
||||
append(builder, " ");
|
||||
|
||||
pretty_print_children(node, 0, builder, flags = 0);
|
||||
pretty_print_node(node.children[0], 0, builder);
|
||||
append(builder, " ");
|
||||
pretty_print_node(node.children[1], 0, builder);
|
||||
append(builder, ")");
|
||||
}
|
||||
|
||||
pretty_print_unary :: (node : *AST_Node, indentation : int, builder : *String_Builder) {
|
||||
pretty_print_unary :: (node : *AST_Node, indentation : int, builder : *String_Builder, skip_indent := false) {
|
||||
if !skip_indent {
|
||||
indent(builder, indentation);
|
||||
}
|
||||
op := node.token;
|
||||
|
||||
print_to_builder(builder, op_to_string(op));
|
||||
pretty_print_node(node.children[0], 0, builder);
|
||||
}
|
||||
|
||||
print_return_node :: (node : *AST_Node, indentation : int, builder : *String_Builder) {
|
||||
print_return_node :: (node : *AST_Node, indentation : int, builder : *String_Builder, skip_indent := false) {
|
||||
if !skip_indent {
|
||||
indent(builder, indentation);
|
||||
}
|
||||
append(builder, "(return ");
|
||||
|
||||
pretty_print_children(node, 0, builder);
|
||||
pretty_print_children(node, indentation, builder);
|
||||
|
||||
append(builder, ")");
|
||||
}
|
||||
|
||||
print_expression_statement :: (node : *AST_Node, indentation : int, builder : *String_Builder) {
|
||||
indent(builder, indentation);
|
||||
pretty_print_if :: (node : *AST_Node, indentation : int, builder : *String_Builder, skip_indent := false) {
|
||||
if !skip_indent {
|
||||
indent(builder, indentation);
|
||||
}
|
||||
append(builder, "(if ");
|
||||
|
||||
condition := node.children[0];
|
||||
pretty_print_node(condition, 0, builder);
|
||||
append(builder, "\n");
|
||||
|
||||
body := node.children[1];
|
||||
// indent(builder,indentation + 4);
|
||||
// append(builder, "(");
|
||||
pretty_print_node(body, indentation + 4, builder);
|
||||
// append(builder, ")");
|
||||
|
||||
if node.children.count == 3 {
|
||||
append(builder, "\n");
|
||||
pretty_print_node(node.children[2], indentation + 4, builder);
|
||||
}
|
||||
|
||||
append(builder, ")");
|
||||
}
|
||||
|
||||
pretty_print_for :: (node : *AST_Node, indentation : int, builder : *String_Builder, skip_indent := false) {
|
||||
if !skip_indent {
|
||||
indent(builder, indentation);
|
||||
}
|
||||
|
||||
append(builder, "(for ");
|
||||
|
||||
loop_iterator := node.token;
|
||||
print_to_builder(builder, "% : ", loop_iterator.ident_value);
|
||||
|
||||
pretty_print_node(node.children[0], 0, builder);
|
||||
append(builder, "..");
|
||||
pretty_print_node(node.children[1], 0, builder);
|
||||
append(builder, "\n");
|
||||
|
||||
pretty_print_node(node.children[2], indentation + 4, builder);
|
||||
|
||||
append(builder, ")");
|
||||
}
|
||||
|
||||
print_expression_statement :: (node : *AST_Node, indentation : int, builder : *String_Builder, skip_indent := false) {
|
||||
if !skip_indent {
|
||||
indent(builder, indentation);
|
||||
}
|
||||
|
||||
if node.children[0] {
|
||||
pretty_print_node(node.children[0], indentation, builder);
|
||||
pretty_print_node(node.children[0], 0, builder);
|
||||
}
|
||||
}
|
||||
|
||||
pretty_print_node :: (node : *AST_Node, indentation : int, builder : *String_Builder) {
|
||||
pretty_print_node :: (node : *AST_Node, indentation : int, builder : *String_Builder, skip_indent := false) {
|
||||
if node.kind == {
|
||||
case .Return; {
|
||||
print_return_node(node, indentation, builder);
|
||||
print_return_node(node, indentation, builder, skip_indent);
|
||||
}
|
||||
case .If; {
|
||||
pretty_print_if(node, indentation, builder, skip_indent);
|
||||
}
|
||||
case .For; {
|
||||
pretty_print_for(node, indentation, builder, skip_indent);
|
||||
}
|
||||
case .Struct;
|
||||
case .ArgList; {
|
||||
pretty_print_arglist(node, indentation + 2, builder);
|
||||
pretty_print_arglist(node, indentation + 2, builder, skip_indent);
|
||||
}
|
||||
case .FieldList; {
|
||||
pretty_print_fieldlist(node, indentation + 2, builder);
|
||||
pretty_print_fieldlist(node, indentation + 2, builder, skip_indent);
|
||||
}
|
||||
case .Field; {
|
||||
pretty_print_field(node, indentation, builder);
|
||||
pretty_print_field(node, indentation, builder, skip_indent);
|
||||
}
|
||||
case .Unnamed_Field; {
|
||||
pretty_print_field(node, indentation, builder);
|
||||
pretty_print_field(node, indentation, builder, skip_indent);
|
||||
}
|
||||
case .Block; {
|
||||
pretty_print_children(node, indentation + 2, builder, flags = .NewLine);
|
||||
pretty_print_block(node, indentation, builder, skip_indent);
|
||||
}
|
||||
case .Binary; {
|
||||
pretty_print_binary(node, indentation, builder);
|
||||
pretty_print_binary(node, indentation, builder, skip_indent);
|
||||
}
|
||||
case .Unary; {
|
||||
pretty_print_unary(node, indentation, builder);
|
||||
pretty_print_unary(node, indentation, builder, skip_indent);
|
||||
}
|
||||
case .Variable; {
|
||||
pretty_print_variable(node, indentation, builder);
|
||||
pretty_print_variable(node, indentation, builder, skip_indent);
|
||||
}
|
||||
case .Expression_Statement; {
|
||||
print_expression_statement(node, indentation, builder);
|
||||
print_expression_statement(node, indentation, builder, skip_indent);
|
||||
}
|
||||
case .Integer; {
|
||||
print_to_builder(builder, "%", node.integer_value);
|
||||
print_to_builder(builder, "%", node.integer_value, skip_indent);
|
||||
}
|
||||
case .Float; {
|
||||
print_to_builder(builder, "%", node.float_value);
|
||||
print_to_builder(builder, "%", node.float_value, skip_indent);
|
||||
}
|
||||
case .Call; {
|
||||
pretty_print_call(node, indentation, builder);
|
||||
pretty_print_call(node, indentation, builder, skip_indent);
|
||||
}
|
||||
case .Error; {
|
||||
print_to_builder(builder, "(error \"%\")", node.name);
|
||||
print_to_builder(builder, "(error \"%\")", node.name, skip_indent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pretty_print_variable :: (node : *AST_Node, indentation : int, builder : *String_Builder) {
|
||||
indent(builder, indentation);
|
||||
pretty_print_variable :: (node : *AST_Node, indentation : int, builder : *String_Builder, skip_indent := false) {
|
||||
if !skip_indent {
|
||||
indent(builder, indentation);
|
||||
}
|
||||
print_to_builder(builder, "%", node.name);
|
||||
|
||||
for child : node.children {
|
||||
if child.kind == .Variable {
|
||||
append(builder, ".");
|
||||
pretty_print_variable(child, indentation, builder);
|
||||
pretty_print_variable(child, indentation, builder, skip_indent = true);
|
||||
} else if child.kind == .Unary {
|
||||
append(builder, "[");
|
||||
pretty_print_node(child.children[0], 0, builder);
|
||||
append(builder, "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pretty_print_declaration :: (declaration : *AST_Node, indentation : int, builder : *String_Builder) {
|
||||
indent(builder, indentation);
|
||||
pretty_print_declaration :: (declaration : *AST_Node, indentation : int, builder : *String_Builder, skip_indent := false) {
|
||||
if !skip_indent {
|
||||
indent(builder, indentation);
|
||||
}
|
||||
append(builder, "(");
|
||||
|
||||
if declaration.foreign_declaration {
|
||||
@@ -299,6 +442,10 @@ pretty_print_declaration :: (declaration : *AST_Node, indentation : int, builder
|
||||
append(builder, "pixel ");
|
||||
}
|
||||
|
||||
if declaration.kind == .If_Directive {
|
||||
append(builder, "#if ");
|
||||
}
|
||||
|
||||
if declaration.kind == .Properties {
|
||||
append(builder, "properties");
|
||||
if declaration.name.count > 0 {
|
||||
@@ -312,6 +459,8 @@ pretty_print_declaration :: (declaration : *AST_Node, indentation : int, builder
|
||||
else {
|
||||
if declaration.kind == .Struct {
|
||||
append(builder, "struct ");
|
||||
} else if declaration.kind == .CBuffer {
|
||||
append(builder, "constant_buffer ");
|
||||
}
|
||||
print_to_builder(builder, "%", declaration.name);
|
||||
}
|
||||
@@ -323,12 +472,18 @@ pretty_print_declaration :: (declaration : *AST_Node, indentation : int, builder
|
||||
print_to_builder(builder, " (@%)", hint.string_value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if declaration.children.count > 0 {
|
||||
print_to_builder(builder, "\n");
|
||||
pretty_print_children(declaration, indentation + 1, builder, flags = .NewLine);
|
||||
if declaration.kind == .If_Directive {
|
||||
pretty_print_node(declaration.children[0], 0, builder);
|
||||
append(builder, "\n");
|
||||
pretty_print_node(declaration.children[1], indentation + 5, builder);
|
||||
} else {
|
||||
print_to_builder(builder, "\n");
|
||||
pretty_print_children(declaration, indentation + 1, builder, flags = .NewLine);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
append(builder, ")");
|
||||
|
||||
473
Codegen.jai
473
Codegen.jai
@@ -1,37 +1,64 @@
|
||||
/////////////////////////////////////
|
||||
//~ nbr:
|
||||
//
|
||||
|
||||
/////////////////////////////////////
|
||||
//~ nbr: Codegen TODOs
|
||||
//
|
||||
// [ ] Prefix output of property values with __PROPERTIES so we don't get name clashes
|
||||
|
||||
Output_Language :: enum {
|
||||
HLSL;
|
||||
GLSL;
|
||||
GLSL; // @Incomplete
|
||||
MLSL; // @Incomplete
|
||||
}
|
||||
|
||||
Codegen_State :: struct {
|
||||
path : string;
|
||||
|
||||
scope_stack : Scope_Stack;
|
||||
// scope_stack : Scope_Stack;
|
||||
current_scope : Scope_Handle;
|
||||
|
||||
type_variables : []Type_Variable;
|
||||
root : *AST_Node;
|
||||
// type_variables : []Type_Variable;
|
||||
// root : *AST_Node;
|
||||
|
||||
output_language : Output_Language;
|
||||
|
||||
builder : String_Builder;
|
||||
|
||||
result : Codegen_Result;
|
||||
result : *Compiler_Context;
|
||||
}
|
||||
|
||||
Codegen_Result :: struct {
|
||||
messages : [..]Compiler_Message;
|
||||
// Codegen_Result :: struct {
|
||||
// messages : [..]Compiler_Message;
|
||||
|
||||
had_error : bool;
|
||||
// had_error : bool;
|
||||
|
||||
result_text : string; // @Incomplete(nb): Result for now, should likely be far more sophisticated.
|
||||
}
|
||||
// result_text : string; // @Incomplete(nb): Result for now, should likely be far more sophisticated.
|
||||
// }
|
||||
|
||||
init_codegen_state :: (state : *Codegen_State, root : *AST_Node, checker_result : Semantic_Check_Result, output_language : Output_Language) {
|
||||
state.root = root;
|
||||
state.scope_stack = checker_result.scope_stack;
|
||||
state.type_variables = checker_result.type_variables;
|
||||
state.current_scope = cast(Scope_Handle)1;
|
||||
Reserved_HLSL_Words :: string.[
|
||||
"texture",
|
||||
"sampler",
|
||||
"matrix",
|
||||
"line",
|
||||
"precise",
|
||||
"shared",
|
||||
"triangle",
|
||||
"triangleadj",
|
||||
];
|
||||
|
||||
Reserved_MLSL_Words :: string.[
|
||||
""
|
||||
];
|
||||
|
||||
Reserved_GLSL_Words :: string.[
|
||||
""
|
||||
];
|
||||
|
||||
init_codegen_state :: (state : *Codegen_State, result : *Compiler_Context, output_language : Output_Language) {
|
||||
state.current_scope = cast(Scope_Handle)1;
|
||||
state.output_language = output_language;
|
||||
init_string_builder(*state.builder);
|
||||
}
|
||||
|
||||
@@ -39,24 +66,82 @@ indent :: (state : *Codegen_State, indentation : int) {
|
||||
for 1..indentation append(*state.builder, " ");
|
||||
}
|
||||
|
||||
emit_field :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
|
||||
find_result := find_symbol(state.scope_stack, node.name, state.current_scope);
|
||||
hlsl_type_to_string :: (type_variable : Type_Variable) -> string {
|
||||
if type_variable.type == {
|
||||
case .Invalid;
|
||||
return "{{invalid}}";
|
||||
case .Unit;
|
||||
return "()";
|
||||
case .Int; {
|
||||
return "int";
|
||||
}
|
||||
case .Half; {
|
||||
return "half";
|
||||
}
|
||||
case .Float; {
|
||||
return "float";
|
||||
}
|
||||
case .Double; {
|
||||
return "double";
|
||||
}
|
||||
case .Sampler; {
|
||||
return "SamplerState";
|
||||
}
|
||||
case .Texture2D; {
|
||||
return "Texture2D";
|
||||
}
|
||||
case .Function; #through;
|
||||
case .Struct; {
|
||||
return type_variable.typename;
|
||||
}
|
||||
case .Array;
|
||||
return "array";
|
||||
}
|
||||
|
||||
field := h2tv(state.type_variables, find_result.type_variable);
|
||||
return "";
|
||||
}
|
||||
|
||||
emit_field :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
|
||||
find_result := find_symbol(state.result.scope_stack, node.name, state.current_scope);
|
||||
|
||||
field := from_handle(state.result.type_variables, find_result.type_variable);
|
||||
|
||||
indent(state, indentation);
|
||||
print_to_builder(*state.builder, "% ", type_to_string(field));
|
||||
|
||||
print_to_builder(*state.builder, "% ", hlsl_type_to_string(field));
|
||||
|
||||
if field.struct_field_parent {
|
||||
parent_tv := from_handle(state.result.type_variables, field.struct_field_parent.type_variable);
|
||||
|
||||
if parent_tv.typename == "properties" {
|
||||
append(*state.builder, "__PROPERTIES__");
|
||||
}
|
||||
}
|
||||
print_to_builder(*state.builder, "%", node.name);
|
||||
|
||||
for i :0..node.children.count - 1 {
|
||||
child := node.children[i];
|
||||
if field.type == .Sampler {
|
||||
print_to_builder(*state.builder, " : register(s%)", field.resource_index);
|
||||
}
|
||||
|
||||
if field.type == .Texture2D {
|
||||
print_to_builder(*state.builder, " : register(t%)", field.resource_index);
|
||||
}
|
||||
|
||||
if node.children.count == 1 {
|
||||
child := node.children[0];
|
||||
|
||||
print_to_builder(*state.builder, " = ");
|
||||
emit_node(state, child, 0);
|
||||
|
||||
}
|
||||
|
||||
for i :0..field.child_count - 1 {
|
||||
child := h2tv(state.type_variables, field.children[i]);
|
||||
if node.parent.kind == .Block {
|
||||
append(*state.builder, ";");
|
||||
}
|
||||
|
||||
|
||||
for i :0..field.children.count - 1 {
|
||||
child := from_handle(state.result.type_variables, field.children[i]);
|
||||
emit_node(state, child.source_node, 0);
|
||||
}
|
||||
|
||||
@@ -64,6 +149,10 @@ emit_field :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
|
||||
if hint.ident_value == "position" {
|
||||
// @Incomplete(nb): Should be a lookup table somewhere
|
||||
append(*state.builder, " : POSITION");
|
||||
} else if hint.ident_value == "uv" {
|
||||
append(*state.builder, " : TEXCOORD0");
|
||||
} else if hint.ident_value == "outposition" {
|
||||
append(*state.builder, " : SV_POSITION");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,32 +162,72 @@ emit_block :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
|
||||
emit_node(state, statement, indentation);
|
||||
|
||||
if it_index < node.children.count {
|
||||
append(*state.builder, ";\n");
|
||||
append(*state.builder, "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
emit_call :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
|
||||
indent(state, indentation);
|
||||
print_to_builder(*state.builder, "%(", node.name);
|
||||
|
||||
if node.children.count > 0 {
|
||||
if node.name == "sample" {
|
||||
assert(node.children.count > 0);
|
||||
args := node.children[0];
|
||||
|
||||
for child : args.children {
|
||||
emit_node(state, args.children[0], 0);
|
||||
append(*state.builder, ".");
|
||||
print_to_builder(*state.builder, "Sample(");
|
||||
|
||||
for i : 1..args.children.count - 1 {
|
||||
child := args.children[i];
|
||||
|
||||
emit_node(state, child, 0);
|
||||
|
||||
if it_index != args.children.count - 1 {
|
||||
if i != args.children.count - 1 {
|
||||
append(*state.builder, ", ");
|
||||
}
|
||||
}
|
||||
} else if starts_with(node.name, "float") && node.children[0].children.count == 1 {
|
||||
args := node.children[0];
|
||||
|
||||
print_to_builder(*state.builder, "%(", node.name);
|
||||
|
||||
number : string;
|
||||
number.data = *node.name.data[5];
|
||||
number.count = node.name.count - 5;
|
||||
count := parse_int(*number, s32);
|
||||
|
||||
for i : 0..count - 1 {
|
||||
child := args.children[0];
|
||||
emit_node(state, child, 0);
|
||||
|
||||
if i != count - 1 {
|
||||
append(*state.builder, ", ");
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
print_to_builder(*state.builder, "%(", node.name);
|
||||
|
||||
if node.children.count > 0 {
|
||||
args := node.children[0];
|
||||
|
||||
for child : args.children {
|
||||
emit_node(state, child, 0);
|
||||
|
||||
if it_index != args.children.count - 1 {
|
||||
append(*state.builder, ", ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
append(*state.builder, ")");
|
||||
}
|
||||
|
||||
emit_properties :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
|
||||
find_result := find_symbol(state.scope_stack, ifx node.name.count > 0 then node.name else "properties", state.current_scope);
|
||||
find_result := find_symbol(state.result.scope_stack, ifx node.name.count > 0 then node.name else "properties", state.current_scope);
|
||||
|
||||
if !find_result {
|
||||
message : Compiler_Message;
|
||||
@@ -109,33 +238,47 @@ 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.");
|
||||
|
||||
variable := h2tv(state.type_variables, find_result.type_variable);
|
||||
variable := from_handle(state.result.type_variables, find_result.type_variable);
|
||||
|
||||
print_to_builder(*state.builder, "cbuffer __PROPERTIES : register(b%) \n{\n", variable.buffer_index);
|
||||
print_to_builder(*state.builder, "cbuffer __PROPERTIES : register(b%) \n{\n", variable.resource_index);
|
||||
|
||||
previous_scope := state.current_scope;
|
||||
state.current_scope = variable.scope;
|
||||
|
||||
resources : Static_Array(*AST_Node, 8);
|
||||
|
||||
for child : node.children {
|
||||
if child.kind == .FieldList {
|
||||
for field : child.children {
|
||||
tv := from_handle(state.result.type_variables, field.type_variable);
|
||||
if tv.type == .Sampler || tv.type == .Texture2D {
|
||||
array_add(*resources, field);
|
||||
continue;
|
||||
}
|
||||
emit_node(state, field, 1);
|
||||
|
||||
append(*state.builder, ";\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
state.current_scope = previous_scope;
|
||||
|
||||
append(*state.builder, "}\n\n");
|
||||
|
||||
for i : 0..resources.count - 1 {
|
||||
resource := resources[i];
|
||||
emit_node(state, resource, 0);
|
||||
|
||||
append(*state.builder, ";\n");
|
||||
}
|
||||
|
||||
append(*state.builder, "\n");
|
||||
|
||||
state.current_scope = previous_scope;
|
||||
}
|
||||
|
||||
emit_function :: (state : *Codegen_State, node : *AST_Node, indentation : int, emit_body := true) {
|
||||
name := get_actual_function_name(node);
|
||||
find_result := find_symbol(state.scope_stack, name, state.current_scope);
|
||||
find_result := find_symbol(state.result.scope_stack, name, state.current_scope);
|
||||
|
||||
assert(find_result != null, "Attempting to generate undeclared function. This should never happen at this stage.");
|
||||
if !find_result {
|
||||
@@ -147,13 +290,13 @@ emit_function :: (state : *Codegen_State, node : *AST_Node, indentation : int, e
|
||||
}
|
||||
|
||||
for func : find_result.functions {
|
||||
function_variable := h2tv(state.type_variables, func.type_variable);
|
||||
function_variable := from_handle(state.result.type_variables, func.type_variable);
|
||||
|
||||
indent(state, indentation);
|
||||
|
||||
if function_variable.return_var {
|
||||
return_variable := h2tv(state.type_variables, function_variable.return_var);
|
||||
print_to_builder(*state.builder, "% ", type_to_string(return_variable));
|
||||
if function_variable.return_type_variable {
|
||||
return_variable := from_handle(state.result.type_variables, function_variable.return_type_variable);
|
||||
print_to_builder(*state.builder, "% ", hlsl_type_to_string(return_variable));
|
||||
} else {
|
||||
append(*state.builder, "void ");
|
||||
}
|
||||
@@ -225,7 +368,22 @@ emit_operator :: (state : *Codegen_State, op_kind : Token_Kind) {
|
||||
}
|
||||
case .TOKEN_SLASH; {
|
||||
append(*state.builder, "/");
|
||||
}
|
||||
}
|
||||
case .TOKEN_MINUSEQUALS; {
|
||||
append(*state.builder, "-=");
|
||||
}
|
||||
case .TOKEN_PLUSEQUALS; {
|
||||
append(*state.builder, "+=");
|
||||
}
|
||||
case .TOKEN_DIVEQUALS; {
|
||||
append(*state.builder, "/=");
|
||||
}
|
||||
case .TOKEN_TIMESEQUALS; {
|
||||
append(*state.builder, "*=");
|
||||
}
|
||||
case .TOKEN_MODEQUALS; {
|
||||
append(*state.builder, "%=");
|
||||
}
|
||||
case .TOKEN_ISEQUAL; {
|
||||
append(*state.builder, "==");
|
||||
}
|
||||
@@ -271,15 +429,23 @@ emit_node :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
|
||||
emit_field(state, node, indentation);
|
||||
}
|
||||
case .Block; {
|
||||
|
||||
assert(false, "Not implemented yet: block");
|
||||
}
|
||||
case .Variable; {
|
||||
indent(*state.builder, indentation);
|
||||
|
||||
type_var := h2tv(state.type_variables, node.type_variable);
|
||||
type_var := from_handle(state.result.type_variables, node.type_variable);
|
||||
is_properties := type_var.typename == "properties";
|
||||
|
||||
if !is_properties {
|
||||
if type_var.struct_field_parent {
|
||||
parent_tv := from_handle(state.result.type_variables, type_var.struct_field_parent.type_variable);
|
||||
|
||||
if parent_tv.typename == "properties" {
|
||||
append(*state.builder, "__PROPERTIES__");
|
||||
}
|
||||
}
|
||||
print_to_builder(*state.builder, "%", node.name);
|
||||
}
|
||||
|
||||
@@ -292,6 +458,11 @@ emit_node :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
|
||||
}
|
||||
case .Binary; {
|
||||
indent(*state.builder, indentation);
|
||||
|
||||
if node.token.kind != .TOKEN_ASSIGN {
|
||||
append(*state.builder, "(");
|
||||
}
|
||||
|
||||
lhs := node.children[0];
|
||||
rhs := node.children[1];
|
||||
emit_node(state, lhs, 0);
|
||||
@@ -300,12 +471,19 @@ emit_node :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
|
||||
emit_operator(state, node.token.kind);
|
||||
append(*state.builder, " ");
|
||||
emit_node(state, rhs, 0);
|
||||
if node.token.kind != .TOKEN_ASSIGN {
|
||||
append(*state.builder, ")");
|
||||
}
|
||||
}
|
||||
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; {
|
||||
emit_node(state, node.children[0], indentation);
|
||||
append(*state.builder, ";");
|
||||
}
|
||||
case .Call; {
|
||||
emit_call(state, node, indentation);
|
||||
@@ -314,10 +492,124 @@ emit_node :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
|
||||
indent(*state.builder, indentation);
|
||||
append(*state.builder, "return ");
|
||||
emit_node(state, node.children[0], 0);
|
||||
append(*state.builder, ";");
|
||||
}
|
||||
case .For; {
|
||||
if node.parent.kind != .For {
|
||||
indent(*state.builder, indentation);
|
||||
}
|
||||
|
||||
append(*state.builder, "for ");
|
||||
|
||||
loop_ident := node.token.ident_value;
|
||||
begin_val := node.children[0].integer_value;
|
||||
end_val := node.children[1].integer_value;
|
||||
print_to_builder(*state.builder, "(int % = %; % < %; %++)\n", loop_ident, begin_val, loop_ident, end_val, loop_ident);
|
||||
|
||||
indent(*state.builder, indentation);
|
||||
append(*state.builder, "{\n");
|
||||
|
||||
emit_block(state, node.children[2], indentation + 1);
|
||||
|
||||
indent(*state.builder, indentation);
|
||||
append(*state.builder, "}\n");
|
||||
}
|
||||
case .If; {
|
||||
if node.parent.kind != .If {
|
||||
indent(*state.builder, indentation);
|
||||
}
|
||||
|
||||
append(*state.builder, "if ");
|
||||
|
||||
cond := node.children[0];
|
||||
emit_node(state, cond, 0);
|
||||
|
||||
body := node.children[1];
|
||||
append(*state.builder, "\n");
|
||||
indent(*state.builder, indentation);
|
||||
append(*state.builder, "{\n");
|
||||
|
||||
emit_block(state, body, indentation + 1);
|
||||
|
||||
indent(*state.builder, indentation);
|
||||
append(*state.builder, "}\n");
|
||||
|
||||
if node.children.count == 3 {
|
||||
emit_else(state, node.children[2], indentation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
emit_else :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
|
||||
indent(*state.builder, indentation);
|
||||
append(*state.builder, "else ");
|
||||
|
||||
if node.kind == .If {
|
||||
emit_node(state, node, indentation);
|
||||
} else if node.kind == .Block {
|
||||
append(*state.builder, "\n");
|
||||
indent(*state.builder, indentation);
|
||||
append(*state.builder, "{\n");
|
||||
|
||||
emit_block(state, node, indentation + 1);
|
||||
|
||||
indent(*state.builder, indentation);
|
||||
append(*state.builder, "}");
|
||||
}
|
||||
}
|
||||
|
||||
emit_field_list :: (state : *Codegen_State, field_list : *AST_Node, indentation : int) {
|
||||
for child : field_list.children {
|
||||
emit_node(state, child, 1);
|
||||
|
||||
if it_index < field_list.children.count {
|
||||
append(*state.builder, ";\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
emit_struct :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
|
||||
print_to_builder(*state.builder, "struct %", node.name);
|
||||
|
||||
current_scope := state.current_scope;
|
||||
state.current_scope = from_handle(state.result.type_variables, node.type_variable).scope;
|
||||
|
||||
field_list := node.children[0];
|
||||
|
||||
if field_list.children.count > 0 {
|
||||
append(*state.builder, "\n{\n");
|
||||
} else {
|
||||
append(*state.builder, " {");
|
||||
}
|
||||
|
||||
emit_field_list(state, field_list, indentation);
|
||||
|
||||
append(*state.builder, "};\n\n");
|
||||
state.current_scope = current_scope;
|
||||
}
|
||||
|
||||
emit_cbuffer :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
|
||||
variable := from_handle(state.result.type_variables, node.type_variable);
|
||||
print_to_builder(*state.builder, "cbuffer % : register(b%)", variable.name, variable.resource_index);
|
||||
|
||||
current_scope := state.current_scope;
|
||||
state.current_scope = from_handle(state.result.type_variables, node.type_variable).scope;
|
||||
|
||||
field_list := node.children[0];
|
||||
|
||||
if field_list.children.count > 0 {
|
||||
append(*state.builder, "\n{\n");
|
||||
} else {
|
||||
append(*state.builder, " {");
|
||||
}
|
||||
|
||||
emit_field_list(state, field_list, indentation);
|
||||
|
||||
append(*state.builder, "}\n\n");
|
||||
state.current_scope = current_scope;
|
||||
}
|
||||
|
||||
emit_declaration :: (state : *Codegen_State, node : *AST_Node) {
|
||||
if node.kind == {
|
||||
case .Function; {
|
||||
@@ -326,53 +618,59 @@ emit_declaration :: (state : *Codegen_State, node : *AST_Node) {
|
||||
case .Properties; {
|
||||
emit_properties(state, node, 0);
|
||||
}
|
||||
case .CBuffer; {
|
||||
emit_cbuffer(state, node, 0);
|
||||
}
|
||||
case .Struct; {
|
||||
print_to_builder(*state.builder, "struct %", node.name);
|
||||
|
||||
current_scope := state.current_scope;
|
||||
state.current_scope = h2tv(state.type_variables, node.type_variable).scope;
|
||||
|
||||
field_list := node.children[0];
|
||||
|
||||
if field_list.children.count > 0 {
|
||||
append(*state.builder, "\n{\n");
|
||||
} else {
|
||||
append(*state.builder, " {");
|
||||
}
|
||||
|
||||
|
||||
for child : field_list.children {
|
||||
emit_node(state, child, 1);
|
||||
|
||||
if it_index < field_list.children.count {
|
||||
append(*state.builder, ";\n");
|
||||
}
|
||||
}
|
||||
|
||||
append(*state.builder, "}\n\n");
|
||||
state.current_scope = current_scope;
|
||||
emit_struct(state, node, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
codegen :: (state : *Codegen_State) -> Codegen_Result {
|
||||
codegen :: (result : *Compiler_Context, allocator := temp) {
|
||||
codegen(result, .HLSL);
|
||||
}
|
||||
|
||||
codegen :: (result : *Compiler_Context, output_language : Output_Language, allocator := temp) {
|
||||
if result.had_error {
|
||||
return;
|
||||
}
|
||||
|
||||
new_context := context;
|
||||
new_context.allocator = allocator;
|
||||
push_context new_context {
|
||||
init_context_allocators();
|
||||
defer clear_context_allocators();
|
||||
|
||||
state : Codegen_State;
|
||||
state.result = result;
|
||||
state.current_scope = cast(Scope_Handle)1;
|
||||
state.output_language = output_language;
|
||||
init_string_builder(*state.builder);
|
||||
|
||||
codegen(*state);
|
||||
}
|
||||
}
|
||||
|
||||
#scope_file
|
||||
codegen :: (state : *Codegen_State) {
|
||||
found_function : bool = false;
|
||||
found_struct : bool = false;
|
||||
// found_struct : bool = false;
|
||||
|
||||
for variable : state.type_variables {
|
||||
if variable.type == .Struct && variable.kind == .Declaration && !variable.builtin {
|
||||
if variable.source_node.kind == .Properties continue;
|
||||
if variable.source_node.kind == .Meta continue;
|
||||
print_to_builder(*state.builder, "struct %;\n", variable.source_node.name);
|
||||
found_struct = true;
|
||||
}
|
||||
}
|
||||
// for variable : state.result.type_variables {
|
||||
// if variable.type == .Struct && variable.kind == .Declaration && !variable.builtin {
|
||||
// if variable.source_node.kind == .Properties continue;
|
||||
// if variable.source_node.kind == .Meta continue;
|
||||
// print_to_builder(*state.builder, "struct %;\n", variable.source_node.name);
|
||||
// found_struct = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
if found_struct {
|
||||
append(*state.builder, "\n");
|
||||
}
|
||||
// if found_struct {
|
||||
// append(*state.builder, "\n");
|
||||
// }
|
||||
|
||||
for variable : state.type_variables {
|
||||
for variable : state.result.type_variables {
|
||||
if variable.type == .Function && !variable.builtin
|
||||
&& !variable.source_node.vertex_entry_point && !variable.source_node.pixel_entry_point {
|
||||
emit_function(state, variable.source_node, 0, false);
|
||||
@@ -383,20 +681,15 @@ codegen :: (state : *Codegen_State) -> Codegen_Result {
|
||||
append(*state.builder, "\n");
|
||||
}
|
||||
|
||||
for declaration : state.root.children {
|
||||
for declaration : state.result.root.children {
|
||||
if declaration.foreign_declaration {
|
||||
continue;
|
||||
}
|
||||
emit_declaration(state, declaration);
|
||||
}
|
||||
|
||||
state.result.result_text = builder_to_string(*state.builder);
|
||||
|
||||
return state.result;
|
||||
state.result.codegen_result_text = builder_to_string(*state.builder);
|
||||
}
|
||||
|
||||
codegen :: (ast_root : *AST_Node, checker_result : Semantic_Check_Result, output_language : Output_Language) -> Codegen_Result {
|
||||
codegen_state : Codegen_State;
|
||||
init_codegen_state(*codegen_state, ast_root, checker_result, output_language);
|
||||
return codegen(*codegen_state);
|
||||
}
|
||||
#scope_module
|
||||
#import "ncore";
|
||||
|
||||
@@ -122,7 +122,10 @@ report_message :: (builder : *String_Builder, path : string, message : string, s
|
||||
} else {
|
||||
append(builder, "internal:");
|
||||
}
|
||||
print_to_builder(builder, "%,%: ", source_locations[0].main_token.line, source_locations[0].main_token.column);
|
||||
|
||||
if source_locations.count > 0 {
|
||||
print_to_builder(builder, "%,%: ", source_locations[0].main_token.line, source_locations[0].main_token.column);
|
||||
}
|
||||
|
||||
if kind == .Log {
|
||||
append(builder, "\x1b[31mlog: ");
|
||||
|
||||
749
Ink.jai
Normal file
749
Ink.jai
Normal file
@@ -0,0 +1,749 @@
|
||||
/////////////////////////////////////
|
||||
/*~ nbr: General improvements
|
||||
- [x] Print out all failed tests in a list at the end
|
||||
- [x] Use new compiler API with Compile_Result and Compiled_File instead
|
||||
- [ ] Use unix (posix? bash? ascii?) color codes for errors
|
||||
- [ ] Print golden file as green and new output as red
|
||||
- [ ] Rename to Ink.jai
|
||||
- [ ] Add -test option. -test does the same as test.exe used to do
|
||||
- [ ] Add -fuzz option to run fuzzer (add args later)
|
||||
- [ ] Add -output option to output the compiled file. Issue with this is the generated data can't be output like that. Would require serialization.
|
||||
*/
|
||||
|
||||
#import "Basic";
|
||||
#import "File";
|
||||
#import "String";
|
||||
#import "File_Utilities";
|
||||
#import "Print_Color";
|
||||
|
||||
#load "module.jai";
|
||||
|
||||
GOLDEN_EXTENSION :: "golden";
|
||||
LEXER_FOLDER :: "lex";
|
||||
PARSER_FOLDER :: "parse";
|
||||
CODEGEN_FOLDER :: "codegen";
|
||||
COMPILED_FOLDER :: "compiled";
|
||||
SEMANTIC_ANALYSIS_FOLDER :: "semant";
|
||||
TESTS_FOLDER :: "test";
|
||||
|
||||
SHADER_EXTENSION :: "ink";
|
||||
SUITE_EXTENSION :: "suite";
|
||||
|
||||
Stage_Flags :: enum_flags u16 {
|
||||
Lexer :: 0x1;
|
||||
Parser :: 0x2;
|
||||
Semantic_Analysis :: 0x4;
|
||||
Codegen :: 0x8;
|
||||
Compile :: 0x10;
|
||||
}
|
||||
|
||||
Output_Type :: enum_flags u16 {
|
||||
Golden :: 0x1;
|
||||
StdOut :: 0x2;
|
||||
}
|
||||
|
||||
Result_Type :: enum {
|
||||
File_Read_Failed;
|
||||
Golden_File_Not_Found;
|
||||
StdOut;
|
||||
Golden_Output;
|
||||
Passed;
|
||||
Failed;
|
||||
}
|
||||
|
||||
Result :: struct {
|
||||
type : Result_Type;
|
||||
path : string;
|
||||
stage : Stage_Flags;
|
||||
|
||||
golden_path : string;
|
||||
info_text : string;
|
||||
}
|
||||
|
||||
Test_Case :: struct {
|
||||
path : string;
|
||||
stage_flags : Stage_Flags;
|
||||
}
|
||||
|
||||
Test_Suite :: struct {
|
||||
name : string;
|
||||
test_cases : [..]Test_Case;
|
||||
|
||||
results : [..]Result;
|
||||
}
|
||||
|
||||
get_golden_path :: (file_path : string, stage : Stage_Flags) -> string {
|
||||
sc := get_scratch();
|
||||
defer scratch_end(sc);
|
||||
path := parse_path(file_path,, sc.allocator);
|
||||
file_without_extension := split(path.words[path.words.count - 1], ".",, sc.allocator);
|
||||
|
||||
builder : String_Builder;
|
||||
builder.allocator = temp;
|
||||
|
||||
final_path_length := file_path.count - SHADER_EXTENSION.count + GOLDEN_EXTENSION.count + 1; // +1 for dot
|
||||
|
||||
path.words.count -= 1;
|
||||
path.words.allocator = sc.allocator;
|
||||
|
||||
if stage == {
|
||||
case .Lexer; {
|
||||
dir := tprint("%/%", TESTS_FOLDER, LEXER_FOLDER);
|
||||
make_directory_if_it_does_not_exist(dir);
|
||||
array_add(*path.words, LEXER_FOLDER);
|
||||
}
|
||||
case .Parser; {
|
||||
dir := tprint("%/%", TESTS_FOLDER, PARSER_FOLDER);
|
||||
make_directory_if_it_does_not_exist(dir);
|
||||
array_add(*path.words, PARSER_FOLDER);
|
||||
}
|
||||
case .Semantic_Analysis; {
|
||||
dir := tprint("%/%", TESTS_FOLDER, SEMANTIC_ANALYSIS_FOLDER);
|
||||
make_directory_if_it_does_not_exist(dir);
|
||||
array_add(*path.words, SEMANTIC_ANALYSIS_FOLDER);
|
||||
}
|
||||
case .Codegen; {
|
||||
dir := tprint("%/%", TESTS_FOLDER, CODEGEN_FOLDER);
|
||||
make_directory_if_it_does_not_exist(dir);
|
||||
array_add(*path.words, CODEGEN_FOLDER);
|
||||
}
|
||||
case .Compile; {
|
||||
dir := tprint("%/%", TESTS_FOLDER, COMPILED_FOLDER);
|
||||
make_directory_if_it_does_not_exist(dir);
|
||||
array_add(*path.words, COMPILED_FOLDER);
|
||||
}
|
||||
}
|
||||
|
||||
init_string_builder(*builder, file_without_extension.count + GOLDEN_EXTENSION.count + 1);
|
||||
builder.allocator = sc.allocator;
|
||||
append(*builder, file_without_extension[0]);
|
||||
append(*builder, ".");
|
||||
append(*builder, GOLDEN_EXTENSION);
|
||||
golden_path := builder_to_string(*builder,, sc.allocator);
|
||||
array_add(*path.words, golden_path);
|
||||
|
||||
final_path := path_to_string(path);
|
||||
|
||||
return final_path;
|
||||
}
|
||||
|
||||
do_golden_comparison :: (golden_path : string, comparison_text : string, result : *Result, output_type : Output_Type) {
|
||||
sc := get_scratch();
|
||||
defer scratch_end(sc);
|
||||
if output_type & .Golden {
|
||||
// Output the comparison file
|
||||
write_entire_file(golden_path, comparison_text);
|
||||
result.golden_path = copy_string(golden_path);
|
||||
result.type = .Golden_Output;
|
||||
return;
|
||||
} else {
|
||||
// Do the comparison
|
||||
if !file_exists(golden_path) {
|
||||
result.info_text = tprint("Golden file % does not exist. Please run with -output-as-golden at least once.\n", golden_path);
|
||||
result.type = .Golden_File_Not_Found;
|
||||
return;
|
||||
}
|
||||
|
||||
golden_text, ok := read_entire_file(golden_path,, sc.allocator);
|
||||
if !ok {
|
||||
result.info_text = tprint("Unable to open golden file %\n", golden_path);
|
||||
result.type = .Golden_File_Not_Found;
|
||||
return;
|
||||
}
|
||||
|
||||
comp := replace(comparison_text, "\r\n", "\n",, sc.allocator);
|
||||
gold := replace(golden_text, "\r\n", "\n",, sc.allocator);
|
||||
ok = compare(comp, gold) == 0;
|
||||
if !ok {
|
||||
result.type = .Failed;
|
||||
result.info_text = tprint("Golden file:\n%\n===============\n%", gold, comp);
|
||||
} else {
|
||||
result.type = .Passed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
run_codegen_test :: (file_path : string, ctx : *Compiler_Context, output_type : Output_Type = 0) -> Result {
|
||||
result : Result;
|
||||
result.path = file_path;
|
||||
|
||||
lex(ctx, context.allocator);
|
||||
parse(ctx, context.allocator);
|
||||
check(ctx, context.allocator);
|
||||
|
||||
if ctx.had_error {
|
||||
result.type = .Failed;
|
||||
return result;
|
||||
}
|
||||
result = run_codegen_test(ctx, output_type);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
run_codegen_test :: (ctx : *Compiler_Context, output_type : Output_Type = 0) -> Result {
|
||||
result : Result;
|
||||
result.path = ctx.file.path;
|
||||
result_text : string;
|
||||
|
||||
codegen(ctx, context.allocator);
|
||||
|
||||
if ctx.had_error {
|
||||
result.type = .Failed;
|
||||
result_text = report_messages(ctx.messages);
|
||||
return result;
|
||||
}
|
||||
|
||||
result_text = ctx.codegen_result_text;
|
||||
|
||||
if output_type & .StdOut {
|
||||
result.info_text = result_text;
|
||||
result.type = .StdOut;
|
||||
return result;
|
||||
}
|
||||
|
||||
golden_path := get_golden_path(ctx.file.path, .Codegen);
|
||||
do_golden_comparison(golden_path, result_text, *result, output_type);
|
||||
return result;
|
||||
}
|
||||
|
||||
run_compile_test :: (path : string, output_type : Output_Type = 0) -> Result, Compiler_Context {
|
||||
ctx : Compiler_Context;
|
||||
result : Result;
|
||||
result.path = path;
|
||||
compile_file(*ctx, path, context.allocator);
|
||||
|
||||
if ctx.had_error {
|
||||
result.type = .Failed;
|
||||
result.info_text = tprint("Failed compiling: %\n", path);
|
||||
} else {
|
||||
sc := get_scratch();
|
||||
defer scratch_end(sc);
|
||||
sb : String_Builder;
|
||||
init_string_builder(*sb,, sc.allocator);
|
||||
if ctx.vertex_entry_point.name.count > 0 {
|
||||
print_to_builder(*sb, "[vertex entry point] - %\n", ctx.vertex_entry_point.name);
|
||||
}
|
||||
if ctx.pixel_entry_point.name.count > 0 {
|
||||
print_to_builder(*sb, "[pixel entry point] - %\n", ctx.pixel_entry_point.name);
|
||||
}
|
||||
|
||||
for cb : ctx.cbuffers {
|
||||
print_to_builder(*sb, "[constant_buffer] - % - %\n", cb.name, cb.buffer_index);
|
||||
|
||||
indent(*sb, 1);
|
||||
for field : cb.fields {
|
||||
append(*sb, "[field] - ");
|
||||
pretty_print_field(*sb, *field.base_field);
|
||||
}
|
||||
}
|
||||
|
||||
result.info_text = builder_to_string(*sb);
|
||||
}
|
||||
|
||||
if output_type & .StdOut {
|
||||
result.type = .StdOut;
|
||||
return result, ctx;
|
||||
}
|
||||
|
||||
golden_path := get_golden_path(ctx.file.path, .Compile);
|
||||
do_golden_comparison(golden_path, result.info_text, *result, output_type);
|
||||
|
||||
return result, ctx;
|
||||
}
|
||||
|
||||
run_lexer_test :: (file_path : string, ctx : *Compiler_Context, output_type : Output_Type = 0) -> Result {
|
||||
result : Result;
|
||||
result.path = file_path;
|
||||
result.stage = .Lexer;
|
||||
|
||||
result_text : string;
|
||||
|
||||
lex(ctx);
|
||||
if ctx.had_error {
|
||||
result.type = .Failed;
|
||||
result_text = report_messages(ctx.messages);
|
||||
} else {
|
||||
result_text = pretty_print_tokens(ctx.tokens, context.allocator);
|
||||
}
|
||||
|
||||
if output_type & .StdOut {
|
||||
result.info_text = result_text;
|
||||
result.type = .StdOut;
|
||||
return result;
|
||||
}
|
||||
|
||||
golden_path := get_golden_path(file_path, .Lexer);
|
||||
do_golden_comparison(golden_path, result_text, *result, output_type);
|
||||
return result;
|
||||
}
|
||||
|
||||
run_parser_test :: (file_path : string, ctx : *Compiler_Context, output_type : Output_Type = 0) -> Result {
|
||||
result : Result;
|
||||
result.path = file_path;
|
||||
|
||||
lex(ctx);
|
||||
if ctx.had_error {
|
||||
result.type = .Passed;
|
||||
return result;
|
||||
}
|
||||
|
||||
result = run_parser_test(ctx, output_type);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
run_parser_test :: (ctx : *Compiler_Context, output_type : Output_Type = 0) -> Result {
|
||||
parse(ctx, context.allocator);
|
||||
result : Result;
|
||||
result.path = ctx.file.path;
|
||||
result_text : string;
|
||||
|
||||
if ctx.had_error {
|
||||
result.type = .Failed;
|
||||
result_text = report_messages(ctx.messages);
|
||||
} else {
|
||||
result_text = pretty_print_ast(ctx.root, context.allocator);
|
||||
}
|
||||
|
||||
if output_type & .StdOut {
|
||||
result.info_text = result_text;
|
||||
result.type = .StdOut;
|
||||
return result;
|
||||
}
|
||||
|
||||
golden_path := get_golden_path(ctx.file.path, .Parser);
|
||||
do_golden_comparison(golden_path, result_text, *result, output_type);
|
||||
return result;
|
||||
}
|
||||
|
||||
run_semantic_analysis_test :: (ctx : *Compiler_Context, output_type : Output_Type = 0) -> Result {
|
||||
result : Result;
|
||||
result.path = ctx.file.path;
|
||||
result_text : string;
|
||||
|
||||
check(ctx, context.allocator);
|
||||
|
||||
if ctx.had_error {
|
||||
result.type = .Failed;
|
||||
result_text = report_messages(ctx.messages);
|
||||
} else {
|
||||
result_text = pretty_print_symbol_table(ctx, context.allocator);
|
||||
}
|
||||
|
||||
if output_type & .StdOut {
|
||||
result.info_text = result_text;
|
||||
result.type = .StdOut;
|
||||
return result;
|
||||
}
|
||||
|
||||
golden_path := get_golden_path(ctx.file.path, .Semantic_Analysis);
|
||||
do_golden_comparison(golden_path, result_text, *result, output_type);
|
||||
return result;
|
||||
}
|
||||
|
||||
run_semantic_analysis_test :: (file_path : string, ctx : *Compiler_Context, output_type : Output_Type = 0) -> Result {
|
||||
result : Result;
|
||||
result.path = file_path;
|
||||
|
||||
lex(ctx, context.allocator);
|
||||
parse(ctx, context.allocator);
|
||||
if ctx.had_error {
|
||||
result.type = .Failed;
|
||||
return result;
|
||||
}
|
||||
|
||||
result = run_semantic_analysis_test(ctx, output_type);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
make_test_case :: (path : string, stage_flags : Stage_Flags, allocator := context.allocator) -> Test_Case {
|
||||
test_case : Test_Case;
|
||||
test_case.path = copy_string(path,, allocator);
|
||||
replace_chars(test_case.path, "\\", #char "/");
|
||||
test_case.stage_flags = stage_flags;
|
||||
|
||||
return test_case;
|
||||
}
|
||||
|
||||
run_test_new :: (file_path : string, stage_flags : Stage_Flags, results : *[..]Result, output_type : Output_Type = 0, allocator := temp) {
|
||||
new_context := context;
|
||||
new_context.allocator = allocator;
|
||||
push_context new_context {
|
||||
ctx : Compiler_Context;
|
||||
|
||||
ctx.file = make_file(*ctx, file_path);
|
||||
|
||||
result : Result;
|
||||
if stage_flags & .Lexer {
|
||||
result = run_lexer_test(file_path, *ctx, output_type);
|
||||
record_result(results, result);
|
||||
}
|
||||
|
||||
if stage_flags & .Parser {
|
||||
if stage_flags & .Lexer && result.type == .Passed || result.type == .Golden_Output {
|
||||
result = run_parser_test(*ctx, output_type);
|
||||
} else {
|
||||
result = run_parser_test(file_path, *ctx, output_type);
|
||||
}
|
||||
record_result(results, result);
|
||||
}
|
||||
|
||||
if stage_flags & .Semantic_Analysis {
|
||||
if stage_flags & .Parser && (result.type == .Passed || result.type == .Golden_Output) {
|
||||
result = run_semantic_analysis_test(*ctx, output_type);
|
||||
} else {
|
||||
result = run_semantic_analysis_test(file_path, *ctx, output_type);
|
||||
}
|
||||
record_result(results, result);
|
||||
}
|
||||
|
||||
if stage_flags & .Codegen {
|
||||
if stage_flags & .Semantic_Analysis && (result.type == .Passed || result.type == .Golden_Output) {
|
||||
result = run_codegen_test(*ctx, output_type);
|
||||
} else {
|
||||
result = run_codegen_test(file_path, *ctx, output_type);
|
||||
}
|
||||
record_result(results, result);
|
||||
}
|
||||
|
||||
if stage_flags & .Compile {
|
||||
result = run_compile_test(file_path, output_type);
|
||||
record_result(results, result);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
run_test :: (test_case : Test_Case, results : *[..]Result, output_type : Output_Type = 0, allocator := temp) {
|
||||
print("%Running test: %......", cyan(), test_case.path);
|
||||
|
||||
// path 30
|
||||
// len 35
|
||||
// == 5
|
||||
|
||||
|
||||
// path 20
|
||||
// len = 35
|
||||
// == 15
|
||||
|
||||
len := 50;
|
||||
rest := len - test_case.path.count;
|
||||
for i: 0..rest {
|
||||
print(" ");
|
||||
}
|
||||
|
||||
run_test_new(test_case.path, test_case.stage_flags, results, output_type, allocator);
|
||||
}
|
||||
|
||||
record_result :: (results : *[..]Result, result : Result) {
|
||||
array_add(results, result);
|
||||
}
|
||||
|
||||
run_test_suite :: (using suite : *Test_Suite, output_type : Output_Type = 0) {
|
||||
if suite.name.count > 0 {
|
||||
print("%Running suite: %\n", green(), suite.name);
|
||||
print("%", reset_color());
|
||||
}
|
||||
|
||||
Fail_Data :: struct {
|
||||
path : string;
|
||||
stage : string;
|
||||
}
|
||||
|
||||
test_arena : Allocator = make_arena(Gigabytes(1));
|
||||
|
||||
failed_test_paths : [..]Fail_Data;
|
||||
failed_test_paths.allocator = test_arena;
|
||||
|
||||
builder : String_Builder;
|
||||
init_string_builder(*builder,, test_arena);
|
||||
|
||||
for test_case : test_cases {
|
||||
run_test(test_case, *suite.results, output_type, allocator = test_arena);
|
||||
|
||||
for < suite.results {
|
||||
result := suite.results[it_index];
|
||||
if compare(result.path, test_case.path) == 0 {
|
||||
if result.type == {
|
||||
case .Failed; {
|
||||
array_add(*failed_test_paths, .{ result.path, stage_to_string(result.stage) });
|
||||
}
|
||||
case .File_Read_Failed; {
|
||||
array_add(*failed_test_paths, .{ result.path, "file not found" });
|
||||
}
|
||||
case .Golden_File_Not_Found; {
|
||||
array_add(*failed_test_paths, .{ result.path, tprint("golden file not found for %", stage_to_string(result.stage)) });
|
||||
}
|
||||
}
|
||||
evaluate_result(result);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// print("\n");
|
||||
}
|
||||
append(*builder, "\n");
|
||||
|
||||
if output_type == 0 {
|
||||
if failed_test_paths.count == 0 {
|
||||
green(*builder);
|
||||
print_to_builder(*builder, "All % tests passed!\n", test_cases.count);
|
||||
reset_color(*builder);
|
||||
} else {
|
||||
print_to_builder(*builder, "%/% tests passed\n", test_cases.count - failed_test_paths.count, test_cases.count);
|
||||
red(*builder);
|
||||
|
||||
print_to_builder(*builder, "% failed\n", failed_test_paths.count);
|
||||
for failed_test : failed_test_paths {
|
||||
print_to_builder(*builder, "% failed with error: %\n", failed_test.path, failed_test.stage);
|
||||
}
|
||||
reset_color(*builder);
|
||||
}
|
||||
}
|
||||
|
||||
print("%\n", builder_to_string(*builder,, test_arena));
|
||||
}
|
||||
|
||||
read_suite :: (file_path : string, suite : *Test_Suite, allocator := temp) -> bool {
|
||||
sc := get_scratch();
|
||||
defer scratch_end(sc);
|
||||
bytes, ok := read_entire_file(file_path,, sc.allocator);
|
||||
if !ok {
|
||||
log_error("Unable to read suite file %\n", file_path);
|
||||
return false;
|
||||
}
|
||||
|
||||
path := parse_path(file_path,, sc.allocator);
|
||||
file_without_extension := split(path.words[path.words.count - 1], ".",, sc.allocator);
|
||||
suite.name = copy_string(file_without_extension[0],, allocator);
|
||||
split_lines := split(bytes, "\n",, sc.allocator);
|
||||
|
||||
for split_line : split_lines {
|
||||
if split_line.count == 0 {
|
||||
break;
|
||||
}
|
||||
|
||||
if split_line[0] == #char "#" {
|
||||
continue;
|
||||
}
|
||||
|
||||
line := split(split_line, " ",, sc.allocator);
|
||||
if line[0].count == 0 {
|
||||
continue;
|
||||
}
|
||||
|
||||
if line[0].data[0] == #char "#" {
|
||||
continue;
|
||||
}
|
||||
|
||||
if line.count == 1 {
|
||||
line = split(split_line, "\t",, sc.allocator);
|
||||
if line.count == 1 {
|
||||
log_error("Invalid line - % - \n", it_index + 1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
test_case_path := line[0];
|
||||
stage_flags : Stage_Flags;
|
||||
|
||||
for i: 0..line.count - 1 {
|
||||
trimmed := trim(line[i]);
|
||||
if equal(trimmed, "lex") {
|
||||
stage_flags |= .Lexer;
|
||||
} else if equal(trimmed, "parse") {
|
||||
stage_flags |= .Parser;
|
||||
} else if equal(trimmed, "semant") {
|
||||
stage_flags |= .Semantic_Analysis;
|
||||
} else if equal(trimmed, "codegen") {
|
||||
stage_flags |= .Codegen;
|
||||
} else if equal(trimmed, "compile") {
|
||||
stage_flags |= .Compile;
|
||||
}
|
||||
}
|
||||
test_case := make_test_case(test_case_path, stage_flags, allocator);
|
||||
array_add(*suite.test_cases, test_case);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
read_test :: () {
|
||||
|
||||
}
|
||||
|
||||
stage_to_string :: (stage : Stage_Flags) -> string {
|
||||
if #complete stage == {
|
||||
case .Lexer; return "lexing";
|
||||
case .Parser; return "parsing";
|
||||
case .Semantic_Analysis; return "semantic checking";
|
||||
case .Codegen; return "codegen";
|
||||
case .Compile; return "compiled";
|
||||
case; return "";
|
||||
}
|
||||
}
|
||||
|
||||
evaluate_result :: (result : Result) {
|
||||
stage : string = stage_to_string(result.stage);
|
||||
|
||||
if #complete result.type == {
|
||||
case .File_Read_Failed; {
|
||||
print(" %", red());
|
||||
print("failed with File_Read_Failed\n");
|
||||
}
|
||||
case .Golden_File_Not_Found; {
|
||||
print(" %", red());
|
||||
print("failed with Golden File Not Found for stage %\n", stage);
|
||||
}
|
||||
case .StdOut; {
|
||||
}
|
||||
case .Golden_Output; {
|
||||
print(" %", yellow());
|
||||
print("output new golden file at %\n", result.golden_path);
|
||||
}
|
||||
case .Passed; {
|
||||
print(" %", green());
|
||||
print("passed %\n", stage);
|
||||
}
|
||||
case .Failed; {
|
||||
print(" %", red());
|
||||
print("failed %\n", stage);
|
||||
}
|
||||
}
|
||||
|
||||
if result.info_text.count > 0 {
|
||||
print("%", cyan());
|
||||
print("--- Info text ---\n");
|
||||
print("%", yellow());
|
||||
print("%\n", result.info_text);
|
||||
}
|
||||
|
||||
print("%", reset_color());
|
||||
}
|
||||
|
||||
main :: () {
|
||||
args := get_command_line_arguments();
|
||||
|
||||
init_context_allocators();
|
||||
|
||||
local_temp := make_arena(Megabytes(128));
|
||||
|
||||
suites : [..]Test_Suite;
|
||||
suites.allocator = local_temp;
|
||||
output_type : Output_Type = 0;
|
||||
|
||||
Argument_Parse_State :: enum {
|
||||
None;
|
||||
Compile;
|
||||
Run_Suite;
|
||||
Run_Test;
|
||||
}
|
||||
|
||||
arg_parse_state : Argument_Parse_State;
|
||||
current_suite : *Test_Suite;
|
||||
|
||||
path : string;
|
||||
|
||||
for i: 1..args.count - 1 {
|
||||
arg := args[i];
|
||||
if arg == "-output-as-golden" {
|
||||
output_type |= .Golden;
|
||||
continue;
|
||||
} else if arg == "-output" {
|
||||
output_type |= .StdOut;
|
||||
continue;
|
||||
}
|
||||
|
||||
if arg_parse_state == {
|
||||
case .Run_Suite; {
|
||||
if arg == "-output-as-golden" {
|
||||
output_type |= .Golden;
|
||||
} else if arg == "-output" {
|
||||
output_type |= .StdOut;
|
||||
} else {
|
||||
print("%Unknown argument % %\n", red(), arg, reset_color());
|
||||
}
|
||||
}
|
||||
case .Run_Test; {
|
||||
cases := current_suite.test_cases.count;
|
||||
if arg == "-lex" {
|
||||
current_suite.test_cases[cases - 1].stage_flags |= .Lexer;
|
||||
} else if arg == "-parse" {
|
||||
current_suite.test_cases[cases - 1].stage_flags |= .Parser;
|
||||
} else if arg == "-semant" {
|
||||
current_suite.test_cases[cases - 1].stage_flags |= .Semantic_Analysis;
|
||||
} else if arg == "-codegen" {
|
||||
current_suite.test_cases[cases - 1].stage_flags |= .Codegen;
|
||||
} else if arg == "-compile" {
|
||||
current_suite.test_cases[cases - 1].stage_flags |= .Compile;
|
||||
} else if contains(arg, ".") {
|
||||
sc := get_scratch();
|
||||
defer scratch_end(sc);
|
||||
path_split := split(arg, "\\",, sc.allocator);
|
||||
split_path := split(path_split[path_split.count - 1], ".",, sc.allocator);
|
||||
extension := split_path[1];
|
||||
if extension == SHADER_EXTENSION {
|
||||
path := copy_string(arg,, local_temp);
|
||||
test_case := make_test_case(path, 0, local_temp);
|
||||
array_add(*current_suite.test_cases, test_case);
|
||||
} else {
|
||||
print("%Invalid file as argument % %\n", red(), arg, reset_color());
|
||||
}
|
||||
} else {
|
||||
print("%Unknown argument % %\n", red(), arg, reset_color());
|
||||
}
|
||||
}
|
||||
case .None; {
|
||||
if contains(arg, ".") {
|
||||
sc := get_scratch();
|
||||
defer scratch_end(sc);
|
||||
path_split := split(arg, "\\",, sc.allocator);
|
||||
split_path := split(path_split[path_split.count - 1], ".",, sc.allocator);
|
||||
extension := split_path[1];
|
||||
|
||||
if extension == SHADER_EXTENSION {
|
||||
if arg_parse_state == .Run_Suite {
|
||||
log_error("Unable to run a test while already running suite.");
|
||||
continue;
|
||||
}
|
||||
|
||||
if !current_suite {
|
||||
suite : Test_Suite;
|
||||
suite.results.allocator = local_temp;
|
||||
suite.test_cases.allocator = local_temp;
|
||||
array_add(*suites, suite);
|
||||
current_suite = *suites[0];
|
||||
}
|
||||
arg_parse_state = .Run_Test;
|
||||
path := copy_string(arg,, local_temp);
|
||||
test_case := make_test_case(path, 0, local_temp);
|
||||
array_add(*current_suite.test_cases, test_case);
|
||||
} else if extension == SUITE_EXTENSION {
|
||||
if arg_parse_state == .Run_Test {
|
||||
log_error("Unable to run a suite while already running test.");
|
||||
continue;
|
||||
}
|
||||
arg_parse_state = .Run_Suite;
|
||||
path := copy_string(arg);
|
||||
|
||||
suite : Test_Suite;
|
||||
suite.results.allocator = local_temp;
|
||||
suite.test_cases.allocator = local_temp;
|
||||
read_suite(path, *suite, local_temp);
|
||||
array_add(*suites, suite);
|
||||
current_suite = *suites[0];
|
||||
} else {
|
||||
print("%Invalid file as argument % %\n", red(), arg, reset_color());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for suite : suites {
|
||||
run_test_suite(*suite, output_type);
|
||||
}
|
||||
|
||||
clear(local_temp);
|
||||
}
|
||||
320
Lexing.jai
320
Lexing.jai
@@ -5,17 +5,11 @@ Lexer :: struct {
|
||||
current_line : int;
|
||||
current_column : int;
|
||||
|
||||
result : Lexing_Result;
|
||||
ctx : *Compiler_Context;
|
||||
|
||||
path : string;
|
||||
}
|
||||
|
||||
Lexing_Result :: struct {
|
||||
tokens : [..]Token;
|
||||
had_error : bool;
|
||||
messages : [..]Compiler_Message;
|
||||
}
|
||||
|
||||
Token_Kind :: enum {
|
||||
TOKEN_FLOATLITERAL;
|
||||
TOKEN_INTLITERAL;
|
||||
@@ -54,6 +48,7 @@ Token_Kind :: enum {
|
||||
TOKEN_SEMICOLON;
|
||||
TOKEN_COMMA;
|
||||
TOKEN_DOT;
|
||||
TOKEN_DOTDOT;
|
||||
|
||||
TOKEN_IDENTIFIER;
|
||||
|
||||
@@ -64,6 +59,7 @@ Token_Kind :: enum {
|
||||
TOKEN_CBUFFER;
|
||||
TOKEN_COLUMNMAJOR;
|
||||
TOKEN_CONST;
|
||||
TOKEN_CONSTANT_BUFFER;
|
||||
TOKEN_CONTINUE;
|
||||
|
||||
TOKEN_DEFAULT;
|
||||
@@ -99,6 +95,7 @@ Token_Kind :: enum {
|
||||
TOKEN_RETURN;
|
||||
TOKEN_REGISTER;
|
||||
|
||||
TOKEN_STRING;
|
||||
TOKEN_STRUCT;
|
||||
TOKEN_SWITCH;
|
||||
|
||||
@@ -128,13 +125,16 @@ Token :: struct {
|
||||
}
|
||||
|
||||
source : *u8;
|
||||
|
||||
|
||||
// This could all be derived on demand
|
||||
line : int;
|
||||
length : int;
|
||||
column : int;
|
||||
index : int;
|
||||
|
||||
error : string;
|
||||
|
||||
builtin : bool; // @Incomplete: This is kind of a bad idea, but let's just do it for now...
|
||||
}
|
||||
|
||||
Source_Range :: struct {
|
||||
@@ -214,46 +214,47 @@ identifier_kind :: (using lexer : *Lexer) -> Token_Kind {
|
||||
identifier.data = *input.data[start];
|
||||
identifier.count = length;
|
||||
|
||||
if identifier == "bool" return .TOKEN_BOOL;
|
||||
if identifier == "case" return .TOKEN_CASE;
|
||||
if identifier == "columnmajor" return .TOKEN_COLUMNMAJOR;
|
||||
if identifier == "const" return .TOKEN_CONST;
|
||||
if identifier == "continue" return .TOKEN_CONTINUE;
|
||||
if identifier == "default" return .TOKEN_DEFAULT;
|
||||
if identifier == "directive" return .TOKEN_DIRECTIVE;
|
||||
if identifier == "discard" return .TOKEN_DIRECTIVE;
|
||||
if identifier == "discard" return .TOKEN_DISCARD;
|
||||
if identifier == "do" return .TOKEN_DO;
|
||||
if identifier == "double" return .TOKEN_DOUBLE;
|
||||
if identifier == "else" return .TOKEN_ELSE;
|
||||
if identifier == "export" return .TOKEN_EXPORT;
|
||||
if identifier == "extern" return .TOKEN_EXTERN;
|
||||
if identifier == "false" return .TOKEN_FALSE;
|
||||
if identifier == "for" return .TOKEN_FOR;
|
||||
if identifier == "half" return .TOKEN_HALF;
|
||||
if identifier == "hint" return .TOKEN_HINT;
|
||||
if identifier == "if" return .TOKEN_IF;
|
||||
if identifier == "in" return .TOKEN_IN;
|
||||
if identifier == "inout" return .TOKEN_INOUT;
|
||||
if identifier == "instance" return .TOKEN_INSTANCE;
|
||||
if identifier == "matrix" return .TOKEN_MATRIX;
|
||||
if identifier == "meta" return .TOKEN_META;
|
||||
if identifier == "optional" return .TOKEN_OPTIONAL;
|
||||
if identifier == "out" return .TOKEN_OUT;
|
||||
if identifier == "pixel" return .TOKEN_PIXEL;
|
||||
if identifier == "properties" return .TOKEN_PROPERTIES;
|
||||
if identifier == "return" return .TOKEN_RETURN;
|
||||
if identifier == "register" return .TOKEN_REGISTER;
|
||||
if identifier == "struct" return .TOKEN_STRUCT;
|
||||
if identifier == "switch" return .TOKEN_SWITCH;
|
||||
if identifier == "true" return .TOKEN_TRUE;
|
||||
if identifier == "unorm" return .TOKEN_UNORM;
|
||||
if identifier == "unsigned" return .TOKEN_UNSIGNED;
|
||||
if identifier == "uint" return .TOKEN_UINT;
|
||||
if identifier == "vector" return .TOKEN_VECTOR;
|
||||
if identifier == "vertex" return .TOKEN_VERTEX;
|
||||
if identifier == "void" return .TOKEN_VOID;
|
||||
if identifier == "while" return .TOKEN_WHILE;
|
||||
if identifier == "bool" return .TOKEN_BOOL;
|
||||
if identifier == "case" return .TOKEN_CASE;
|
||||
if identifier == "columnmajor" return .TOKEN_COLUMNMAJOR;
|
||||
if identifier == "const" return .TOKEN_CONST;
|
||||
if identifier == "constant_buffer" return .TOKEN_CONSTANT_BUFFER;
|
||||
if identifier == "continue" return .TOKEN_CONTINUE;
|
||||
if identifier == "default" return .TOKEN_DEFAULT;
|
||||
if identifier == "directive" return .TOKEN_DIRECTIVE;
|
||||
if identifier == "discard" return .TOKEN_DIRECTIVE;
|
||||
if identifier == "discard" return .TOKEN_DISCARD;
|
||||
if identifier == "do" return .TOKEN_DO;
|
||||
if identifier == "double" return .TOKEN_DOUBLE;
|
||||
if identifier == "else" return .TOKEN_ELSE;
|
||||
if identifier == "export" return .TOKEN_EXPORT;
|
||||
if identifier == "extern" return .TOKEN_EXTERN;
|
||||
if identifier == "false" return .TOKEN_FALSE;
|
||||
if identifier == "for" return .TOKEN_FOR;
|
||||
if identifier == "half" return .TOKEN_HALF;
|
||||
if identifier == "hint" return .TOKEN_HINT;
|
||||
if identifier == "if" return .TOKEN_IF;
|
||||
if identifier == "in" return .TOKEN_IN;
|
||||
if identifier == "inout" return .TOKEN_INOUT;
|
||||
if identifier == "instance" return .TOKEN_INSTANCE;
|
||||
if identifier == "matrix" return .TOKEN_MATRIX;
|
||||
if identifier == "meta" return .TOKEN_META;
|
||||
if identifier == "optional" return .TOKEN_OPTIONAL;
|
||||
if identifier == "out" return .TOKEN_OUT;
|
||||
if identifier == "pixel" return .TOKEN_PIXEL;
|
||||
if identifier == "properties" return .TOKEN_PROPERTIES;
|
||||
if identifier == "return" return .TOKEN_RETURN;
|
||||
if identifier == "register" return .TOKEN_REGISTER;
|
||||
if identifier == "struct" return .TOKEN_STRUCT;
|
||||
if identifier == "switch" return .TOKEN_SWITCH;
|
||||
if identifier == "true" return .TOKEN_TRUE;
|
||||
if identifier == "unorm" return .TOKEN_UNORM;
|
||||
if identifier == "unsigned" return .TOKEN_UNSIGNED;
|
||||
if identifier == "uint" return .TOKEN_UINT;
|
||||
if identifier == "vector" return .TOKEN_VECTOR;
|
||||
if identifier == "vertex" return .TOKEN_VERTEX;
|
||||
if identifier == "void" return .TOKEN_VOID;
|
||||
if identifier == "while" return .TOKEN_WHILE;
|
||||
|
||||
return .TOKEN_IDENTIFIER;
|
||||
}
|
||||
@@ -261,12 +262,32 @@ identifier_kind :: (using lexer : *Lexer) -> Token_Kind {
|
||||
error_token :: (lexer : *Lexer, message : string) -> *Token {
|
||||
token : *Token = new_token(lexer, .TOKEN_ERROR);
|
||||
|
||||
lexer.result.had_error = true;
|
||||
lexer.ctx.had_error = true;
|
||||
token.error = copy_string(message);
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
// unable_to_open_file :: (state : *Parse_State, path : string, token : Token) {
|
||||
// builder : String_Builder;
|
||||
// init_string_builder(*builder,, temp);
|
||||
|
||||
// print_to_builder(*builder, "Unable to open file '%' for reading\n\n", path);
|
||||
|
||||
// location := generate_source_location_from_token(state, token);
|
||||
|
||||
// indent(*builder, 1);
|
||||
// cyan(*builder);
|
||||
// print_to_builder(*builder, "%\n", print_from_source_location(location));
|
||||
// indent(*builder, 1);
|
||||
|
||||
// loc := location.begin;
|
||||
// print_token_pointer(*builder, loc);
|
||||
|
||||
// final_message := builder_to_string(*builder);
|
||||
// record_error(state, token, final_message, false);
|
||||
// }
|
||||
|
||||
record_error :: (lexer : *Lexer, message : string) {
|
||||
error : Compiler_Message;
|
||||
error.message_kind = .Error;
|
||||
@@ -288,8 +309,8 @@ record_error :: (lexer : *Lexer, message : string) {
|
||||
|
||||
array_add(*error.source_locations, source_location);
|
||||
|
||||
lexer.result.had_error = true;
|
||||
array_add(*lexer.result.messages, error);
|
||||
lexer.ctx.had_error = true;
|
||||
array_add(*lexer.ctx.messages, error);
|
||||
}
|
||||
|
||||
make_int :: (lexer : *Lexer) -> *Token {
|
||||
@@ -319,10 +340,6 @@ make_float :: (lexer : *Lexer) -> *Token {
|
||||
return token;
|
||||
}
|
||||
|
||||
make_string :: () {
|
||||
|
||||
}
|
||||
|
||||
new_token :: (lexer : *Lexer, kind : Token_Kind) -> *Token {
|
||||
length := lexer.cursor - lexer.start;
|
||||
token : Token;
|
||||
@@ -339,13 +356,49 @@ new_token :: (lexer : *Lexer, kind : Token_Kind) -> *Token {
|
||||
}
|
||||
lexer.current_column += length;
|
||||
|
||||
array_add(*lexer.result.tokens, token);
|
||||
return *lexer.result.tokens[lexer.result.tokens.count - 1];
|
||||
array_add(*lexer.ctx.tokens, token);
|
||||
return *lexer.ctx.tokens[lexer.ctx.tokens.count - 1];
|
||||
}
|
||||
|
||||
make_directive :: (lexer : *Lexer) -> *Token {
|
||||
lexer.start += 1;
|
||||
return make_identifier(lexer, .TOKEN_DIRECTIVE);
|
||||
ident := make_identifier(lexer, .TOKEN_DIRECTIVE);
|
||||
if ident.ident_value == "load" {
|
||||
path_tok := scan_next_token(lexer);
|
||||
path := path_tok.string_value;
|
||||
ctx : Compiler_Context;
|
||||
ctx.environment = lexer.ctx.environment;
|
||||
|
||||
ctx.file = make_file(*ctx, path);
|
||||
|
||||
if ctx.file.source.count == 0 {
|
||||
// unable_to_open_file(lexer, path, path_tok);
|
||||
record_error(lexer, tprint("Unable to open file '%' for reading\n", path));
|
||||
return error_token(lexer, tprint("Unable to open file '%' for reading\n", path));
|
||||
}
|
||||
|
||||
lex(*ctx);
|
||||
|
||||
ctx.tokens.count -= 1; // @Note: remote TOKEN_EOF
|
||||
lexer.ctx.tokens.count -= 2;
|
||||
array_resize(*lexer.ctx.tokens, lexer.ctx.tokens.count + ctx.tokens.count);
|
||||
|
||||
for tok : ctx.tokens {
|
||||
lexer.ctx.tokens[it_index] = tok;
|
||||
}
|
||||
return scan_next_token(lexer);;
|
||||
}
|
||||
return ident;
|
||||
}
|
||||
|
||||
make_string :: (lexer : *Lexer) -> *Token {
|
||||
token : *Token = new_token(lexer, .TOKEN_STRING);
|
||||
|
||||
name : string = .{ count = token.length - 2,
|
||||
data = *lexer.input.data[lexer.start + 1] };
|
||||
token.string_value = name;
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
make_identifier :: (lexer : *Lexer, kind : Token_Kind) -> *Token {
|
||||
@@ -364,6 +417,7 @@ make_token :: (lexer : *Lexer, token_kind : Token_Kind) -> *Token {
|
||||
|
||||
skip_whitespace :: (lexer : *Lexer) {
|
||||
while true {
|
||||
if is_at_end(lexer) return;
|
||||
c := peek_char(lexer);
|
||||
|
||||
if c == {
|
||||
@@ -418,6 +472,17 @@ scan_next_token :: (lexer : *Lexer) -> *Token {
|
||||
if is_digit(c) return number(lexer);
|
||||
|
||||
if c == {
|
||||
case #char "\""; {
|
||||
c = advance(lexer);
|
||||
// lexer.start = lexer.cursor;
|
||||
while c != #char "\"" {
|
||||
c = advance(lexer);
|
||||
}
|
||||
// lexer.cursor -= 1;
|
||||
tok := make_string(lexer);
|
||||
// advance(lexer);
|
||||
return tok;
|
||||
}
|
||||
case #char "+"; {
|
||||
if match_character(lexer, #char "=") return make_token(lexer, .TOKEN_PLUSEQUALS);
|
||||
return make_token(lexer, .TOKEN_PLUS);
|
||||
@@ -487,7 +552,10 @@ scan_next_token :: (lexer : *Lexer) -> *Token {
|
||||
}
|
||||
case #char ";"; return make_token(lexer, .TOKEN_SEMICOLON);
|
||||
case #char ","; return make_token(lexer, .TOKEN_COMMA);
|
||||
case #char "."; return make_token(lexer, .TOKEN_DOT);
|
||||
case #char "."; {
|
||||
if match_character(lexer, #char ".") return make_token(lexer, .TOKEN_DOTDOT);
|
||||
return make_token(lexer, .TOKEN_DOT);
|
||||
}
|
||||
}
|
||||
|
||||
s : string = .{ count = 1, data = *c };
|
||||
@@ -496,8 +564,79 @@ scan_next_token :: (lexer : *Lexer) -> *Token {
|
||||
// return error_token(lexer, tprint("Invalid token: %", s));
|
||||
}
|
||||
|
||||
lex :: (ctx : *Compiler_Context, allocator := temp) {
|
||||
if ctx.had_error {
|
||||
return;
|
||||
}
|
||||
|
||||
new_context := context;
|
||||
new_context.allocator = allocator;
|
||||
push_context new_context {
|
||||
init_context_allocators();
|
||||
defer clear_context_allocators();
|
||||
|
||||
lexer : Lexer;
|
||||
lexer.ctx = ctx;
|
||||
array_reserve(*lexer.ctx.tokens, 1024);
|
||||
|
||||
init_lexer_from_string(*lexer, ctx.file.source);
|
||||
lexer.path = ctx.file.path;
|
||||
token : *Token = scan_next_token(*lexer);
|
||||
while token && token.kind != .TOKEN_EOF {
|
||||
token = scan_next_token(*lexer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
init_lexer_from_string :: (lexer : *Lexer, input : string) {
|
||||
ok := read_input_from_string(lexer, input);
|
||||
if !ok {
|
||||
record_error(lexer, "Unable to initialize from string\n");
|
||||
lexer.ctx.had_error = true;
|
||||
}
|
||||
}
|
||||
|
||||
init_lexer_from_file :: (lexer : *Lexer, file_path : string) {
|
||||
ok := read_input_from_file(lexer, file_path);
|
||||
if !ok {
|
||||
record_error(lexer, tprint("Unable to read file: %\n", file_path));
|
||||
lexer.ctx.had_error = true;
|
||||
}
|
||||
}
|
||||
|
||||
read_input_from_string :: (lexer : *Lexer, input : string) -> bool {
|
||||
lexer.input = input;
|
||||
lexer.cursor = 0;
|
||||
lexer.start = 0;
|
||||
lexer.current_line = 1;
|
||||
lexer.current_column = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
read_input_from_file :: (lexer : *Lexer, file_path : string) -> bool {
|
||||
assert(file_path != "");
|
||||
|
||||
value, success := read_entire_file(file_path, true, true);
|
||||
if !success {
|
||||
free(value);
|
||||
return false;
|
||||
}
|
||||
|
||||
lexer.path = copy_string(file_path);
|
||||
lexer.input = value;
|
||||
lexer.cursor = 0;
|
||||
lexer.start = 0;
|
||||
lexer.current_line = 1;
|
||||
lexer.current_column = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ===========================================================
|
||||
// Pretty printing
|
||||
pretty_print_token :: (token : *Token, builder : *String_Builder) {
|
||||
MAX :: 18;
|
||||
MAX :: 21;
|
||||
kind_name := enum_names(Token_Kind)[cast(int)token.kind];
|
||||
diff := MAX - kind_name.count;
|
||||
|
||||
@@ -631,65 +770,14 @@ print_from_source_location :: (builder : *String_Builder, source_location : Sour
|
||||
}
|
||||
|
||||
print_from_source_location :: (source_location : Source_Range, allocator := context.allocator, indentation : int = 0) -> string {
|
||||
sc := get_scratch();
|
||||
defer scratch_end(sc);
|
||||
builder : String_Builder;
|
||||
init_string_builder(*builder,, allocator);
|
||||
print_from_source_location(*builder, source_location);
|
||||
init_string_builder(*builder,, sc.allocator);
|
||||
print_from_source_location(*builder, source_location,, sc.allocator);
|
||||
return builder_to_string(*builder,, allocator);
|
||||
}
|
||||
|
||||
lex :: (lexer : *Lexer, allocator : Allocator = context.allocator) -> Lexing_Result {
|
||||
lexer.result.tokens.allocator = allocator;
|
||||
token : *Token = scan_next_token(lexer);
|
||||
while token && token.kind != .TOKEN_EOF {
|
||||
token = scan_next_token(lexer);
|
||||
}
|
||||
|
||||
return lexer.result;
|
||||
}
|
||||
|
||||
init_lexer_from_string :: (lexer : *Lexer, input : string) {
|
||||
ok := read_input_from_string(lexer, input);
|
||||
if !ok {
|
||||
record_error(lexer, "Unable to initialize from string\n");
|
||||
lexer.result.had_error = true;
|
||||
}
|
||||
}
|
||||
|
||||
init_lexer_from_file :: (lexer : *Lexer, file_path : string) {
|
||||
ok := read_input_from_file(lexer, file_path);
|
||||
if !ok {
|
||||
record_error(lexer, tprint("Unable to read file: %\n", file_path));
|
||||
lexer.result.had_error = true;
|
||||
}
|
||||
}
|
||||
|
||||
read_input_from_string :: (lexer : *Lexer, input : string) -> bool {
|
||||
lexer.input = input;
|
||||
lexer.cursor = 0;
|
||||
lexer.start = 0;
|
||||
lexer.current_line = 1;
|
||||
lexer.current_column = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
read_input_from_file :: (lexer : *Lexer, file_path : string) -> bool {
|
||||
assert(file_path != "");
|
||||
|
||||
value, success := read_entire_file(file_path, true, true);
|
||||
if !success {
|
||||
free(value);
|
||||
return false;
|
||||
}
|
||||
|
||||
lexer.path = copy_string(file_path);
|
||||
lexer.input = value;
|
||||
lexer.cursor = 0;
|
||||
lexer.start = 0;
|
||||
lexer.current_line = 1;
|
||||
lexer.current_column = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#import "Basic";
|
||||
#import "File";
|
||||
|
||||
744
Parsing.jai
744
Parsing.jai
File diff suppressed because it is too large
Load Diff
24
README.md
24
README.md
@@ -49,13 +49,22 @@ properties {
|
||||
view : float4x4;
|
||||
}
|
||||
```
|
||||
which will be exposed in the compiled result. In the future `properties` can be renamed to a custom/shorter name like
|
||||
which will be exposed in the compiled result. `properties` can be renamed to a custom/shorter name like
|
||||
```
|
||||
p :: properties {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
You can also define constant buffers
|
||||
|
||||
```
|
||||
camera :: Constant_Buffer {
|
||||
projection : float4x4;
|
||||
view : float4x4;
|
||||
}
|
||||
```
|
||||
|
||||
## Jai Usage Example
|
||||
|
||||
To compile a shader and use the result, you can do the following in jai
|
||||
@@ -95,6 +104,9 @@ A `Shader_Variant_Collection` looks as follows
|
||||
Shader_Variant_Collection :: struct {
|
||||
properties : Properties;
|
||||
|
||||
max_constant_buffers :: 16;
|
||||
cbuffers : Static_Array(Constant_Buffer, max_constant_buffers);
|
||||
|
||||
variants : [..]Shader_Variant;
|
||||
}
|
||||
|
||||
@@ -114,6 +126,16 @@ Shader_Variant :: struct {
|
||||
}
|
||||
}
|
||||
|
||||
Constant_Buffer :: struct {
|
||||
register : int;
|
||||
|
||||
name : string;
|
||||
|
||||
fields : Static_Array(Property_Field, 16);
|
||||
|
||||
buffer_index : u32;
|
||||
}
|
||||
|
||||
Properties :: struct {
|
||||
fields : [..]Property_Field;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
762
Test.jai
762
Test.jai
@@ -1,762 +0,0 @@
|
||||
/////////////////////////////////////
|
||||
//~ nbr: General improvements
|
||||
//
|
||||
// [x] Print out all failed tests in a list at the end
|
||||
// [ ] Use unix (posix? bash? ascii?) color codes for errors
|
||||
// [ ] Print golden file as green and new output as red
|
||||
|
||||
#import "Basic";
|
||||
#import "File";
|
||||
#import "String";
|
||||
#import "File_Utilities";
|
||||
#import "Print_Color";
|
||||
|
||||
#load "module.jai";
|
||||
|
||||
GOLDEN_EXTENSION :: "golden";
|
||||
LEXER_FOLDER :: "lex";
|
||||
PARSER_FOLDER :: "parse";
|
||||
CODEGEN_FOLDER :: "codegen";
|
||||
COMPILED_FOLDER :: "compiled";
|
||||
SEMANTIC_ANALYSIS_FOLDER :: "semant";
|
||||
TESTS_FOLDER :: "test";
|
||||
|
||||
SHADER_EXTENSION :: "shd";
|
||||
SUITE_EXTENSION :: "suite";
|
||||
|
||||
Stage_Flags :: enum_flags u16 {
|
||||
Lexer :: 0x1;
|
||||
Parser :: 0x2;
|
||||
Semantic_Analysis :: 0x4;
|
||||
Codegen :: 0x8;
|
||||
Compile :: 0x10;
|
||||
}
|
||||
|
||||
Output_Type :: enum_flags u16 {
|
||||
Golden :: 0x1;
|
||||
StdOut :: 0x2;
|
||||
}
|
||||
|
||||
Result_Type :: enum {
|
||||
File_Read_Failed;
|
||||
Golden_File_Not_Found;
|
||||
StdOut;
|
||||
Golden_Output;
|
||||
Passed;
|
||||
Failed;
|
||||
}
|
||||
|
||||
Result :: struct {
|
||||
type : Result_Type;
|
||||
path : string;
|
||||
stage : Stage_Flags;
|
||||
|
||||
golden_path : string;
|
||||
info_text : string;
|
||||
}
|
||||
|
||||
Test_Case :: struct {
|
||||
path : string;
|
||||
stage_flags : Stage_Flags;
|
||||
}
|
||||
|
||||
Test_Suite :: struct {
|
||||
name : string;
|
||||
test_cases : [..]Test_Case;
|
||||
|
||||
results : [..]Result;
|
||||
}
|
||||
|
||||
get_golden_path :: (file_path : string, stage : Stage_Flags, allocator := context.allocator) -> string {
|
||||
path := parse_path(file_path);
|
||||
file_without_extension := split(path.words[path.words.count - 1], ".");
|
||||
|
||||
builder : String_Builder;
|
||||
builder.allocator = temp;
|
||||
|
||||
final_path_length := file_path.count - SHADER_EXTENSION.count + GOLDEN_EXTENSION.count + 1; // +1 for dot
|
||||
|
||||
path.words.count -= 1;
|
||||
|
||||
if stage == {
|
||||
case .Lexer; {
|
||||
dir := tprint("%/%", TESTS_FOLDER, LEXER_FOLDER);
|
||||
make_directory_if_it_does_not_exist(dir);
|
||||
array_add(*path.words, LEXER_FOLDER);
|
||||
}
|
||||
case .Parser; {
|
||||
dir := tprint("%/%", TESTS_FOLDER, PARSER_FOLDER);
|
||||
make_directory_if_it_does_not_exist(dir);
|
||||
array_add(*path.words, PARSER_FOLDER);
|
||||
}
|
||||
case .Semantic_Analysis; {
|
||||
dir := tprint("%/%", TESTS_FOLDER, SEMANTIC_ANALYSIS_FOLDER);
|
||||
make_directory_if_it_does_not_exist(dir);
|
||||
array_add(*path.words, SEMANTIC_ANALYSIS_FOLDER);
|
||||
}
|
||||
case .Codegen; {
|
||||
dir := tprint("%/%", TESTS_FOLDER, CODEGEN_FOLDER);
|
||||
make_directory_if_it_does_not_exist(dir);
|
||||
array_add(*path.words, CODEGEN_FOLDER);
|
||||
}
|
||||
case .Compile; {
|
||||
dir := tprint("%/%", TESTS_FOLDER, COMPILED_FOLDER);
|
||||
make_directory_if_it_does_not_exist(dir);
|
||||
array_add(*path.words, COMPILED_FOLDER);
|
||||
}
|
||||
}
|
||||
|
||||
init_string_builder(*builder, file_without_extension.count + GOLDEN_EXTENSION.count + 1);
|
||||
append(*builder, file_without_extension[0]);
|
||||
append(*builder, ".");
|
||||
append(*builder, GOLDEN_EXTENSION);
|
||||
golden_path := builder_to_string(*builder);
|
||||
array_add(*path.words, golden_path);
|
||||
|
||||
final_path := path_to_string(path);
|
||||
|
||||
return final_path;
|
||||
}
|
||||
|
||||
run_lexer_test :: (file_path : string, lexer : *Lexer, output_type : Output_Type = 0) -> Result {
|
||||
ok := read_input_from_file(lexer, file_path);
|
||||
|
||||
result_data : Result;
|
||||
result_data.path = file_path;
|
||||
result_data.stage = .Lexer;
|
||||
|
||||
if !ok {
|
||||
result_data.type = .File_Read_Failed;
|
||||
result_data.info_text = tprint("Unable to read file: %\n", file_path);
|
||||
|
||||
return result_data;
|
||||
} else {
|
||||
result_text : string;
|
||||
result := lex(lexer, *temp);
|
||||
|
||||
if result.had_error {
|
||||
result_data.type = .Failed;
|
||||
result_text = report_messages(result.messages);
|
||||
} else {
|
||||
result_text = pretty_print_tokens(result.tokens, *temp);
|
||||
}
|
||||
|
||||
if output_type & .StdOut {
|
||||
result_data.info_text = result_text;
|
||||
result_data.type = .StdOut;
|
||||
return result_data;
|
||||
}
|
||||
|
||||
golden_path := get_golden_path(file_path, .Lexer);
|
||||
do_golden_comparison(golden_path, result_text, *result_data, output_type);
|
||||
return result_data;
|
||||
}
|
||||
}
|
||||
|
||||
run_parser_test :: (file_path : string, output_type : Output_Type = 0) -> Result, *AST_Node {
|
||||
lexer : Lexer;
|
||||
result_data : Result;
|
||||
result_data.path = file_path;
|
||||
|
||||
ok := read_input_from_file(*lexer, file_path);
|
||||
if !ok {
|
||||
log_error("Unable to read file: %\n", file_path);
|
||||
result_data.type = .File_Read_Failed;
|
||||
result_data.stage = .Lexer;
|
||||
return result_data, null;
|
||||
}
|
||||
|
||||
result := lex(*lexer, *temp);
|
||||
if result.had_error {
|
||||
result_data.type = .Passed;
|
||||
return result_data, null;
|
||||
}
|
||||
|
||||
result_data =, root := run_parser_test(*lexer, output_type);
|
||||
|
||||
return result_data, root;
|
||||
}
|
||||
|
||||
do_golden_comparison :: (golden_path : string, comparison_text : string, result_data : *Result, output_type : Output_Type) {
|
||||
if output_type & .Golden {
|
||||
// Output the comparison file
|
||||
write_entire_file(golden_path, comparison_text);
|
||||
result_data.golden_path = copy_string(golden_path);
|
||||
result_data.type = .Golden_Output;
|
||||
return;
|
||||
} else {
|
||||
// Do the comparison
|
||||
if !file_exists(golden_path) {
|
||||
result_data.info_text = tprint("Golden file % does not exist. Please run with -output-as-golden at least once.\n", golden_path);
|
||||
result_data.type = .Golden_File_Not_Found;
|
||||
return;
|
||||
}
|
||||
|
||||
golden_text, ok := read_entire_file(golden_path);
|
||||
if !ok {
|
||||
result_data.info_text = tprint("Unable to open golden file %\n", golden_path);
|
||||
result_data.type = .Golden_File_Not_Found;
|
||||
return;
|
||||
}
|
||||
|
||||
comp := replace(comparison_text, "\r\n", "\n");
|
||||
gold := replace(golden_text, "\r\n", "\n");
|
||||
result := compare(comp, gold) == 0;
|
||||
if !result {
|
||||
result_data.type = .Failed;
|
||||
result_data.info_text = tprint("Golden file:\n%\n===============\n%", gold, comp);
|
||||
} else {
|
||||
result_data.type = .Passed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
run_parser_test :: (lexer : *Lexer, output_type : Output_Type = 0) -> Result, *AST_Node {
|
||||
parse_state : Parse_State;
|
||||
result_data : Result;
|
||||
result_data.path = lexer.path;
|
||||
result_data.stage = .Parser;
|
||||
init_parse_state(*parse_state, lexer.result.tokens, lexer.path, context.allocator);
|
||||
|
||||
result := parse(*parse_state);
|
||||
result_node : *AST_Node;
|
||||
result_text : string;
|
||||
|
||||
if result.had_error {
|
||||
result_data.type = .Failed;
|
||||
result_text = report_messages(result.messages,, temp);
|
||||
} else {
|
||||
result_text = pretty_print_ast(parse_state.result.root, *temp);
|
||||
result_node = parse_state.result.root;
|
||||
}
|
||||
|
||||
if output_type & .StdOut {
|
||||
result_data.info_text = result_text;
|
||||
result_data.type = .StdOut;
|
||||
return result_data, result_node;
|
||||
}
|
||||
|
||||
golden_path := get_golden_path(parse_state.path, .Parser);
|
||||
do_golden_comparison(golden_path, result_text, *result_data, output_type);
|
||||
return result_data, result_node;
|
||||
}
|
||||
|
||||
run_semantic_analysis_test :: (file_path : string, output_type : Output_Type = 0) -> Result, Semantic_Check_Result {
|
||||
lexer : Lexer;
|
||||
result_data : Result;
|
||||
result_data.path = file_path;
|
||||
|
||||
ok := read_input_from_file(*lexer, file_path);
|
||||
if !ok {
|
||||
log_error("Unable to read file: %\n", file_path);
|
||||
result_data.type = .File_Read_Failed;
|
||||
result_data.stage = .Lexer;
|
||||
|
||||
return result_data, .{};
|
||||
}
|
||||
|
||||
lex_result := lex(*lexer, *temp);
|
||||
if lex_result.had_error {
|
||||
result_data.type = .Failed;
|
||||
result_data.stage = .Lexer;
|
||||
result_data.info_text = report_messages(lex_result.messages);
|
||||
|
||||
if output_type & .StdOut {
|
||||
result_data.type = .StdOut;
|
||||
return result_data, .{};
|
||||
}
|
||||
golden_path := get_golden_path(file_path, .Semantic_Analysis);
|
||||
do_golden_comparison(golden_path, result_data.info_text, *result_data, output_type);
|
||||
return result_data, .{};
|
||||
}
|
||||
|
||||
parse_state : Parse_State;
|
||||
result_data.stage = .Parser;
|
||||
init_parse_state(*parse_state, lex_result.tokens, lexer.path, context.allocator);
|
||||
|
||||
parse_result := parse(*parse_state);
|
||||
if parse_result.had_error {
|
||||
result_data.type = .Failed;
|
||||
result_data.info_text = report_messages(parse_result.messages);
|
||||
|
||||
if output_type & .StdOut {
|
||||
result_data.type = .StdOut;
|
||||
return result_data, .{};
|
||||
}
|
||||
|
||||
golden_path := get_golden_path(file_path, .Semantic_Analysis);
|
||||
do_golden_comparison(golden_path, result_data.info_text, *result_data, output_type);
|
||||
return result_data, .{};
|
||||
}
|
||||
|
||||
result, check_result := run_semantic_analysis_test(file_path, parse_state.result.root, output_type);
|
||||
return result, check_result;
|
||||
}
|
||||
|
||||
run_semantic_analysis_test :: (file_path : string, root : *AST_Node, output_type : Output_Type = 0) -> Result, Semantic_Check_Result {
|
||||
result_data : Result;
|
||||
|
||||
result_data.path = file_path;
|
||||
result_data.stage = .Semantic_Analysis;
|
||||
checker : Semantic_Checker;
|
||||
init_semantic_checker(*checker, root, file_path);
|
||||
result_text : string;
|
||||
|
||||
result := check(*checker);
|
||||
if result.had_error {
|
||||
result_data.type = .Failed;
|
||||
result_text = report_messages(checker.result.messages);
|
||||
} else {
|
||||
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 {
|
||||
result_data.info_text = result_text;
|
||||
result_data.type = .StdOut;
|
||||
return result_data, .{};
|
||||
}
|
||||
|
||||
golden_path := get_golden_path(checker.path, .Semantic_Analysis);
|
||||
do_golden_comparison(golden_path, result_text, *result_data, output_type);
|
||||
return result_data, result;
|
||||
}
|
||||
|
||||
run_codegen_test :: (path : string, root : *AST_Node, check_result : Semantic_Check_Result, output_type : Output_Type = 0) -> Result, Codegen_Result {
|
||||
|
||||
result_data : Result;
|
||||
result_data.path = path;
|
||||
result_data.stage = .Codegen;
|
||||
|
||||
state : Codegen_State;
|
||||
init_codegen_state(*state, root, check_result, .HLSL);
|
||||
|
||||
result_text : string;
|
||||
|
||||
result := codegen(*state);
|
||||
|
||||
if result.had_error {
|
||||
result_data.type = .Failed;
|
||||
result_data.info_text = report_messages(result.messages);
|
||||
return result_data, .{};
|
||||
}
|
||||
|
||||
result_text = result.result_text;
|
||||
|
||||
if output_type & .StdOut {
|
||||
result_data.info_text = result_text;
|
||||
result_data.type = .StdOut;
|
||||
return result_data, result;
|
||||
}
|
||||
|
||||
golden_path := get_golden_path(path, .Codegen);
|
||||
do_golden_comparison(golden_path, result_text, *result_data, output_type);
|
||||
return result_data, result;
|
||||
}
|
||||
|
||||
run_codegen_test :: (path : string, root : *AST_Node, output_type : Output_Type = 0) -> Result, Codegen_Result {
|
||||
checker : Semantic_Checker;
|
||||
init_semantic_checker(*checker, root, path);
|
||||
|
||||
result_data : Result;
|
||||
result_data.path = path;
|
||||
result_data.stage = .Semantic_Analysis;
|
||||
|
||||
check_result := check(*checker);
|
||||
if check_result.had_error {
|
||||
result_data.type = .Failed;
|
||||
result_data.info_text = report_messages(check_result.messages);
|
||||
return result_data, .{};
|
||||
}
|
||||
|
||||
result, codegen_result := run_codegen_test(path, root, check_result, output_type);
|
||||
return result, codegen_result;
|
||||
}
|
||||
|
||||
run_codegen_test :: (path : string, output_type : Output_Type = 0) -> Result, Codegen_Result {
|
||||
lexer : Lexer;
|
||||
result_data : Result;
|
||||
result_data.path = path;
|
||||
|
||||
ok := read_input_from_file(*lexer, path);
|
||||
if !ok {
|
||||
log_error("Unable to read file: %\n", path);
|
||||
result_data.type = .File_Read_Failed;
|
||||
result_data.stage = .Lexer;
|
||||
return result_data, .{};
|
||||
}
|
||||
|
||||
lex_result := lex(*lexer, *temp);
|
||||
if lex_result.had_error {
|
||||
result_data.type = .Failed;
|
||||
result_data.stage = .Lexer;
|
||||
return result_data, .{};
|
||||
}
|
||||
|
||||
parse_state : Parse_State;
|
||||
result_data.stage = .Parser;
|
||||
init_parse_state(*parse_state, lex_result.tokens, lexer.path, context.allocator);
|
||||
|
||||
parse_result := parse(*parse_state);
|
||||
if parse_result.had_error {
|
||||
result_data.type = .Failed;
|
||||
result_data.info_text = pretty_print_ast(parse_result.root, *temp);
|
||||
return result_data, .{};
|
||||
}
|
||||
|
||||
result, codegen_result := run_codegen_test(path, parse_result.root, output_type);
|
||||
return result, codegen_result;
|
||||
}
|
||||
|
||||
run_compile_test :: (path : string, output_type : Output_Type = 0) -> Result, Compilation_Result {
|
||||
compiler : Shader_Compiler;
|
||||
result : Result;
|
||||
compilation_result := compile_file(*compiler, path);
|
||||
if compilation_result.had_error {
|
||||
result.type = .Failed;
|
||||
result.info_text = tprint("Failed compiling: %\n", path);
|
||||
}
|
||||
|
||||
return result, compilation_result;
|
||||
}
|
||||
|
||||
make_test_case :: (path : string, stage_flags : Stage_Flags, allocator := context.allocator) -> Test_Case {
|
||||
test_case : Test_Case;
|
||||
test_case.path = copy_string(path,, allocator);
|
||||
replace_chars(test_case.path, "\\", #char "/");
|
||||
test_case.stage_flags = stage_flags;
|
||||
|
||||
return test_case;
|
||||
}
|
||||
|
||||
run_test :: (file_path : string, stage_flags : Stage_Flags, results : *[..]Result, output_type : Output_Type = 0) {
|
||||
lexer : Lexer;
|
||||
result : Result;
|
||||
if stage_flags & .Lexer {
|
||||
result = run_lexer_test(file_path, *lexer, output_type);
|
||||
record_result(results, result);
|
||||
}
|
||||
|
||||
root_node : *AST_Node;
|
||||
if stage_flags & .Parser {
|
||||
if stage_flags & .Lexer && result.type == .Passed || result.type == .Golden_Output {
|
||||
result, root_node = run_parser_test(*lexer, output_type);
|
||||
} else {
|
||||
result, root_node = run_parser_test(file_path, output_type);
|
||||
}
|
||||
record_result(results, result);
|
||||
}
|
||||
|
||||
check_result : Semantic_Check_Result;
|
||||
if stage_flags & .Semantic_Analysis {
|
||||
if stage_flags & .Parser && (result.type == .Passed || result.type == .Golden_Output) {
|
||||
result, check_result = run_semantic_analysis_test(file_path, root_node, output_type);
|
||||
} else {
|
||||
result, check_result = run_semantic_analysis_test(file_path, output_type);
|
||||
}
|
||||
record_result(results, result);
|
||||
}
|
||||
|
||||
if stage_flags & .Codegen {
|
||||
if stage_flags & .Semantic_Analysis && (result.type == .Passed || result.type == .Golden_Output) {
|
||||
result = run_codegen_test(file_path, root_node, check_result, output_type);
|
||||
} else if root_node {
|
||||
result = run_codegen_test(file_path, root_node, output_type);
|
||||
} else {
|
||||
result = run_codegen_test(file_path, output_type);
|
||||
}
|
||||
record_result(results, result);
|
||||
}
|
||||
|
||||
if stage_flags & .Compile {
|
||||
result = run_compile_test(file_path, output_type);
|
||||
}
|
||||
}
|
||||
|
||||
run_test :: (test_case : Test_Case, results : *[..]Result, output_type : Output_Type = 0) {
|
||||
print("%Running test: %\n", cyan(), test_case.path);
|
||||
run_test(test_case.path, test_case.stage_flags, results, output_type);
|
||||
}
|
||||
|
||||
record_result :: (results : *[..]Result, result : Result) {
|
||||
array_add(results, result);
|
||||
}
|
||||
|
||||
run_test_suite :: (using suite : *Test_Suite, output_type : Output_Type = 0) {
|
||||
if suite.name.count > 0 {
|
||||
print("%Running suite: %\n", green(), suite.name);
|
||||
print("%", reset_color());
|
||||
}
|
||||
|
||||
Fail_Data :: struct {
|
||||
path : string;
|
||||
stage : string;
|
||||
}
|
||||
|
||||
failed_test_paths : [..]Fail_Data;
|
||||
failed_test_paths.allocator = temp;
|
||||
|
||||
builder : String_Builder;
|
||||
init_string_builder(*builder,, temp);
|
||||
|
||||
for test_case : test_cases {
|
||||
run_test(test_case, *suite.results, output_type);
|
||||
|
||||
for < suite.results {
|
||||
result := suite.results[it_index];
|
||||
if compare(result.path, test_case.path) == 0 {
|
||||
if result.type == {
|
||||
case .Failed; {
|
||||
array_add(*failed_test_paths, .{ result.path, stage_to_string(result.stage) });
|
||||
}
|
||||
case .File_Read_Failed; {
|
||||
array_add(*failed_test_paths, .{ result.path, "file not found" });
|
||||
}
|
||||
case .Golden_File_Not_Found; {
|
||||
array_add(*failed_test_paths, .{ result.path, tprint("golden file not found for %", stage_to_string(result.stage)) });
|
||||
}
|
||||
}
|
||||
evaluate_result(result);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
print("\n");
|
||||
}
|
||||
print("\n");
|
||||
|
||||
if output_type == 0 {
|
||||
if failed_test_paths.count == 0 {
|
||||
green(*builder);
|
||||
print_to_builder(*builder, "All % tests passed!\n", test_cases.count);
|
||||
reset_color(*builder);
|
||||
} else {
|
||||
print_to_builder(*builder, "%/% tests passed\n", test_cases.count - failed_test_paths.count, test_cases.count);
|
||||
red(*builder);
|
||||
|
||||
print_to_builder(*builder, "% failed\n", failed_test_paths.count);
|
||||
for failed_test : failed_test_paths {
|
||||
print_to_builder(*builder, "% failed with error: %\n", failed_test.path, failed_test.stage);
|
||||
}
|
||||
reset_color(*builder);
|
||||
}
|
||||
}
|
||||
|
||||
print("%\n", builder_to_string(*builder));
|
||||
}
|
||||
|
||||
read_suite :: (file_path : string, suite : *Test_Suite) -> bool {
|
||||
bytes, ok := read_entire_file(file_path);
|
||||
if !ok {
|
||||
log_error("Unable to read suite file %\n", file_path);
|
||||
return false;
|
||||
}
|
||||
|
||||
path := parse_path(file_path);
|
||||
file_without_extension := split(path.words[path.words.count - 1], ".");
|
||||
suite.name = copy_string(file_without_extension[0]);
|
||||
split_lines := split(bytes, "\n");
|
||||
|
||||
for split_line : split_lines {
|
||||
line := split(split_line, " ");
|
||||
if line[0].count == 0 {
|
||||
continue;
|
||||
}
|
||||
|
||||
if line[0].data[0] == #char "#" {
|
||||
continue;
|
||||
}
|
||||
|
||||
if line.count == 1 {
|
||||
log_error("Invalid line - % - %\n", it_index + 1, line);
|
||||
continue;
|
||||
}
|
||||
test_case_path := line[0];
|
||||
stage_flags : Stage_Flags;
|
||||
|
||||
for i: 0..line.count - 1 {
|
||||
trimmed := trim(line[i]);
|
||||
if equal(trimmed, "lex") {
|
||||
stage_flags |= .Lexer;
|
||||
} else if equal(trimmed, "parse") {
|
||||
stage_flags |= .Parser;
|
||||
} else if equal(trimmed, "semant") {
|
||||
stage_flags |= .Semantic_Analysis;
|
||||
} else if equal(trimmed, "codegen") {
|
||||
stage_flags |= .Codegen;
|
||||
} else if equal(trimmed, "compile") {
|
||||
stage_flags |= .Compile;
|
||||
}
|
||||
}
|
||||
|
||||
test_case := make_test_case(test_case_path, stage_flags);
|
||||
array_add(*suite.test_cases, test_case);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
read_test :: () {
|
||||
|
||||
}
|
||||
|
||||
stage_to_string :: (stage : Stage_Flags) -> string {
|
||||
if #complete stage == {
|
||||
case .Lexer; return "lexing";
|
||||
case .Parser; return "parsing";
|
||||
case .Semantic_Analysis; return "semantic checking";
|
||||
case .Codegen; return "codegen";
|
||||
case .Compile; return "compiled";
|
||||
case; return "";
|
||||
}
|
||||
}
|
||||
|
||||
evaluate_result :: (result : Result) {
|
||||
stage : string = stage_to_string(result.stage);
|
||||
|
||||
if #complete result.type == {
|
||||
case .File_Read_Failed; {
|
||||
print("%", red());
|
||||
print("% failed with File_Read_Failed\n", result.path);
|
||||
}
|
||||
case .Golden_File_Not_Found; {
|
||||
print("%", red());
|
||||
print("% failed with Golden File Not Found for stage %\n", result.path, stage);
|
||||
}
|
||||
case .StdOut; {
|
||||
}
|
||||
case .Golden_Output; {
|
||||
print("%", yellow());
|
||||
print("% output new golden file at %\n", result.path, result.golden_path);
|
||||
}
|
||||
case .Passed; {
|
||||
print("%", green());
|
||||
print("% passed %\n", result.path, stage);
|
||||
}
|
||||
case .Failed; {
|
||||
print("%", red());
|
||||
print("% failed %\n", result.path, stage);
|
||||
}
|
||||
}
|
||||
|
||||
if result.info_text.count > 0 {
|
||||
print("%", cyan());
|
||||
print("--- Info text ---\n");
|
||||
print("%", yellow());
|
||||
print("%\n", result.info_text);
|
||||
}
|
||||
|
||||
print("%", reset_color());
|
||||
}
|
||||
|
||||
main :: () {
|
||||
lexer : Lexer;
|
||||
|
||||
args := get_command_line_arguments();
|
||||
|
||||
suites : [..]Test_Suite;
|
||||
output_type : Output_Type = 0;
|
||||
|
||||
Argument_Parse_State :: enum {
|
||||
None;
|
||||
Run_Suite;
|
||||
Run_Test;
|
||||
}
|
||||
|
||||
arg_parse_state : Argument_Parse_State;
|
||||
current_suite : *Test_Suite;
|
||||
|
||||
path : string;
|
||||
|
||||
for i: 1..args.count - 1 {
|
||||
arg := args[i];
|
||||
if arg == "-output-as-golden" {
|
||||
output_type |= .Golden;
|
||||
continue;
|
||||
} else if arg == "-output" {
|
||||
output_type |= .StdOut;
|
||||
continue;
|
||||
}
|
||||
|
||||
if arg_parse_state == {
|
||||
case .Run_Suite; {
|
||||
if arg == "-output-as-golden" {
|
||||
output_type |= .Golden;
|
||||
} else if arg == "-output" {
|
||||
output_type |= .StdOut;
|
||||
} else {
|
||||
print("%Unknown argument %\n", red(), arg);
|
||||
}
|
||||
}
|
||||
case .Run_Test; {
|
||||
cases := current_suite.test_cases.count;
|
||||
if arg == "-lex" {
|
||||
current_suite.test_cases[cases - 1].stage_flags |= .Lexer;
|
||||
} else if arg == "-parse" {
|
||||
current_suite.test_cases[cases - 1].stage_flags |= .Parser;
|
||||
} else if arg == "-semant" {
|
||||
current_suite.test_cases[cases - 1].stage_flags |= .Semantic_Analysis;
|
||||
} else if arg == "-codegen" {
|
||||
current_suite.test_cases[cases - 1].stage_flags |= .Codegen;
|
||||
} else if arg == "-compile" {
|
||||
current_suite.test_cases[cases - 1].stage_flags |= .Compile;
|
||||
} else if contains(arg, ".") {
|
||||
split_path := split(arg, ".");
|
||||
extension := split_path[1];
|
||||
if extension == SHADER_EXTENSION {
|
||||
path := copy_string(arg);
|
||||
test_case := make_test_case(path, 0);
|
||||
array_add(*current_suite.test_cases, test_case);
|
||||
}
|
||||
} else {
|
||||
print("%Unknown argument %\n", red, arg);
|
||||
}
|
||||
}
|
||||
case .None; {
|
||||
if contains(arg, ".") {
|
||||
split_path := split(arg, ".");
|
||||
extension := split_path[1];
|
||||
|
||||
if extension == SHADER_EXTENSION {
|
||||
if arg_parse_state == .Run_Suite {
|
||||
log_error("Unable to run a test while already running suite.");
|
||||
continue;
|
||||
}
|
||||
|
||||
if !current_suite {
|
||||
suite : Test_Suite;
|
||||
array_add(*suites, suite);
|
||||
current_suite = *suites[0];
|
||||
}
|
||||
|
||||
arg_parse_state = .Run_Test;
|
||||
path := copy_string(arg);
|
||||
test_case := make_test_case(path, 0);
|
||||
array_add(*current_suite.test_cases, test_case);
|
||||
} else if extension == SUITE_EXTENSION {
|
||||
if arg_parse_state == .Run_Test {
|
||||
log_error("Unable to run a suite while already running test.");
|
||||
continue;
|
||||
}
|
||||
|
||||
arg_parse_state = .Run_Suite;
|
||||
path := copy_string(arg);
|
||||
|
||||
suite : Test_Suite;
|
||||
read_suite(path, *suite);
|
||||
array_add(*suites, suite);
|
||||
current_suite = *suites[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for suite : suites {
|
||||
run_test_suite(*suite, output_type);
|
||||
}
|
||||
}
|
||||
289
builtins.ink
Normal file
289
builtins.ink
Normal file
@@ -0,0 +1,289 @@
|
||||
float2 :: struct {
|
||||
x : float;
|
||||
y : float;
|
||||
}
|
||||
|
||||
float3 :: struct {
|
||||
x : float;
|
||||
y : float;
|
||||
z : float;
|
||||
}
|
||||
|
||||
float4 :: struct {
|
||||
x : float;
|
||||
y : float;
|
||||
z : float;
|
||||
w : float;
|
||||
}
|
||||
|
||||
float4x4 :: struct {
|
||||
m11 : float;
|
||||
m12 : float;
|
||||
m13 : float;
|
||||
m14 : float;
|
||||
m21 : float;
|
||||
m22 : float;
|
||||
m23 : float;
|
||||
m24 : float;
|
||||
m31 : float;
|
||||
m32 : float;
|
||||
m33 : float;
|
||||
m34 : float;
|
||||
m41 : float;
|
||||
m42 : float;
|
||||
m43 : float;
|
||||
m44 : float;
|
||||
}
|
||||
|
||||
int2 :: struct {
|
||||
x : int;
|
||||
y : int;
|
||||
}
|
||||
|
||||
int3 :: struct {
|
||||
x : int;
|
||||
y : int;
|
||||
z : int;
|
||||
}
|
||||
|
||||
int4 :: struct {
|
||||
x : int;
|
||||
y : int;
|
||||
z : int;
|
||||
w : int;
|
||||
}
|
||||
|
||||
int4x4 :: struct {
|
||||
m11 : int;
|
||||
m12 : int;
|
||||
m13 : int;
|
||||
m14 : int;
|
||||
m21 : int;
|
||||
m22 : int;
|
||||
m23 : int;
|
||||
m24 : int;
|
||||
m31 : int;
|
||||
m32 : int;
|
||||
m33 : int;
|
||||
m34 : int;
|
||||
m41 : int;
|
||||
m42 : int;
|
||||
m43 : int;
|
||||
m44 : int;
|
||||
}
|
||||
|
||||
//~ nbr: Constructors
|
||||
#foreign float2 :: (float, float) -> float2;
|
||||
#foreign float2 :: (float2) -> float2;
|
||||
#foreign float2 :: (float) -> float2;
|
||||
|
||||
#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 :: (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
|
||||
#foreign cross :: (float3, float3) -> float3;
|
||||
#foreign distance :: (float2, float2) -> float;
|
||||
#foreign distance :: (float3, float3) -> 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 :: (float3, float3) -> float;
|
||||
#foreign dot :: (float4, float4) -> float;
|
||||
|
||||
#foreign normalize :: (float2) -> float2;
|
||||
#foreign normalize :: (float3) -> float3;
|
||||
#foreign normalize :: (float4) -> float4;
|
||||
|
||||
#foreign transpose :: (float4x4) -> float4x4;
|
||||
|
||||
//~ nbr: Multiplies
|
||||
#foreign mul :: (float2, float2) -> float;
|
||||
#foreign mul :: (float3, float3) -> float;
|
||||
#foreign mul :: (float4, float4) -> float;
|
||||
#foreign mul :: (float4x4, float4x4) -> float4x4;
|
||||
#foreign mul :: (float, float2) -> float2;
|
||||
#foreign mul :: (float, float3) -> float3;
|
||||
#foreign mul :: (float, float4) -> float4;
|
||||
|
||||
#foreign mul :: (float, float4x4) -> float4x4;
|
||||
#foreign mul :: (float4x4, float) -> float4x4;
|
||||
#foreign mul :: (float4x4, float4) -> float4;
|
||||
#foreign mul :: (float2, float) -> float2;
|
||||
#foreign mul :: (float3, float) -> float3;
|
||||
#foreign mul :: (float4, float) -> float4;
|
||||
|
||||
#foreign mul :: (float4, float4x4) -> float4x4;
|
||||
|
||||
//~ nbr: General
|
||||
#foreign abs :: (float) -> float;
|
||||
#foreign abs :: (float2) -> float2;
|
||||
#foreign abs :: (float3) -> float3;
|
||||
#foreign abs :: (float4) -> float4;
|
||||
#foreign abs :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign min :: (float) -> float;
|
||||
#foreign min :: (float2) -> float2;
|
||||
#foreign min :: (float3) -> float3;
|
||||
#foreign min :: (float4) -> float4;
|
||||
#foreign min :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign max :: (float) -> float;
|
||||
#foreign max :: (float2) -> float2;
|
||||
#foreign max :: (float3) -> float3;
|
||||
#foreign max :: (float4) -> float4;
|
||||
#foreign max :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign ceil :: (float) -> float;
|
||||
#foreign ceil :: (float2) -> float2;
|
||||
#foreign ceil :: (float3) -> float3;
|
||||
#foreign ceil :: (float4) -> float4;
|
||||
#foreign ceil :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign floor :: (float) -> float;
|
||||
#foreign floor :: (float2) -> float2;
|
||||
#foreign floor :: (float3) -> float3;
|
||||
#foreign floor :: (float4) -> float4;
|
||||
#foreign floor :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign round :: (float) -> float;
|
||||
#foreign round :: (float2) -> float2;
|
||||
#foreign round :: (float3) -> float3;
|
||||
#foreign round :: (float4) -> float4;
|
||||
#foreign round :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign clamp :: (float, float, float) -> float;
|
||||
#foreign clamp :: (float2, float2, float2) -> float2;
|
||||
#foreign clamp :: (float3, float3, float3) -> float3;
|
||||
#foreign clamp :: (float4, float4, float4) -> float4;
|
||||
#foreign clamp :: (float4x4, float4x4, float4x4) -> float4x4;
|
||||
|
||||
#foreign log :: (float) -> float;
|
||||
#foreign log :: (float2) -> float2;
|
||||
#foreign log :: (float3) -> float3;
|
||||
#foreign log :: (float4) -> float4;
|
||||
#foreign log :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign log2 :: (float) -> float;
|
||||
#foreign log2 :: (float2) -> float2;
|
||||
#foreign log2 :: (float3) -> float3;
|
||||
#foreign log2 :: (float4) -> float4;
|
||||
#foreign log2 :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign log10 :: (float) -> float;
|
||||
#foreign log10 :: (float2) -> float2;
|
||||
#foreign log10 :: (float3) -> float3;
|
||||
#foreign log10 :: (float4) -> float4;
|
||||
#foreign log10 :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign pow :: (float, float, float) -> float;
|
||||
#foreign pow :: (float2, float2, float2) -> float2;
|
||||
#foreign pow :: (float3, float3, float3) -> float3;
|
||||
#foreign pow :: (float4, float4, float4) -> float4;
|
||||
#foreign pow :: (float4x4, float4x4, float4x4) -> float4x4;
|
||||
|
||||
#foreign smoothstep :: (float, float, float) -> float;
|
||||
#foreign smoothstep :: (float2, float2, float2) -> float2;
|
||||
#foreign smoothstep :: (float3, float3, float3) -> float3;
|
||||
#foreign smoothstep :: (float4, float4, float4) -> float4;
|
||||
#foreign smoothstep :: (float4x4, float4x4, float4x4) -> float4x4;
|
||||
|
||||
#foreign step :: (float, float) -> float;
|
||||
#foreign step :: (float2, float2) -> float2;
|
||||
#foreign step :: (float3, float3) -> float3;
|
||||
#foreign step :: (float4, float4) -> float4;
|
||||
#foreign step :: (float4x4, float4x4) -> float4x4;
|
||||
|
||||
#foreign sqrt :: (float) -> float;
|
||||
#foreign sqrt :: (float2) -> float2;
|
||||
#foreign sqrt :: (float3) -> float3;
|
||||
#foreign sqrt :: (float4) -> float4;
|
||||
#foreign sqrt :: (float4x4) -> float4x4;
|
||||
|
||||
|
||||
|
||||
//~ nbr: Trigonometry
|
||||
#foreign cos :: (float) -> float;
|
||||
#foreign cos :: (float2) -> float2;
|
||||
#foreign cos :: (float3) -> float3;
|
||||
#foreign cos :: (float4) -> float4;
|
||||
#foreign cos :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign cosh :: (float) -> float;
|
||||
#foreign cosh :: (float2) -> float2;
|
||||
#foreign cosh :: (float3) -> float3;
|
||||
#foreign cosh :: (float4) -> float4;
|
||||
#foreign cosh :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign acos :: (float) -> float;
|
||||
#foreign acos :: (float2) -> float2;
|
||||
#foreign acos :: (float3) -> float3;
|
||||
#foreign acos :: (float4) -> float4;
|
||||
#foreign acos :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign sin :: (float) -> float;
|
||||
#foreign sin :: (float2) -> float2;
|
||||
#foreign sin :: (float3) -> float3;
|
||||
#foreign sin :: (float4) -> float4;
|
||||
#foreign sin :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign sinh :: (float) -> float;
|
||||
#foreign sinh :: (float2) -> float2;
|
||||
#foreign sinh :: (float3) -> float3;
|
||||
#foreign sinh :: (float4) -> float4;
|
||||
#foreign sinh :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign asin :: (float) -> float;
|
||||
#foreign asin :: (float2) -> float2;
|
||||
#foreign asin :: (float3) -> float3;
|
||||
#foreign asin :: (float4) -> float4;
|
||||
#foreign asin :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign tan :: (float) -> float;
|
||||
#foreign tan :: (float2) -> float2;
|
||||
#foreign tan :: (float3) -> float3;
|
||||
#foreign tan :: (float4) -> float4;
|
||||
#foreign tan :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign tanh :: (float) -> float;
|
||||
#foreign tanh :: (float2) -> float2;
|
||||
#foreign tanh :: (float3) -> float3;
|
||||
#foreign tanh :: (float4) -> float4;
|
||||
#foreign tanh :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign atan :: (float) -> float;
|
||||
#foreign atan :: (float2) -> float2;
|
||||
#foreign atan :: (float3) -> float3;
|
||||
#foreign atan :: (float4) -> float4;
|
||||
#foreign atan :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign atan2 :: (float, float) -> float;
|
||||
#foreign atan2 :: (float2, float2) -> float2;
|
||||
#foreign atan2 :: (float3, float3) -> float3;
|
||||
#foreign atan2 :: (float4, float4) -> float4;
|
||||
#foreign atan2 :: (float4x4, float4x4) -> float4x4;
|
||||
|
||||
#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;
|
||||
|
||||
#foreign fmod :: (float, float) -> float;
|
||||
109
first.jai
Normal file
109
first.jai
Normal file
@@ -0,0 +1,109 @@
|
||||
#import "Basic";
|
||||
#import "File";
|
||||
#import "Compiler";
|
||||
#import "Metaprogram_Plugins";
|
||||
|
||||
plugins: [..] *Metaprogram_Plugin;
|
||||
|
||||
build :: () {
|
||||
w := compiler_create_workspace("Ink Build");
|
||||
if !w {
|
||||
print("Workspace creation failed.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
EXECUTABLE_NAME :: "ink";
|
||||
MAIN_FILE :: "Ink.jai";
|
||||
|
||||
options := get_build_options(w);
|
||||
|
||||
options.write_added_strings = true;
|
||||
|
||||
args := options.compile_time_command_line;
|
||||
|
||||
intercept_flags: Intercept_Flags;
|
||||
plugin_start_index := -1;
|
||||
|
||||
for arg : args {
|
||||
if arg == {
|
||||
case "check"; {
|
||||
options.output_type = .NO_OUTPUT;
|
||||
}
|
||||
}
|
||||
|
||||
it := args[it_index];
|
||||
|
||||
if !it continue;
|
||||
|
||||
if it[0] == #char "+" {
|
||||
plugin_start_index = it_index;
|
||||
}
|
||||
}
|
||||
|
||||
plugins_to_create: [..] Plugin_To_Create;
|
||||
tracy : Plugin_To_Create;
|
||||
tracy.name = "tracy";
|
||||
array_add(*plugins_to_create, tracy);
|
||||
// got_error := false;
|
||||
// if plugin_start_index >= 0 {
|
||||
// success:, plugins_to_create = parse_plugin_arguments(args, plugin_start_index);
|
||||
// if !success got_error = true;
|
||||
// }
|
||||
|
||||
// if got_error {
|
||||
// exit(1);
|
||||
// }
|
||||
|
||||
success := init_plugins(plugins_to_create, *plugins, w);
|
||||
if !success {
|
||||
log_error("A plugin init() failed. Exiting.\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
new_path: [..] string;
|
||||
array_add(*new_path, ..options.import_path);
|
||||
array_add(*new_path, "modules");
|
||||
// array_add(*new_path, "modules/shader_parsing");
|
||||
options.import_path = new_path;
|
||||
options.output_executable_name = EXECUTABLE_NAME;
|
||||
|
||||
wd := get_working_directory();
|
||||
|
||||
set_build_options(options, w);
|
||||
|
||||
for plugins {
|
||||
if it.before_intercept it.before_intercept(it, *intercept_flags);
|
||||
}
|
||||
|
||||
compiler_begin_intercept(w, intercept_flags);
|
||||
|
||||
for plugins if it.add_source it.add_source(it);
|
||||
|
||||
add_build_file(MAIN_FILE, w);
|
||||
|
||||
// Call message_loop(), which is a routine of ours below that will receive the messages.
|
||||
message_loop(w);
|
||||
|
||||
compiler_end_intercept(w);
|
||||
|
||||
for plugins if it.finish it.finish (it);
|
||||
for plugins if it.shutdown it.shutdown(it);
|
||||
|
||||
print("\nDone!\n\n");
|
||||
|
||||
set_build_options_dc(.{do_output=false, write_added_strings=false});
|
||||
}
|
||||
|
||||
message_loop :: (w: Workspace) {
|
||||
while true {
|
||||
// We ask the compiler for the next message. If one is not available,
|
||||
// we will wait until it becomes available.
|
||||
message := compiler_wait_for_message();
|
||||
// Pass the message to all plugins.
|
||||
for plugins if it.message it.message(it, message);
|
||||
|
||||
if message.kind == .COMPLETE break;
|
||||
}
|
||||
}
|
||||
|
||||
#run, stallable build();
|
||||
255
hlsl_builtin.jai
255
hlsl_builtin.jai
@@ -1,252 +1,5 @@
|
||||
HLSL_BULTIN :: #string DONE
|
||||
HLSL_BUILTIN :: #run -> string {
|
||||
// return read_entire_file("./hlsl_builtin.shd");
|
||||
return "";
|
||||
};
|
||||
|
||||
float2 :: struct {
|
||||
x : float;
|
||||
y : float;
|
||||
}
|
||||
|
||||
float3 :: struct {
|
||||
x : float;
|
||||
y : float;
|
||||
z : float;
|
||||
}
|
||||
|
||||
float4 :: struct {
|
||||
x : float;
|
||||
y : float;
|
||||
z : float;
|
||||
w : float;
|
||||
}
|
||||
|
||||
float4x4 :: struct {
|
||||
m11 : float;
|
||||
m12 : float;
|
||||
m13 : float;
|
||||
m14 : float;
|
||||
m21 : float;
|
||||
m22 : float;
|
||||
m23 : float;
|
||||
m24 : float;
|
||||
m31 : float;
|
||||
m32 : float;
|
||||
m33 : float;
|
||||
m34 : float;
|
||||
m41 : float;
|
||||
m42 : float;
|
||||
m43 : float;
|
||||
m44 : float;
|
||||
}
|
||||
|
||||
int2 :: struct {
|
||||
x : int;
|
||||
y : int;
|
||||
}
|
||||
|
||||
int3 :: struct {
|
||||
x : int;
|
||||
y : int;
|
||||
z : int;
|
||||
}
|
||||
|
||||
int4 :: struct {
|
||||
x : int;
|
||||
y : int;
|
||||
z : int;
|
||||
w : int;
|
||||
}
|
||||
|
||||
int4x4 :: struct {
|
||||
m11 : int;
|
||||
m12 : int;
|
||||
m13 : int;
|
||||
m14 : int;
|
||||
m21 : int;
|
||||
m22 : int;
|
||||
m23 : int;
|
||||
m24 : int;
|
||||
m31 : int;
|
||||
m32 : int;
|
||||
m33 : int;
|
||||
m34 : int;
|
||||
m41 : int;
|
||||
m42 : int;
|
||||
m43 : int;
|
||||
m44 : int;
|
||||
}
|
||||
|
||||
//~ nbr: Constructors
|
||||
#foreign float2 :: (float, float) -> float2;
|
||||
#foreign float3 :: (float, float, float) -> float3;
|
||||
#foreign float4 :: (float, float, float, float) -> float4;
|
||||
|
||||
//~ nbr: Vectors
|
||||
#foreign cross :: (float3, float3) -> float3;
|
||||
#foreign distance :: (float2, float2) -> float;
|
||||
#foreign distance :: (float3, float3) -> float;
|
||||
#foreign distance :: (float4, float4) -> float;
|
||||
|
||||
#foreign dot :: (float2, float2) -> float;
|
||||
#foreign dot :: (float3, float3) -> float;
|
||||
#foreign dot :: (float4, float4) -> float;
|
||||
|
||||
#foreign normalize :: (float2) -> float2;
|
||||
#foreign normalize :: (float3) -> float3;
|
||||
#foreign normalize :: (float4) -> float4;
|
||||
|
||||
#foreign transpose :: (float4x4) -> float4x4;
|
||||
|
||||
//~ nbr: Multiplies
|
||||
#foreign mul :: (float2, float2) -> float2;
|
||||
#foreign mul :: (float3, float3) -> float3;
|
||||
#foreign mul :: (float4, float4) -> float4;
|
||||
#foreign mul :: (float4x4, float4x4) -> float4x4;
|
||||
|
||||
//~ nbr: General
|
||||
#foreign abs :: (float) -> float;
|
||||
#foreign abs :: (float2) -> float2;
|
||||
#foreign abs :: (float3) -> float3;
|
||||
#foreign abs :: (float4) -> float4;
|
||||
#foreign abs :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign min :: (float) -> float;
|
||||
#foreign min :: (float2) -> float2;
|
||||
#foreign min :: (float3) -> float3;
|
||||
#foreign min :: (float4) -> float4;
|
||||
#foreign min :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign max :: (float) -> float;
|
||||
#foreign max :: (float2) -> float2;
|
||||
#foreign max :: (float3) -> float3;
|
||||
#foreign max :: (float4) -> float4;
|
||||
#foreign max :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign ceil :: (float) -> float;
|
||||
#foreign ceil :: (float2) -> float2;
|
||||
#foreign ceil :: (float3) -> float3;
|
||||
#foreign ceil :: (float4) -> float4;
|
||||
#foreign ceil :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign floor :: (float) -> float;
|
||||
#foreign floor :: (float2) -> float2;
|
||||
#foreign floor :: (float3) -> float3;
|
||||
#foreign floor :: (float4) -> float4;
|
||||
#foreign floor :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign round :: (float) -> float;
|
||||
#foreign round :: (float2) -> float2;
|
||||
#foreign round :: (float3) -> float3;
|
||||
#foreign round :: (float4) -> float4;
|
||||
#foreign round :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign clamp :: (float, float, float) -> float;
|
||||
#foreign clamp :: (float2, float2, float2) -> float2;
|
||||
#foreign clamp :: (float3, float3, float3) -> float3;
|
||||
#foreign clamp :: (float4, float4, float4) -> float4;
|
||||
#foreign clamp :: (float4x4, float4x4, float4x4) -> float4x4;
|
||||
|
||||
#foreign log :: (float) -> float;
|
||||
#foreign log :: (float2) -> float2;
|
||||
#foreign log :: (float3) -> float3;
|
||||
#foreign log :: (float4) -> float4;
|
||||
#foreign log :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign log2 :: (float) -> float;
|
||||
#foreign log2 :: (float2) -> float2;
|
||||
#foreign log2 :: (float3) -> float3;
|
||||
#foreign log2 :: (float4) -> float4;
|
||||
#foreign log2 :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign log10 :: (float) -> float;
|
||||
#foreign log10 :: (float2) -> float2;
|
||||
#foreign log10 :: (float3) -> float3;
|
||||
#foreign log10 :: (float4) -> float4;
|
||||
#foreign log10 :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign pow :: (float, float, float) -> float;
|
||||
#foreign pow :: (float2, float2, float2) -> float2;
|
||||
#foreign pow :: (float3, float3, float3) -> float3;
|
||||
#foreign pow :: (float4, float4, float4) -> float4;
|
||||
#foreign pow :: (float4x4, float4x4, float4x4) -> float4x4;
|
||||
|
||||
#foreign smoothstep :: (float, float, float) -> float;
|
||||
#foreign smoothstep :: (float2, float2, float2) -> float2;
|
||||
#foreign smoothstep :: (float3, float3, float3) -> float3;
|
||||
#foreign smoothstep :: (float4, float4, float4) -> float4;
|
||||
#foreign smoothstep :: (float4x4, float4x4, float4x4) -> float4x4;
|
||||
|
||||
#foreign step :: (float, float) -> float;
|
||||
#foreign step :: (float2, float2) -> float2;
|
||||
#foreign step :: (float3, float3) -> float3;
|
||||
#foreign step :: (float4, float4) -> float4;
|
||||
#foreign step :: (float4x4, float4x4) -> float4x4;
|
||||
|
||||
#foreign sqrt :: (float) -> float;
|
||||
#foreign sqrt :: (float2) -> float2;
|
||||
#foreign sqrt :: (float3) -> float3;
|
||||
#foreign sqrt :: (float4) -> float4;
|
||||
#foreign sqrt :: (float4x4) -> float4x4;
|
||||
|
||||
|
||||
|
||||
//~ nbr: Trigonometry
|
||||
#foreign cos :: (float) -> float;
|
||||
#foreign cos :: (float2) -> float2;
|
||||
#foreign cos :: (float3) -> float3;
|
||||
#foreign cos :: (float4) -> float4;
|
||||
#foreign cos :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign cosh :: (float) -> float;
|
||||
#foreign cosh :: (float2) -> float2;
|
||||
#foreign cosh :: (float3) -> float3;
|
||||
#foreign cosh :: (float4) -> float4;
|
||||
#foreign cosh :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign acos :: (float) -> float;
|
||||
#foreign acos :: (float2) -> float2;
|
||||
#foreign acos :: (float3) -> float3;
|
||||
#foreign acos :: (float4) -> float4;
|
||||
#foreign acos :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign sin :: (float) -> float;
|
||||
#foreign sin :: (float2) -> float2;
|
||||
#foreign sin :: (float3) -> float3;
|
||||
#foreign sin :: (float4) -> float4;
|
||||
#foreign sin :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign sinh :: (float) -> float;
|
||||
#foreign sinh :: (float2) -> float2;
|
||||
#foreign sinh :: (float3) -> float3;
|
||||
#foreign sinh :: (float4) -> float4;
|
||||
#foreign sinh :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign asin :: (float) -> float;
|
||||
#foreign asin :: (float2) -> float2;
|
||||
#foreign asin :: (float3) -> float3;
|
||||
#foreign asin :: (float4) -> float4;
|
||||
#foreign asin :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign tan :: (float) -> float;
|
||||
#foreign tan :: (float2) -> float2;
|
||||
#foreign tan :: (float3) -> float3;
|
||||
#foreign tan :: (float4) -> float4;
|
||||
#foreign tan :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign tanh :: (float) -> float;
|
||||
#foreign tanh :: (float2) -> float2;
|
||||
#foreign tanh :: (float3) -> float3;
|
||||
#foreign tanh :: (float4) -> float4;
|
||||
#foreign tanh :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign atan :: (float) -> float;
|
||||
#foreign atan :: (float2) -> float2;
|
||||
#foreign atan :: (float3) -> float3;
|
||||
#foreign atan :: (float4) -> float4;
|
||||
#foreign atan :: (float4x4) -> float4x4;
|
||||
|
||||
#foreign atan2 :: (float, float) -> float;
|
||||
#foreign atan2 :: (float2, float2) -> float2;
|
||||
#foreign atan2 :: (float3, float3) -> float3;
|
||||
#foreign atan2 :: (float4, float4) -> float4;
|
||||
#foreign atan2 :: (float4x4, float4x4) -> float4x4;
|
||||
|
||||
DONE
|
||||
|
||||
302
module.jai
302
module.jai
@@ -4,6 +4,7 @@
|
||||
#load "Semantic_Analysis.jai";
|
||||
#load "Codegen.jai";
|
||||
|
||||
#import "File_Utilities";
|
||||
|
||||
add_define :: (env : *Environment, key : string) {
|
||||
for define : env.defines {
|
||||
@@ -27,10 +28,6 @@ Environment :: struct {
|
||||
defines : [..]string;
|
||||
}
|
||||
|
||||
Shader_Compiler :: struct {
|
||||
environment : Environment;
|
||||
}
|
||||
|
||||
Field_Kind :: enum {
|
||||
Int :: 0;
|
||||
Half :: 1;
|
||||
@@ -56,6 +53,7 @@ Hint_Kind :: enum {
|
||||
None;
|
||||
|
||||
Position;
|
||||
UV;
|
||||
Target;
|
||||
|
||||
Custom;
|
||||
@@ -72,6 +70,7 @@ Field :: struct {
|
||||
name : string;
|
||||
|
||||
type : Field_Type;
|
||||
resource_index : u32;
|
||||
hints : [..]Field_Hint;
|
||||
}
|
||||
|
||||
@@ -111,18 +110,130 @@ Properties :: struct {
|
||||
buffer_index : u32;
|
||||
}
|
||||
|
||||
Constant_Buffer :: struct {
|
||||
register : int;
|
||||
|
||||
name : string;
|
||||
|
||||
fields : Static_Array(Property_Field, 16);
|
||||
|
||||
// hints : Field_Hint; // optional hint...
|
||||
hints : [..]Field_Hint;
|
||||
|
||||
buffer_index : u32;
|
||||
}
|
||||
|
||||
Shader_Variant_Collection :: struct {
|
||||
properties : Properties;
|
||||
|
||||
max_constant_buffers :: 16;
|
||||
cbuffers : Static_Array(Constant_Buffer, max_constant_buffers);
|
||||
|
||||
variants : [..]Shader_Variant;
|
||||
}
|
||||
|
||||
Compilation_Result :: struct {
|
||||
messages : [..]Compiler_Message;
|
||||
Input_File :: struct {
|
||||
source : string;
|
||||
path : string;
|
||||
}
|
||||
|
||||
Compiler_Context :: struct {
|
||||
file : Input_File;
|
||||
|
||||
environment : Environment;
|
||||
|
||||
tokens : [..]Token;;
|
||||
root : *AST_Node;
|
||||
nodes : [..]AST_Node;
|
||||
|
||||
codegen_result_text : string;
|
||||
|
||||
constant_buffers : Static_Array(Type_Variable_Handle, 16);
|
||||
|
||||
scope_stack : Scope_Stack;
|
||||
type_variables : [..]Type_Variable;
|
||||
|
||||
property_name : string;
|
||||
|
||||
vertex_entry_point : struct {
|
||||
node : *AST_Node;
|
||||
name : string;
|
||||
input : [..]Field;
|
||||
}
|
||||
|
||||
pixel_entry_point : struct {
|
||||
node : *AST_Node;
|
||||
name : string;
|
||||
return_value : Field;
|
||||
}
|
||||
|
||||
properties : Properties;
|
||||
|
||||
max_constant_buffers :: 16;
|
||||
|
||||
cbuffers : Static_Array(Constant_Buffer, max_constant_buffers);
|
||||
|
||||
had_error : bool;
|
||||
messages : [..]Compiler_Message;
|
||||
}
|
||||
|
||||
collection : Shader_Variant_Collection;
|
||||
#add_context scratch_allocators : [2]Allocator;
|
||||
#add_context scratch_id : int = 0;
|
||||
|
||||
init_context_allocators :: () {
|
||||
if get_arena(context.scratch_allocators[0]) == null {
|
||||
context.scratch_allocators[0] = make_arena(Megabytes(128));
|
||||
context.scratch_allocators[1] = make_arena(Megabytes(128));
|
||||
}
|
||||
}
|
||||
|
||||
clear_context_allocators :: () {
|
||||
if get_arena(context.scratch_allocators[0]) != null {
|
||||
clear(context.scratch_allocators[0]);
|
||||
clear(context.scratch_allocators[1]);
|
||||
}
|
||||
}
|
||||
|
||||
get_scratch :: (conflict : Allocator = .{}) -> Scratch {
|
||||
arena := cast(*Arena)conflict.data;
|
||||
if arena == get_arena(context.scratch_allocators[0]) || context.scratch_id == 0 {
|
||||
context.scratch_id = 1;
|
||||
return scratch_begin(*context.scratch_allocators[1]);
|
||||
}
|
||||
context.scratch_id = 0;
|
||||
return scratch_begin(*context.scratch_allocators[0]);
|
||||
}
|
||||
|
||||
record_error :: (result : *Compiler_Context, format : string, args : .. Any) {
|
||||
error : Compiler_Message;
|
||||
error.message_kind = .Error;
|
||||
error.message = sprint(format, args);
|
||||
|
||||
array_add(*result.messages, error);
|
||||
}
|
||||
|
||||
make_file :: (result : *Compiler_Context, path : string) -> Input_File {
|
||||
if !file_exists(path) {
|
||||
record_error(result, "Unable to load file: %", path);
|
||||
return .{};
|
||||
}
|
||||
file_string, ok := read_entire_file(path);
|
||||
|
||||
if !ok {
|
||||
record_error(result, "Unable to load file: %", path);
|
||||
return .{};
|
||||
}
|
||||
|
||||
return make_file_from_string(file_string, path);
|
||||
}
|
||||
|
||||
make_file_from_string :: (source : string, path : string = "") -> Input_File {
|
||||
input_file : Input_File;
|
||||
|
||||
input_file.source = source;
|
||||
input_file.path = path;
|
||||
|
||||
return input_file;
|
||||
}
|
||||
|
||||
pretty_print_field :: (field : *Field) -> string {
|
||||
@@ -202,10 +313,10 @@ pretty_print_field :: (builder : *String_Builder, field : *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.name = variable.name;
|
||||
@@ -227,21 +338,25 @@ type_variable_to_field :: (checker : *Semantic_Checker, variable : *Type_Variabl
|
||||
}
|
||||
case .Texture2D; {
|
||||
type.kind = Field_Kind.Texture2D;
|
||||
|
||||
field.resource_index = variable.resource_index;
|
||||
}
|
||||
case .Sampler; {
|
||||
type.kind = Field_Kind.Sampler;
|
||||
|
||||
field.resource_index = variable.resource_index;
|
||||
}
|
||||
case .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");
|
||||
|
||||
type_var := h2tv(checker, find_result.type_variable);
|
||||
type_var := from_handle(type_variables, find_result.type_variable);
|
||||
|
||||
for i : 0..type_var.child_count - 1 {
|
||||
for i : 0..type_var.children.count - 1 {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -255,6 +370,8 @@ type_variable_to_field :: (checker : *Semantic_Checker, variable : *Type_Variabl
|
||||
if hint.ident_value == "position" {
|
||||
// @Incomplete(nb): Should be a lookup table somewhere
|
||||
field_hint.kind = .Position;
|
||||
} else if hint.ident_value == "uv" {
|
||||
field_hint.kind = .UV;
|
||||
} else if starts_with(hint.ident_value, "target") {
|
||||
// @Incomplete(nb): Should be a lookup table somewhere
|
||||
index_str : string;
|
||||
@@ -267,7 +384,8 @@ type_variable_to_field :: (checker : *Semantic_Checker, variable : *Type_Variabl
|
||||
}
|
||||
field_hint.kind = .Target;
|
||||
} else {
|
||||
// @Incomplete(nb): custo hints
|
||||
field_hint.custom_hint_name = hint.ident_value;
|
||||
field_hint.kind = .Custom;
|
||||
}
|
||||
array_add(*field.hints, field_hint);
|
||||
}
|
||||
@@ -277,67 +395,23 @@ type_variable_to_field :: (checker : *Semantic_Checker, variable : *Type_Variabl
|
||||
return field;
|
||||
}
|
||||
|
||||
compile_file :: (compiler : *Shader_Compiler, path : string) -> Compilation_Result {
|
||||
result : Compilation_Result;
|
||||
|
||||
lexer : Lexer;
|
||||
|
||||
init_lexer_from_file(*lexer, path);
|
||||
if lexer.result.had_error {
|
||||
copy_messages(lexer.result.messages, *result.messages);
|
||||
result.had_error = true;
|
||||
return result;
|
||||
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.ctx.type_variables, checker.ctx.scope_stack, variable);
|
||||
}
|
||||
|
||||
generate_output_data :: (ctx : *Compiler_Context) {
|
||||
if ctx.had_error {
|
||||
return;
|
||||
}
|
||||
|
||||
lex_result := lex(*lexer,, *temp);
|
||||
if lex_result.had_error {
|
||||
copy_messages(lex_result.messages, *result.messages);
|
||||
result.had_error = true;
|
||||
return result;
|
||||
}
|
||||
if ctx.vertex_entry_point.node {
|
||||
ctx.vertex_entry_point.name = ctx.vertex_entry_point.node.name;
|
||||
|
||||
parse_state : Parse_State;
|
||||
init_parse_state(*parse_state, lex_result.tokens, lexer.path, context.allocator);
|
||||
|
||||
parse_result := parse(*parse_state);
|
||||
if parse_result.had_error {
|
||||
copy_messages(parse_result.messages, *result.messages);
|
||||
result.had_error = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
checker : Semantic_Checker;
|
||||
init_semantic_checker(*checker, parse_result.root, path);
|
||||
|
||||
check_result := check(*checker);
|
||||
if check_result.had_error {
|
||||
copy_messages(check_result.messages, *result.messages);
|
||||
result.had_error = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
state : Codegen_State;
|
||||
init_codegen_state(*state, parse_result.root, check_result, .HLSL);
|
||||
|
||||
result_text : string;
|
||||
|
||||
codegen_result := codegen(*state);
|
||||
if codegen_result.had_error {
|
||||
copy_messages(codegen_result.messages, *result.messages);
|
||||
result.had_error = true;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// @Incomplete(nb): Assumes only a single variant for now
|
||||
|
||||
variant : Shader_Variant;
|
||||
variant.text = codegen_result.result_text;
|
||||
|
||||
if checker.vertex_entry_point {
|
||||
variant.vertex_entry_point.name = checker.vertex_entry_point.name;
|
||||
|
||||
type_variable := h2tv(*checker, checker.vertex_entry_point.type_variable);
|
||||
type_variable := from_handle(ctx.type_variables, ctx.vertex_entry_point.node.type_variable);
|
||||
assert(type_variable.type == .Function);
|
||||
|
||||
node := type_variable.source_node;
|
||||
@@ -345,36 +419,58 @@ compile_file :: (compiler : *Shader_Compiler, path : string) -> Compilation_Resu
|
||||
if node.children[0].kind == .FieldList {
|
||||
field_list := node.children[0];
|
||||
for child : field_list.children {
|
||||
tv := h2tv(*checker, child.type_variable);
|
||||
field := type_variable_to_field(*checker, tv);
|
||||
print("%\n", pretty_print_field(*field));
|
||||
array_add(*variant.vertex_entry_point.input, field);
|
||||
tv := from_handle(ctx.type_variables, child.type_variable);
|
||||
field := type_variable_to_field(ctx.type_variables, ctx.scope_stack, tv);
|
||||
array_add(*ctx.vertex_entry_point.input, field);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
find_result := find_symbol(*check_result.scope_stack, "properties", xx 1);
|
||||
if find_result {
|
||||
property_variable := h2tv(check_result.type_variables, find_result.type_variable);
|
||||
for buffer_variable : ctx.constant_buffers {
|
||||
variable := from_handle(ctx.type_variables, buffer_variable);
|
||||
|
||||
for i : 0..property_variable.child_count - 1 {
|
||||
child := property_variable.children[i];
|
||||
field := type_variable_to_field(*checker, h2tv(*checker, child));
|
||||
prop_field : Property_Field;
|
||||
prop_field.base_field = field;
|
||||
array_add(*result.collection.properties.fields, prop_field);
|
||||
cb := array_add(*ctx.cbuffers);
|
||||
|
||||
for i : 0..variable.children.count - 1 {
|
||||
child := variable.children[i];
|
||||
field : Property_Field;
|
||||
field.base_field = type_variable_to_field(ctx.type_variables, ctx.scope_stack, from_handle(ctx.type_variables, child));
|
||||
array_add(*cb.fields, field);
|
||||
}
|
||||
|
||||
cb.buffer_index = variable.resource_index;
|
||||
|
||||
for hint : variable.source_node.hint_tokens {
|
||||
field_hint : Field_Hint;
|
||||
field_hint.custom_hint_name = hint.ident_value;
|
||||
field_hint.kind = .Custom;
|
||||
array_add(*cb.hints, field_hint);
|
||||
}
|
||||
result.collection.properties.buffer_index = property_variable.buffer_index;
|
||||
}
|
||||
|
||||
if checker.pixel_entry_point {
|
||||
variant.pixel_entry_point.name = checker.pixel_entry_point.name;
|
||||
find_result := find_symbol(*ctx.scope_stack, ctx.property_name, xx 1);
|
||||
if find_result {
|
||||
property_variable := from_handle(ctx.type_variables, find_result.type_variable);
|
||||
|
||||
type_variable := h2tv(*checker, checker.pixel_entry_point.type_variable);
|
||||
for i : 0..property_variable.children.count - 1 {
|
||||
child := property_variable.children[i];
|
||||
field := type_variable_to_field(ctx.type_variables, ctx.scope_stack, from_handle(ctx.type_variables, child));
|
||||
prop_field : Property_Field;
|
||||
prop_field.base_field = field;
|
||||
array_add(*ctx.properties.fields, prop_field);
|
||||
}
|
||||
ctx.properties.buffer_index = property_variable.resource_index;
|
||||
}
|
||||
|
||||
|
||||
if ctx.pixel_entry_point.node {
|
||||
ctx.pixel_entry_point.name = ctx.pixel_entry_point.node.name;
|
||||
|
||||
type_variable := from_handle(ctx.type_variables, ctx.pixel_entry_point.node.type_variable);
|
||||
assert(type_variable.type == .Function);
|
||||
|
||||
field := type_variable_to_field(*checker, type_variable.return_var);
|
||||
field := type_variable_to_field(ctx.type_variables, ctx.scope_stack, type_variable.return_type_variable);
|
||||
for hint : type_variable.source_node.hint_tokens {
|
||||
field_hint : Field_Hint;
|
||||
|
||||
@@ -393,16 +489,28 @@ compile_file :: (compiler : *Shader_Compiler, path : string) -> Compilation_Resu
|
||||
}
|
||||
field_hint.kind = .Target;
|
||||
} else {
|
||||
// @Incomplete(nb): custo hints
|
||||
// @Incomplete(nb): custom hints
|
||||
}
|
||||
array_add(*field.hints, field_hint);
|
||||
}
|
||||
|
||||
variant.pixel_entry_point.return_value = field;
|
||||
print("%\n", pretty_print_field(*field));
|
||||
ctx.pixel_entry_point.return_value = field;
|
||||
}
|
||||
}
|
||||
|
||||
compile_file :: (ctx : *Compiler_Context, path : string, allocator : Allocator = temp) {
|
||||
new_context := context;
|
||||
new_context.allocator = allocator;
|
||||
push_context new_context {
|
||||
init_context_allocators();
|
||||
defer clear_context_allocators();
|
||||
|
||||
ctx.file = make_file(ctx, path);
|
||||
|
||||
lex(ctx, allocator);
|
||||
parse(ctx, allocator);
|
||||
check(ctx, allocator);
|
||||
codegen(ctx, allocator);
|
||||
generate_output_data(ctx);
|
||||
}
|
||||
|
||||
array_add(*result.collection.variants, variant);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
1
modules/ncore
Submodule
1
modules/ncore
Submodule
Submodule modules/ncore added at 788980c88f
1
modules/tracy
Submodule
1
modules/tracy
Submodule
Submodule modules/tracy added at 9668d7b8ab
BIN
output.tracy
Normal file
BIN
output.tracy
Normal file
Binary file not shown.
@@ -1,12 +1,12 @@
|
||||
test/assign_arithmetic_expression.shd lex parse
|
||||
test/empty_vertex_main.shd lex parse
|
||||
test/empty_vertex_main_with_position_parameter.shd lex parse
|
||||
test/meta_block.shd lex parse
|
||||
test/basic_property_and_return_value.shd lex parse
|
||||
test/function_call_return.shd lex parse
|
||||
test/struct_field_access_test.shd lex parse
|
||||
test/pass_and_access_struct_fields_in_functions.shd lex parse
|
||||
test/field_without_type_specifier.shd lex parse
|
||||
test/functions_with_same_name.shd lex parse
|
||||
test/function_with_int_return.shd lex parse
|
||||
test/type_as_variable_name.shd lex parse
|
||||
test/assign_arithmetic_expression.inx lex parse
|
||||
test/empty_vertex_main.inx lex parse
|
||||
test/empty_vertex_main_with_position_parameter.inx lex parse
|
||||
test/meta_block.inx lex parse
|
||||
test/basic_property_and_return_value.inx lex parse
|
||||
test/function_call_return.inx lex parse
|
||||
test/struct_field_access_test.inx lex parse
|
||||
test/pass_and_access_struct_fields_in_functions.inx lex parse
|
||||
test/field_without_type_specifier.inx lex parse
|
||||
test/functions_with_same_name.inx lex parse
|
||||
test/function_with_int_return.inx lex parse
|
||||
test/type_as_variable_name.inx lex parse
|
||||
5
test/arrays.ink
Normal file
5
test/arrays.ink
Normal file
@@ -0,0 +1,5 @@
|
||||
vertex main :: () -> float4 @position {
|
||||
arr : [16].float4;
|
||||
arr[0] = float4(1,1,1);
|
||||
return arr[0];
|
||||
}
|
||||
8
test/binary_with_access.ink
Normal file
8
test/binary_with_access.ink
Normal file
@@ -0,0 +1,8 @@
|
||||
props :: properties {
|
||||
resolution : float2;
|
||||
}
|
||||
|
||||
vertex main :: (pos : float3 @position) -> float4 @position {
|
||||
p := float2(1.0 - 2.0 * props.resolution.x, 1.0 - 2.0 * props.resolution.y);
|
||||
return float4(p, 1.0, 1.0);
|
||||
}
|
||||
34
test/builtin_types.ink
Normal file
34
test/builtin_types.ink
Normal file
@@ -0,0 +1,34 @@
|
||||
vertex main :: () {
|
||||
v2 : float2 = float2(2.0, 2.0);
|
||||
v2 = float2(2.0);
|
||||
v2 = float2(v2);
|
||||
|
||||
v3 : float3 = float3(2.0, 2.0, 2.0);
|
||||
v3 = float3(v2, 1.0);
|
||||
v3 = float3(1.0, v2);
|
||||
v3 = float3(1.0);
|
||||
v3 = float3(v3);
|
||||
|
||||
v4 : float4 = float4(2.0, 2.0, 2.0, 2.0);
|
||||
v4 = float4(v4);
|
||||
v4 = float4(v2, v2);
|
||||
v4 = float4(v2, 1.0, 1.0);
|
||||
v4 = float4(1.0, v2, 1.0);
|
||||
v4 = float4(1.0, 1.0, v2);
|
||||
v4 = float4(v3, 2.0);
|
||||
v4 = float4(2.0, v3);
|
||||
v4 = float4(2.0);
|
||||
|
||||
|
||||
v4 = float4(1.0, 1.0, v2);
|
||||
v4 = float4(2.0);
|
||||
|
||||
v2.x = 2.0;
|
||||
v2.y = 2.0;
|
||||
|
||||
p := v2.x + v3.z;
|
||||
q := v4.w + v2.x;
|
||||
|
||||
m : float4x4;
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
void vs_main()
|
||||
{
|
||||
float x = 2.0f + 5.0f;
|
||||
float x = (2.0f + 5.0f);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
cbuffer __PROPERTIES : register(b0)
|
||||
{
|
||||
float4 color;
|
||||
float4 __PROPERTIES__color;
|
||||
}
|
||||
|
||||
|
||||
float3 vs_main(float3 pos : POSITION) : SV_POSITION
|
||||
{
|
||||
return pos;
|
||||
@@ -10,6 +11,6 @@ float3 vs_main(float3 pos : POSITION) : SV_POSITION
|
||||
|
||||
float4 ps_main() : SV_TARGET
|
||||
{
|
||||
return color;
|
||||
return __PROPERTIES__color;
|
||||
}
|
||||
|
||||
|
||||
28
test/codegen/builtin_types.golden
Normal file
28
test/codegen/builtin_types.golden
Normal file
@@ -0,0 +1,28 @@
|
||||
void vs_main()
|
||||
{
|
||||
float2 v2 = float2(2.0f, 2.0f);
|
||||
v2 = float2(2.0f, 2.0f);
|
||||
v2 = float2(v2, v2);
|
||||
float3 v3 = float3(2.0f, 2.0f, 2.0f);
|
||||
v3 = float3(v2, 1.0f);
|
||||
v3 = float3(1.0f, v2);
|
||||
v3 = float3(1.0f, 1.0f, 1.0f);
|
||||
v3 = float3(v3, v3, v3);
|
||||
float4 v4 = float4(2.0f, 2.0f, 2.0f, 2.0f);
|
||||
v4 = float4(v4, v4, v4, v4);
|
||||
v4 = float4(v2, v2);
|
||||
v4 = float4(v2, 1.0f, 1.0f);
|
||||
v4 = float4(1.0f, v2, 1.0f);
|
||||
v4 = float4(1.0f, 1.0f, v2);
|
||||
v4 = float4(v3, 2.0f);
|
||||
v4 = float4(2.0f, v3);
|
||||
v4 = float4(2.0f, 2.0f, 2.0f, 2.0f);
|
||||
v4 = float4(1.0f, 1.0f, v2);
|
||||
v4 = float4(2.0f, 2.0f, 2.0f, 2.0f);
|
||||
v2.x = 2.0f;
|
||||
v2.y = 2.0f;
|
||||
float p = (v2.x + v3.z);
|
||||
float q = (v4.w + v2.x);
|
||||
float4x4 m;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,6 @@ void vs_main()
|
||||
{
|
||||
float x = 5.0f;
|
||||
float y = 3000.0f;
|
||||
float z = y * y + x;
|
||||
float z = ((y * y) + x);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
struct Foo;
|
||||
|
||||
struct Foo {}
|
||||
struct Foo {};
|
||||
|
||||
|
||||
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,15 +1,16 @@
|
||||
cbuffer __PROPERTIES : register(b0)
|
||||
{
|
||||
float4 color;
|
||||
float4 __PROPERTIES__color;
|
||||
}
|
||||
|
||||
float3 vs_main(float3 pos : POSITION, float2 uv) : SV_POSITION
|
||||
|
||||
float3 vs_main(float3 pos : POSITION, float2 uv : TEXCOORD0) : SV_POSITION
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
|
||||
float4 ps_main() : SV_TARGET
|
||||
{
|
||||
return color;
|
||||
return __PROPERTIES__color;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ int foo()
|
||||
|
||||
float bar()
|
||||
{
|
||||
return 1235.0f * 500;
|
||||
return (1235.0f * 500);
|
||||
}
|
||||
|
||||
void vs_main()
|
||||
|
||||
18
test/codegen/nested_if.golden
Normal file
18
test/codegen/nested_if.golden
Normal file
@@ -0,0 +1,18 @@
|
||||
float4 vs_main(float3 pos : POSITION) : SV_POSITION
|
||||
{
|
||||
if (pos.x > 100)
|
||||
{
|
||||
if (pos.x > 50)
|
||||
{
|
||||
return float4(pos, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
return float4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
return float4(pos, 1.0f);
|
||||
}
|
||||
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
93
test/codegen/night_time.golden
Normal file
93
test/codegen/night_time.golden
Normal file
@@ -0,0 +1,93 @@
|
||||
float4 apply_night(float4 color);
|
||||
float4 apply_twilight(float4 color);
|
||||
float4 apply_morning(float4 color);
|
||||
float4 apply_dawn(float4 color);
|
||||
|
||||
cbuffer __PROPERTIES : register(b0)
|
||||
{
|
||||
float __PROPERTIES__hour_of_day;
|
||||
}
|
||||
|
||||
Texture2D __PROPERTIES__input_tex : register(t0);
|
||||
SamplerState __PROPERTIES__tex_sampler : register(s0);
|
||||
|
||||
struct VS_Input
|
||||
{
|
||||
float3 pos : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct VS_Output
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
VS_Output vs_main(VS_Input input)
|
||||
{
|
||||
VS_Output output;
|
||||
output.pos = float4(input.pos, 1.0f);
|
||||
output.uv = input.uv;
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 apply_night(float4 color)
|
||||
{
|
||||
float4 result = color;
|
||||
(result -= float4(0.3f, 0.2f, 0.0f, 0.0f));
|
||||
(result *= 0.8f);
|
||||
return result;
|
||||
}
|
||||
|
||||
float4 apply_twilight(float4 color)
|
||||
{
|
||||
float4 result = color;
|
||||
(result += float4(0.2f, -0.1f, 0.1f, 0.0f));
|
||||
(result *= 0.9f);
|
||||
return result;
|
||||
}
|
||||
|
||||
float4 apply_morning(float4 color)
|
||||
{
|
||||
return (color * 1.3f);
|
||||
}
|
||||
|
||||
float4 apply_dawn(float4 color)
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
||||
float4 ps_main(VS_Output input)
|
||||
{
|
||||
float4 sampled_color = __PROPERTIES__input_tex.Sample(__PROPERTIES__tex_sampler, input.uv);
|
||||
float t = 0.0f;
|
||||
float4 a = float4(0, 0, 0, 0);
|
||||
float4 b = float4(0, 0, 0, 0);
|
||||
if (__PROPERTIES__hour_of_day > 16)
|
||||
{
|
||||
t = ((__PROPERTIES__hour_of_day - 16) / 6);
|
||||
a = apply_twilight(sampled_color);
|
||||
b = apply_night(sampled_color);
|
||||
}
|
||||
else if (__PROPERTIES__hour_of_day > 12)
|
||||
{
|
||||
t = ((__PROPERTIES__hour_of_day - 12) / 6);
|
||||
a = sampled_color;
|
||||
b = apply_twilight(sampled_color);
|
||||
}
|
||||
else if (__PROPERTIES__hour_of_day > 6)
|
||||
{
|
||||
t = ((__PROPERTIES__hour_of_day - 6) / 6);
|
||||
a = apply_morning(sampled_color);
|
||||
b = sampled_color;
|
||||
}
|
||||
else if (__PROPERTIES__hour_of_day >= 0)
|
||||
{
|
||||
t = (__PROPERTIES__hour_of_day / 6);
|
||||
a = apply_night(sampled_color);
|
||||
b = apply_morning(sampled_color);
|
||||
}
|
||||
|
||||
return lerp(a, b, t);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
struct Foo;
|
||||
|
||||
float foo(Foo f);
|
||||
|
||||
struct Foo
|
||||
{
|
||||
float some_data;
|
||||
}
|
||||
};
|
||||
|
||||
float foo(Foo f)
|
||||
{
|
||||
return f.some_data * 2.0f;
|
||||
return (f.some_data * 2.0f);
|
||||
}
|
||||
|
||||
void vs_main()
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
cbuffer __PROPERTIES : register(b0)
|
||||
{
|
||||
float4 color;
|
||||
float4 __PROPERTIES__color;
|
||||
}
|
||||
|
||||
|
||||
float4 vs_main(float4 pos : POSITION) : SV_POSITION
|
||||
{
|
||||
return pos;
|
||||
@@ -10,6 +11,6 @@ float4 vs_main(float4 pos : POSITION) : SV_POSITION
|
||||
|
||||
float4 ps_main() : SV_TARGET
|
||||
{
|
||||
return color;
|
||||
return __PROPERTIES__color;
|
||||
}
|
||||
|
||||
|
||||
17
test/codegen/simple_else_if.golden
Normal file
17
test/codegen/simple_else_if.golden
Normal file
@@ -0,0 +1,17 @@
|
||||
float4 vs_main(float3 pos : POSITION) : SV_POSITION
|
||||
{
|
||||
if (pos.x > 100)
|
||||
{
|
||||
return float4(pos, 1.0f);
|
||||
}
|
||||
else if (pos.x > 50)
|
||||
{
|
||||
return float4(pos, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
return float4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
10
test/codegen/simple_if.golden
Normal file
10
test/codegen/simple_if.golden
Normal file
@@ -0,0 +1,10 @@
|
||||
float4 vs_main(float3 pos : POSITION) : SV_POSITION
|
||||
{
|
||||
if (0 > 100)
|
||||
{
|
||||
return float4(pos, 1.0f);
|
||||
}
|
||||
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
13
test/codegen/simple_if_else.golden
Normal file
13
test/codegen/simple_if_else.golden
Normal file
@@ -0,0 +1,13 @@
|
||||
float4 vs_main(float3 pos : POSITION) : SV_POSITION
|
||||
{
|
||||
if (0 > 100)
|
||||
{
|
||||
return float4(pos, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
return float4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
struct Data;
|
||||
|
||||
struct Data
|
||||
{
|
||||
float4 color;
|
||||
}
|
||||
};
|
||||
|
||||
void vs_main()
|
||||
{
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
struct Foo;
|
||||
struct Bar;
|
||||
|
||||
struct Foo
|
||||
{
|
||||
float4 color;
|
||||
}
|
||||
};
|
||||
|
||||
struct Bar
|
||||
{
|
||||
Foo t;
|
||||
}
|
||||
};
|
||||
|
||||
void vs_main()
|
||||
{
|
||||
|
||||
29
test/codegen/texture_sample.golden
Normal file
29
test/codegen/texture_sample.golden
Normal file
@@ -0,0 +1,29 @@
|
||||
struct PS_Input;
|
||||
|
||||
cbuffer __PROPERTIES : register(b0)
|
||||
{
|
||||
}
|
||||
|
||||
Texture2D texture : register(t0);
|
||||
Sampler sampler : register(s0);
|
||||
|
||||
struct PS_Input
|
||||
{
|
||||
float2 uv;
|
||||
float4 pos : POSITION;
|
||||
}
|
||||
|
||||
PS_Input vs_main(float4 pos : POSITION, float2 uv)
|
||||
{
|
||||
PS_Input result;
|
||||
result.uv = uv;
|
||||
result.pos = pos;
|
||||
return result;
|
||||
}
|
||||
|
||||
float4 ps_main(PS_Input input) : SV_TARGET
|
||||
{
|
||||
float4 color = texture.sample(input.uv, sampler);
|
||||
return 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,19 +1,27 @@
|
||||
test/assign_arithmetic_expression.shd codegen
|
||||
test/basic_property_and_return_value.shd codegen
|
||||
test/complicated_computation.shd codegen
|
||||
test/empty_struct.shd codegen
|
||||
test/empty_vertex_main.shd codegen
|
||||
test/empty_vertex_main_with_position_parameter.shd codegen
|
||||
test/field_assignment.shd codegen
|
||||
test/function_call.shd codegen
|
||||
test/function_call_out_of_order_declaration.shd codegen
|
||||
test/function_call_return.shd codegen
|
||||
test/meta_block.shd codegen
|
||||
test/multiple_functions.shd codegen
|
||||
test/multiple_semicolons_everywhere.shd codegen
|
||||
test/pass_and_access_struct_fields_in_functions.shd codegen
|
||||
test/passthrough.shd codegen
|
||||
test/property_rename.shd codegen
|
||||
test/simple_struct_access.shd codegen
|
||||
test/struct_within_struct.shd codegen
|
||||
test/use_builtin_functions.shd codegen
|
||||
test/assign_arithmetic_expression.ink codegen
|
||||
test/basic_property_and_return_value.ink codegen
|
||||
test/builtin_types.ink codegen
|
||||
test/complicated_computation.ink codegen
|
||||
test/constant_buffer.ink codegen
|
||||
test/empty_struct.ink codegen
|
||||
test/empty_vertex_main.ink codegen
|
||||
test/empty_vertex_main_with_position_parameter.ink codegen
|
||||
test/field_assignment.ink codegen
|
||||
test/function_call.ink codegen
|
||||
test/function_call_out_of_order_declaration.ink codegen
|
||||
test/function_call_return.ink codegen
|
||||
test/inferred_types.ink codegen
|
||||
test/meta_block.ink codegen
|
||||
test/multiple_functions.ink codegen
|
||||
test/multiple_semicolons_everywhere.ink codegen
|
||||
test/nested_if.ink codegen
|
||||
test/pass_and_access_struct_fields_in_functions.ink codegen
|
||||
test/passthrough.ink codegen
|
||||
test/property_rename.ink codegen
|
||||
test/simple_else_if.ink codegen
|
||||
test/simple_if_else.ink codegen
|
||||
test/simple_if.ink codegen
|
||||
test/simple_struct_access.ink 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,26 @@
|
||||
test/assign_arithmetic_expression.shd compile
|
||||
test/basic_property_and_return_value.shd compile
|
||||
test/complicated_computation.shd compile
|
||||
test/empty_struct.shd compile
|
||||
test/empty_vertex_main.shd compile
|
||||
test/empty_vertex_main_with_position_parameter.shd compile
|
||||
test/field_assignment.shd compile
|
||||
test/float_suffix.shd compile
|
||||
test/function_call.shd compile
|
||||
test/function_call_out_of_order_declaration.shd compile
|
||||
test/function_call_return.shd compile
|
||||
test/functions_with_same_name.shd compile
|
||||
test/meta_block.shd compile
|
||||
test/multiple_functions.shd compile
|
||||
test/multiple_semicolons_everywhere.shd compile
|
||||
test/pass_and_access_struct_fields_in_functions.shd compile
|
||||
test/passthrough.shd compile
|
||||
test/simple_struct_access.shd compile
|
||||
test/struct_within_struct.shd compile
|
||||
test/use_builtin_functions.shd compile
|
||||
test/assign_arithmetic_expression.ink compile
|
||||
test/basic_property_and_return_value.ink compile
|
||||
test/builtin_types.ink compile
|
||||
test/complicated_computation.ink compile
|
||||
test/empty_struct.ink compile
|
||||
test/empty_vertex_main.ink compile
|
||||
test/empty_vertex_main_with_position_parameter.ink compile
|
||||
test/field_assignment.ink compile
|
||||
test/float_suffix.ink compile
|
||||
test/function_call.ink compile
|
||||
test/function_call_out_of_order_declaration.ink compile
|
||||
test/function_call_return.ink compile
|
||||
test/functions_with_same_name.ink compile
|
||||
test/inferred_types.ink compile
|
||||
test/meta_block.ink compile
|
||||
test/multiple_functions.ink compile
|
||||
test/multiple_semicolons_everywhere.ink compile
|
||||
test/pass_and_access_struct_fields_in_functions.ink compile
|
||||
test/passthrough.ink compile
|
||||
test/simple_else_if.ink compile
|
||||
test/simple_if_else.ink compile
|
||||
test/simple_if.ink compile
|
||||
test/simple_struct_access.ink compile
|
||||
test/struct_within_struct.ink compile
|
||||
test/unary.ink compile
|
||||
test/use_builtin_functions.ink compile
|
||||
1
test/compiled/builtin_types.golden
Normal file
1
test/compiled/builtin_types.golden
Normal file
@@ -0,0 +1 @@
|
||||
[vertex entry point] - vs_main
|
||||
14
test/constant_buffer.ink
Normal file
14
test/constant_buffer.ink
Normal file
@@ -0,0 +1,14 @@
|
||||
camera :: constant_buffer {
|
||||
projection : float4x4;
|
||||
view : float4x4;
|
||||
}
|
||||
|
||||
vertex main :: (pos : float4 @position) -> float4 @position {
|
||||
mv : float4 = mul(camera.view, pos);
|
||||
mvp : float4 = mul(camera.projection, mv);
|
||||
return mvp;
|
||||
}
|
||||
|
||||
pixel main :: () -> float4 @target {
|
||||
return float4(0.5, 0.5, 0.5, 1.0);
|
||||
}
|
||||
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);
|
||||
}
|
||||
7
test/double_access.ink
Normal file
7
test/double_access.ink
Normal file
@@ -0,0 +1,7 @@
|
||||
p :: properties {
|
||||
v : float2;
|
||||
}
|
||||
|
||||
vertex main ::() {
|
||||
x : float = p.v.x / p.v.y;
|
||||
}
|
||||
10
test/else_if_after_else.ink
Normal file
10
test/else_if_after_else.ink
Normal file
@@ -0,0 +1,10 @@
|
||||
vertex main :: (pos : float3 @position) -> float4 @position {
|
||||
if 0 > 100 {
|
||||
|
||||
} else {
|
||||
|
||||
} else if 0 > 200 {
|
||||
|
||||
}
|
||||
return float4(0.0);
|
||||
}
|
||||
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);
|
||||
}
|
||||
6
test/for_i_loop.ink
Normal file
6
test/for_i_loop.ink
Normal file
@@ -0,0 +1,6 @@
|
||||
vertex main :: () {
|
||||
x := 0;
|
||||
for i : 0..10 {
|
||||
x += 1.0;
|
||||
}
|
||||
}
|
||||
4
test/for_i_one_liner.ink
Normal file
4
test/for_i_one_liner.ink
Normal file
@@ -0,0 +1,4 @@
|
||||
vertex main :: () {
|
||||
x := 0.0;
|
||||
for i : 0..10 x += 2.0;
|
||||
}
|
||||
6
test/for_no_iter.ink
Normal file
6
test/for_no_iter.ink
Normal file
@@ -0,0 +1,6 @@
|
||||
vertex main :: () {
|
||||
x := 0.0;
|
||||
for i : 0.. {
|
||||
x += 2.0;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
vertex main :: (pos : float3) -> int {
|
||||
|
||||
return 0;
|
||||
}
|
||||
6
test/if_cond_assign.ink
Normal file
6
test/if_cond_assign.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);
|
||||
}
|
||||
6
test/if_if_if.ink
Normal file
6
test/if_if_if.ink
Normal file
@@ -0,0 +1,6 @@
|
||||
vertex main :: (pos : float3 @position) -> float4 @position {
|
||||
if if if 0 > 100 {
|
||||
return float4(pos, 1.0);
|
||||
}
|
||||
return float4(0.0);
|
||||
}
|
||||
5
test/if_no_cond.ink
Normal file
5
test/if_no_cond.ink
Normal file
@@ -0,0 +1,5 @@
|
||||
vertex main :: () {
|
||||
if {
|
||||
|
||||
}
|
||||
}
|
||||
5
test/ifdefs.ink
Normal file
5
test/ifdefs.ink
Normal file
@@ -0,0 +1,5 @@
|
||||
#if Defines.Skinning {
|
||||
vertex main :: () {
|
||||
// Stub
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
42
test/large_block.ink
Normal file
42
test/large_block.ink
Normal file
@@ -0,0 +1,42 @@
|
||||
p :: properties {
|
||||
color : float4;
|
||||
rect_position : float2;
|
||||
rect_scale : float2;
|
||||
resolution : float2;
|
||||
texture : Texture2D;
|
||||
sampler : Sampler;
|
||||
}
|
||||
|
||||
PS_Input :: struct {
|
||||
uv : float2 @uv;
|
||||
pos : float4 @pos;
|
||||
}
|
||||
|
||||
vertex main :: (pos : float4 @position) -> PS_Input {
|
||||
res : float2 = p.resolution;
|
||||
scale : float2 = p.rect_scale;
|
||||
rect_pos : float2 = p.rect_position;;
|
||||
|
||||
center : float2 = rect_pos;
|
||||
half_size : float2 = float2(scale.x / 2, scale.y / 2);
|
||||
dst_pos : float4 = float4(pos.x * half_size.x + center.x, pos.y * half_size.y + center.y, 0.0, 1.0);
|
||||
|
||||
result : PS_Input;
|
||||
|
||||
src_p0 : float2 = float2(0.0, 1.0);
|
||||
src_p1 : float2 = float2(1.0, 0.0);
|
||||
|
||||
src_half_size : float2 = (src_p1 - src_p0) / 2;
|
||||
src_center : float2 = (src_p1 + src_p0) / 2;
|
||||
src_pos : float2 = float2(pos.x, pos.y) * src_half_size + src_center;
|
||||
|
||||
result.uv = float2(1, 1);
|
||||
result.pos = float4(2.0 * dst_pos.x / res.x - 1, 2.0 * dst_pos.y / res.y - 1, 0.0, 1.0);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
pixel main :: (input : PS_Input) -> float4 @target0 {
|
||||
color : float4 = p.color;
|
||||
return color;
|
||||
}
|
||||
40
test/lex/arrays.golden
Normal file
40
test/lex/arrays.golden
Normal file
@@ -0,0 +1,40 @@
|
||||
{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_RIGHTPAREN; ; index = 16 ; length = 1 line = 1 ; column = 16 ; value =')'; }
|
||||
{kind = TOKEN_ARROW; ; index = 18 ; length = 2 line = 1 ; column = 18 ; value ='->'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 21 ; length = 6 line = 1 ; column = 21 ; value ='float4'; }
|
||||
{kind = TOKEN_AT; ; index = 28 ; length = 1 line = 1 ; column = 28 ; value ='@'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 29 ; length = 8 line = 1 ; column = 29 ; value ='position'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 38 ; length = 1 line = 1 ; column = 38 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 42 ; length = 3 line = 2 ; column = 0 ; value ='arr'; }
|
||||
{kind = TOKEN_COLON; ; index = 46 ; length = 1 line = 2 ; column = 4 ; value =':'; }
|
||||
{kind = TOKEN_LEFTBRACKET; ; index = 48 ; length = 1 line = 2 ; column = 6 ; value ='['; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 49 ; length = 2 line = 2 ; column = 7 ; value ='16'; }
|
||||
{kind = TOKEN_RIGHTBRACKET; ; index = 51 ; length = 1 line = 2 ; column = 9 ; value =']'; }
|
||||
{kind = TOKEN_DOT; ; index = 52 ; length = 1 line = 2 ; column = 10 ; value ='.'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 53 ; length = 6 line = 2 ; column = 11 ; value ='float4'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 59 ; length = 1 line = 2 ; column = 17 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 63 ; length = 3 line = 3 ; column = 0 ; value ='arr'; }
|
||||
{kind = TOKEN_LEFTBRACKET; ; index = 66 ; length = 1 line = 3 ; column = 3 ; value ='['; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 67 ; length = 1 line = 3 ; column = 4 ; value ='0'; }
|
||||
{kind = TOKEN_RIGHTBRACKET; ; index = 68 ; length = 1 line = 3 ; column = 5 ; value =']'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 70 ; length = 1 line = 3 ; column = 7 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 72 ; length = 6 line = 3 ; column = 9 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 78 ; length = 1 line = 3 ; column = 15 ; value ='('; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 79 ; length = 1 line = 3 ; column = 16 ; value ='1'; }
|
||||
{kind = TOKEN_COMMA; ; index = 80 ; length = 1 line = 3 ; column = 17 ; value =','; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 81 ; length = 1 line = 3 ; column = 18 ; value ='1'; }
|
||||
{kind = TOKEN_COMMA; ; index = 82 ; length = 1 line = 3 ; column = 19 ; value =','; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 83 ; length = 1 line = 3 ; column = 20 ; value ='1'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 84 ; length = 1 line = 3 ; column = 21 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 85 ; length = 1 line = 3 ; column = 22 ; value =';'; }
|
||||
{kind = TOKEN_RETURN; ; index = 89 ; length = 6 line = 4 ; column = 0 ; value ='return'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 96 ; length = 3 line = 4 ; column = 7 ; value ='arr'; }
|
||||
{kind = TOKEN_LEFTBRACKET; ; index = 99 ; length = 1 line = 4 ; column = 10 ; value ='['; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 100 ; length = 1 line = 4 ; column = 11 ; value ='0'; }
|
||||
{kind = TOKEN_RIGHTBRACKET; ; index = 101 ; length = 1 line = 4 ; column = 12 ; value =']'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 102 ; length = 1 line = 4 ; column = 13 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 105 ; length = 1 line = 5 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 108 ; length = 0 line = 6 ; column = 0 ; value =''; }
|
||||
@@ -1,16 +1,16 @@
|
||||
{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_RIGHTPAREN; ; index = 16 ; length = 1 line = 1 ; column = 16 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 18 ; length = 1 line = 1 ; column = 18 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 22 ; length = 1 line = 2 ; column = 0 ; value ='x'; }
|
||||
{kind = TOKEN_COLON; ; index = 24 ; length = 1 line = 2 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 26 ; length = 5 line = 2 ; column = 4 ; value ='float'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 32 ; length = 1 line = 2 ; column = 10 ; value ='='; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 34 ; length = 3 line = 2 ; column = 12 ; value ='2'; }
|
||||
{kind = TOKEN_PLUS; ; index = 38 ; length = 1 line = 2 ; column = 16 ; value ='+'; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 40 ; length = 3 line = 2 ; column = 18 ; value ='5'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 43 ; length = 1 line = 2 ; column = 21 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 46 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 49 ; length = 0 line = 4 ; column = 0 ; value =''; }
|
||||
{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_RIGHTPAREN; ; index = 16 ; length = 1 line = 1 ; column = 16 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 18 ; length = 1 line = 1 ; column = 18 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 22 ; length = 1 line = 2 ; column = 0 ; value ='x'; }
|
||||
{kind = TOKEN_COLON; ; index = 24 ; length = 1 line = 2 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 26 ; length = 5 line = 2 ; column = 4 ; value ='float'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 32 ; length = 1 line = 2 ; column = 10 ; value ='='; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 34 ; length = 3 line = 2 ; column = 12 ; value ='2'; }
|
||||
{kind = TOKEN_PLUS; ; index = 38 ; length = 1 line = 2 ; column = 16 ; value ='+'; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 40 ; length = 3 line = 2 ; column = 18 ; value ='5'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 43 ; length = 1 line = 2 ; column = 21 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 46 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 49 ; length = 0 line = 4 ; column = 0 ; value =''; }
|
||||
|
||||
@@ -1,43 +1,43 @@
|
||||
{kind = TOKEN_PROPERTIES; ; index = 0 ; length = 10 line = 1 ; column = 0 ; value ='properties'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 11 ; length = 1 line = 1 ; column = 11 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 15 ; length = 5 line = 2 ; column = 0 ; value ='color'; }
|
||||
{kind = TOKEN_COLON; ; index = 21 ; length = 1 line = 2 ; column = 6 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 23 ; length = 6 line = 2 ; column = 8 ; value ='float4'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 29 ; length = 1 line = 2 ; column = 14 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 32 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_VERTEX; ; index = 37 ; length = 6 line = 5 ; column = 0 ; value ='vertex'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 44 ; length = 4 line = 5 ; column = 7 ; value ='main'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 49 ; length = 2 line = 5 ; column = 12 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 52 ; length = 1 line = 5 ; column = 15 ; value ='('; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 53 ; length = 3 line = 5 ; column = 16 ; value ='pos'; }
|
||||
{kind = TOKEN_COLON; ; index = 57 ; length = 1 line = 5 ; column = 20 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 59 ; length = 6 line = 5 ; column = 22 ; value ='float3'; }
|
||||
{kind = TOKEN_AT; ; index = 66 ; length = 1 line = 5 ; column = 29 ; value ='@'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 67 ; length = 8 line = 5 ; column = 30 ; value ='position'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 75 ; length = 1 line = 5 ; column = 38 ; value =')'; }
|
||||
{kind = TOKEN_ARROW; ; index = 77 ; length = 2 line = 5 ; column = 40 ; value ='->'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 80 ; length = 6 line = 5 ; column = 43 ; value ='float3'; }
|
||||
{kind = TOKEN_AT; ; index = 87 ; length = 1 line = 5 ; column = 50 ; value ='@'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 88 ; length = 8 line = 5 ; column = 51 ; value ='position'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 97 ; length = 1 line = 5 ; column = 60 ; value ='{'; }
|
||||
{kind = TOKEN_RETURN; ; index = 103 ; length = 6 line = 6 ; column = 2 ; value ='return'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 110 ; length = 3 line = 6 ; column = 9 ; value ='pos'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 113 ; length = 1 line = 6 ; column = 12 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 116 ; length = 1 line = 7 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_PIXEL; ; index = 121 ; length = 5 line = 9 ; column = 0 ; value ='pixel'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 127 ; length = 4 line = 9 ; column = 6 ; value ='main'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 132 ; length = 2 line = 9 ; column = 11 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 135 ; length = 1 line = 9 ; column = 14 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 136 ; length = 1 line = 9 ; column = 15 ; value =')'; }
|
||||
{kind = TOKEN_ARROW; ; index = 138 ; length = 2 line = 9 ; column = 17 ; value ='->'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 141 ; length = 6 line = 9 ; column = 20 ; value ='float4'; }
|
||||
{kind = TOKEN_AT; ; index = 148 ; length = 1 line = 9 ; column = 27 ; value ='@'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 149 ; length = 7 line = 9 ; column = 28 ; value ='target0'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 157 ; length = 1 line = 9 ; column = 36 ; value ='{'; }
|
||||
{kind = TOKEN_RETURN; ; index = 163 ; length = 6 line = 10 ; column = 2 ; value ='return'; }
|
||||
{kind = TOKEN_PROPERTIES; ; index = 170 ; length = 10 line = 10 ; column = 9 ; value ='properties'; }
|
||||
{kind = TOKEN_DOT; ; index = 180 ; length = 1 line = 10 ; column = 19 ; value ='.'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 181 ; length = 5 line = 10 ; column = 20 ; value ='color'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 186 ; length = 1 line = 10 ; column = 25 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 189 ; length = 1 line = 11 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 192 ; length = 0 line = 12 ; column = 0 ; value =''; }
|
||||
{kind = TOKEN_PROPERTIES; ; index = 0 ; length = 10 line = 1 ; column = 0 ; value ='properties'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 11 ; length = 1 line = 1 ; column = 11 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 15 ; length = 5 line = 2 ; column = 0 ; value ='color'; }
|
||||
{kind = TOKEN_COLON; ; index = 21 ; length = 1 line = 2 ; column = 6 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 23 ; length = 6 line = 2 ; column = 8 ; value ='float4'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 29 ; length = 1 line = 2 ; column = 14 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 32 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_VERTEX; ; index = 37 ; length = 6 line = 5 ; column = 0 ; value ='vertex'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 44 ; length = 4 line = 5 ; column = 7 ; value ='main'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 49 ; length = 2 line = 5 ; column = 12 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 52 ; length = 1 line = 5 ; column = 15 ; value ='('; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 53 ; length = 3 line = 5 ; column = 16 ; value ='pos'; }
|
||||
{kind = TOKEN_COLON; ; index = 57 ; length = 1 line = 5 ; column = 20 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 59 ; length = 6 line = 5 ; column = 22 ; value ='float3'; }
|
||||
{kind = TOKEN_AT; ; index = 66 ; length = 1 line = 5 ; column = 29 ; value ='@'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 67 ; length = 8 line = 5 ; column = 30 ; value ='position'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 75 ; length = 1 line = 5 ; column = 38 ; value =')'; }
|
||||
{kind = TOKEN_ARROW; ; index = 77 ; length = 2 line = 5 ; column = 40 ; value ='->'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 80 ; length = 6 line = 5 ; column = 43 ; value ='float3'; }
|
||||
{kind = TOKEN_AT; ; index = 87 ; length = 1 line = 5 ; column = 50 ; value ='@'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 88 ; length = 8 line = 5 ; column = 51 ; value ='position'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 97 ; length = 1 line = 5 ; column = 60 ; value ='{'; }
|
||||
{kind = TOKEN_RETURN; ; index = 103 ; length = 6 line = 6 ; column = 2 ; value ='return'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 110 ; length = 3 line = 6 ; column = 9 ; value ='pos'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 113 ; length = 1 line = 6 ; column = 12 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 116 ; length = 1 line = 7 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_PIXEL; ; index = 121 ; length = 5 line = 9 ; column = 0 ; value ='pixel'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 127 ; length = 4 line = 9 ; column = 6 ; value ='main'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 132 ; length = 2 line = 9 ; column = 11 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 135 ; length = 1 line = 9 ; column = 14 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 136 ; length = 1 line = 9 ; column = 15 ; value =')'; }
|
||||
{kind = TOKEN_ARROW; ; index = 138 ; length = 2 line = 9 ; column = 17 ; value ='->'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 141 ; length = 6 line = 9 ; column = 20 ; value ='float4'; }
|
||||
{kind = TOKEN_AT; ; index = 148 ; length = 1 line = 9 ; column = 27 ; value ='@'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 149 ; length = 7 line = 9 ; column = 28 ; value ='target0'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 157 ; length = 1 line = 9 ; column = 36 ; value ='{'; }
|
||||
{kind = TOKEN_RETURN; ; index = 163 ; length = 6 line = 10 ; column = 2 ; value ='return'; }
|
||||
{kind = TOKEN_PROPERTIES; ; index = 170 ; length = 10 line = 10 ; column = 9 ; value ='properties'; }
|
||||
{kind = TOKEN_DOT; ; index = 180 ; length = 1 line = 10 ; column = 19 ; value ='.'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 181 ; length = 5 line = 10 ; column = 20 ; value ='color'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 186 ; length = 1 line = 10 ; column = 25 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 189 ; length = 1 line = 11 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 192 ; length = 0 line = 12 ; column = 0 ; value =''; }
|
||||
|
||||
223
test/lex/builtin_types.golden
Normal file
223
test/lex/builtin_types.golden
Normal file
@@ -0,0 +1,223 @@
|
||||
{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_RIGHTPAREN; ; index = 16 ; length = 1 line = 1 ; column = 16 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 18 ; length = 1 line = 1 ; column = 18 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 22 ; length = 2 line = 2 ; column = 0 ; value ='v2'; }
|
||||
{kind = TOKEN_COLON; ; index = 25 ; length = 1 line = 2 ; column = 3 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 27 ; length = 6 line = 2 ; column = 5 ; value ='float2'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 34 ; length = 1 line = 2 ; column = 12 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 36 ; length = 6 line = 2 ; column = 14 ; value ='float2'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 42 ; length = 1 line = 2 ; column = 20 ; value ='('; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 43 ; length = 3 line = 2 ; column = 21 ; value ='2'; }
|
||||
{kind = TOKEN_COMMA; ; index = 46 ; length = 1 line = 2 ; column = 24 ; value =','; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 48 ; length = 3 line = 2 ; column = 26 ; value ='2'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 51 ; length = 1 line = 2 ; column = 29 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 52 ; length = 1 line = 2 ; column = 30 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 56 ; length = 2 line = 3 ; column = 0 ; value ='v2'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 59 ; length = 1 line = 3 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 61 ; length = 6 line = 3 ; column = 5 ; value ='float2'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 67 ; length = 1 line = 3 ; column = 11 ; value ='('; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 68 ; length = 3 line = 3 ; column = 12 ; value ='2'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 71 ; length = 1 line = 3 ; column = 15 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 72 ; length = 1 line = 3 ; column = 16 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 76 ; length = 2 line = 4 ; column = 0 ; value ='v2'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 79 ; length = 1 line = 4 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 81 ; length = 6 line = 4 ; column = 5 ; value ='float2'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 87 ; length = 1 line = 4 ; column = 11 ; value ='('; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 88 ; length = 2 line = 4 ; column = 12 ; value ='v2'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 90 ; length = 1 line = 4 ; column = 14 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 91 ; length = 1 line = 4 ; column = 15 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 97 ; length = 2 line = 6 ; column = 0 ; value ='v3'; }
|
||||
{kind = TOKEN_COLON; ; index = 100 ; length = 1 line = 6 ; column = 3 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 102 ; length = 6 line = 6 ; column = 5 ; value ='float3'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 109 ; length = 1 line = 6 ; column = 12 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 111 ; length = 6 line = 6 ; column = 14 ; value ='float3'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 117 ; length = 1 line = 6 ; column = 20 ; value ='('; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 118 ; length = 3 line = 6 ; column = 21 ; value ='2'; }
|
||||
{kind = TOKEN_COMMA; ; index = 121 ; length = 1 line = 6 ; column = 24 ; value =','; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 123 ; length = 3 line = 6 ; column = 26 ; value ='2'; }
|
||||
{kind = TOKEN_COMMA; ; index = 126 ; length = 1 line = 6 ; column = 29 ; value =','; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 128 ; length = 3 line = 6 ; column = 31 ; value ='2'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 131 ; length = 1 line = 6 ; column = 34 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 132 ; length = 1 line = 6 ; column = 35 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 136 ; length = 2 line = 7 ; column = 0 ; value ='v3'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 139 ; length = 1 line = 7 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 141 ; length = 6 line = 7 ; column = 5 ; value ='float3'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 147 ; length = 1 line = 7 ; column = 11 ; value ='('; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 148 ; length = 2 line = 7 ; column = 12 ; value ='v2'; }
|
||||
{kind = TOKEN_COMMA; ; index = 150 ; length = 1 line = 7 ; column = 14 ; value =','; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 152 ; length = 3 line = 7 ; column = 16 ; value ='1'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 155 ; length = 1 line = 7 ; column = 19 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 156 ; length = 1 line = 7 ; column = 20 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 160 ; length = 2 line = 8 ; column = 0 ; value ='v3'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 163 ; length = 1 line = 8 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 165 ; length = 6 line = 8 ; column = 5 ; value ='float3'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 171 ; length = 1 line = 8 ; column = 11 ; value ='('; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 172 ; length = 3 line = 8 ; column = 12 ; value ='1'; }
|
||||
{kind = TOKEN_COMMA; ; index = 175 ; length = 1 line = 8 ; column = 15 ; value =','; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 177 ; length = 2 line = 8 ; column = 17 ; value ='v2'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 179 ; length = 1 line = 8 ; column = 19 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 180 ; length = 1 line = 8 ; column = 20 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 184 ; length = 2 line = 9 ; column = 0 ; value ='v3'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 187 ; length = 1 line = 9 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 189 ; length = 6 line = 9 ; column = 5 ; value ='float3'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 195 ; length = 1 line = 9 ; column = 11 ; value ='('; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 196 ; length = 3 line = 9 ; column = 12 ; value ='1'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 199 ; length = 1 line = 9 ; column = 15 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 200 ; length = 1 line = 9 ; column = 16 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 204 ; length = 2 line = 10 ; column = 0 ; value ='v3'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 207 ; length = 1 line = 10 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 209 ; length = 6 line = 10 ; column = 5 ; value ='float3'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 215 ; length = 1 line = 10 ; column = 11 ; value ='('; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 216 ; length = 2 line = 10 ; column = 12 ; value ='v3'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 218 ; length = 1 line = 10 ; column = 14 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 219 ; length = 1 line = 10 ; column = 15 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 226 ; length = 2 line = 12 ; column = 0 ; value ='v4'; }
|
||||
{kind = TOKEN_COLON; ; index = 229 ; length = 1 line = 12 ; column = 3 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 231 ; length = 6 line = 12 ; column = 5 ; value ='float4'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 238 ; length = 1 line = 12 ; column = 12 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 240 ; length = 6 line = 12 ; column = 14 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 246 ; length = 1 line = 12 ; column = 20 ; value ='('; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 247 ; length = 3 line = 12 ; column = 21 ; value ='2'; }
|
||||
{kind = TOKEN_COMMA; ; index = 250 ; length = 1 line = 12 ; column = 24 ; value =','; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 252 ; length = 3 line = 12 ; column = 26 ; value ='2'; }
|
||||
{kind = TOKEN_COMMA; ; index = 255 ; length = 1 line = 12 ; column = 29 ; value =','; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 257 ; length = 3 line = 12 ; column = 31 ; value ='2'; }
|
||||
{kind = TOKEN_COMMA; ; index = 260 ; length = 1 line = 12 ; column = 34 ; value =','; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 262 ; length = 3 line = 12 ; column = 36 ; value ='2'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 265 ; length = 1 line = 12 ; column = 39 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 266 ; length = 1 line = 12 ; column = 40 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 270 ; length = 2 line = 13 ; column = 0 ; value ='v4'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 273 ; length = 1 line = 13 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 275 ; length = 6 line = 13 ; column = 5 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 281 ; length = 1 line = 13 ; column = 11 ; value ='('; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 282 ; length = 2 line = 13 ; column = 12 ; value ='v4'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 284 ; length = 1 line = 13 ; column = 14 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 285 ; length = 1 line = 13 ; column = 15 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 289 ; length = 2 line = 14 ; column = 0 ; value ='v4'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 292 ; length = 1 line = 14 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 294 ; length = 6 line = 14 ; column = 5 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 300 ; length = 1 line = 14 ; column = 11 ; value ='('; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 301 ; length = 2 line = 14 ; column = 12 ; value ='v2'; }
|
||||
{kind = TOKEN_COMMA; ; index = 303 ; length = 1 line = 14 ; column = 14 ; value =','; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 305 ; length = 2 line = 14 ; column = 16 ; value ='v2'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 307 ; length = 1 line = 14 ; column = 18 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 308 ; length = 1 line = 14 ; column = 19 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 312 ; length = 2 line = 15 ; column = 0 ; value ='v4'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 315 ; length = 1 line = 15 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 317 ; length = 6 line = 15 ; column = 5 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 323 ; length = 1 line = 15 ; column = 11 ; value ='('; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 324 ; length = 2 line = 15 ; column = 12 ; value ='v2'; }
|
||||
{kind = TOKEN_COMMA; ; index = 326 ; length = 1 line = 15 ; column = 14 ; value =','; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 328 ; length = 3 line = 15 ; column = 16 ; value ='1'; }
|
||||
{kind = TOKEN_COMMA; ; index = 331 ; length = 1 line = 15 ; column = 19 ; value =','; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 333 ; length = 3 line = 15 ; column = 21 ; value ='1'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 336 ; length = 1 line = 15 ; column = 24 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 337 ; length = 1 line = 15 ; column = 25 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 341 ; length = 2 line = 16 ; column = 0 ; value ='v4'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 344 ; length = 1 line = 16 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 346 ; length = 6 line = 16 ; column = 5 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 352 ; length = 1 line = 16 ; column = 11 ; value ='('; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 353 ; length = 3 line = 16 ; column = 12 ; value ='1'; }
|
||||
{kind = TOKEN_COMMA; ; index = 356 ; length = 1 line = 16 ; column = 15 ; value =','; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 358 ; length = 2 line = 16 ; column = 17 ; value ='v2'; }
|
||||
{kind = TOKEN_COMMA; ; index = 360 ; length = 1 line = 16 ; column = 19 ; value =','; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 362 ; length = 3 line = 16 ; column = 21 ; value ='1'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 365 ; length = 1 line = 16 ; column = 24 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 366 ; length = 1 line = 16 ; column = 25 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 370 ; length = 2 line = 17 ; column = 0 ; value ='v4'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 373 ; length = 1 line = 17 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 375 ; length = 6 line = 17 ; column = 5 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 381 ; length = 1 line = 17 ; column = 11 ; value ='('; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 382 ; length = 3 line = 17 ; column = 12 ; value ='1'; }
|
||||
{kind = TOKEN_COMMA; ; index = 385 ; length = 1 line = 17 ; column = 15 ; value =','; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 387 ; length = 3 line = 17 ; column = 17 ; value ='1'; }
|
||||
{kind = TOKEN_COMMA; ; index = 390 ; length = 1 line = 17 ; column = 20 ; value =','; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 392 ; length = 2 line = 17 ; column = 22 ; value ='v2'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 394 ; length = 1 line = 17 ; column = 24 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 395 ; length = 1 line = 17 ; column = 25 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 399 ; length = 2 line = 18 ; column = 0 ; value ='v4'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 402 ; length = 1 line = 18 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 404 ; length = 6 line = 18 ; column = 5 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 410 ; length = 1 line = 18 ; column = 11 ; value ='('; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 411 ; length = 2 line = 18 ; column = 12 ; value ='v3'; }
|
||||
{kind = TOKEN_COMMA; ; index = 413 ; length = 1 line = 18 ; column = 14 ; value =','; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 415 ; length = 3 line = 18 ; column = 16 ; value ='2'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 418 ; length = 1 line = 18 ; column = 19 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 419 ; length = 1 line = 18 ; column = 20 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 423 ; length = 2 line = 19 ; column = 0 ; value ='v4'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 426 ; length = 1 line = 19 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 428 ; length = 6 line = 19 ; column = 5 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 434 ; length = 1 line = 19 ; column = 11 ; value ='('; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 435 ; length = 3 line = 19 ; column = 12 ; value ='2'; }
|
||||
{kind = TOKEN_COMMA; ; index = 438 ; length = 1 line = 19 ; column = 15 ; value =','; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 440 ; length = 2 line = 19 ; column = 17 ; value ='v3'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 442 ; length = 1 line = 19 ; column = 19 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 443 ; length = 1 line = 19 ; column = 20 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 447 ; length = 2 line = 20 ; column = 0 ; value ='v4'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 450 ; length = 1 line = 20 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 452 ; length = 6 line = 20 ; column = 5 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 458 ; length = 1 line = 20 ; column = 11 ; value ='('; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 459 ; length = 3 line = 20 ; column = 12 ; value ='2'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 462 ; length = 1 line = 20 ; column = 15 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 463 ; length = 1 line = 20 ; column = 16 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 472 ; length = 2 line = 23 ; column = 0 ; value ='v4'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 475 ; length = 1 line = 23 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 477 ; length = 6 line = 23 ; column = 5 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 483 ; length = 1 line = 23 ; column = 11 ; value ='('; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 484 ; length = 3 line = 23 ; column = 12 ; value ='1'; }
|
||||
{kind = TOKEN_COMMA; ; index = 487 ; length = 1 line = 23 ; column = 15 ; value =','; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 489 ; length = 3 line = 23 ; column = 17 ; value ='1'; }
|
||||
{kind = TOKEN_COMMA; ; index = 492 ; length = 1 line = 23 ; column = 20 ; value =','; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 494 ; length = 2 line = 23 ; column = 22 ; value ='v2'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 496 ; length = 1 line = 23 ; column = 24 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 497 ; length = 1 line = 23 ; column = 25 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 501 ; length = 2 line = 24 ; column = 0 ; value ='v4'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 504 ; length = 1 line = 24 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 506 ; length = 6 line = 24 ; column = 5 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 512 ; length = 1 line = 24 ; column = 11 ; value ='('; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 513 ; length = 3 line = 24 ; column = 12 ; value ='2'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 516 ; length = 1 line = 24 ; column = 15 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 517 ; length = 1 line = 24 ; column = 16 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 524 ; length = 2 line = 26 ; column = 0 ; value ='v2'; }
|
||||
{kind = TOKEN_DOT; ; index = 526 ; length = 1 line = 26 ; column = 2 ; value ='.'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 527 ; length = 1 line = 26 ; column = 3 ; value ='x'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 529 ; length = 1 line = 26 ; column = 5 ; value ='='; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 531 ; length = 3 line = 26 ; column = 7 ; value ='2'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 534 ; length = 1 line = 26 ; column = 10 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 538 ; length = 2 line = 27 ; column = 0 ; value ='v2'; }
|
||||
{kind = TOKEN_DOT; ; index = 540 ; length = 1 line = 27 ; column = 2 ; value ='.'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 541 ; length = 1 line = 27 ; column = 3 ; value ='y'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 543 ; length = 1 line = 27 ; column = 5 ; value ='='; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 545 ; length = 3 line = 27 ; column = 7 ; value ='2'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 548 ; length = 1 line = 27 ; column = 10 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 554 ; length = 1 line = 29 ; column = 0 ; value ='p'; }
|
||||
{kind = TOKEN_COLON; ; index = 556 ; length = 1 line = 29 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 557 ; length = 1 line = 29 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 559 ; length = 2 line = 29 ; column = 5 ; value ='v2'; }
|
||||
{kind = TOKEN_DOT; ; index = 561 ; length = 1 line = 29 ; column = 7 ; value ='.'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 562 ; length = 1 line = 29 ; column = 8 ; value ='x'; }
|
||||
{kind = TOKEN_PLUS; ; index = 564 ; length = 1 line = 29 ; column = 10 ; value ='+'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 566 ; length = 2 line = 29 ; column = 12 ; value ='v3'; }
|
||||
{kind = TOKEN_DOT; ; index = 568 ; length = 1 line = 29 ; column = 14 ; value ='.'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 569 ; length = 1 line = 29 ; column = 15 ; value ='z'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 570 ; length = 1 line = 29 ; column = 16 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 574 ; length = 1 line = 30 ; column = 0 ; value ='q'; }
|
||||
{kind = TOKEN_COLON; ; index = 576 ; length = 1 line = 30 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 577 ; length = 1 line = 30 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 579 ; length = 2 line = 30 ; column = 5 ; value ='v4'; }
|
||||
{kind = TOKEN_DOT; ; index = 581 ; length = 1 line = 30 ; column = 7 ; value ='.'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 582 ; length = 1 line = 30 ; column = 8 ; value ='w'; }
|
||||
{kind = TOKEN_PLUS; ; index = 584 ; length = 1 line = 30 ; column = 10 ; value ='+'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 586 ; length = 2 line = 30 ; column = 12 ; value ='v2'; }
|
||||
{kind = TOKEN_DOT; ; index = 588 ; length = 1 line = 30 ; column = 14 ; value ='.'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 589 ; length = 1 line = 30 ; column = 15 ; value ='x'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 590 ; length = 1 line = 30 ; column = 16 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 596 ; length = 1 line = 32 ; column = 0 ; value ='m'; }
|
||||
{kind = TOKEN_COLON; ; index = 598 ; length = 1 line = 32 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 600 ; length = 8 line = 32 ; column = 4 ; value ='float4x4'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 608 ; length = 1 line = 32 ; column = 12 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 614 ; length = 1 line = 34 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 617 ; length = 0 line = 35 ; column = 0 ; value =''; }
|
||||
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,30 +1,30 @@
|
||||
{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_RIGHTPAREN; ; index = 16 ; length = 1 line = 1 ; column = 16 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 18 ; length = 1 line = 1 ; column = 18 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 22 ; length = 1 line = 2 ; column = 0 ; value ='x'; }
|
||||
{kind = TOKEN_COLON; ; index = 24 ; length = 1 line = 2 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 26 ; length = 5 line = 2 ; column = 4 ; value ='float'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 32 ; length = 1 line = 2 ; column = 10 ; value ='='; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 34 ; length = 3 line = 2 ; column = 12 ; value ='5'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 37 ; length = 1 line = 2 ; column = 15 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 41 ; length = 1 line = 3 ; column = 0 ; value ='y'; }
|
||||
{kind = TOKEN_COLON; ; index = 43 ; length = 1 line = 3 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 45 ; length = 5 line = 3 ; column = 4 ; value ='float'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 51 ; length = 1 line = 3 ; column = 10 ; value ='='; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 53 ; length = 6 line = 3 ; column = 12 ; value ='3000'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 59 ; length = 1 line = 3 ; column = 18 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 65 ; length = 1 line = 5 ; column = 0 ; value ='z'; }
|
||||
{kind = TOKEN_COLON; ; index = 67 ; length = 1 line = 5 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 69 ; length = 5 line = 5 ; column = 4 ; value ='float'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 75 ; length = 1 line = 5 ; column = 10 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 77 ; length = 1 line = 5 ; column = 12 ; value ='y'; }
|
||||
{kind = TOKEN_STAR; ; index = 79 ; length = 1 line = 5 ; column = 14 ; value ='*'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 81 ; length = 1 line = 5 ; column = 16 ; value ='y'; }
|
||||
{kind = TOKEN_PLUS; ; index = 83 ; length = 1 line = 5 ; column = 18 ; value ='+'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 85 ; length = 1 line = 5 ; column = 20 ; value ='x'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 86 ; length = 1 line = 5 ; column = 21 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 89 ; length = 1 line = 6 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 92 ; length = 0 line = 7 ; column = 0 ; value =''; }
|
||||
{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_RIGHTPAREN; ; index = 16 ; length = 1 line = 1 ; column = 16 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 18 ; length = 1 line = 1 ; column = 18 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 22 ; length = 1 line = 2 ; column = 0 ; value ='x'; }
|
||||
{kind = TOKEN_COLON; ; index = 24 ; length = 1 line = 2 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 26 ; length = 5 line = 2 ; column = 4 ; value ='float'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 32 ; length = 1 line = 2 ; column = 10 ; value ='='; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 34 ; length = 3 line = 2 ; column = 12 ; value ='5'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 37 ; length = 1 line = 2 ; column = 15 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 41 ; length = 1 line = 3 ; column = 0 ; value ='y'; }
|
||||
{kind = TOKEN_COLON; ; index = 43 ; length = 1 line = 3 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 45 ; length = 5 line = 3 ; column = 4 ; value ='float'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 51 ; length = 1 line = 3 ; column = 10 ; value ='='; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 53 ; length = 6 line = 3 ; column = 12 ; value ='3000'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 59 ; length = 1 line = 3 ; column = 18 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 65 ; length = 1 line = 5 ; column = 0 ; value ='z'; }
|
||||
{kind = TOKEN_COLON; ; index = 67 ; length = 1 line = 5 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 69 ; length = 5 line = 5 ; column = 4 ; value ='float'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 75 ; length = 1 line = 5 ; column = 10 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 77 ; length = 1 line = 5 ; column = 12 ; value ='y'; }
|
||||
{kind = TOKEN_STAR; ; index = 79 ; length = 1 line = 5 ; column = 14 ; value ='*'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 81 ; length = 1 line = 5 ; column = 16 ; value ='y'; }
|
||||
{kind = TOKEN_PLUS; ; index = 83 ; length = 1 line = 5 ; column = 18 ; value ='+'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 85 ; length = 1 line = 5 ; column = 20 ; value ='x'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 86 ; length = 1 line = 5 ; column = 21 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 89 ; length = 1 line = 6 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 92 ; length = 0 line = 7 ; column = 0 ; value =''; }
|
||||
|
||||
82
test/lex/constant_buffer.golden
Normal file
82
test/lex/constant_buffer.golden
Normal file
@@ -0,0 +1,82 @@
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 0 ; length = 6 line = 1 ; column = 0 ; value ='camera'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 7 ; length = 2 line = 1 ; column = 7 ; value ='::'; }
|
||||
{kind = TOKEN_CONSTANT_BUFFER; ; index = 10 ; length = 15 line = 1 ; column = 10 ; value ='constant_buffer'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 26 ; length = 1 line = 1 ; column = 26 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 30 ; length = 10 line = 2 ; column = 0 ; value ='projection'; }
|
||||
{kind = TOKEN_COLON; ; index = 41 ; length = 1 line = 2 ; column = 11 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 43 ; length = 8 line = 2 ; column = 13 ; value ='float4x4'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 51 ; length = 1 line = 2 ; column = 21 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 55 ; length = 4 line = 3 ; column = 0 ; value ='view'; }
|
||||
{kind = TOKEN_COLON; ; index = 66 ; length = 1 line = 3 ; column = 11 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 68 ; length = 8 line = 3 ; column = 13 ; value ='float4x4'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 76 ; length = 1 line = 3 ; column = 21 ; 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 ='float4'; }
|
||||
{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_IDENTIFIER; ; index = 148 ; length = 2 line = 7 ; column = 0 ; value ='mv'; }
|
||||
{kind = TOKEN_COLON; ; index = 151 ; length = 1 line = 7 ; column = 3 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 153 ; length = 6 line = 7 ; column = 5 ; value ='float4'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 160 ; length = 1 line = 7 ; column = 12 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 162 ; length = 3 line = 7 ; column = 14 ; value ='mul'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 165 ; length = 1 line = 7 ; column = 17 ; value ='('; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 166 ; length = 6 line = 7 ; column = 18 ; value ='camera'; }
|
||||
{kind = TOKEN_DOT; ; index = 172 ; length = 1 line = 7 ; column = 24 ; value ='.'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 173 ; length = 4 line = 7 ; column = 25 ; value ='view'; }
|
||||
{kind = TOKEN_COMMA; ; index = 177 ; length = 1 line = 7 ; column = 29 ; value =','; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 179 ; length = 3 line = 7 ; column = 31 ; value ='pos'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 182 ; length = 1 line = 7 ; column = 34 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 183 ; length = 1 line = 7 ; column = 35 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 187 ; length = 3 line = 8 ; column = 0 ; value ='mvp'; }
|
||||
{kind = TOKEN_COLON; ; index = 191 ; length = 1 line = 8 ; column = 4 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 193 ; length = 6 line = 8 ; column = 6 ; value ='float4'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 200 ; length = 1 line = 8 ; column = 13 ; value ='='; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 202 ; length = 3 line = 8 ; column = 15 ; value ='mul'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 205 ; length = 1 line = 8 ; column = 18 ; value ='('; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 206 ; length = 6 line = 8 ; column = 19 ; value ='camera'; }
|
||||
{kind = TOKEN_DOT; ; index = 212 ; length = 1 line = 8 ; column = 25 ; value ='.'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 213 ; length = 10 line = 8 ; column = 26 ; value ='projection'; }
|
||||
{kind = TOKEN_COMMA; ; index = 223 ; length = 1 line = 8 ; column = 36 ; value =','; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 225 ; length = 2 line = 8 ; column = 38 ; value ='mv'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 227 ; length = 1 line = 8 ; column = 40 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 228 ; length = 1 line = 8 ; column = 41 ; value =';'; }
|
||||
{kind = TOKEN_RETURN; ; index = 232 ; length = 6 line = 9 ; column = 0 ; value ='return'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 239 ; length = 3 line = 9 ; column = 7 ; value ='mvp'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 242 ; length = 1 line = 9 ; column = 10 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 245 ; length = 1 line = 10 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_PIXEL; ; index = 250 ; length = 5 line = 12 ; column = 0 ; value ='pixel'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 256 ; length = 4 line = 12 ; column = 6 ; value ='main'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 261 ; length = 2 line = 12 ; column = 11 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 264 ; length = 1 line = 12 ; column = 14 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 265 ; length = 1 line = 12 ; column = 15 ; value =')'; }
|
||||
{kind = TOKEN_ARROW; ; index = 267 ; length = 2 line = 12 ; column = 17 ; value ='->'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 270 ; length = 6 line = 12 ; column = 20 ; value ='float4'; }
|
||||
{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 =''; }
|
||||
39
test/lex/else_if_after_else.golden
Normal file
39
test/lex/else_if_after_else.golden
Normal file
@@ -0,0 +1,39 @@
|
||||
{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_RIGHTBRACE; ; index = 83 ; length = 1 line = 4 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_ELSE; ; index = 85 ; length = 4 line = 4 ; column = 2 ; value ='else'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 90 ; length = 1 line = 4 ; column = 7 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 99 ; length = 1 line = 6 ; column = 4 ; value ='}'; }
|
||||
{kind = TOKEN_ELSE; ; index = 101 ; length = 4 line = 6 ; column = 6 ; value ='else'; }
|
||||
{kind = TOKEN_IF; ; index = 106 ; length = 2 line = 6 ; column = 11 ; value ='if'; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 109 ; length = 1 line = 6 ; column = 14 ; value ='0'; }
|
||||
{kind = TOKEN_GREATER; ; index = 111 ; length = 1 line = 6 ; column = 16 ; value ='>'; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 113 ; length = 3 line = 6 ; column = 18 ; value ='200'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 117 ; length = 1 line = 6 ; column = 22 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 123 ; length = 1 line = 8 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_RETURN; ; index = 127 ; length = 6 line = 9 ; column = 0 ; value ='return'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 134 ; length = 6 line = 9 ; column = 7 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 140 ; length = 1 line = 9 ; column = 13 ; value ='('; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 141 ; length = 3 line = 9 ; column = 14 ; value ='0'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 144 ; length = 1 line = 9 ; column = 17 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 145 ; length = 1 line = 9 ; column = 18 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 148 ; length = 1 line = 10 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 151 ; length = 0 line = 11 ; column = 0 ; value =''; }
|
||||
@@ -1,6 +1,6 @@
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 0 ; length = 3 line = 1 ; column = 0 ; value ='Foo'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 4 ; length = 2 line = 1 ; column = 4 ; value ='::'; }
|
||||
{kind = TOKEN_STRUCT; ; index = 7 ; length = 6 line = 1 ; column = 7 ; value ='struct'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 14 ; length = 1 line = 1 ; column = 14 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 15 ; length = 1 line = 1 ; column = 15 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 22 ; length = 0 line = 4 ; column = 0 ; value =''; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 0 ; length = 3 line = 1 ; column = 0 ; value ='Foo'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 4 ; length = 2 line = 1 ; column = 4 ; value ='::'; }
|
||||
{kind = TOKEN_STRUCT; ; index = 7 ; length = 6 line = 1 ; column = 7 ; value ='struct'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 14 ; length = 1 line = 1 ; column = 14 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 15 ; length = 1 line = 1 ; column = 15 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 22 ; length = 0 line = 4 ; column = 0 ; value =''; }
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{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_RIGHTPAREN; ; index = 16 ; length = 1 line = 1 ; column = 16 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 18 ; length = 1 line = 1 ; column = 18 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 23 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 24 ; length = 0 line = 3 ; column = 1 ; value =''; }
|
||||
{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_RIGHTPAREN; ; index = 16 ; length = 1 line = 1 ; column = 16 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 18 ; length = 1 line = 1 ; column = 18 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 23 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 24 ; length = 0 line = 3 ; column = 1 ; value =''; }
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
{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 ='float3'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 50 ; length = 1 line = 1 ; column = 50 ; value ='{'; }
|
||||
{kind = TOKEN_RETURN; ; index = 54 ; length = 6 line = 2 ; column = 0 ; value ='return'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 61 ; length = 3 line = 2 ; column = 7 ; value ='pos'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 64 ; length = 1 line = 2 ; column = 10 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 67 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 70 ; length = 0 line = 4 ; column = 0 ; value =''; }
|
||||
{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 ='float3'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 50 ; length = 1 line = 1 ; column = 50 ; value ='{'; }
|
||||
{kind = TOKEN_RETURN; ; index = 54 ; length = 6 line = 2 ; column = 0 ; value ='return'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 61 ; length = 3 line = 2 ; column = 7 ; value ='pos'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 64 ; length = 1 line = 2 ; column = 10 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 67 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 70 ; length = 0 line = 4 ; column = 0 ; value =''; }
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
{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 ='float4'; }
|
||||
{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_IDENTIFIER; ; index = 64 ; length = 1 line = 2 ; column = 0 ; value ='x'; }
|
||||
{kind = TOKEN_COLON; ; index = 66 ; length = 1 line = 2 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 68 ; length = 5 line = 2 ; column = 4 ; value ='float'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 74 ; length = 1 line = 2 ; column = 10 ; value ='='; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 76 ; length = 3 line = 2 ; column = 12 ; value ='5'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 79 ; length = 1 line = 2 ; column = 15 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 83 ; length = 1 line = 3 ; column = 0 ; value ='x'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 85 ; length = 1 line = 3 ; column = 2 ; value ='='; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 87 ; length = 3 line = 3 ; column = 4 ; value ='7'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 90 ; length = 1 line = 3 ; column = 7 ; value =';'; }
|
||||
{kind = TOKEN_RETURN; ; index = 96 ; length = 6 line = 5 ; column = 0 ; value ='return'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 103 ; length = 3 line = 5 ; column = 7 ; value ='pos'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 106 ; length = 1 line = 5 ; column = 10 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 109 ; length = 1 line = 6 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 112 ; length = 0 line = 7 ; column = 0 ; value =''; }
|
||||
{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 ='float4'; }
|
||||
{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_IDENTIFIER; ; index = 64 ; length = 1 line = 2 ; column = 0 ; value ='x'; }
|
||||
{kind = TOKEN_COLON; ; index = 66 ; length = 1 line = 2 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 68 ; length = 5 line = 2 ; column = 4 ; value ='float'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 74 ; length = 1 line = 2 ; column = 10 ; value ='='; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 76 ; length = 3 line = 2 ; column = 12 ; value ='5'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 79 ; length = 1 line = 2 ; column = 15 ; value =';'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 83 ; length = 1 line = 3 ; column = 0 ; value ='x'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 85 ; length = 1 line = 3 ; column = 2 ; value ='='; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 87 ; length = 3 line = 3 ; column = 4 ; value ='7'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 90 ; length = 1 line = 3 ; column = 7 ; value =';'; }
|
||||
{kind = TOKEN_RETURN; ; index = 96 ; length = 6 line = 5 ; column = 0 ; value ='return'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 103 ; length = 3 line = 5 ; column = 7 ; value ='pos'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 106 ; length = 1 line = 5 ; column = 10 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 109 ; length = 1 line = 6 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 112 ; length = 0 line = 7 ; column = 0 ; value =''; }
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{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_RIGHTPAREN; ; index = 16 ; length = 1 line = 1 ; column = 16 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 18 ; length = 1 line = 1 ; column = 18 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 22 ; length = 1 line = 2 ; column = 0 ; value ='x'; }
|
||||
{kind = TOKEN_COLON; ; index = 24 ; length = 1 line = 2 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 25 ; length = 1 line = 2 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 27 ; length = 3 line = 2 ; column = 5 ; value ='5'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 30 ; length = 1 line = 2 ; column = 8 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 33 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 36 ; length = 0 line = 4 ; column = 0 ; value =''; }
|
||||
{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_RIGHTPAREN; ; index = 16 ; length = 1 line = 1 ; column = 16 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 18 ; length = 1 line = 1 ; column = 18 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 22 ; length = 1 line = 2 ; column = 0 ; value ='x'; }
|
||||
{kind = TOKEN_COLON; ; index = 24 ; length = 1 line = 2 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 25 ; length = 1 line = 2 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 27 ; length = 3 line = 2 ; column = 5 ; value ='5'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 30 ; length = 1 line = 2 ; column = 8 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 33 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 36 ; length = 0 line = 4 ; column = 0 ; value =''; }
|
||||
|
||||
35
test/lex/float_if_cond.golden
Normal file
35
test/lex/float_if_cond.golden
Normal file
@@ -0,0 +1,35 @@
|
||||
{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_FLOATLITERAL; ; index = 67 ; length = 3 line = 2 ; column = 3 ; value ='1'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 71 ; length = 1 line = 2 ; column = 7 ; value ='{'; }
|
||||
{kind = TOKEN_RETURN; ; index = 76 ; length = 6 line = 3 ; column = 0 ; value ='return'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 83 ; length = 6 line = 3 ; column = 7 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 89 ; length = 1 line = 3 ; column = 13 ; value ='('; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 90 ; length = 3 line = 3 ; column = 14 ; value ='pos'; }
|
||||
{kind = TOKEN_COMMA; ; index = 93 ; length = 1 line = 3 ; column = 17 ; value =','; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 95 ; length = 3 line = 3 ; column = 19 ; value ='1'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 98 ; length = 1 line = 3 ; column = 22 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 99 ; length = 1 line = 3 ; column = 23 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 103 ; length = 1 line = 4 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_RETURN; ; index = 107 ; length = 6 line = 5 ; column = 0 ; value ='return'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 114 ; length = 6 line = 5 ; column = 7 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 120 ; length = 1 line = 5 ; column = 13 ; value ='('; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 121 ; length = 3 line = 5 ; column = 14 ; value ='0'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 124 ; length = 1 line = 5 ; column = 17 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 125 ; length = 1 line = 5 ; column = 18 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 128 ; length = 1 line = 6 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 131 ; length = 0 line = 7 ; 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
|
||||
^^^^
|
||||
[37m
|
||||
25
test/lex/for_i_loop.golden
Normal file
25
test/lex/for_i_loop.golden
Normal file
@@ -0,0 +1,25 @@
|
||||
{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_RIGHTPAREN; ; index = 16 ; length = 1 line = 1 ; column = 16 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 18 ; length = 1 line = 1 ; column = 18 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 22 ; length = 1 line = 2 ; column = 0 ; value ='x'; }
|
||||
{kind = TOKEN_COLON; ; index = 24 ; length = 1 line = 2 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 25 ; length = 1 line = 2 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 27 ; length = 1 line = 2 ; column = 5 ; value ='0'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 28 ; length = 1 line = 2 ; column = 6 ; value =';'; }
|
||||
{kind = TOKEN_FOR; ; index = 32 ; length = 3 line = 3 ; column = 0 ; value ='for'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 36 ; length = 1 line = 3 ; column = 4 ; value ='i'; }
|
||||
{kind = TOKEN_COLON; ; index = 38 ; length = 1 line = 3 ; column = 6 ; value =':'; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 40 ; length = 1 line = 3 ; column = 8 ; value ='0'; }
|
||||
{kind = TOKEN_DOTDOT; ; index = 41 ; length = 2 line = 3 ; column = 9 ; value ='..'; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 43 ; length = 2 line = 3 ; column = 11 ; value ='10'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 46 ; length = 1 line = 3 ; column = 14 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 51 ; length = 1 line = 4 ; column = 0 ; value ='x'; }
|
||||
{kind = TOKEN_PLUSEQUALS; ; index = 53 ; length = 2 line = 4 ; column = 2 ; value ='+='; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 56 ; length = 3 line = 4 ; column = 5 ; value ='1'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 59 ; length = 1 line = 4 ; column = 8 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 63 ; length = 1 line = 5 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 66 ; length = 1 line = 6 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 69 ; length = 0 line = 7 ; column = 0 ; value =''; }
|
||||
23
test/lex/for_i_one_liner.golden
Normal file
23
test/lex/for_i_one_liner.golden
Normal file
@@ -0,0 +1,23 @@
|
||||
{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_RIGHTPAREN; ; index = 16 ; length = 1 line = 1 ; column = 16 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 18 ; length = 1 line = 1 ; column = 18 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 22 ; length = 1 line = 2 ; column = 0 ; value ='x'; }
|
||||
{kind = TOKEN_COLON; ; index = 24 ; length = 1 line = 2 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 25 ; length = 1 line = 2 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 27 ; length = 3 line = 2 ; column = 5 ; value ='0'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 30 ; length = 1 line = 2 ; column = 8 ; value =';'; }
|
||||
{kind = TOKEN_FOR; ; index = 34 ; length = 3 line = 3 ; column = 0 ; value ='for'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 38 ; length = 1 line = 3 ; column = 4 ; value ='i'; }
|
||||
{kind = TOKEN_COLON; ; index = 40 ; length = 1 line = 3 ; column = 6 ; value =':'; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 42 ; length = 1 line = 3 ; column = 8 ; value ='0'; }
|
||||
{kind = TOKEN_DOTDOT; ; index = 43 ; length = 2 line = 3 ; column = 9 ; value ='..'; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 45 ; length = 2 line = 3 ; column = 11 ; value ='10'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 48 ; length = 1 line = 3 ; column = 14 ; value ='x'; }
|
||||
{kind = TOKEN_PLUSEQUALS; ; index = 50 ; length = 2 line = 3 ; column = 16 ; value ='+='; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 53 ; length = 3 line = 3 ; column = 19 ; value ='2'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 56 ; length = 1 line = 3 ; column = 22 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 59 ; length = 1 line = 4 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 62 ; length = 0 line = 5 ; column = 0 ; value =''; }
|
||||
24
test/lex/for_no_iter.golden
Normal file
24
test/lex/for_no_iter.golden
Normal file
@@ -0,0 +1,24 @@
|
||||
{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_RIGHTPAREN; ; index = 16 ; length = 1 line = 1 ; column = 16 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 18 ; length = 1 line = 1 ; column = 18 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 22 ; length = 1 line = 2 ; column = 0 ; value ='x'; }
|
||||
{kind = TOKEN_COLON; ; index = 24 ; length = 1 line = 2 ; column = 2 ; value =':'; }
|
||||
{kind = TOKEN_ASSIGN; ; index = 25 ; length = 1 line = 2 ; column = 3 ; value ='='; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 27 ; length = 3 line = 2 ; column = 5 ; value ='0'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 30 ; length = 1 line = 2 ; column = 8 ; value =';'; }
|
||||
{kind = TOKEN_FOR; ; index = 34 ; length = 3 line = 3 ; column = 0 ; value ='for'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 38 ; length = 1 line = 3 ; column = 4 ; value ='i'; }
|
||||
{kind = TOKEN_COLON; ; index = 40 ; length = 1 line = 3 ; column = 6 ; value =':'; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 42 ; length = 1 line = 3 ; column = 8 ; value ='0'; }
|
||||
{kind = TOKEN_DOTDOT; ; index = 43 ; length = 2 line = 3 ; column = 9 ; value ='..'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 46 ; length = 1 line = 3 ; column = 12 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 51 ; length = 1 line = 4 ; column = 0 ; value ='x'; }
|
||||
{kind = TOKEN_PLUSEQUALS; ; index = 53 ; length = 2 line = 4 ; column = 2 ; value ='+='; }
|
||||
{kind = TOKEN_FLOATLITERAL; ; index = 56 ; length = 3 line = 4 ; column = 5 ; value ='2'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 59 ; length = 1 line = 4 ; column = 8 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 63 ; length = 1 line = 5 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 66 ; length = 1 line = 6 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 69 ; length = 0 line = 7 ; column = 0 ; value =''; }
|
||||
@@ -1,23 +1,23 @@
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 0 ; length = 3 line = 1 ; column = 0 ; value ='foo'; }
|
||||
{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 = 3 line = 1 ; column = 13 ; value ='int'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 17 ; length = 1 line = 1 ; column = 17 ; value ='{'; }
|
||||
{kind = TOKEN_RETURN; ; index = 21 ; length = 6 line = 2 ; column = 0 ; value ='return'; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 28 ; length = 1 line = 2 ; column = 7 ; value ='4'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 29 ; length = 1 line = 2 ; column = 8 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 32 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_VERTEX; ; index = 37 ; length = 6 line = 5 ; column = 0 ; value ='vertex'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 44 ; length = 4 line = 5 ; column = 7 ; value ='main'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 49 ; length = 2 line = 5 ; column = 12 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 52 ; length = 1 line = 5 ; column = 15 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 53 ; length = 1 line = 5 ; column = 16 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 55 ; length = 1 line = 5 ; column = 18 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 59 ; length = 3 line = 6 ; column = 0 ; value ='foo'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 62 ; length = 1 line = 6 ; column = 3 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 63 ; length = 1 line = 6 ; column = 4 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 64 ; length = 1 line = 6 ; column = 5 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 67 ; length = 1 line = 7 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 70 ; length = 0 line = 8 ; column = 0 ; value =''; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 0 ; length = 3 line = 1 ; column = 0 ; value ='foo'; }
|
||||
{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 = 3 line = 1 ; column = 13 ; value ='int'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 17 ; length = 1 line = 1 ; column = 17 ; value ='{'; }
|
||||
{kind = TOKEN_RETURN; ; index = 21 ; length = 6 line = 2 ; column = 0 ; value ='return'; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 28 ; length = 1 line = 2 ; column = 7 ; value ='4'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 29 ; length = 1 line = 2 ; column = 8 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 32 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_VERTEX; ; index = 37 ; length = 6 line = 5 ; column = 0 ; value ='vertex'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 44 ; length = 4 line = 5 ; column = 7 ; value ='main'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 49 ; length = 2 line = 5 ; column = 12 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 52 ; length = 1 line = 5 ; column = 15 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 53 ; length = 1 line = 5 ; column = 16 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 55 ; length = 1 line = 5 ; column = 18 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 59 ; length = 3 line = 6 ; column = 0 ; value ='foo'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 62 ; length = 1 line = 6 ; column = 3 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 63 ; length = 1 line = 6 ; column = 4 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 64 ; length = 1 line = 6 ; column = 5 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 67 ; length = 1 line = 7 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 70 ; length = 0 line = 8 ; column = 0 ; value =''; }
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
{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_RIGHTPAREN; ; index = 16 ; length = 1 line = 1 ; column = 16 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 18 ; length = 1 line = 1 ; column = 18 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 22 ; length = 3 line = 2 ; column = 0 ; value ='foo'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 25 ; length = 1 line = 2 ; column = 3 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 26 ; length = 1 line = 2 ; column = 4 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 27 ; length = 1 line = 2 ; column = 5 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 30 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 35 ; length = 3 line = 5 ; column = 0 ; value ='foo'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 39 ; length = 2 line = 5 ; column = 4 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 42 ; length = 1 line = 5 ; column = 7 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 43 ; length = 1 line = 5 ; column = 8 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 45 ; length = 1 line = 5 ; column = 10 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 50 ; length = 1 line = 7 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 53 ; length = 0 line = 8 ; column = 0 ; value =''; }
|
||||
{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_RIGHTPAREN; ; index = 16 ; length = 1 line = 1 ; column = 16 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 18 ; length = 1 line = 1 ; column = 18 ; value ='{'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 22 ; length = 3 line = 2 ; column = 0 ; value ='foo'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 25 ; length = 1 line = 2 ; column = 3 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 26 ; length = 1 line = 2 ; column = 4 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 27 ; length = 1 line = 2 ; column = 5 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 30 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 35 ; length = 3 line = 5 ; column = 0 ; value ='foo'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 39 ; length = 2 line = 5 ; column = 4 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 42 ; length = 1 line = 5 ; column = 7 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 43 ; length = 1 line = 5 ; column = 8 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 45 ; length = 1 line = 5 ; column = 10 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 50 ; length = 1 line = 7 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 53 ; length = 0 line = 8 ; column = 0 ; value =''; }
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
{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_RIGHTPAREN; ; index = 16 ; length = 1 line = 1 ; column = 16 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 18 ; length = 1 line = 1 ; column = 18 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 23 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_PIXEL; ; index = 28 ; length = 5 line = 5 ; column = 0 ; value ='pixel'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 34 ; length = 4 line = 5 ; column = 6 ; value ='main'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 39 ; length = 2 line = 5 ; column = 11 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 42 ; length = 1 line = 5 ; column = 14 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 43 ; length = 1 line = 5 ; column = 15 ; value =')'; }
|
||||
{kind = TOKEN_ARROW; ; index = 45 ; length = 2 line = 5 ; column = 17 ; value ='->'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 48 ; length = 6 line = 5 ; column = 20 ; value ='float4'; }
|
||||
{kind = TOKEN_AT; ; index = 55 ; length = 1 line = 5 ; column = 27 ; value ='@'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 56 ; length = 7 line = 5 ; column = 28 ; value ='target0'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 64 ; length = 1 line = 5 ; column = 36 ; value ='{'; }
|
||||
{kind = TOKEN_RETURN; ; index = 68 ; length = 6 line = 6 ; column = 0 ; value ='return'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 75 ; length = 6 line = 6 ; column = 7 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 81 ; length = 1 line = 6 ; column = 13 ; value ='('; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 82 ; length = 1 line = 6 ; column = 14 ; value ='1'; }
|
||||
{kind = TOKEN_COMMA; ; index = 83 ; length = 1 line = 6 ; column = 15 ; value =','; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 85 ; length = 1 line = 6 ; column = 17 ; value ='1'; }
|
||||
{kind = TOKEN_COMMA; ; index = 86 ; length = 1 line = 6 ; column = 18 ; value =','; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 88 ; length = 1 line = 6 ; column = 20 ; value ='1'; }
|
||||
{kind = TOKEN_COMMA; ; index = 89 ; length = 1 line = 6 ; column = 21 ; value =','; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 91 ; length = 1 line = 6 ; column = 23 ; value ='1'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 92 ; length = 1 line = 6 ; column = 24 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 93 ; length = 1 line = 6 ; column = 25 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 96 ; length = 1 line = 7 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 99 ; length = 0 line = 8 ; column = 0 ; value =''; }
|
||||
{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_RIGHTPAREN; ; index = 16 ; length = 1 line = 1 ; column = 16 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 18 ; length = 1 line = 1 ; column = 18 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 23 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_PIXEL; ; index = 28 ; length = 5 line = 5 ; column = 0 ; value ='pixel'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 34 ; length = 4 line = 5 ; column = 6 ; value ='main'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 39 ; length = 2 line = 5 ; column = 11 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 42 ; length = 1 line = 5 ; column = 14 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 43 ; length = 1 line = 5 ; column = 15 ; value =')'; }
|
||||
{kind = TOKEN_ARROW; ; index = 45 ; length = 2 line = 5 ; column = 17 ; value ='->'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 48 ; length = 6 line = 5 ; column = 20 ; value ='float4'; }
|
||||
{kind = TOKEN_AT; ; index = 55 ; length = 1 line = 5 ; column = 27 ; value ='@'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 56 ; length = 7 line = 5 ; column = 28 ; value ='target0'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 64 ; length = 1 line = 5 ; column = 36 ; value ='{'; }
|
||||
{kind = TOKEN_RETURN; ; index = 68 ; length = 6 line = 6 ; column = 0 ; value ='return'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 75 ; length = 6 line = 6 ; column = 7 ; value ='float4'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 81 ; length = 1 line = 6 ; column = 13 ; value ='('; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 82 ; length = 1 line = 6 ; column = 14 ; value ='1'; }
|
||||
{kind = TOKEN_COMMA; ; index = 83 ; length = 1 line = 6 ; column = 15 ; value =','; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 85 ; length = 1 line = 6 ; column = 17 ; value ='1'; }
|
||||
{kind = TOKEN_COMMA; ; index = 86 ; length = 1 line = 6 ; column = 18 ; value =','; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 88 ; length = 1 line = 6 ; column = 20 ; value ='1'; }
|
||||
{kind = TOKEN_COMMA; ; index = 89 ; length = 1 line = 6 ; column = 21 ; value =','; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 91 ; length = 1 line = 6 ; column = 23 ; value ='1'; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 92 ; length = 1 line = 6 ; column = 24 ; value =')'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 93 ; length = 1 line = 6 ; column = 25 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 96 ; length = 1 line = 7 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 99 ; length = 0 line = 8 ; column = 0 ; value =''; }
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
{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_RIGHTPAREN; ; index = 28 ; length = 1 line = 1 ; column = 28 ; value =')'; }
|
||||
{kind = TOKEN_ARROW; ; index = 30 ; length = 2 line = 1 ; column = 30 ; value ='->'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 33 ; length = 3 line = 1 ; column = 33 ; value ='int'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 37 ; length = 1 line = 1 ; column = 37 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 43 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 46 ; length = 0 line = 4 ; column = 0 ; value =''; }
|
||||
{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_RIGHTPAREN; ; index = 28 ; length = 1 line = 1 ; column = 28 ; value =')'; }
|
||||
{kind = TOKEN_ARROW; ; index = 30 ; length = 2 line = 1 ; column = 30 ; value ='->'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 33 ; length = 3 line = 1 ; column = 33 ; value ='int'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 37 ; length = 1 line = 1 ; column = 37 ; value ='{'; }
|
||||
{kind = TOKEN_RETURN; ; index = 41 ; length = 6 line = 2 ; column = 0 ; value ='return'; }
|
||||
{kind = TOKEN_INTLITERAL; ; index = 48 ; length = 1 line = 2 ; column = 7 ; value ='0'; }
|
||||
{kind = TOKEN_SEMICOLON; ; index = 49 ; length = 1 line = 2 ; column = 8 ; value =';'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 52 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 55 ; length = 0 line = 4 ; column = 0 ; value =''; }
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 0 ; length = 3 line = 1 ; column = 0 ; value ='foo'; }
|
||||
{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_LEFTBRACE; ; index = 10 ; length = 1 line = 1 ; column = 10 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 11 ; length = 1 line = 1 ; column = 11 ; value ='}'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 14 ; length = 3 line = 2 ; column = 0 ; value ='foo'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 18 ; length = 2 line = 2 ; column = 4 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 21 ; length = 1 line = 2 ; column = 7 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 22 ; length = 1 line = 2 ; column = 8 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 24 ; length = 1 line = 2 ; column = 10 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 25 ; length = 1 line = 2 ; column = 11 ; value ='}'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 28 ; length = 3 line = 3 ; column = 0 ; value ='bar'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 32 ; length = 2 line = 3 ; column = 4 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 35 ; length = 1 line = 3 ; column = 7 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 36 ; length = 1 line = 3 ; column = 8 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 38 ; length = 1 line = 3 ; column = 10 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 39 ; length = 1 line = 3 ; column = 11 ; value ='}'; }
|
||||
{kind = TOKEN_VERTEX; ; index = 44 ; length = 6 line = 5 ; column = 0 ; value ='vertex'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 51 ; length = 4 line = 5 ; column = 7 ; value ='main'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 56 ; length = 2 line = 5 ; column = 12 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 59 ; length = 1 line = 5 ; column = 15 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 60 ; length = 1 line = 5 ; column = 16 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 62 ; length = 1 line = 5 ; column = 18 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 67 ; length = 1 line = 7 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 70 ; length = 0 line = 8 ; column = 0 ; value =''; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 0 ; length = 3 line = 1 ; column = 0 ; value ='foo'; }
|
||||
{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_LEFTBRACE; ; index = 10 ; length = 1 line = 1 ; column = 10 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 11 ; length = 1 line = 1 ; column = 11 ; value ='}'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 14 ; length = 3 line = 2 ; column = 0 ; value ='foo'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 18 ; length = 2 line = 2 ; column = 4 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 21 ; length = 1 line = 2 ; column = 7 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 22 ; length = 1 line = 2 ; column = 8 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 24 ; length = 1 line = 2 ; column = 10 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 25 ; length = 1 line = 2 ; column = 11 ; value ='}'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 28 ; length = 3 line = 3 ; column = 0 ; value ='bar'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 32 ; length = 2 line = 3 ; column = 4 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 35 ; length = 1 line = 3 ; column = 7 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 36 ; length = 1 line = 3 ; column = 8 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 38 ; length = 1 line = 3 ; column = 10 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 39 ; length = 1 line = 3 ; column = 11 ; value ='}'; }
|
||||
{kind = TOKEN_VERTEX; ; index = 44 ; length = 6 line = 5 ; column = 0 ; value ='vertex'; }
|
||||
{kind = TOKEN_IDENTIFIER; ; index = 51 ; length = 4 line = 5 ; column = 7 ; value ='main'; }
|
||||
{kind = TOKEN_DOUBLECOLON; ; index = 56 ; length = 2 line = 5 ; column = 12 ; value ='::'; }
|
||||
{kind = TOKEN_LEFTPAREN; ; index = 59 ; length = 1 line = 5 ; column = 15 ; value ='('; }
|
||||
{kind = TOKEN_RIGHTPAREN; ; index = 60 ; length = 1 line = 5 ; column = 16 ; value =')'; }
|
||||
{kind = TOKEN_LEFTBRACE; ; index = 62 ; length = 1 line = 5 ; column = 18 ; value ='{'; }
|
||||
{kind = TOKEN_RIGHTBRACE; ; index = 67 ; length = 1 line = 7 ; column = 0 ; value ='}'; }
|
||||
{kind = TOKEN_EOF; ; index = 70 ; length = 0 line = 8 ; column = 0 ; value =''; }
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user