Compare commits

12 Commits

76 changed files with 1443 additions and 1000 deletions

57
AST.jai
View File

@@ -8,23 +8,17 @@ AST_Kind :: enum {
Function;
Return;
// @Incomplete(nb): Should these three really be their own block types?
// Maybe they at least shouldn't need to have their own tokens...
Properties;
Meta;
Instance;
//==
// Directives
If_Directive;
// Hint;
// Type;
// Operator;
Access;
Call;
Struct;
If;
For;
CBuffer;
Buffer;
FieldList;
ArgList;
Variable;
@@ -261,9 +255,15 @@ pretty_print_binary :: (node : *AST_Node, indentation : int, builder : *String_B
if !skip_indent {
indent(builder, indentation);
}
if node.token.kind == .TOKEN_LEFTBRACKET {
pretty_print_node(node.children[0], 0, builder);
append(builder, "[");
pretty_print_node(node.children[1], 0, builder);
append(builder, "]");
} else {
append(builder, "(");
op := node.token;
print_to_builder(builder, op_to_string(op));
append(builder, " ");
@@ -271,6 +271,19 @@ pretty_print_binary :: (node : *AST_Node, indentation : int, builder : *String_B
append(builder, " ");
pretty_print_node(node.children[1], 0, builder);
append(builder, ")");
}
}
pretty_print_access :: (node : *AST_Node, indentation : int, builder : *String_Builder, skip_indent := false) {
if !skip_indent {
indent(builder, indentation);
}
pretty_print_node(node.children[0], 0, builder);
append(builder, ".");
pretty_print_node(node.children[1], 0, builder);
}
pretty_print_unary :: (node : *AST_Node, indentation : int, builder : *String_Builder, skip_indent := false) {
@@ -401,6 +414,9 @@ pretty_print_node :: (node : *AST_Node, indentation : int, builder : *String_Bui
case .Binary; {
pretty_print_binary(node, indentation, builder, skip_indent);
}
case .Access; {
pretty_print_access(node, indentation, builder, skip_indent);
}
case .Unary; {
pretty_print_unary(node, indentation, builder, skip_indent);
}
@@ -469,26 +485,25 @@ pretty_print_declaration :: (declaration : *AST_Node, indentation : int, builder
append(builder, "#if ");
}
if declaration.kind == .Properties {
append(builder, "properties");
if declaration.name.count > 0 {
print_to_builder(builder, " %", declaration.name);
}
} else if declaration.kind == .Instance {
append(builder, "instance");
} else if declaration.kind == .Meta {
append(builder, "meta");
}
else {
if declaration.kind == .Struct {
append(builder, "struct ");
} else if declaration.kind == .CBuffer {
append(builder, "constant_buffer ");
} else if declaration.kind == .Buffer {
append(builder, "buffer ");
}
if declaration.kind != .If_Directive {
print_to_builder(builder, "%", declaration.name);
if declaration.kind == .CBuffer || declaration.kind == .Buffer{
for hint : declaration.hint_tokens {
if hint.string_value.count > 0 {
print_to_builder(builder, " (@%)", hint.string_value);
}
}
// if declaration.kind != .If_Directive {
// print_to_builder(builder, "%", declaration.name);
// }
}
if declaration.kind == .Function && declaration.token.kind == .TOKEN_IDENTIFIER{
print_to_builder(builder, " -> %", declaration.token.ident_value);

418
Check.jai
View File

@@ -5,7 +5,11 @@
/////////////////////////////////////
//~ nbr: Error reporting TODOs
//
// [ ] Add a sentinel variable that works for from_handle
// [ ] Add and error for using keywords as names, or rename the dx11 keywords in the resulting hlsl shader.
// [ ] Add missing scope in for loop for loop iterator
// [ ] Add swizzling
// [ ] Add temp assignment fail check: (a + b).x = float2(0, 0);
// [x] Improve error reporting on mismatched overloads when types don't match, but arity does.
// [x] Improve error reporting for type mismatches in general. It seems like the expect node is not always correct.
@@ -35,14 +39,14 @@ Type_Kind :: enum {
Unresolved_Expression;
Struct;
Properties;
CBuffer;
Buffer;
Array;
}
Source_Kind :: enum {
Expression;
Declaration; // struct, properties, function, etc.
Declaration; // struct, cbuffers, function, etc.
}
Typenames :: string.[
@@ -65,6 +69,8 @@ Type_Variable :: struct {
name : string;
//@Note(niels) For functions
return_type_variable : Type_Variable_Handle;
@@ -75,11 +81,16 @@ Type_Variable :: struct {
struct_field_parent : *AST_Node;
typename : string;
is_array : bool;
element_type : Type_Variable_Handle;
element_count : int;
MAX_TYPE_VARIABLE_CHILDREN :: 32;
children : Static_Array(Type_Variable_Handle, MAX_TYPE_VARIABLE_CHILDREN);
//@Incomplete: Should we remove this and do it in the output generation instead?
// Seems kind of superfluous considering we auto-generate it.
// Otherwise if we want to specify it, it should be specified as a hint @binding(index)
// In the case of using hints, we can just have it on the AST node.
//@Note(niels): For constant buffers
resource_index : u32;
@@ -108,7 +119,7 @@ Scope_Kind :: enum {
Global;
Function;
Struct;
Properties;
Block;
}
Scope :: struct {
@@ -145,6 +156,8 @@ Checker :: struct {
ctx : *Compiler_Context;
checking_lvalue : bool;
current_buffer_index : u32 = 0;
current_sampler_index : u32 = 0;
current_texture_index : u32 = 0;
@@ -409,6 +422,43 @@ Error: Undeclared identifier 'name'.
record_error(checker, message, node.source_location, false);
}
cannot_assign_to_lvalue :: (checker : *Checker, node : *AST_Node) {
/*
Cannot assign to an lvalue.
(a + b).x = 2.0;
*/
builder : String_Builder;
init_string_builder(*builder,, temp);
append(*builder, "Cannot assign to an lvalue.\n");
cyan(*builder);
indent(*builder, 1);
location := node.source_location;
begin : Token = node.token;
begin.index -= begin.column;
begin.length += begin.column;
begin.source -= begin.column;
begin.column = 0;
location.begin = begin;
print("%\n", location.main_token.kind);
print_to_builder(*builder, "%\n", print_from_source_location(checker.ctx, location));
// print_to_builder(*builder, "%\n", print_from_source_location(checker.ctx, node.source_location));
indent(*builder, 1);
print_token_pointer(*builder, location.begin);
newline(*builder);
newline(*builder);
message := builder_to_string(*builder);
record_error(checker, message, node.source_location, false);
}
field_not_defined_on_struct :: (checker : *Checker, node : *AST_Node, struct_symbol : *Defined_Symbol) {
/*
Field '%' is not defined in struct '%'.
@@ -463,12 +513,10 @@ Attempting to access a field on a primitive type '%'.
print_to_builder(*builder, "%\n", print_from_source_location(checker.ctx, node.source_location));
indent(*builder, 1);
node_variable := from_handle(checker, node.type_variable);
for 0..node.name.count - 1 {
append(*builder, " ");
}
print_token_pointer(*builder, node.source_location.begin);
// for 0..variable.source_node.name.count - 1 {
// append(*builder, " ");
// }
print_token_pointer(*builder, node.source_location.main_token);
append(*builder, "\n");
@@ -539,11 +587,11 @@ type_mismatch :: (checker : *Checker, usage_site : *AST_Node, expect_node : *AST
child_handle := got_var.children[i];
child := from_handle(checker, child_handle);
print_to_builder(*builder, "% : %", child.name, type_to_string(child));
print_to_builder(*builder, "% : %", child.name, type_to_string(checker.ctx.type_variables, child));
}
}
print_to_builder(*builder, "Type mismatch. Expected % got %\n", type_to_string(expect_var), type_to_string(got_var));
print_to_builder(*builder, "Type mismatch. Expected % got %\n", type_to_string(checker.ctx.type_variables, expect_var), type_to_string(checker.ctx.type_variables, got_var));
cyan(*builder);
location := usage_site.source_location;
@@ -813,7 +861,16 @@ new_builtin_function :: (checker : *Checker, name : string, args : []Arg, return
if return_arg.typename.count > 0 {
return_var, return_handle := new_type_variable(checker);
return_var.type = lookup_type(checker, checker.current_scope, return_arg.typename, *return_var.typename);
symb : Defined_Symbol;
return_var.type = lookup_type(checker, checker.current_scope, return_arg.typename, *return_var.typename, *symb);
if symb.type_variable > 0 {
symb_var := from_handle(checker, symb.type_variable);
if symb_var.type == .Array || symb_var.type == .Buffer {
return_var.element_type = symb_var.element_type;
// return_var.element_typename = symb_var.element_typename;
return_var.element_count = symb_var.element_count;
}
}
from_handle(checker, handle).return_type_variable = return_handle;
}
@@ -834,10 +891,6 @@ add_child :: (checker : *Checker, handle : Type_Variable_Handle, child : Type_Va
}
init_semantic_checker :: (checker : *Checker, root : *AST_Node, path : string) {
checker.current_buffer_index = 0;
checker.current_sampler_index = 0;
checker.current_texture_index = 0;
checker.program_root = root;
checker.path = path;
@@ -915,7 +968,6 @@ proper_type_to_string :: (ctx : *Compiler_Context, builder : *String_Builder, va
}
append(builder, ")");
if var.return_type_variable > 0 {
append(builder, " -> ", );
return_var := from_handle(variables, var.return_type_variable);
@@ -959,7 +1011,7 @@ proper_type_to_string :: (ctx : *Compiler_Context, variables : []Type_Variable,
return "______not proper type______";
}
lookup_type :: (checker : *Checker, scope : Scope_Handle, type_string : string, typename : *string = null) -> Type_Kind {
lookup_type :: (scope_stack : Scope_Stack, variables : []Type_Variable, scope : Scope_Handle, type_string : string, typename : *string = null, out_symbol : *Defined_Symbol = null) -> Type_Kind {
if type_string == {
case Typenames[Type_Kind.Int]; return .Int;
case Typenames[Type_Kind.Half]; return .Half;
@@ -969,9 +1021,12 @@ lookup_type :: (checker : *Checker, scope : Scope_Handle, type_string : string,
case Typenames[Type_Kind.Texture2D]; return .Texture2D;
}
symbol := find_symbol(checker, type_string, scope);
symbol := find_symbol(scope_stack, type_string, scope);
if symbol {
symbol_var := from_handle(checker, symbol.type_variable);
if out_symbol {
out_symbol.* = symbol.*;
}
symbol_var := from_handle(variables, symbol.type_variable);
if symbol_var.type == .Struct {
if typename {
typename.* = symbol_var.typename;
@@ -985,15 +1040,21 @@ lookup_type :: (checker : *Checker, scope : Scope_Handle, type_string : string,
return .Invalid;
}
lookup_type :: (checker : *Checker, scope : Scope_Handle, type_string : string, typename : *string = null, out_symbol : *Defined_Symbol = null) -> Type_Kind {
return lookup_type(checker.ctx.scope_stack, checker.ctx.type_variables, scope, type_string, typename, out_symbol);
}
lookup_type :: (checker : *Checker, scope : Scope_Handle, node : *AST_Node, typename : *string = null) -> Type_Kind {
type_string := node.token.ident_value;
return lookup_type(checker, scope, type_string, typename);
}
check_block :: (checker : *Checker, node : *AST_Node) {
push_scope(checker, kind = Scope_Kind.Block);
for child : node.children {
check_node(checker, child);
}
pop_scope(checker);
}
declare_struct :: (checker : *Checker, node : *AST_Node, name : string) -> Type_Variable_Handle {
@@ -1043,33 +1104,52 @@ declare_struct :: (checker : *Checker, node : *AST_Node) -> Type_Variable_Handle
return declare_struct(checker, node, node.name);
}
declare_properties :: (checker : *Checker, node : *AST_Node) -> Type_Variable_Handle {
name := ifx node.name.count == 0 then "properties" else node.name;
if node.name.count > 0 {
checker.ctx.property_name = name;
} else {
checker.ctx.property_name = "properties";
}
type_var := declare_struct(checker, node, name);
var := from_handle(checker, type_var);
var.type = .Properties;
var.typename = "properties";
var.resource_index = checker.current_buffer_index;
checker.current_buffer_index += 1;
return type_var;
}
declare_cbuffer :: (checker : *Checker, node : *AST_Node) -> Type_Variable_Handle {
type_var := declare_struct(checker, node);
var := from_handle(checker, type_var);
var.type = .CBuffer;
var.resource_index = checker.current_buffer_index;
checker.current_buffer_index += 1;
array_add(*checker.ctx.constant_buffers, type_var);
array_add(*checker.ctx.typed_buffers, type_var);
return type_var;
}
declare_buffer :: (checker : *Checker, node : *AST_Node) -> Type_Variable_Handle {
variable, handle := new_type_variable(checker);
variable.type = .Buffer;
variable.source_kind = .Declaration;
variable.name = node.name;
variable.source_node = node;
find_result := find_symbol(checker, node.name, checker.current_scope);
if !find_result {
symbol : Defined_Symbol;
symbol.name = node.name;
symbol.source_node = node;
symbol.type_variable = handle;
add_symbol_to_scope(checker.state, *checker.ctx.scope_stack, checker.current_scope, node.name, symbol);
} else {
symbol_redeclaration(checker, node, find_result);
return 0;
}
buffer_struct_name := sprint("__buffer_substruct__%_%", random_get(), node.name);
variable.element_type = declare_struct(checker, node, buffer_struct_name);
variable.resource_index = checker.current_texture_index;
element := from_handle(checker, variable.element_type);
scope := get_scope(checker, element.scope);
scope.builtin = true;
variable.scope = element.scope;
checker.current_texture_index += 1;
node.type_variable = handle;
array_add(*checker.ctx.typed_buffers, handle);
return handle;
}
get_actual_function_name :: (node : *AST_Node) -> string {
name_to_check := node.name;
if node.vertex_entry_point {
@@ -1120,7 +1200,7 @@ declare_function :: (checker : *Checker, node : *AST_Node, builtin : bool = fals
symbol.source_node = node;
symbol.type_variable = 0;
symbol.functions.allocator = get_current_scope(checker).allocator;
array_reserve(*symbol.functions, 32);
array_reserve(*symbol.functions, 4);
array_add(*symbol.functions, function);
add_symbol_to_scope(checker.state, *checker.ctx.scope_stack, checker.current_scope, name_to_check, symbol);
@@ -1183,7 +1263,8 @@ declare_function :: (checker : *Checker, node : *AST_Node, builtin : bool = fals
variable.scope = scope_handle;
}
for child : node.children {
for i : 0..node.children.count - 1 {
child := node.children[i];
if child.kind == .FieldList {
for field : child.children {
type_var := check_node(checker, field);
@@ -1262,44 +1343,13 @@ check_function :: (checker : *Checker, node : *AST_Node) {
}
}
check_variable :: (checker : *Checker, node : *AST_Node, struct_field_parent : *AST_Node = null) -> Type_Variable_Handle {
check_variable :: (checker : *Checker, node : *AST_Node) -> Type_Variable_Handle {
find_result := find_symbol(checker, node.name, checker.current_scope);
// x : int;
// x.d = 5;
if find_result {
node.type_variable = find_result.type_variable;
variable := from_handle(checker, find_result.type_variable);
variable.struct_field_parent = struct_field_parent;
if get_scope(checker, checker.current_scope).kind == .Struct {
variable.scope = checker.current_scope;
}
if node.children.count > 0 {
if variable.type != .Struct && variable.type != .Properties && variable.type != .CBuffer {
field_access_on_primitive_type(checker, node, find_result.type_variable);
return 0;
} else {
lookup_name : string = variable.typename;
if variable.typename == "properties" {
lookup_name = variable.name;
}
struct_symbol := find_symbol(checker, lookup_name, checker.current_scope);
type_variable := from_handle(checker, struct_symbol.type_variable);
previous_scope := use_scope(checker, type_variable.scope);
child := node.children[0];
var := find_symbol(checker, child.name, type_variable.scope);
if var == null {
field_not_defined_on_struct(checker, child, struct_symbol);
return 0;
}
access := check_variable(checker, child, node);
use_scope(checker, previous_scope);
return access;
}
}
return find_result.type_variable;
}
@@ -1324,11 +1374,20 @@ check_field :: (checker : *Checker, node : *AST_Node) -> Type_Variable_Handle {
variable, handle := new_type_variable(checker);
variable.name = node.name;
typename : string;
if node.array_field {
variable.type = .Array;
element_type, element_handle := new_type_variable(checker);
element_type.type = lookup_type(checker, checker.current_scope, node, *element_type.typename);
element_type.scope = checker.current_scope;
variable.element_type = element_handle;
variable.element_count = node.children[0].integer_value;
} else {
variable.type = lookup_type(checker, checker.current_scope, node, *typename);
}
variable.is_array = node.array_field;
if variable.is_array {
if variable.type == .Array {
size_node := node.children[0];
size_var := check_node(checker, size_node);
if from_handle(checker, size_var).type != .Int {
@@ -1336,16 +1395,6 @@ check_field :: (checker : *Checker, node : *AST_Node) -> Type_Variable_Handle {
}
}
if variable.source_kind == .Declaration && variable.type == .Sampler {
variable.resource_index = checker.current_sampler_index;
checker.current_sampler_index += 1;
}
if variable.source_kind == .Declaration && variable.type == .Texture2D {
variable.resource_index = checker.current_texture_index;
checker.current_texture_index += 1;
}
variable.typename = typename;
variable.source_node = node;
variable.scope = checker.current_scope;
@@ -1365,20 +1414,33 @@ check_field :: (checker : *Checker, node : *AST_Node) -> Type_Variable_Handle {
symbol.source_node = node;
symbol.type_variable = handle;
add_symbol_to_scope(checker.state, *checker.ctx.scope_stack, checker.current_scope, node.name, symbol);
variable.source_kind = .Declaration;
} else {
symbol_redeclaration(checker, node, find_result);
return 0;
}
}
if node.token.ident_value.count > 0 {
variable.type = lookup_type(checker, checker.current_scope, node);
if variable.source_kind == .Declaration && variable.type == .Sampler {
variable.resource_index = checker.current_sampler_index;
checker.current_sampler_index += 1;
}
if node.children.count > 0 {
if variable.source_kind == .Declaration && variable.type == .Texture2D {
variable.resource_index = checker.current_texture_index;
checker.current_texture_index += 1;
}
if variable.type != .Array && node.children.count > 0 || variable.type == .Array && node.children.count > 1 {
rhs : Type_Variable_Handle;
assert(node.children.count == 1);
for child : node.children {
start_index := 0;
if variable.type == .Array {
start_index += 1;
}
for i : start_index..node.children.count - 1 {
child := node.children[i];
rhs = check_node(checker, child);
}
@@ -1543,8 +1605,46 @@ check_node :: (checker : *Checker, node : *AST_Node) -> Type_Variable_Handle {
return handle;
}
case .Access; {
lhs_handle := check_node(checker, node.children[0]);
if lhs_handle == 0 {
return 0;
}
lhs_variable := from_handle(checker, lhs_handle);
if lhs_variable.type != .Struct && lhs_variable.type != .CBuffer {
field_access_on_primitive_type(checker, node.children[0], lhs_handle);
return 0;
}
lookup_name := lhs_variable.typename;
struct_symbol := find_symbol(checker, lookup_name, checker.current_scope);
type_variable := from_handle(checker, struct_symbol.type_variable);
previous_scope := use_scope(checker, type_variable.scope);
member := node.children[1];
var := find_symbol(checker, member.name, type_variable.scope);
if var == null {
field_not_defined_on_struct(checker, member, struct_symbol);
return 0;
}
access := check_node(checker, member);
use_scope(checker, previous_scope);
return access;
}
case .Binary; {
if checker.checking_lvalue {
cannot_assign_to_lvalue(checker, node.parent.parent);
return 0;
}
prev_checking_lvalue := checker.checking_lvalue;
if node.token.kind == .TOKEN_ASSIGN {
checker.checking_lvalue = true;
}
lhs_var := check_node(checker, node.children[0]);
checker.checking_lvalue = prev_checking_lvalue;
if lhs_var == 0 {
return 0;
}
@@ -1557,7 +1657,14 @@ check_node :: (checker : *Checker, node : *AST_Node) -> Type_Variable_Handle {
lhs_type := from_handle(checker, lhs_var);
rhs_type := from_handle(checker, rhs_var);
if lhs_type.type == .Array {
element := from_handle(checker, lhs_type.element_type);
variable.type = element.type;
variable.typename = element.typename;
} else {
variable.type = lhs_type.type;
}
variable.typename = lhs_type.typename;
variable.scope = lhs_type.scope;
variable.source_node = node;
@@ -1566,6 +1673,11 @@ check_node :: (checker : *Checker, node : *AST_Node) -> Type_Variable_Handle {
add_child(variable, rhs_var);
if node.token.kind == {
case .TOKEN_LEFTBRACKET; {
element := from_handle(checker, lhs_type.element_type);
variable.type = element.type;
variable.typename = element.typename;
}
case .TOKEN_PLUS; #through;
case .TOKEN_MINUS; #through;
case .TOKEN_STAR; #through;
@@ -1586,11 +1698,18 @@ check_node :: (checker : *Checker, node : *AST_Node) -> Type_Variable_Handle {
}
}
case .TOKEN_ASSIGN; {
if lhs_type.type == .Array {
if !types_compatible(checker, lhs_type.element_type, rhs_var) {
type_mismatch(checker, node.parent, node.children[1], lhs_var, rhs_var);
return 0;
}
} else {
if !types_compatible(checker, lhs_var, rhs_var) {
type_mismatch(checker, node.parent, node.children[1], lhs_var, rhs_var);
return 0;
}
}
}
case .TOKEN_GREATER; #through;
case .TOKEN_GREATEREQUALS; #through;
case .TOKEN_LESS; #through;
@@ -1610,11 +1729,15 @@ check_node :: (checker : *Checker, node : *AST_Node) -> Type_Variable_Handle {
}
case .For; {
loop_iterator := node.token;
// @Incomplete: Missing scope here?
scope, scope_handle := push_scope(checker, kind = .Block);
symbol : Defined_Symbol;
symbol.name = loop_iterator.ident_value;
symbol.source_node = node;
variable, handle := new_type_variable(checker);
variable.scope = scope_handle;
variable.name = symbol.name;
typename : string;
variable.type = .Int;
@@ -1634,6 +1757,7 @@ check_node :: (checker : *Checker, node : *AST_Node) -> Type_Variable_Handle {
}
check_block(checker, node.children[2]);
pop_scope(checker);
}
case .If; {
cond_var := check_node(checker, node.children[0]);
@@ -1706,7 +1830,17 @@ is_valid_define :: (checker : *Checker, def : string) -> bool {
}
check_env_expression :: (checker : *Checker, expr : *AST_Node, directive : *AST_Node) -> bool {
if expr.kind == .Binary {
if expr.kind == .Access {
lhs := expr.children[0];
if lhs.kind == .Variable && lhs.name == "Env" {
rhs := expr.children[1];
return is_valid_define(checker, rhs.name);
} else {
return check_env_expression(checker, lhs, directive);
}
}
else if expr.kind == .Binary {
lhs := expr.children[0];
rhs := expr.children[1];
@@ -1719,6 +1853,7 @@ check_env_expression :: (checker : *Checker, expr : *AST_Node, directive : *AST_
return lhs_valid && rhs_valid;
}
} else if expr.kind == .Variable {
assert(false, "");
if expr.name == "Env" {
child := expr.children[0]; // The variable in the environment
@@ -1781,14 +1916,14 @@ check_declaration :: (checker : *Checker, declaration : *AST_Node) {
} else {
fun_handle := declare_function(checker, declaration);
}
} else if declaration.kind == .Properties {
declare_properties(checker, declaration);
} else if declaration.kind == .Struct {
declare_struct(checker, declaration);
} else if declaration.kind == .CBuffer {
declare_cbuffer(checker, declaration);
} else if declaration.kind == .If_Directive {
check_if_directive(checker, declaration);
} else if declaration.kind == .Buffer {
declare_buffer(checker, declaration);
}
}
@@ -1843,8 +1978,6 @@ types_compatible :: (checker : *Checker, lhs : Type_Variable_Handle, rhs : Type_
return rhs_var.type == lhs_var.type;
}
case .Struct; {
lhs_node := lhs_var.source_node;
rhs_node := rhs_var.source_node;
if rhs_var.type != .Struct && !param_matching {
if lhs_var.typename == {
case "float2"; #through;
@@ -2238,9 +2371,6 @@ check :: (ctx : *Compiler_Context, allocator : Allocator = temp) {
checker : Checker;
checker.current_buffer_index = 0;
checker.current_sampler_index = 0;
checker.current_texture_index = 0;
checker.ctx = ctx;
init_semantic_checker(*checker, ctx.root, ctx.file.path);
@@ -2260,8 +2390,7 @@ check :: (ctx : *Compiler_Context, allocator : Allocator = temp) {
// Pretty printing
#scope_file
type_to_string :: (type_variable : Type_Variable) -> string {
type_to_string :: (variables : []Type_Variable, type_variable : Type_Variable, allocator := context.allocator) -> string {
if type_variable.type == {
case .Invalid;
return "{{invalid}}";
@@ -2279,8 +2408,10 @@ type_to_string :: (type_variable : Type_Variable) -> string {
case .Struct; {
return type_variable.typename;
}
case .Buffer; #through;
case .Array;
return "array";
element_type := from_handle(variables, type_variable.element_type);
return sprint("[%].%", type_variable.element_count, type_to_string(variables, element_type));
}
return "";
}
@@ -2313,7 +2444,7 @@ pretty_print_function :: (scope_stack : *Scope_Stack, current_scope : Scope_Hand
if tv.builtin {
print_to_builder(builder, "%", tv.name);
} else {
print_to_builder(builder, "% : %", tv.name, type_to_string(tv));
print_to_builder(builder, "% : %", tv.name, type_to_string(variables, tv));
}
} else {
pretty_print_function(scope_stack, current_scope, variables, builder, "", tv, 0);
@@ -2327,30 +2458,35 @@ pretty_print_function :: (scope_stack : *Scope_Stack, current_scope : Scope_Hand
}
if function.return_type_variable> 0 {
print_to_builder(builder, ") -> %\n", type_to_string(from_handle(variables, function.return_type_variable)));
print_to_builder(builder, ") -> %\n", type_to_string(variables, from_handle(variables, function.return_type_variable)));
} else {
append(builder, ")\n");
}
}
pretty_print_struct :: (scope_stack : *Scope_Stack, current_scope : Scope_Handle, variables : []Type_Variable, builder : *String_Builder, name : string, struct_type : Type_Variable, indentation : int) {
pretty_print_struct :: (ctx : *Compiler_Context, scope_stack : *Scope_Stack, current_scope : Scope_Handle, variables : []Type_Variable, builder : *String_Builder, name : string, struct_field : Type_Variable, indentation : int) {
indent(builder, indentation);
print_key(scope_stack, current_scope, builder, name);
append(builder, "{");
struct_symbol : Defined_Symbol;
lookup_type(scope_stack, variables, current_scope, struct_field.typename, null, *struct_symbol);
struct_type := from_handle(variables, struct_symbol.type_variable);
for 0..struct_type.children.count - 1 {
child_handle := struct_type.children[it];
child := from_handle(variables, child_handle);
print_to_builder(builder, child.name);
append(builder, " : ");
print_to_builder(builder, type_to_string(child));
print_to_builder(builder, type_to_string(variables, child));
if it < struct_type.children.count - 1 {
append(builder, ", ");
}
}
append(builder, "}\n");
append(builder, "}");
}
pretty_print_scope :: (ctx : *Compiler_Context, current_scope : Scope_Handle, scope_stack : Scope_Stack, variables : []Type_Variable, scope : *Scope, builder : *String_Builder, indentation : int = 0) {
@@ -2365,8 +2501,21 @@ pretty_print_scope :: (ctx : *Compiler_Context, current_scope : Scope_Handle, sc
if scope.name.count > 0 {
print_to_builder(builder, "%", scope.name);
} else {
if scope.kind == {
case .Global; {
append(builder, "global");
}
case .Block; {
append(builder, "block");
}
case .Function; {
append(builder, "function");
}
case .Struct; {
append(builder, "struct");
}
}
}
append(builder, ") [");
if scope.table.count > 0 {
append(builder, "\n");
@@ -2383,24 +2532,6 @@ pretty_print_scope :: (ctx : *Compiler_Context, current_scope : Scope_Handle, sc
case .Function; {
pretty_print_function(*scope_stack, current_scope, variables, builder, key, type_variable, 1);
}
case .CBuffer; #through;
case .Properties; #through;
case .Struct; {
if type_variable.typename.count > 0 && type_variable.source_kind != .Declaration {
indent(builder, indentation + 1);
print_key(*scope_stack, current_scope, builder, key);
print_type_variable(ctx, builder, variables, type_variable);
append(builder, "\n");
// print_to_builder(builder, "%\n", type_variable.typename);
} else {
pretty_print_struct(*scope_stack, current_scope, variables, builder, key, type_variable, 1);
}
}
case; {
indent(builder, indentation + 1);
print_key(*scope_stack, current_scope, builder, key);
print_to_builder(builder, "%\n", type_to_string(type_variable));
}
}
}
} else {
@@ -2409,25 +2540,34 @@ pretty_print_scope :: (ctx : *Compiler_Context, current_scope : Scope_Handle, sc
case .Function; {
pretty_print_function(*scope_stack, current_scope, variables, builder, key, type_variable, 1);
}
case .CBuffer; #through;
case .Properties; #through;
case .CBuffer; {
pretty_print_struct(ctx, *scope_stack, current_scope, variables, builder, key, type_variable, 1);
append(builder, "\n");
}
case .Buffer; {
element := from_handle(variables, type_variable.element_type);
pretty_print_struct(ctx, *scope_stack, current_scope, variables, builder, key, element, 1);
append(builder, "\n");
}
case .Struct; {
if type_variable.typename.count > 0 && type_variable.source_kind != .Declaration {
if type_variable.source_node.kind != .Buffer {
if type_variable.typename.count > 0 && !type_variable.builtin && (type_variable.source_kind != .Declaration || type_variable.source_node.kind != .Struct) {
indent(builder, indentation + 1);
print_key(*scope_stack, current_scope, builder, key);
print_to_builder(builder, "%\n", type_variable.typename);
} else {
pretty_print_struct(*scope_stack, current_scope, variables, builder, key, type_variable, 1);
pretty_print_struct(ctx, *scope_stack, current_scope, variables, builder, key, type_variable, indentation);
append(builder, "\n");
}
}
}
case; {
indent(builder, indentation + 1);
print_key(*scope_stack, current_scope, builder, key);
print_to_builder(builder, "%\n", type_to_string(type_variable));
print_to_builder(builder, "%\n", type_to_string(variables, type_variable));
}
}
}
}
for child : scope.children {
@@ -2435,7 +2575,7 @@ pretty_print_scope :: (ctx : *Compiler_Context, current_scope : Scope_Handle, sc
pretty_print_scope(ctx, current_scope, *scope_stack, variables, child_scope, builder, indentation + 1);
}
if scope.table.count > 0 {
if (scope.table.count > 0 || scope.children.count > 0) {
indent(builder, indentation);
}
append(builder, "]\n");
@@ -2444,7 +2584,7 @@ pretty_print_scope :: (ctx : *Compiler_Context, current_scope : Scope_Handle, sc
print_type_variable :: (ctx : *Compiler_Context, builder : *String_Builder, variables : []Type_Variable, variable : Type_Variable) {
if variable.builtin {
if variable.type != .Function || variable.type != .Struct {
print_to_builder(builder, "%", type_to_string(variable));
print_to_builder(builder, "%", type_to_string(variables, variable));
} else {
print_to_builder(builder, "%", variable.name);
}
@@ -2452,16 +2592,6 @@ print_type_variable :: (ctx : *Compiler_Context, builder : *String_Builder, vari
node := variable.source_node;
if node {
if node.kind == {
case .Properties; {
if node.name.count > 0 {
print_to_builder(builder, "% : ", node.name);
}
append(builder, "properties");
}
case .Meta; {
append(builder, "meta");
}
case .Function; #through;
case .Struct; #through;
case .CBuffer; #through;
@@ -2471,6 +2601,9 @@ print_type_variable :: (ctx : *Compiler_Context, builder : *String_Builder, vari
}
print_to_builder(builder, "%", node.name);
}
case .Access; {
}
case .Binary; {
left_most := node.children[0];
@@ -2552,3 +2685,4 @@ pretty_print_symbol_table :: (ctx : *Compiler_Context, allocator : Allocator) ->
#import "ncore";
#import "Hash_Table";
#import "String";
#import "Random";

View File

@@ -5,7 +5,6 @@
/////////////////////////////////////
//~ nbr: Codegen TODOs
//
// [ ] Prefix output of property values with __PROPERTIES so we don't get name clashes
Output_Language :: enum {
HLSL;
@@ -23,7 +22,7 @@ Codegen_State :: struct {
builder : String_Builder;
result : *Compiler_Context;
ctx : *Compiler_Context;
}
Reserved_HLSL_Words :: string.[
@@ -45,7 +44,7 @@ Reserved_GLSL_Words :: string.[
""
];
init_codegen_state :: (state : *Codegen_State, result : *Compiler_Context, output_language : Output_Language) {
init_codegen_state :: (state : *Codegen_State, ctx : *Compiler_Context, output_language : Output_Language) {
state.current_scope = cast(Scope_Handle)1;
state.output_language = output_language;
init_string_builder(*state.builder);
@@ -55,7 +54,11 @@ indent :: (state : *Codegen_State, indentation : int) {
for 1..indentation append(*state.builder, " ");
}
hlsl_type_to_string :: (type_variable : Type_Variable) -> string {
hlsl_type_to_string :: (variables : []Type_Variable, type_handle : Type_Variable_Handle) -> string {
return hlsl_type_to_string(variables, from_handle(variables, type_handle));
}
hlsl_type_to_string :: (variables : []Type_Variable, type_variable : Type_Variable) -> string {
if type_variable.type == {
case .Invalid;
return "{{invalid}}";
@@ -84,28 +87,21 @@ hlsl_type_to_string :: (type_variable : Type_Variable) -> string {
return type_variable.typename;
}
case .Array;
return "array";
return hlsl_type_to_string(variables, type_variable.element_type);
}
return "";
}
emit_field :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
find_result := find_symbol(state.result.scope_stack, node.name, state.current_scope);
find_result := find_symbol(state.ctx.scope_stack, node.name, state.current_scope);
field := from_handle(state.result.type_variables, find_result.type_variable);
field := from_handle(state.ctx.type_variables, find_result.type_variable);
indent(state, indentation);
print_to_builder(*state.builder, "% ", hlsl_type_to_string(field));
print_to_builder(*state.builder, "% ", hlsl_type_to_string(state.ctx.type_variables, 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);
if field.type == .Sampler {
@@ -119,16 +115,22 @@ emit_field :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
if node.children.count == 1 {
child := node.children[0];
if field.type == .Array {
append(*state.builder, "[");
emit_node(state, child, 0);
append(*state.builder, "]");
} else {
print_to_builder(*state.builder, " = ");
emit_node(state, child, 0);
}
}
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]);
child := from_handle(state.ctx.type_variables, field.children[i]);
emit_node(state, child.source_node, 0);
}
@@ -144,13 +146,20 @@ emit_field :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
}
emit_block :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
previous_scope := state.current_scope;
for statement : node.children {
if statement.type_variable {
state.current_scope = from_handle(state.ctx.type_variables, statement.type_variable).scope;
}
emit_node(state, statement, indentation);
if it_index < node.children.count {
append(*state.builder, "\n");
}
}
state.current_scope = previous_scope;
}
emit_call :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
@@ -212,59 +221,9 @@ emit_call :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
append(*state.builder, ")");
}
emit_properties :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
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;
message.message_kind = .Internal_Error;
message.path = state.path;
message.message = "Attempting to generate undeclared properties buffer. This should never happen at this stage.";
array_add(*state.result.messages, message);
}
assert(find_result != null, "Attempting to generate undeclared properties buffer. This should never happen at this stage.");
variable := from_handle(state.result.type_variables, find_result.type_variable);
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");
}
}
}
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.result.scope_stack, name, state.current_scope);
find_result := find_symbol(state.ctx.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 {
@@ -272,17 +231,17 @@ emit_function :: (state : *Codegen_State, node : *AST_Node, indentation : int, e
message.message_kind = .Internal_Error;
message.path = state.path;
message.message = "Attempting to generate undeclared function. This should never happen at this stage.";
array_add(*state.result.messages, message);
array_add(*state.ctx.messages, message);
}
for func : find_result.functions {
function_variable := from_handle(state.result.type_variables, func.type_variable);
function_variable := from_handle(state.ctx.type_variables, func.type_variable);
indent(state, indentation);
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));
return_variable := from_handle(state.ctx.type_variables, function_variable.return_type_variable);
print_to_builder(*state.builder, "% ", hlsl_type_to_string(state.ctx.type_variables, return_variable));
} else {
append(*state.builder, "void ");
}
@@ -407,9 +366,6 @@ emit_node :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
}
case .Float; {
print_to_builder(*state.builder, "%f", formatFloat(node.float_value, zero_removal=.ONE_ZERO_AFTER_DECIMAL));
}
case .Properties; {
}
case .Field; {
emit_field(state, node, indentation);
@@ -421,46 +377,57 @@ emit_node :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
case .Variable; {
indent(*state.builder, indentation);
type_var := from_handle(state.result.type_variables, node.type_variable);
is_properties := type_var.typename == "properties";
type_var := from_handle(state.ctx.type_variables, node.type_variable);
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);
}
if node.children.count > 0 {
if !is_properties {
append(*state.builder, ".");
}
emit_node(state, node.children[0], 0);
}
}
case .Access; {
indent(*state.builder, indentation);
lhs := node.children[0];
rhs := node.children[1];
emit_node(state, lhs, 0);
print_to_builder(*state.builder, "%.", node.name);
emit_node(state, rhs, 0);
}
case .Binary; {
indent(*state.builder, indentation);
if node.token.kind != .TOKEN_ASSIGN {
if node.token.kind != .TOKEN_ASSIGN && node.token.kind != .TOKEN_LEFTBRACKET {
if (node.parent.kind == .Binary && node.parent.token.kind != .TOKEN_ASSIGN) || node.parent.kind == .Access {
append(*state.builder, "(");
}
}
lhs := node.children[0];
rhs := node.children[1];
emit_node(state, lhs, 0);
if node.token.kind == .TOKEN_LEFTBRACKET {
emit_node(state, lhs, 0);
append(*state.builder, "[");
emit_node(state, rhs, 0);
append(*state.builder, "]");
} else {
emit_node(state, lhs, 0);
append(*state.builder, " ");
emit_operator(state, node.token.kind);
append(*state.builder, " ");
emit_node(state, rhs, 0);
if node.token.kind != .TOKEN_ASSIGN {
}
if node.token.kind != .TOKEN_ASSIGN && node.token.kind != .TOKEN_LEFTBRACKET {
if (node.parent.kind == .Binary && node.parent.token.kind != .TOKEN_ASSIGN) || node.parent.kind == .Access {
append(*state.builder, ")");
}
}
}
case .Unary; {
indent(*state.builder, indentation);
@@ -508,7 +475,9 @@ emit_node :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
append(*state.builder, "if ");
cond := node.children[0];
append(*state.builder, "(");
emit_node(state, cond, 0);
append(*state.builder, ")");
body := node.children[1];
append(*state.builder, "\n");
@@ -555,11 +524,16 @@ emit_field_list :: (state : *Codegen_State, field_list : *AST_Node, indentation
}
}
emit_struct :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
emit_struct :: (state : *Codegen_State, node : *AST_Node, indentation : int, name : string = "") {
if name.count > 0 {
print_to_builder(*state.builder, "struct %", name);
} else {
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;
state.current_scope = from_handle(state.ctx.type_variables, node.type_variable).scope;
field_list := node.children[0];
@@ -576,11 +550,11 @@ emit_struct :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
}
emit_cbuffer :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
variable := from_handle(state.result.type_variables, node.type_variable);
variable := from_handle(state.ctx.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;
state.current_scope = from_handle(state.ctx.type_variables, node.type_variable).scope;
field_list := node.children[0];
@@ -596,17 +570,26 @@ emit_cbuffer :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
state.current_scope = current_scope;
}
emit_buffer :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
variable := from_handle(state.ctx.type_variables, node.type_variable);
element := from_handle(state.ctx.type_variables, variable.element_type);
emit_struct(state, node, indentation, element.typename);
print_to_builder(*state.builder, "StructuredBuffer<%> % : register(t%);\n\n", element.typename, variable.name, variable.resource_index);
}
emit_declaration :: (state : *Codegen_State, node : *AST_Node) {
if node.kind == {
case .Function; {
emit_function(state, node, 0);
}
case .Properties; {
emit_properties(state, node, 0);
}
case .CBuffer; {
emit_cbuffer(state, node, 0);
}
case .Buffer; {
emit_buffer(state, node, 0);
}
case .Struct; {
emit_struct(state, node, 0);
}
@@ -629,7 +612,7 @@ codegen :: (result : *Compiler_Context, output_language : Output_Language, alloc
defer clear_context_allocators();
state : Codegen_State;
state.result = result;
state.ctx = result;
state.current_scope = cast(Scope_Handle)1;
state.output_language = output_language;
init_string_builder(*state.builder);
@@ -643,7 +626,7 @@ codegen :: (state : *Codegen_State) {
found_function : bool = false;
// found_struct : bool = false;
// for variable : state.result.type_variables {
// for variable : state.ctx.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;
@@ -656,7 +639,7 @@ codegen :: (state : *Codegen_State) {
// append(*state.builder, "\n");
// }
for variable : state.result.type_variables {
for variable : state.ctx.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);
@@ -667,14 +650,14 @@ codegen :: (state : *Codegen_State) {
append(*state.builder, "\n");
}
for declaration : state.result.root.children {
for declaration : state.ctx.root.children {
if declaration.foreign_declaration {
continue;
}
emit_declaration(state, declaration);
}
state.result.codegen_result_text = builder_to_string(*state.builder);
state.ctx.codegen_result_text = builder_to_string(*state.builder);
}
#scope_module

37
Ink.jai
View File

@@ -227,32 +227,35 @@ run_compile_test :: (path : string, output_type : Output_Type = 0) -> Result, Co
print_to_builder(*sb, "[pixel entry point] - %\n", ctx.pixel_entry_point.name);
}
if ctx.properties.fields.count > 0{
for buf : ctx.buffers {
if buf.kind == {
case .Constant; {
print_to_builder(*sb, "[constant_buffer] - % - %", buf.name, buf.buffer_index);
props := ctx.properties;
append(*sb, "[");
if ctx.property_name.count > 0 {
print_to_builder(*sb, "% :: ", ctx.property_name);
}
print_to_builder(*sb, "properties] - %\n", props.buffer_index);
case .Structured; {
print_to_builder(*sb, "[buffer] - % - %", buf.name, buf.buffer_index);
}
if buf.hints.count > 0 {
for hint : buf.hints {
print_to_builder(*sb, " (@%)", hint.custom_hint_name);
}
}
append(*sb, "\n");
indent(*sb, 1);
for field : props.fields {
for field : buf.fields {
append(*sb, "[field] - ");
pretty_print_field(*sb, *field.base_field);
}
}
for cb : ctx.cbuffers {
print_to_builder(*sb, "[constant_buffer] - % - %\n", cb.name, cb.buffer_index);
pretty_print_field(*sb, *field);
append(*sb, "\n");
indent(*sb, 1);
for field : cb.fields {
append(*sb, "[field] - ");
pretty_print_field(*sb, *field.base_field);
}
}
}
result.info_text = builder_to_string(*sb);
}

View File

@@ -55,6 +55,7 @@ Token_Kind :: enum {
// Keywords
TOKEN_BOOL;
TOKEN_BUFFER;
TOKEN_CASE;
TOKEN_CBUFFER;
@@ -91,7 +92,7 @@ Token_Kind :: enum {
TOKEN_OUT;
TOKEN_PIXEL;
TOKEN_PROPERTIES;
TOKEN_PLEX;
TOKEN_RETURN;
TOKEN_REGISTER;
@@ -216,10 +217,11 @@ identifier_kind :: (using lexer : *Lexer) -> Token_Kind {
identifier.count = length;
if identifier == "bool" return .TOKEN_BOOL;
if identifier == "Buffer" return .TOKEN_BUFFER;
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 == "Constant_Buffer" return .TOKEN_CONSTANT_BUFFER;
if identifier == "continue" return .TOKEN_CONTINUE;
if identifier == "default" return .TOKEN_DEFAULT;
if identifier == "directive" return .TOKEN_DIRECTIVE;
@@ -243,10 +245,10 @@ identifier_kind :: (using lexer : *Lexer) -> Token_Kind {
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 == "plex" return .TOKEN_STRUCT;
if identifier == "switch" return .TOKEN_SWITCH;
if identifier == "true" return .TOKEN_TRUE;
if identifier == "unorm" return .TOKEN_UNORM;
@@ -758,12 +760,7 @@ print_from_source_location :: (ctx : *Compiler_Context, builder : *String_Builde
text.count = tok.length;
print_to_builder(builder, "%", text);
}
return;
} else {
}
begin_pos := 0;
token_string : string;
count := end.index - begin.index + end.length;
@@ -788,6 +785,7 @@ print_from_source_location :: (ctx : *Compiler_Context, builder : *String_Builde
indent(builder, indentation);
print_to_builder(builder, "%", token_string);
}
}
}
print_from_source_location :: (ctx : *Compiler_Context, source_location : Source_Range, allocator := context.allocator, indentation : int = 0) -> string {

View File

@@ -1,13 +1,3 @@
#import "Flat_Pool";
// #load "qpwodkqopwkd.jai";
/**
* TODO:
* if parsing
* for/while loop parsing
**/
////////////////////////////
//@nb - Parse_state state
Parse_State :: struct {
@@ -19,15 +9,6 @@ Parse_State :: struct {
ctx : *Compiler_Context;
}
////////////////////////////
//@nb - Result and error handling
Parse_Error_Kind :: enum {
Parse_Error_Type_Missing;
Parse_Error_Expected_Expression;
Parse_Error_Empty_Block;
Parse_Error_Unexpected_Token;
}
////////////////////////////
//@nb - Parsing helper types
Separator_Type :: enum {
@@ -75,7 +56,7 @@ parse_rules :: #run -> [(cast(int)Token_Kind.TOKEN_ERROR) + 1]Parse_Rule {
rules[Token_Kind.TOKEN_RIGHTBRACKET] = .{null, null, .PREC_NONE};
rules[Token_Kind.TOKEN_COMMA] = .{null, null, .PREC_NONE};
rules[Token_Kind.TOKEN_DOT] = .{null, dot, .PREC_CALL};
rules[Token_Kind.TOKEN_PROPERTIES] = .{named_variable, null, .PREC_CALL};
// rules[Token_Kind.TOKEN_PROPERTIES] = .{named_variable, null, .PREC_CALL};
rules[Token_Kind.TOKEN_MINUS] = .{unary, binary, .PREC_TERM};
rules[Token_Kind.TOKEN_PLUS] = .{null, binary, .PREC_TERM};
rules[Token_Kind.TOKEN_SEMICOLON] = .{null, null, .PREC_NONE};
@@ -535,7 +516,7 @@ new_builtin_function_node :: (ctx : *Compiler_Context, name : string, members :
}
get_field_list :: (struct_or_func : *AST_Node) -> *AST_Node {
assert(struct_or_func.kind == .Function || struct_or_func.kind == .Struct || struct_or_func.kind == .Properties);
assert(struct_or_func.kind == .Function || struct_or_func.kind == .Struct || struct_or_func.kind == .CBuffer);
return struct_or_func.children[0];
}
@@ -727,13 +708,12 @@ array_access :: (parse_state : *Parse_State, left : *AST_Node) -> *AST_Node {
identifier := parse_state.ctx.tokens[parse_state.current_token_index - 3];
left_bracket := parse_state.ctx.tokens[parse_state.current_token_index - 2];
array_access := make_node(parse_state, .Unary);
array_access := make_node(parse_state, .Binary);
array_access.token = left_bracket;
array_index := expression(parse_state);
add_child(array_access, left);
add_child(array_access, array_index);
add_child(left, array_access);
consume(parse_state, .TOKEN_RIGHTBRACKET, "Expected ']' after array index.");
source_location : Source_Range;
@@ -750,8 +730,8 @@ array_access :: (parse_state : *Parse_State, left : *AST_Node) -> *AST_Node {
}
source_location.end = parse_state.previous;
left.source_location = source_location;
return left;
array_access.source_location = source_location;
return array_access;
}
unary :: (parse_state : *Parse_State, left : *AST_Node) -> *AST_Node {
@@ -819,49 +799,6 @@ directive :: (state : *Parse_State) -> *AST_Node {
if_directive.source_location = source_location;
return if_directive;
} else if state.current.ident_value == "load" {
advance(state);
if check(state, .TOKEN_STRING) {
// path_tok := state.current;
// path := path_tok.string_value;
// advance(state);
// result : Compiler_Context;
// ctx.allocator = state.ctx.allocator;
// ctx.environment = state.ctx.environment;
// ctx.file = make_file(*result, path);
// if ctx.file.source.count == 0 {
// unable_to_open_file(state, path, path_tok);
// advance_to_sync_point(state);
// advance(state);
// return null;
// }
// consume(state, .TOKEN_SEMICOLON, "Expected ';' after #load directive");
// lex(*result);
// count := state.ctx.tokens..count;
// current_idx := state.current_token_index;
// result_count := ctx.tokens..count;
// // state.ctx.tokens..count -= 1;
// array_resize(*state.ctx.tokens., count + result_count - 1);
// memcpy(*state.ctx.tokens[current_idx + result_count - 1], *state.ctx.tokens[current_idx], size_of(Token) * (count - current_idx));
// for *tok : ctx.tokens. {
// if tok.kind == .TOKEN_EOF {
// break;
// }
// tok.builtin = true;
// state.ctx.tokens[it_index] = tok.*;
// }
}
}
return null;
@@ -899,34 +836,31 @@ dot :: (parse_state : *Parse_State, left : *AST_Node) -> *AST_Node {
source_location : Source_Range;
source_location.begin = left.source_location.begin;
source_location.main_token = identifier;
access := make_node(parse_state, .Access);
variable := make_node(parse_state, .Variable);
variable.name = identifier.ident_value;
add_child(access, left);
add_child(access, variable);
if check_any(parse_state, .TOKEN_ASSIGN, .TOKEN_MINUSEQUALS, .TOKEN_PLUSEQUALS, .TOKEN_DIVEQUALS, .TOKEN_MODEQUALS, .TOKEN_TIMESEQUALS) {
advance(parse_state);
variable := make_node(parse_state, .Variable);
variable.source_location = generate_source_location_from_token(parse_state, identifier);
variable.name = identifier.ident_value;
add_child(left, variable);
access.source_location = generate_source_location_from_token(parse_state, identifier);
node := make_node(parse_state, .Binary);
node.token = parse_state.previous;
add_child(node, left);
node.source_location = generate_source_location_from_token(parse_state, node.token);
add_child(node, access);
add_child(node, expression(parse_state));
return node;
}
variable := make_node(parse_state, .Variable);
variable.name = identifier.ident_value;
if check(parse_state, .TOKEN_DOT) {
advance(parse_state);
dot(parse_state, variable);
}
add_child(left, variable);
source_location.end = parse_state.previous;
variable.source_location = source_location;
return left;
source_location.end = parse_state.current;
access.source_location = source_location;
return access;
}
integer :: (parse_state : *Parse_State, left : *AST_Node) -> *AST_Node {
@@ -1368,67 +1302,40 @@ function_declaration :: (parse_state : *Parse_State, identifier_token : *Token,
return node;
}
instance_block :: (parse_state : *Parse_State) -> *AST_Node {
node : *AST_Node;
buffer :: (state : *Parse_State, identifier_token : *Token = null) -> *AST_Node {
node : *AST_Node = make_node(state, .Buffer);
source_location : Source_Range;
source_location.begin = parse_state.current;
source_location.begin = state.current;
consume(parse_state, .TOKEN_LEFTBRACE, "Expect '{' after 'instance' keyword");
properties := field_list(parse_state, .Semicolon);
if check(state, .TOKEN_AT) {
while check(state, .TOKEN_AT) {
advance(state);
// @Incomplete(niels): this is a mapping
if check(state, .TOKEN_IDENTIFIER) {
array_add(*node.hint_tokens, state.current);
advance(state);
}
}
}
node = make_node(parse_state, .Instance);
add_child(node, properties);
consume(state, .TOKEN_LEFTBRACE, "Expect '{' after 'buffer' keyword");
buffer := field_list(state, .Semicolon);
node.array_field = true;
consume(parse_state, .TOKEN_RIGHTBRACE, "Expect '}' after instance block");
source_location.end = parse_state.previous;
node.source_location = source_location;
return node;
}
meta_block :: (parse_state : *Parse_State) -> *AST_Node {
node : *AST_Node;
source_location : Source_Range;
source_location.begin = parse_state.current;
consume(parse_state, .TOKEN_LEFTBRACE, "Expect '{' after 'meta' keyword");
properties := field_list(parse_state, .Semicolon);
node = make_node(parse_state, .Meta);
add_child(node, properties);
consume(parse_state, .TOKEN_RIGHTBRACE, "Expect '}' after meta block");
source_location.end = parse_state.previous;
node.source_location = source_location;
return node;
}
property_block :: (parse_state : *Parse_State, identifier_token : *Token = null) -> *AST_Node {
node : *AST_Node;
source_location : Source_Range;
source_location.begin = parse_state.current;
consume(parse_state, .TOKEN_LEFTBRACE, "Expect '{' after 'property' keyword");
properties := field_list(parse_state, .Semicolon);
node = make_node(parse_state, .Properties);
if identifier_token {
node.name = identifier_token.ident_value;
}
add_child(node, properties);
add_child(node, buffer);
consume(parse_state, .TOKEN_RIGHTBRACE, "Expect '}' after 'property' keyword");
source_location.end = parse_state.previous;
consume(state, .TOKEN_RIGHTBRACE, "Expect '}' after 'buffer' block");
source_location.end = state.previous;
node.source_location = source_location;
return node;
}
constant_buffer :: (parse_state : *Parse_State, identifier_token : *Token = null) -> *AST_Node {
node : *AST_Node;
node : *AST_Node = make_node(parse_state, .CBuffer);
source_location : Source_Range;
source_location.begin = parse_state.current;
@@ -1446,7 +1353,6 @@ constant_buffer :: (parse_state : *Parse_State, identifier_token : *Token = null
consume(parse_state, .TOKEN_LEFTBRACE, "Expect '{' after 'constant_buffer' keyword");
buffer := field_list(parse_state, .Semicolon);
node = make_node(parse_state, .CBuffer);
if identifier_token {
node.name = identifier_token.ident_value;
}
@@ -1488,10 +1394,10 @@ const_declaration :: (parse_state : *Parse_State, identifier_token : *Token) ->
return struct_declaration(parse_state, identifier_token);
} else if check(parse_state, .TOKEN_LEFTPAREN) {
return function_declaration(parse_state, identifier_token, .None);
} else if match(parse_state, .TOKEN_PROPERTIES) {
return property_block(parse_state, identifier_token);
} else if match(parse_state, .TOKEN_CONSTANT_BUFFER) {
return constant_buffer(parse_state, identifier_token);
} else if match(parse_state, .TOKEN_BUFFER) {
return buffer(parse_state, identifier_token);
}
return error_node(parse_state, tprint("Couldn't parse constant declaration at token %\n", parse_state.current.*));
}
@@ -1499,13 +1405,7 @@ const_declaration :: (parse_state : *Parse_State, identifier_token : *Token) ->
declaration :: (parse_state : *Parse_State) -> *AST_Node {
skip_statement := false;
decl_node : *AST_Node;
if match(parse_state, .TOKEN_PROPERTIES) {
decl_node = property_block(parse_state);
} else if match(parse_state, .TOKEN_INSTANCE) {
decl_node = instance_block(parse_state);
} else if match(parse_state, .TOKEN_META) {
decl_node = meta_block(parse_state);
} else if match(parse_state, .TOKEN_VERTEX) {
if match(parse_state, .TOKEN_VERTEX) {
vertex_token := parse_state.previous;
identifier := parse_state.current;
@@ -1521,8 +1421,6 @@ declaration :: (parse_state : *Parse_State) -> *AST_Node {
consume(parse_state, .TOKEN_DOUBLECOLON, "Expect '::' after pixel entry point declaration.");
decl_node = function_declaration(parse_state, identifier, .Pixel);
} else if check(parse_state, .TOKEN_LEFTPAREN) {
decl_node = call(parse_state, null);
} else if check(parse_state, .TOKEN_DIRECTIVE) {
decl_node = directive(parse_state);
skip_statement = true;
@@ -1592,4 +1490,4 @@ parse :: (ctx : *Compiler_Context, allocator := temp) {
}
}
#load "AST.jai";
#load "ast.jai";

View File

@@ -13,46 +13,33 @@ build :: () {
}
EXECUTABLE_NAME :: "ink";
MAIN_FILE :: "Ink.jai";
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;
profile : bool = false;
for arg : args {
if arg == {
case "check"; {
options.output_type = .NO_OUTPUT;
}
case "profile"; {
}
it := args[it_index];
if !it continue;
if it[0] == #char "+" {
plugin_start_index = it_index;
}
}
intercept_flags: Intercept_Flags;
plugins_to_create: [..] Plugin_To_Create;
if profile {
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 {
@@ -63,7 +50,6 @@ build :: () {
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;

View File

@@ -1,8 +1,8 @@
#load "Lexing.jai";
#load "Error.jai";
#load "Parsing.jai";
#load "Check.jai";
#load "Codegen.jai";
#load "lexing.jai";
#load "error.jai";
#load "parsing.jai";
#load "check.jai";
#load "codegen.jai";
#import "File_Utilities";
@@ -13,7 +13,7 @@
- [ ] Support compute shaders
- [x] Support #if at top level
- [x] Support #if at block level
- [ ] Remove properties block and just use hinted constant buffers instead
- [x] Remove properties block and just use hinted constant buffers instead
```
props :: constant_buffer @properties {
[...]
@@ -21,7 +21,13 @@
```
- [ ] while loops
- [ ] for-each loops
- [ ]
- [ ] add parameters to hints (meta properties, resource binding indices if needed)
- [ ] consider @entry(stage) syntax instead of the forced keyword
- [ ] Add flags to compiler
- [ ] Generate output flag(s)
- [ ] Possibly final stage flag, so you can just call compile_file and it only does what you need.
- Probably this flag is about which stage you need as the _last_ and not which stages to do, as that doesn't make sense.
- [ ] Multiple output languages?
*/
add_define :: (env : *Environment, key : string) {
@@ -122,23 +128,16 @@ Entry_Point :: struct {
return_value : Field;
}
Property_Field :: struct {
base_field : Field;
// @Incomplete(nb): Editor information, min max, etc.
// This should also be compiled out for ship
Buffer_Kind :: enum {
Constant;
Structured;
}
Properties :: struct {
fields : [..]Property_Field;
buffer_index : u32;
}
Constant_Buffer :: struct {
Buffer :: struct {
kind : Buffer_Kind;
name : string;
fields : Static_Array(Property_Field, 16);
fields : Static_Array(Field, 16);
hints : [..]Field_Hint;
@@ -161,13 +160,12 @@ Compiler_Context :: struct {
codegen_result_text : string;
constant_buffers : Static_Array(Type_Variable_Handle, 16);
typed_buffers : Static_Array(Type_Variable_Handle, 32);
// structured_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;
@@ -180,11 +178,9 @@ Compiler_Context :: struct {
return_value : Field;
}
properties : Properties; //@Note(niels): We'll deprecate this in favor of just marking a constant buffer with a hint on how you'd want to use it
max_buffers :: 32;
max_constant_buffers :: 16;
cbuffers : Static_Array(Constant_Buffer, max_constant_buffers);
buffers : Static_Array(Buffer, max_buffers);
had_error : bool;
messages : [..]Compiler_Message;
@@ -263,7 +259,7 @@ Min_Field_Name :: 10;
pretty_print_field :: (builder : *String_Builder, field : *Field) {
if field.name.count > 0 {
print_to_builder(builder, "% ", field.name);
append(builder, "- ");
append(builder, ": ");
} else {
append(builder, "return - ");
}
@@ -292,10 +288,17 @@ pretty_print_field :: (builder : *String_Builder, field : *Field) {
case .Struct; {
print_to_builder(builder, "struct : % {", type.name);
newline_after := type.children.count / 4;
for *child : type.children {
pretty_print_field(builder, child);
if it_index < type.children.count - 1 {
append(builder, " ");
append(builder, ", ");
}
if it_index % newline_after == 0 {
append(builder, "\n");
indent(builder, 4);
}
}
@@ -325,11 +328,7 @@ pretty_print_field :: (builder : *String_Builder, field : *Field) {
}
}
type_variable_to_field :: (checker : *Checker, variable : Type_Variable_Handle) -> Field {
return type_variable_to_field(checker, from_handle(checker, variable));
}
type_variable_to_field :: (type_variables : []Type_Variable, scope_stack : Scope_Stack, variable : *Type_Variable) -> Field {
type_variable_to_field :: (ctx : *Compiler_Context, variable : *Type_Variable) -> Field {
field : Field;
field.name = variable.name;
@@ -362,14 +361,14 @@ type_variable_to_field :: (type_variables : []Type_Variable, scope_stack : Scope
case .Struct; {
type.kind = Field_Kind.Struct;
find_result := find_symbol(scope_stack, variable.typename, xx 1);
find_result := find_symbol(ctx.scope_stack, variable.typename, xx 1);
assert(find_result != null, "Internal compiler error\n");
type_var := from_handle(type_variables, find_result.type_variable);
type_var := from_handle(ctx.type_variables, find_result.type_variable);
for i : 0..type_var.children.count - 1 {
child := type_var.children[i];
child_field := type_variable_to_field(type_variables, scope_stack, child);
child_field := type_variable_to_field(ctx, child);
array_add(*type.children, child_field);
}
@@ -406,12 +405,39 @@ type_variable_to_field :: (type_variables : []Type_Variable, scope_stack : Scope
return field;
}
type_variable_to_field :: (type_variables : []Type_Variable, scope_stack : Scope_Stack, variable : Type_Variable_Handle) -> Field {
return type_variable_to_field(type_variables, scope_stack, from_handle(type_variables, variable));
type_variable_to_field :: (ctx : *Compiler_Context, variable : Type_Variable_Handle) -> Field {
return type_variable_to_field(ctx, from_handle(ctx.type_variables, variable));
}
type_variable_to_field :: (checker : *Checker, variable : *Type_Variable) -> Field {
return type_variable_to_field(checker.ctx.type_variables, checker.ctx.scope_stack, variable);
generate_buffer :: (ctx : *Compiler_Context, type_handle : Type_Variable_Handle, buffers : *Static_Array) {
variable := from_handle(ctx.type_variables, type_handle);
buffer := array_add(buffers);
if variable.type == {
case .CBuffer; {
buffer.kind = .Constant;
}
case .Buffer; {
buffer.kind = .Structured;
}
}
buffer.name = variable.name;
for i : 0..variable.children.count - 1 {
child := variable.children[i];
field : Field = type_variable_to_field(ctx, from_handle(ctx.type_variables, child));
array_add(*buffer.fields, field);
}
buffer.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(*buffer.hints, field_hint);
}
}
generate_output_data :: (ctx : *Compiler_Context) {
@@ -431,48 +457,15 @@ generate_output_data :: (ctx : *Compiler_Context) {
field_list := node.children[0];
for child : field_list.children {
tv := from_handle(ctx.type_variables, child.type_variable);
field := type_variable_to_field(ctx.type_variables, ctx.scope_stack, tv);
field := type_variable_to_field(ctx, tv);
array_add(*ctx.vertex_entry_point.input, field);
}
}
}
}
for buffer_variable : ctx.constant_buffers {
variable := from_handle(ctx.type_variables, buffer_variable);
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);
}
}
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);
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;
for buffer_variable : ctx.typed_buffers {
generate_buffer(ctx, buffer_variable, *ctx.buffers);
}
if ctx.pixel_entry_point.node {
@@ -482,7 +475,7 @@ generate_output_data :: (ctx : *Compiler_Context) {
assert(type_variable.type == .Function);
if type_variable.return_type_variable > 0 {
field := type_variable_to_field(ctx.type_variables, ctx.scope_stack, type_variable.return_type_variable);
field := type_variable_to_field(ctx, type_variable.return_type_variable);
for hint : type_variable.source_node.hint_tokens {
field_hint : Field_Hint;

View File

@@ -0,0 +1,4 @@
vertex main :: () {
v : float2;
v.x = (2.0 + ((4.0 - 2.0) * 1.5)) * 3.0;
}

View File

@@ -1,5 +1,6 @@
vertex main :: () -> float4 @position {
arr : [16].float4;
arr[0] = float4(1,1,1);
return arr[0];
arr[0] = float4(1, 1, 1, 1);
pos := arr[1];
return pos;
}

View File

@@ -0,0 +1,5 @@
vertex main :: () {
a : float2;
b : float2;
(a + b).x = 2.0;
}

View File

@@ -0,0 +1,10 @@
P :: struct {
v : float2;
}
vertex main :: () {
p : P;
p.v.x.y = 2.0;
// v : float2;
// v.x.y.z = 2.0;
}

View File

@@ -1,4 +1,4 @@
properties {
properties :: Constant_Buffer @properties {
color : float4;
}

11
test/buffers.ink Normal file
View File

@@ -0,0 +1,11 @@
property_buffer :: Buffer {
color : float4;
}
const_buffer :: Constant_Buffer {
color : float4;
}
pixel main :: (index : int) {
return property_buffer[index].color;
}

View File

@@ -0,0 +1,6 @@
scope (global) [
[vertex__vs_main] : ()
scope (vertex__vs_main) [
[v] : float2
]
]

7
test/check/arrays.golden Normal file
View File

@@ -0,0 +1,7 @@
scope (global) [
[vertex__vs_main] : () -> float4
scope (vertex__vs_main) [
[pos] : float4
[arr] : [16].float4
]
]

View File

@@ -0,0 +1,6 @@
test/bad_double_access.ink:7,4: error: Attempting to access a field on a primitive type 'float'.
p.v.x.
^
declaration:
x: float


View File

@@ -0,0 +1,10 @@
scope (global) [
[vertex__vs_main] : ()
[p] : {v : float2}
scope (p) [
[v] : float2
]
scope (vertex__vs_main) [
[x] : float
]
]

View File

@@ -1,4 +1,4 @@
scope (global) [
[Foo] : {}
[Foo] : {}
scope (Foo) []
]

View File

@@ -1,7 +1,10 @@
scope (global) [
[vertex__vs_main] : ()
scope (vertex__vs_main) [
[i] : int
[x] : int
scope (block) [
[i] : int
scope (block) []
]
]
]

View File

@@ -0,0 +1,4 @@
test/for_index_outside.ink:6,0: error: Use of undeclared symbol 'i'
 i += 1;
^


View File

@@ -0,0 +1,13 @@
scope (global) [
[vertex__vs_main] : (pos : float4) -> float4
[props] : {projection : float4x4, view : float4x4}
scope (props) [
[projection] : float4x4
[view] : float4x4
]
scope (vertex__vs_main) [
[pos] : float4
[mv] : float4
[mvp] : float4
]
]

View File

@@ -1,7 +1,8 @@
scope (global) [
[pixel__ps_main] : ()
scope (pixel__ps_main) [
scope (pixel__ps_main) [ scope (block) [
[alpha_color] : float4
[f] : float
]
]
]

View File

@@ -2,5 +2,8 @@ scope (global) [
[vertex__vs_main] : (pos : float3) -> float4
scope (vertex__vs_main) [
[pos] : float3
scope (block) [ scope (block) []
scope (block) []
]
]
]

View File

@@ -1,7 +1,7 @@
scope (global) [
[foo] : (f : Foo) -> float
[vertex__vs_main] : ()
[Foo] : {some_data : float}
[Foo] : {some_data : float}
scope (Foo) [
[some_data] : float
]

View File

@@ -0,0 +1,8 @@
scope (global) [
[vertex__vs_main] : ()
scope (vertex__vs_main) [
[b] : float2
[x] : float
[a] : float2
]
]

View File

@@ -2,5 +2,8 @@ scope (global) [
[vertex__vs_main] : (pos : float3) -> float4
scope (vertex__vs_main) [
[pos] : float3
scope (block) []
scope (block) []
scope (block) []
]
]

View File

@@ -2,5 +2,6 @@ scope (global) [
[vertex__vs_main] : (pos : float3) -> float4
scope (vertex__vs_main) [
[pos] : float3
scope (block) []
]
]

View File

@@ -2,5 +2,7 @@ scope (global) [
[vertex__vs_main] : (pos : float3) -> float4
scope (vertex__vs_main) [
[pos] : float3
scope (block) []
scope (block) []
]
]

View File

@@ -1,5 +1,5 @@
scope (global) [
[Data] : {color : float4}
[Data] : {color : float4}
[vertex__vs_main] : ()
scope (Data) [
[color] : float4

View File

@@ -1,7 +1,7 @@
scope (global) [
[Bar] : {t : Foo}
[Bar] : {t : Foo}
[vertex__vs_main] : ()
[Foo] : {color : float4}
[Foo] : {color : float4}
scope (Foo) [
[color] : float4
]

View File

@@ -0,0 +1,6 @@
test/temp_access.ink:5,10: error: Cannot assign to an lvalue.
 (a + b).x = 2.0;
^^^^^^^^^^^


View File

@@ -1,8 +1,11 @@
test/assign_arithmetic_expression.ink check
test/arithmetic_parens.ink check
test/basic_property_and_return_value.ink check
test/builtin_types.ink check
test/complicated_computation.ink check
test/constant_buffer.ink check
test/bad_double_access.ink check
test/double_access.ink check
test/empty_struct.ink check
test/empty_vertex_main.ink check
test/empty_vertex_main_with_position_parameter.ink check
@@ -24,14 +27,15 @@ test/nested_if.ink check
test/non_bool_cond.ink check
test/pass_and_access_struct_fields_in_functions.ink check
test/passthrough.ink check
test/property_rename.ink check
test/redeclared_variable.ink check
test/rvalue_binary.ink check
test/simple_else_if.ink check
test/simple_if_else.ink check
test/simple_if.ink check
test/simple_struct_access.ink check
test/struct_access_primitive_type.ink check
test/struct_within_struct.ink check
test/temp_access.ink check
test/type_as_variable_name.ink check
test/unary.ink check
test/undeclared_function.ink check

View File

@@ -0,0 +1,6 @@
void vs_main()
{
float2 v;
v.x = (2.0f + ((4.0f - 2.0f) * 1.5f)) * 3.0f;
}

View File

@@ -0,0 +1,6 @@
float4 vs_main() : SV_POSITION
{
float4 arr[16];
return arr[0];
}

View File

@@ -1,5 +1,5 @@
void vs_main()
{
float x = (2.0f + 5.0f);
float x = 2.0f + 5.0f;
}

View File

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

View File

@@ -21,8 +21,8 @@ void vs_main()
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);
float p = v2.x + v3.z;
float q = v4.w + v2.x;
float4x4 m;
}

View File

@@ -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;
}

View File

@@ -0,0 +1,13 @@
cbuffer props : register(b0)
{
float4x4 projection;
float4x4 view;
}
float4 vs_main(float4 pos : POSITION) : SV_POSITION
{
float4 mv = mul(props.view, pos);
float4 mvp = mul(props.projection, mv);
return mvp;
}

View File

@@ -8,7 +8,7 @@ int foo()
float bar()
{
return (1235.0f * 500);
return 1235.0f * 500;
}
void vs_main()

View File

@@ -7,7 +7,7 @@ struct Foo
float foo(Foo f)
{
return (f.some_data * 2.0f);
return f.some_data * 2.0f;
}
void vs_main()

View File

@@ -0,0 +1,7 @@
void vs_main()
{
float2 a;
float2 b;
float x = (a + b).x;
}

View File

@@ -1,4 +1,5 @@
test/assign_arithmetic_expression.ink codegen
test/arithmetic_parens.ink codegen
test/basic_property_and_return_value.ink codegen
test/builtin_types.ink codegen
test/complicated_computation.ink codegen
@@ -14,13 +15,12 @@ test/ifdefs.ink codegen
test/if_def_block.ink codegen
test/if_def_expression.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/rvalue_binary.ink codegen
test/simple_else_if.ink codegen
test/simple_if_else.ink codegen
test/simple_if.ink codegen

View File

@@ -1,4 +1,5 @@
test/assign_arithmetic_expression.ink compile
test/arithmetic_parens.ink compile
test/basic_property_and_return_value.ink compile
test/builtin_types.ink compile
test/complicated_computation.ink compile
@@ -15,11 +16,11 @@ test/ifdefs.ink compile
test/if_def_block.ink compile
test/if_def_expression.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/rvalue_binary.ink compile
test/simple_else_if.ink compile
test/simple_if_else.ink compile
test/simple_if.ink compile

View File

@@ -0,0 +1,13 @@
[vertex entry point] - vs_main
[constant_buffer] - props - 0 (@properties)
[field] - projection : struct : float4x4 {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} (@projection)
[field] - view : struct : float4x4 {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} (@view)

View File

@@ -1,4 +1,4 @@
camera :: constant_buffer {
camera :: Constant_Buffer {
projection : float4x4;
view : float4x4;
}

View File

@@ -1,4 +1,4 @@
p :: properties {
p :: Constant_Buffer {
v : float2;
}

View File

@@ -0,0 +1,7 @@
vertex main :: () {
for i : 0..10 {
x : float;
}
i += 1;
}

10
test/hinted_cbuffer.ink Normal file
View File

@@ -0,0 +1,10 @@
props :: constant_buffer @properties {
projection : float4x4 @projection;
view : float4x4 @view;
}
vertex main :: (pos : float4 @position) -> float4 @position {
mv : float4 = mul(props.view, pos);
mvp : float4 = mul(props.projection, mv);
return mvp;
}

View File

@@ -1,4 +1,4 @@
p :: properties {
p :: Constant_Buffer @properties {
color : float4;
rect_position : float2;
rect_scale : float2;

View File

@@ -0,0 +1,32 @@
{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 ='v'; }
{kind = TOKEN_COLON; ; index = 24 ; length = 1 line = 2 ; column = 2 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 26 ; length = 6 line = 2 ; column = 4 ; value ='float2'; }
{kind = TOKEN_SEMICOLON; ; index = 32 ; length = 1 line = 2 ; column = 10 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 36 ; length = 1 line = 3 ; column = 0 ; value ='v'; }
{kind = TOKEN_DOT; ; index = 37 ; length = 1 line = 3 ; column = 1 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 38 ; length = 1 line = 3 ; column = 2 ; value ='x'; }
{kind = TOKEN_ASSIGN; ; index = 40 ; length = 1 line = 3 ; column = 4 ; value ='='; }
{kind = TOKEN_LEFTPAREN; ; index = 42 ; length = 1 line = 3 ; column = 6 ; value ='('; }
{kind = TOKEN_FLOATLITERAL; ; index = 43 ; length = 3 line = 3 ; column = 7 ; value ='2'; }
{kind = TOKEN_PLUS; ; index = 47 ; length = 1 line = 3 ; column = 11 ; value ='+'; }
{kind = TOKEN_LEFTPAREN; ; index = 49 ; length = 1 line = 3 ; column = 13 ; value ='('; }
{kind = TOKEN_LEFTPAREN; ; index = 50 ; length = 1 line = 3 ; column = 14 ; value ='('; }
{kind = TOKEN_FLOATLITERAL; ; index = 51 ; length = 3 line = 3 ; column = 15 ; value ='4'; }
{kind = TOKEN_MINUS; ; index = 55 ; length = 1 line = 3 ; column = 19 ; value ='-'; }
{kind = TOKEN_FLOATLITERAL; ; index = 57 ; length = 3 line = 3 ; column = 21 ; value ='2'; }
{kind = TOKEN_RIGHTPAREN; ; index = 60 ; length = 1 line = 3 ; column = 24 ; value =')'; }
{kind = TOKEN_STAR; ; index = 62 ; length = 1 line = 3 ; column = 26 ; value ='*'; }
{kind = TOKEN_FLOATLITERAL; ; index = 64 ; length = 3 line = 3 ; column = 28 ; value ='1.5'; }
{kind = TOKEN_RIGHTPAREN; ; index = 67 ; length = 1 line = 3 ; column = 31 ; value =')'; }
{kind = TOKEN_RIGHTPAREN; ; index = 68 ; length = 1 line = 3 ; column = 32 ; value =')'; }
{kind = TOKEN_STAR; ; index = 70 ; length = 1 line = 3 ; column = 34 ; value ='*'; }
{kind = TOKEN_FLOATLITERAL; ; index = 72 ; length = 3 line = 3 ; column = 36 ; value ='3'; }
{kind = TOKEN_SEMICOLON; ; index = 75 ; length = 1 line = 3 ; column = 39 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 78 ; length = 1 line = 4 ; column = 0 ; value ='}'; }
{kind = TOKEN_EOF; ; index = 81 ; length = 0 line = 5 ; column = 0 ; value =''; }

View File

@@ -0,0 +1,31 @@
{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_STRUCT; ; index = 5 ; length = 6 line = 1 ; column = 5 ; value ='struct'; }
{kind = TOKEN_LEFTBRACE; ; index = 12 ; length = 1 line = 1 ; column = 12 ; value ='{'; }
{kind = TOKEN_IDENTIFIER; ; index = 16 ; length = 1 line = 2 ; column = 0 ; value ='v'; }
{kind = TOKEN_COLON; ; index = 18 ; length = 1 line = 2 ; column = 2 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 20 ; length = 6 line = 2 ; column = 4 ; value ='float2'; }
{kind = TOKEN_SEMICOLON; ; index = 26 ; length = 1 line = 2 ; column = 10 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 29 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
{kind = TOKEN_VERTEX; ; index = 34 ; length = 6 line = 5 ; column = 0 ; value ='vertex'; }
{kind = TOKEN_IDENTIFIER; ; index = 41 ; length = 4 line = 5 ; column = 7 ; value ='main'; }
{kind = TOKEN_DOUBLECOLON; ; index = 46 ; length = 2 line = 5 ; column = 12 ; value ='::'; }
{kind = TOKEN_LEFTPAREN; ; index = 49 ; length = 1 line = 5 ; column = 15 ; value ='('; }
{kind = TOKEN_RIGHTPAREN; ; index = 50 ; length = 1 line = 5 ; column = 16 ; value =')'; }
{kind = TOKEN_LEFTBRACE; ; index = 52 ; length = 1 line = 5 ; column = 18 ; value ='{'; }
{kind = TOKEN_IDENTIFIER; ; index = 56 ; length = 1 line = 6 ; column = 0 ; value ='p'; }
{kind = TOKEN_COLON; ; index = 58 ; length = 1 line = 6 ; column = 2 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 60 ; length = 1 line = 6 ; column = 4 ; value ='P'; }
{kind = TOKEN_SEMICOLON; ; index = 61 ; length = 1 line = 6 ; column = 5 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 65 ; length = 1 line = 7 ; column = 0 ; value ='p'; }
{kind = TOKEN_DOT; ; index = 66 ; length = 1 line = 7 ; column = 1 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 67 ; length = 1 line = 7 ; column = 2 ; value ='v'; }
{kind = TOKEN_DOT; ; index = 68 ; length = 1 line = 7 ; column = 3 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 69 ; length = 1 line = 7 ; column = 4 ; value ='x'; }
{kind = TOKEN_DOT; ; index = 70 ; length = 1 line = 7 ; column = 5 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 71 ; length = 1 line = 7 ; column = 6 ; value ='y'; }
{kind = TOKEN_ASSIGN; ; index = 73 ; length = 1 line = 7 ; column = 8 ; value ='='; }
{kind = TOKEN_FLOATLITERAL; ; index = 75 ; length = 3 line = 7 ; column = 10 ; value ='2'; }
{kind = TOKEN_SEMICOLON; ; index = 78 ; length = 1 line = 7 ; column = 13 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 118 ; length = 1 line = 10 ; column = 0 ; value ='}'; }
{kind = TOKEN_EOF; ; index = 121 ; length = 0 line = 11 ; column = 0 ; value =''; }

View File

@@ -1,43 +1,47 @@
{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_IDENTIFIER; ; index = 0 ; length = 10 line = 1 ; column = 0 ; value ='properties'; }
{kind = TOKEN_DOUBLECOLON; ; index = 11 ; length = 2 line = 1 ; column = 11 ; value ='::'; }
{kind = TOKEN_CONSTANT_BUFFER; ; index = 14 ; length = 15 line = 1 ; column = 14 ; value ='Constant_Buffer'; }
{kind = TOKEN_AT; ; index = 30 ; length = 1 line = 1 ; column = 30 ; value ='@'; }
{kind = TOKEN_IDENTIFIER; ; index = 31 ; length = 10 line = 1 ; column = 31 ; value ='properties'; }
{kind = TOKEN_LEFTBRACE; ; index = 42 ; length = 1 line = 1 ; column = 42 ; value ='{'; }
{kind = TOKEN_IDENTIFIER; ; index = 46 ; length = 5 line = 2 ; column = 0 ; value ='color'; }
{kind = TOKEN_COLON; ; index = 52 ; length = 1 line = 2 ; column = 6 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 54 ; length = 6 line = 2 ; column = 8 ; value ='float4'; }
{kind = TOKEN_SEMICOLON; ; index = 60 ; length = 1 line = 2 ; column = 14 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 63 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
{kind = TOKEN_VERTEX; ; index = 68 ; length = 6 line = 5 ; column = 0 ; value ='vertex'; }
{kind = TOKEN_IDENTIFIER; ; index = 75 ; length = 4 line = 5 ; column = 7 ; value ='main'; }
{kind = TOKEN_DOUBLECOLON; ; index = 80 ; length = 2 line = 5 ; column = 12 ; value ='::'; }
{kind = TOKEN_LEFTPAREN; ; index = 83 ; length = 1 line = 5 ; column = 15 ; value ='('; }
{kind = TOKEN_IDENTIFIER; ; index = 84 ; length = 3 line = 5 ; column = 16 ; value ='pos'; }
{kind = TOKEN_COLON; ; index = 88 ; length = 1 line = 5 ; column = 20 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 90 ; length = 6 line = 5 ; column = 22 ; value ='float3'; }
{kind = TOKEN_AT; ; index = 97 ; length = 1 line = 5 ; column = 29 ; value ='@'; }
{kind = TOKEN_IDENTIFIER; ; index = 98 ; length = 8 line = 5 ; column = 30 ; value ='position'; }
{kind = TOKEN_RIGHTPAREN; ; index = 106 ; length = 1 line = 5 ; column = 38 ; value =')'; }
{kind = TOKEN_ARROW; ; index = 108 ; length = 2 line = 5 ; column = 40 ; value ='->'; }
{kind = TOKEN_IDENTIFIER; ; index = 111 ; length = 6 line = 5 ; column = 43 ; value ='float3'; }
{kind = TOKEN_AT; ; index = 118 ; length = 1 line = 5 ; column = 50 ; value ='@'; }
{kind = TOKEN_IDENTIFIER; ; index = 119 ; length = 8 line = 5 ; column = 51 ; value ='position'; }
{kind = TOKEN_LEFTBRACE; ; index = 128 ; length = 1 line = 5 ; column = 60 ; value ='{'; }
{kind = TOKEN_RETURN; ; index = 134 ; length = 6 line = 6 ; column = 2 ; value ='return'; }
{kind = TOKEN_IDENTIFIER; ; index = 141 ; length = 3 line = 6 ; column = 9 ; value ='pos'; }
{kind = TOKEN_SEMICOLON; ; index = 144 ; length = 1 line = 6 ; column = 12 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 147 ; length = 1 line = 7 ; column = 0 ; value ='}'; }
{kind = TOKEN_PIXEL; ; index = 152 ; length = 5 line = 9 ; column = 0 ; value ='pixel'; }
{kind = TOKEN_IDENTIFIER; ; index = 158 ; length = 4 line = 9 ; column = 6 ; value ='main'; }
{kind = TOKEN_DOUBLECOLON; ; index = 163 ; length = 2 line = 9 ; column = 11 ; value ='::'; }
{kind = TOKEN_LEFTPAREN; ; index = 166 ; length = 1 line = 9 ; column = 14 ; value ='('; }
{kind = TOKEN_RIGHTPAREN; ; index = 167 ; length = 1 line = 9 ; column = 15 ; value =')'; }
{kind = TOKEN_ARROW; ; index = 169 ; length = 2 line = 9 ; column = 17 ; value ='->'; }
{kind = TOKEN_IDENTIFIER; ; index = 172 ; length = 6 line = 9 ; column = 20 ; value ='float4'; }
{kind = TOKEN_AT; ; index = 179 ; length = 1 line = 9 ; column = 27 ; value ='@'; }
{kind = TOKEN_IDENTIFIER; ; index = 180 ; length = 7 line = 9 ; column = 28 ; value ='target0'; }
{kind = TOKEN_LEFTBRACE; ; index = 188 ; length = 1 line = 9 ; column = 36 ; value ='{'; }
{kind = TOKEN_RETURN; ; index = 194 ; length = 6 line = 10 ; column = 2 ; value ='return'; }
{kind = TOKEN_IDENTIFIER; ; index = 201 ; length = 10 line = 10 ; column = 9 ; value ='properties'; }
{kind = TOKEN_DOT; ; index = 211 ; length = 1 line = 10 ; column = 19 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 212 ; length = 5 line = 10 ; column = 20 ; value ='color'; }
{kind = TOKEN_SEMICOLON; ; index = 217 ; length = 1 line = 10 ; column = 25 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 220 ; length = 1 line = 11 ; column = 0 ; value ='}'; }
{kind = TOKEN_EOF; ; index = 223 ; length = 0 line = 12 ; column = 0 ; value =''; }

View File

@@ -1,6 +1,6 @@
{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_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 =':'; }

View File

@@ -0,0 +1,33 @@
{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_CONSTANT_BUFFER; ; index = 5 ; length = 15 line = 1 ; column = 5 ; value ='Constant_Buffer'; }
{kind = TOKEN_LEFTBRACE; ; index = 21 ; length = 1 line = 1 ; column = 21 ; value ='{'; }
{kind = TOKEN_IDENTIFIER; ; index = 25 ; length = 1 line = 2 ; column = 0 ; value ='v'; }
{kind = TOKEN_COLON; ; index = 27 ; length = 1 line = 2 ; column = 2 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 29 ; length = 6 line = 2 ; column = 4 ; value ='float2'; }
{kind = TOKEN_SEMICOLON; ; index = 35 ; length = 1 line = 2 ; column = 10 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 38 ; length = 1 line = 3 ; column = 0 ; value ='}'; }
{kind = TOKEN_VERTEX; ; index = 43 ; length = 6 line = 5 ; column = 0 ; value ='vertex'; }
{kind = TOKEN_IDENTIFIER; ; index = 50 ; length = 4 line = 5 ; column = 7 ; value ='main'; }
{kind = TOKEN_DOUBLECOLON; ; index = 55 ; length = 2 line = 5 ; column = 12 ; value ='::'; }
{kind = TOKEN_LEFTPAREN; ; index = 57 ; length = 1 line = 5 ; column = 14 ; value ='('; }
{kind = TOKEN_RIGHTPAREN; ; index = 58 ; length = 1 line = 5 ; column = 15 ; value =')'; }
{kind = TOKEN_LEFTBRACE; ; index = 60 ; length = 1 line = 5 ; column = 17 ; value ='{'; }
{kind = TOKEN_IDENTIFIER; ; index = 64 ; length = 1 line = 6 ; column = 0 ; value ='x'; }
{kind = TOKEN_COLON; ; index = 66 ; length = 1 line = 6 ; column = 2 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 68 ; length = 5 line = 6 ; column = 4 ; value ='float'; }
{kind = TOKEN_ASSIGN; ; index = 74 ; length = 1 line = 6 ; column = 10 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 76 ; length = 1 line = 6 ; column = 12 ; value ='p'; }
{kind = TOKEN_DOT; ; index = 77 ; length = 1 line = 6 ; column = 13 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 78 ; length = 1 line = 6 ; column = 14 ; value ='v'; }
{kind = TOKEN_DOT; ; index = 79 ; length = 1 line = 6 ; column = 15 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 80 ; length = 1 line = 6 ; column = 16 ; value ='x'; }
{kind = TOKEN_SLASH; ; index = 82 ; length = 1 line = 6 ; column = 18 ; value ='/'; }
{kind = TOKEN_IDENTIFIER; ; index = 84 ; length = 1 line = 6 ; column = 20 ; value ='p'; }
{kind = TOKEN_DOT; ; index = 85 ; length = 1 line = 6 ; column = 21 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 86 ; length = 1 line = 6 ; column = 22 ; value ='v'; }
{kind = TOKEN_DOT; ; index = 87 ; length = 1 line = 6 ; column = 23 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 88 ; length = 1 line = 6 ; column = 24 ; value ='y'; }
{kind = TOKEN_SEMICOLON; ; index = 89 ; length = 1 line = 6 ; column = 25 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 92 ; length = 1 line = 7 ; column = 0 ; value ='}'; }
{kind = TOKEN_EOF; ; index = 95 ; length = 0 line = 8 ; column = 0 ; value =''; }

View File

@@ -0,0 +1,65 @@
{kind = TOKEN_IDENTIFIER; ; index = 0 ; length = 5 line = 1 ; column = 0 ; value ='props'; }
{kind = TOKEN_DOUBLECOLON; ; index = 6 ; length = 2 line = 1 ; column = 6 ; value ='::'; }
{kind = TOKEN_CONSTANT_BUFFER; ; index = 9 ; length = 15 line = 1 ; column = 9 ; value ='constant_buffer'; }
{kind = TOKEN_AT; ; index = 25 ; length = 1 line = 1 ; column = 25 ; value ='@'; }
{kind = TOKEN_PROPERTIES; ; index = 26 ; length = 10 line = 1 ; column = 26 ; value ='properties'; }
{kind = TOKEN_LEFTBRACE; ; index = 37 ; length = 1 line = 1 ; column = 37 ; value ='{'; }
{kind = TOKEN_IDENTIFIER; ; index = 41 ; length = 10 line = 2 ; column = 0 ; value ='projection'; }
{kind = TOKEN_COLON; ; index = 52 ; length = 1 line = 2 ; column = 11 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 54 ; length = 8 line = 2 ; column = 13 ; value ='float4x4'; }
{kind = TOKEN_AT; ; index = 63 ; length = 1 line = 2 ; column = 22 ; value ='@'; }
{kind = TOKEN_IDENTIFIER; ; index = 64 ; length = 10 line = 2 ; column = 23 ; value ='projection'; }
{kind = TOKEN_SEMICOLON; ; index = 74 ; length = 1 line = 2 ; column = 33 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 78 ; length = 4 line = 3 ; column = 0 ; value ='view'; }
{kind = TOKEN_COLON; ; index = 89 ; length = 1 line = 3 ; column = 11 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 91 ; length = 8 line = 3 ; column = 13 ; value ='float4x4'; }
{kind = TOKEN_AT; ; index = 100 ; length = 1 line = 3 ; column = 22 ; value ='@'; }
{kind = TOKEN_IDENTIFIER; ; index = 101 ; length = 4 line = 3 ; column = 23 ; value ='view'; }
{kind = TOKEN_SEMICOLON; ; index = 105 ; length = 1 line = 3 ; column = 27 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 108 ; length = 1 line = 4 ; column = 0 ; value ='}'; }
{kind = TOKEN_VERTEX; ; index = 113 ; length = 6 line = 6 ; column = 0 ; value ='vertex'; }
{kind = TOKEN_IDENTIFIER; ; index = 120 ; length = 4 line = 6 ; column = 7 ; value ='main'; }
{kind = TOKEN_DOUBLECOLON; ; index = 125 ; length = 2 line = 6 ; column = 12 ; value ='::'; }
{kind = TOKEN_LEFTPAREN; ; index = 128 ; length = 1 line = 6 ; column = 15 ; value ='('; }
{kind = TOKEN_IDENTIFIER; ; index = 129 ; length = 3 line = 6 ; column = 16 ; value ='pos'; }
{kind = TOKEN_COLON; ; index = 133 ; length = 1 line = 6 ; column = 20 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 135 ; length = 6 line = 6 ; column = 22 ; value ='float4'; }
{kind = TOKEN_AT; ; index = 142 ; length = 1 line = 6 ; column = 29 ; value ='@'; }
{kind = TOKEN_IDENTIFIER; ; index = 143 ; length = 8 line = 6 ; column = 30 ; value ='position'; }
{kind = TOKEN_RIGHTPAREN; ; index = 151 ; length = 1 line = 6 ; column = 38 ; value =')'; }
{kind = TOKEN_ARROW; ; index = 153 ; length = 2 line = 6 ; column = 40 ; value ='->'; }
{kind = TOKEN_IDENTIFIER; ; index = 156 ; length = 6 line = 6 ; column = 43 ; value ='float4'; }
{kind = TOKEN_AT; ; index = 163 ; length = 1 line = 6 ; column = 50 ; value ='@'; }
{kind = TOKEN_IDENTIFIER; ; index = 164 ; length = 8 line = 6 ; column = 51 ; value ='position'; }
{kind = TOKEN_LEFTBRACE; ; index = 173 ; length = 1 line = 6 ; column = 60 ; value ='{'; }
{kind = TOKEN_IDENTIFIER; ; index = 177 ; length = 2 line = 7 ; column = 0 ; value ='mv'; }
{kind = TOKEN_COLON; ; index = 180 ; length = 1 line = 7 ; column = 3 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 182 ; length = 6 line = 7 ; column = 5 ; value ='float4'; }
{kind = TOKEN_ASSIGN; ; index = 189 ; length = 1 line = 7 ; column = 12 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 191 ; length = 3 line = 7 ; column = 14 ; value ='mul'; }
{kind = TOKEN_LEFTPAREN; ; index = 194 ; length = 1 line = 7 ; column = 17 ; value ='('; }
{kind = TOKEN_IDENTIFIER; ; index = 195 ; length = 5 line = 7 ; column = 18 ; value ='props'; }
{kind = TOKEN_DOT; ; index = 200 ; length = 1 line = 7 ; column = 23 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 201 ; length = 4 line = 7 ; column = 24 ; value ='view'; }
{kind = TOKEN_COMMA; ; index = 205 ; length = 1 line = 7 ; column = 28 ; value =','; }
{kind = TOKEN_IDENTIFIER; ; index = 207 ; length = 3 line = 7 ; column = 30 ; value ='pos'; }
{kind = TOKEN_RIGHTPAREN; ; index = 210 ; length = 1 line = 7 ; column = 33 ; value =')'; }
{kind = TOKEN_SEMICOLON; ; index = 211 ; length = 1 line = 7 ; column = 34 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 215 ; length = 3 line = 8 ; column = 0 ; value ='mvp'; }
{kind = TOKEN_COLON; ; index = 219 ; length = 1 line = 8 ; column = 4 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 221 ; length = 6 line = 8 ; column = 6 ; value ='float4'; }
{kind = TOKEN_ASSIGN; ; index = 228 ; length = 1 line = 8 ; column = 13 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 230 ; length = 3 line = 8 ; column = 15 ; value ='mul'; }
{kind = TOKEN_LEFTPAREN; ; index = 233 ; length = 1 line = 8 ; column = 18 ; value ='('; }
{kind = TOKEN_IDENTIFIER; ; index = 234 ; length = 5 line = 8 ; column = 19 ; value ='props'; }
{kind = TOKEN_DOT; ; index = 239 ; length = 1 line = 8 ; column = 24 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 240 ; length = 10 line = 8 ; column = 25 ; value ='projection'; }
{kind = TOKEN_COMMA; ; index = 250 ; length = 1 line = 8 ; column = 35 ; value =','; }
{kind = TOKEN_IDENTIFIER; ; index = 252 ; length = 2 line = 8 ; column = 37 ; value ='mv'; }
{kind = TOKEN_RIGHTPAREN; ; index = 254 ; length = 1 line = 8 ; column = 39 ; value =')'; }
{kind = TOKEN_SEMICOLON; ; index = 255 ; length = 1 line = 8 ; column = 40 ; value =';'; }
{kind = TOKEN_RETURN; ; index = 259 ; length = 6 line = 9 ; column = 0 ; value ='return'; }
{kind = TOKEN_IDENTIFIER; ; index = 266 ; length = 3 line = 9 ; column = 7 ; value ='mvp'; }
{kind = TOKEN_SEMICOLON; ; index = 269 ; length = 1 line = 9 ; column = 10 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 272 ; length = 1 line = 10 ; column = 0 ; value ='}'; }
{kind = TOKEN_EOF; ; index = 275 ; length = 0 line = 11 ; column = 0 ; value =''; }

View File

@@ -1,289 +1,291 @@
{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 = 5 line = 2 ; column = 0 ; value ='color'; }
{kind = TOKEN_COLON; ; index = 34 ; length = 1 line = 2 ; column = 14 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 36 ; length = 6 line = 2 ; column = 16 ; value ='float4'; }
{kind = TOKEN_SEMICOLON; ; index = 42 ; length = 1 line = 2 ; column = 22 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 46 ; length = 13 line = 3 ; column = 0 ; value ='rect_position'; }
{kind = TOKEN_COLON; ; index = 60 ; length = 1 line = 3 ; column = 14 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 62 ; length = 6 line = 3 ; column = 16 ; value ='float2'; }
{kind = TOKEN_SEMICOLON; ; index = 68 ; length = 1 line = 3 ; column = 22 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 72 ; length = 10 line = 4 ; column = 0 ; value ='rect_scale'; }
{kind = TOKEN_COLON; ; index = 86 ; length = 1 line = 4 ; column = 14 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 88 ; length = 6 line = 4 ; column = 16 ; value ='float2'; }
{kind = TOKEN_SEMICOLON; ; index = 94 ; length = 1 line = 4 ; column = 22 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 98 ; length = 10 line = 5 ; column = 0 ; value ='resolution'; }
{kind = TOKEN_COLON; ; index = 112 ; length = 1 line = 5 ; column = 14 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 114 ; length = 6 line = 5 ; column = 16 ; value ='float2'; }
{kind = TOKEN_SEMICOLON; ; index = 120 ; length = 1 line = 5 ; column = 22 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 124 ; length = 7 line = 6 ; column = 0 ; value ='texture'; }
{kind = TOKEN_COLON; ; index = 138 ; length = 1 line = 6 ; column = 14 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 140 ; length = 9 line = 6 ; column = 16 ; value ='Texture2D'; }
{kind = TOKEN_SEMICOLON; ; index = 149 ; length = 1 line = 6 ; column = 25 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 153 ; length = 7 line = 7 ; column = 0 ; value ='sampler'; }
{kind = TOKEN_COLON; ; index = 167 ; length = 1 line = 7 ; column = 14 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 169 ; length = 7 line = 7 ; column = 16 ; value ='Sampler'; }
{kind = TOKEN_SEMICOLON; ; index = 176 ; length = 1 line = 7 ; column = 23 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 179 ; length = 1 line = 8 ; column = 0 ; value ='}'; }
{kind = TOKEN_IDENTIFIER; ; index = 184 ; length = 8 line = 10 ; column = 0 ; value ='PS_Input'; }
{kind = TOKEN_DOUBLECOLON; ; index = 193 ; length = 2 line = 10 ; column = 9 ; value ='::'; }
{kind = TOKEN_STRUCT; ; index = 196 ; length = 6 line = 10 ; column = 12 ; value ='struct'; }
{kind = TOKEN_LEFTBRACE; ; index = 203 ; length = 1 line = 10 ; column = 19 ; value ='{'; }
{kind = TOKEN_IDENTIFIER; ; index = 207 ; length = 2 line = 11 ; column = 0 ; value ='uv'; }
{kind = TOKEN_COLON; ; index = 210 ; length = 1 line = 11 ; column = 3 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 212 ; length = 6 line = 11 ; column = 5 ; value ='float2'; }
{kind = TOKEN_AT; ; index = 219 ; length = 1 line = 11 ; column = 12 ; value ='@'; }
{kind = TOKEN_IDENTIFIER; ; index = 220 ; length = 2 line = 11 ; column = 13 ; value ='uv'; }
{kind = TOKEN_SEMICOLON; ; index = 222 ; length = 1 line = 11 ; column = 15 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 226 ; length = 3 line = 12 ; column = 0 ; value ='pos'; }
{kind = TOKEN_COLON; ; index = 230 ; length = 1 line = 12 ; column = 4 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 232 ; length = 6 line = 12 ; column = 6 ; value ='float4'; }
{kind = TOKEN_AT; ; index = 239 ; length = 1 line = 12 ; column = 13 ; value ='@'; }
{kind = TOKEN_IDENTIFIER; ; index = 240 ; length = 3 line = 12 ; column = 14 ; value ='pos'; }
{kind = TOKEN_SEMICOLON; ; index = 243 ; length = 1 line = 12 ; column = 17 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 246 ; length = 1 line = 13 ; column = 0 ; value ='}'; }
{kind = TOKEN_VERTEX; ; index = 251 ; length = 6 line = 15 ; column = 0 ; value ='vertex'; }
{kind = TOKEN_IDENTIFIER; ; index = 258 ; length = 4 line = 15 ; column = 7 ; value ='main'; }
{kind = TOKEN_DOUBLECOLON; ; index = 263 ; length = 2 line = 15 ; column = 12 ; value ='::'; }
{kind = TOKEN_LEFTPAREN; ; index = 266 ; length = 1 line = 15 ; column = 15 ; value ='('; }
{kind = TOKEN_IDENTIFIER; ; index = 267 ; length = 3 line = 15 ; column = 16 ; value ='pos'; }
{kind = TOKEN_COLON; ; index = 271 ; length = 1 line = 15 ; column = 20 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 273 ; length = 6 line = 15 ; column = 22 ; value ='float4'; }
{kind = TOKEN_AT; ; index = 280 ; length = 1 line = 15 ; column = 29 ; value ='@'; }
{kind = TOKEN_IDENTIFIER; ; index = 281 ; length = 8 line = 15 ; column = 30 ; value ='position'; }
{kind = TOKEN_RIGHTPAREN; ; index = 289 ; length = 1 line = 15 ; column = 38 ; value =')'; }
{kind = TOKEN_ARROW; ; index = 291 ; length = 2 line = 15 ; column = 40 ; value ='->'; }
{kind = TOKEN_IDENTIFIER; ; index = 294 ; length = 8 line = 15 ; column = 43 ; value ='PS_Input'; }
{kind = TOKEN_LEFTBRACE; ; index = 303 ; length = 1 line = 15 ; column = 52 ; value ='{'; }
{kind = TOKEN_IDENTIFIER; ; index = 307 ; length = 3 line = 16 ; column = 0 ; value ='res'; }
{kind = TOKEN_COLON; ; index = 316 ; length = 1 line = 16 ; column = 9 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 318 ; length = 6 line = 16 ; column = 11 ; value ='float2'; }
{kind = TOKEN_ASSIGN; ; index = 325 ; length = 1 line = 16 ; column = 18 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 327 ; length = 1 line = 16 ; column = 20 ; value ='p'; }
{kind = TOKEN_DOT; ; index = 328 ; length = 1 line = 16 ; column = 21 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 329 ; length = 10 line = 16 ; column = 22 ; value ='resolution'; }
{kind = TOKEN_SEMICOLON; ; index = 339 ; length = 1 line = 16 ; column = 32 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 343 ; length = 5 line = 17 ; column = 0 ; value ='scale'; }
{kind = TOKEN_COLON; ; index = 352 ; length = 1 line = 17 ; column = 9 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 354 ; length = 6 line = 17 ; column = 11 ; value ='float2'; }
{kind = TOKEN_ASSIGN; ; index = 361 ; length = 1 line = 17 ; column = 18 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 363 ; length = 1 line = 17 ; column = 20 ; value ='p'; }
{kind = TOKEN_DOT; ; index = 364 ; length = 1 line = 17 ; column = 21 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 365 ; length = 10 line = 17 ; column = 22 ; value ='rect_scale'; }
{kind = TOKEN_SEMICOLON; ; index = 375 ; length = 1 line = 17 ; column = 32 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 379 ; length = 8 line = 18 ; column = 0 ; value ='rect_pos'; }
{kind = TOKEN_COLON; ; index = 388 ; length = 1 line = 18 ; column = 9 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 390 ; length = 6 line = 18 ; column = 11 ; value ='float2'; }
{kind = TOKEN_ASSIGN; ; index = 397 ; length = 1 line = 18 ; column = 18 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 399 ; length = 1 line = 18 ; column = 20 ; value ='p'; }
{kind = TOKEN_DOT; ; index = 400 ; length = 1 line = 18 ; column = 21 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 401 ; length = 13 line = 18 ; column = 22 ; value ='rect_position'; }
{kind = TOKEN_SEMICOLON; ; index = 414 ; length = 1 line = 18 ; column = 35 ; value =';'; }
{kind = TOKEN_SEMICOLON; ; index = 415 ; length = 1 line = 18 ; column = 36 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 421 ; length = 6 line = 20 ; column = 0 ; value ='center'; }
{kind = TOKEN_COLON; ; index = 428 ; length = 1 line = 20 ; column = 7 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 430 ; length = 6 line = 20 ; column = 9 ; value ='float2'; }
{kind = TOKEN_ASSIGN; ; index = 437 ; length = 1 line = 20 ; column = 16 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 439 ; length = 8 line = 20 ; column = 18 ; value ='rect_pos'; }
{kind = TOKEN_SEMICOLON; ; index = 447 ; length = 1 line = 20 ; column = 26 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 451 ; length = 9 line = 21 ; column = 0 ; value ='half_size'; }
{kind = TOKEN_COLON; ; index = 462 ; length = 1 line = 21 ; column = 11 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 464 ; length = 6 line = 21 ; column = 13 ; value ='float2'; }
{kind = TOKEN_ASSIGN; ; index = 471 ; length = 1 line = 21 ; column = 20 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 473 ; length = 6 line = 21 ; column = 22 ; value ='float2'; }
{kind = TOKEN_LEFTPAREN; ; index = 479 ; length = 1 line = 21 ; column = 28 ; value ='('; }
{kind = TOKEN_IDENTIFIER; ; index = 480 ; length = 5 line = 21 ; column = 29 ; value ='scale'; }
{kind = TOKEN_DOT; ; index = 485 ; length = 1 line = 21 ; column = 34 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 486 ; length = 1 line = 21 ; column = 35 ; value ='x'; }
{kind = TOKEN_SLASH; ; index = 488 ; length = 1 line = 21 ; column = 37 ; value ='/'; }
{kind = TOKEN_INTLITERAL; ; index = 490 ; length = 1 line = 21 ; column = 39 ; value ='2'; }
{kind = TOKEN_COMMA; ; index = 491 ; length = 1 line = 21 ; column = 40 ; value =','; }
{kind = TOKEN_IDENTIFIER; ; index = 493 ; length = 5 line = 21 ; column = 42 ; value ='scale'; }
{kind = TOKEN_DOT; ; index = 498 ; length = 1 line = 21 ; column = 47 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 499 ; length = 1 line = 21 ; column = 48 ; value ='y'; }
{kind = TOKEN_SLASH; ; index = 501 ; length = 1 line = 21 ; column = 50 ; value ='/'; }
{kind = TOKEN_INTLITERAL; ; index = 503 ; length = 1 line = 21 ; column = 52 ; value ='2'; }
{kind = TOKEN_RIGHTPAREN; ; index = 504 ; length = 1 line = 21 ; column = 53 ; value =')'; }
{kind = TOKEN_SEMICOLON; ; index = 505 ; length = 1 line = 21 ; column = 54 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 509 ; length = 7 line = 22 ; column = 0 ; value ='dst_pos'; }
{kind = TOKEN_COLON; ; index = 520 ; length = 1 line = 22 ; column = 11 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 522 ; length = 6 line = 22 ; column = 13 ; value ='float4'; }
{kind = TOKEN_ASSIGN; ; index = 529 ; length = 1 line = 22 ; column = 20 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 531 ; length = 6 line = 22 ; column = 22 ; value ='float4'; }
{kind = TOKEN_LEFTPAREN; ; index = 537 ; length = 1 line = 22 ; column = 28 ; value ='('; }
{kind = TOKEN_IDENTIFIER; ; index = 538 ; length = 3 line = 22 ; column = 29 ; value ='pos'; }
{kind = TOKEN_DOT; ; index = 541 ; length = 1 line = 22 ; column = 32 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 542 ; length = 1 line = 22 ; column = 33 ; value ='x'; }
{kind = TOKEN_STAR; ; index = 544 ; length = 1 line = 22 ; column = 35 ; value ='*'; }
{kind = TOKEN_IDENTIFIER; ; index = 546 ; length = 9 line = 22 ; column = 37 ; value ='half_size'; }
{kind = TOKEN_DOT; ; index = 555 ; length = 1 line = 22 ; column = 46 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 556 ; length = 1 line = 22 ; column = 47 ; value ='x'; }
{kind = TOKEN_PLUS; ; index = 558 ; length = 1 line = 22 ; column = 49 ; value ='+'; }
{kind = TOKEN_IDENTIFIER; ; index = 560 ; length = 6 line = 22 ; column = 51 ; value ='center'; }
{kind = TOKEN_DOT; ; index = 566 ; length = 1 line = 22 ; column = 57 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 567 ; length = 1 line = 22 ; column = 58 ; value ='x'; }
{kind = TOKEN_COMMA; ; index = 568 ; length = 1 line = 22 ; column = 59 ; value =','; }
{kind = TOKEN_IDENTIFIER; ; index = 570 ; length = 3 line = 22 ; column = 61 ; value ='pos'; }
{kind = TOKEN_DOT; ; index = 573 ; length = 1 line = 22 ; column = 64 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 574 ; length = 1 line = 22 ; column = 65 ; value ='y'; }
{kind = TOKEN_STAR; ; index = 576 ; length = 1 line = 22 ; column = 67 ; value ='*'; }
{kind = TOKEN_IDENTIFIER; ; index = 578 ; length = 9 line = 22 ; column = 69 ; value ='half_size'; }
{kind = TOKEN_DOT; ; index = 587 ; length = 1 line = 22 ; column = 78 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 588 ; length = 1 line = 22 ; column = 79 ; value ='y'; }
{kind = TOKEN_PLUS; ; index = 590 ; length = 1 line = 22 ; column = 81 ; value ='+'; }
{kind = TOKEN_IDENTIFIER; ; index = 592 ; length = 6 line = 22 ; column = 83 ; value ='center'; }
{kind = TOKEN_DOT; ; index = 598 ; length = 1 line = 22 ; column = 89 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 599 ; length = 1 line = 22 ; column = 90 ; value ='y'; }
{kind = TOKEN_COMMA; ; index = 600 ; length = 1 line = 22 ; column = 91 ; value =','; }
{kind = TOKEN_FLOATLITERAL; ; index = 602 ; length = 3 line = 22 ; column = 93 ; value ='0'; }
{kind = TOKEN_COMMA; ; index = 605 ; length = 1 line = 22 ; column = 96 ; value =','; }
{kind = TOKEN_FLOATLITERAL; ; index = 607 ; length = 3 line = 22 ; column = 98 ; value ='1'; }
{kind = TOKEN_RIGHTPAREN; ; index = 610 ; length = 1 line = 22 ; column = 101 ; value =')'; }
{kind = TOKEN_SEMICOLON; ; index = 611 ; length = 1 line = 22 ; column = 102 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 617 ; length = 6 line = 24 ; column = 0 ; value ='result'; }
{kind = TOKEN_COLON; ; index = 624 ; length = 1 line = 24 ; column = 7 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 626 ; length = 8 line = 24 ; column = 9 ; value ='PS_Input'; }
{kind = TOKEN_SEMICOLON; ; index = 634 ; length = 1 line = 24 ; column = 17 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 640 ; length = 6 line = 26 ; column = 0 ; value ='src_p0'; }
{kind = TOKEN_COLON; ; index = 647 ; length = 1 line = 26 ; column = 7 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 649 ; length = 6 line = 26 ; column = 9 ; value ='float2'; }
{kind = TOKEN_ASSIGN; ; index = 656 ; length = 1 line = 26 ; column = 16 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 658 ; length = 6 line = 26 ; column = 18 ; value ='float2'; }
{kind = TOKEN_LEFTPAREN; ; index = 664 ; length = 1 line = 26 ; column = 24 ; value ='('; }
{kind = TOKEN_FLOATLITERAL; ; index = 665 ; length = 3 line = 26 ; column = 25 ; value ='0'; }
{kind = TOKEN_COMMA; ; index = 668 ; length = 1 line = 26 ; column = 28 ; value =','; }
{kind = TOKEN_FLOATLITERAL; ; index = 670 ; length = 3 line = 26 ; column = 30 ; value ='1'; }
{kind = TOKEN_RIGHTPAREN; ; index = 673 ; length = 1 line = 26 ; column = 33 ; value =')'; }
{kind = TOKEN_SEMICOLON; ; index = 674 ; length = 1 line = 26 ; column = 34 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 678 ; length = 6 line = 27 ; column = 0 ; value ='src_p1'; }
{kind = TOKEN_COLON; ; index = 685 ; length = 1 line = 27 ; column = 7 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 687 ; length = 6 line = 27 ; column = 9 ; value ='float2'; }
{kind = TOKEN_ASSIGN; ; index = 694 ; length = 1 line = 27 ; column = 16 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 696 ; length = 6 line = 27 ; column = 18 ; value ='float2'; }
{kind = TOKEN_LEFTPAREN; ; index = 702 ; length = 1 line = 27 ; column = 24 ; value ='('; }
{kind = TOKEN_FLOATLITERAL; ; index = 703 ; length = 3 line = 27 ; column = 25 ; value ='1'; }
{kind = TOKEN_COMMA; ; index = 706 ; length = 1 line = 27 ; column = 28 ; value =','; }
{kind = TOKEN_FLOATLITERAL; ; index = 708 ; length = 3 line = 27 ; column = 30 ; value ='0'; }
{kind = TOKEN_RIGHTPAREN; ; index = 711 ; length = 1 line = 27 ; column = 33 ; value =')'; }
{kind = TOKEN_SEMICOLON; ; index = 712 ; length = 1 line = 27 ; column = 34 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 718 ; length = 13 line = 29 ; column = 0 ; value ='src_half_size'; }
{kind = TOKEN_COLON; ; index = 732 ; length = 1 line = 29 ; column = 14 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 734 ; length = 6 line = 29 ; column = 16 ; value ='float2'; }
{kind = TOKEN_ASSIGN; ; index = 741 ; length = 1 line = 29 ; column = 23 ; value ='='; }
{kind = TOKEN_LEFTPAREN; ; index = 743 ; length = 1 line = 29 ; column = 25 ; value ='('; }
{kind = TOKEN_IDENTIFIER; ; index = 744 ; length = 6 line = 29 ; column = 26 ; value ='src_p1'; }
{kind = TOKEN_MINUS; ; index = 751 ; length = 1 line = 29 ; column = 33 ; value ='-'; }
{kind = TOKEN_IDENTIFIER; ; index = 753 ; length = 6 line = 29 ; column = 35 ; value ='src_p0'; }
{kind = TOKEN_RIGHTPAREN; ; index = 759 ; length = 1 line = 29 ; column = 41 ; value =')'; }
{kind = TOKEN_SLASH; ; index = 761 ; length = 1 line = 29 ; column = 43 ; value ='/'; }
{kind = TOKEN_INTLITERAL; ; index = 763 ; length = 1 line = 29 ; column = 45 ; value ='2'; }
{kind = TOKEN_SEMICOLON; ; index = 764 ; length = 1 line = 29 ; column = 46 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 768 ; length = 10 line = 30 ; column = 0 ; value ='src_center'; }
{kind = TOKEN_COLON; ; index = 782 ; length = 1 line = 30 ; column = 14 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 784 ; length = 6 line = 30 ; column = 16 ; value ='float2'; }
{kind = TOKEN_ASSIGN; ; index = 791 ; length = 1 line = 30 ; column = 23 ; value ='='; }
{kind = TOKEN_LEFTPAREN; ; index = 793 ; length = 1 line = 30 ; column = 25 ; value ='('; }
{kind = TOKEN_IDENTIFIER; ; index = 794 ; length = 6 line = 30 ; column = 26 ; value ='src_p1'; }
{kind = TOKEN_PLUS; ; index = 801 ; length = 1 line = 30 ; column = 33 ; value ='+'; }
{kind = TOKEN_IDENTIFIER; ; index = 803 ; length = 6 line = 30 ; column = 35 ; value ='src_p0'; }
{kind = TOKEN_RIGHTPAREN; ; index = 809 ; length = 1 line = 30 ; column = 41 ; value =')'; }
{kind = TOKEN_SLASH; ; index = 811 ; length = 1 line = 30 ; column = 43 ; value ='/'; }
{kind = TOKEN_INTLITERAL; ; index = 813 ; length = 1 line = 30 ; column = 45 ; value ='2'; }
{kind = TOKEN_SEMICOLON; ; index = 814 ; length = 1 line = 30 ; column = 46 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 818 ; length = 7 line = 31 ; column = 0 ; value ='src_pos'; }
{kind = TOKEN_COLON; ; index = 832 ; length = 1 line = 31 ; column = 14 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 834 ; length = 6 line = 31 ; column = 16 ; value ='float2'; }
{kind = TOKEN_ASSIGN; ; index = 841 ; length = 1 line = 31 ; column = 23 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 843 ; length = 6 line = 31 ; column = 25 ; value ='float2'; }
{kind = TOKEN_LEFTPAREN; ; index = 849 ; length = 1 line = 31 ; column = 31 ; value ='('; }
{kind = TOKEN_IDENTIFIER; ; index = 850 ; length = 3 line = 31 ; column = 32 ; value ='pos'; }
{kind = TOKEN_DOT; ; index = 853 ; length = 1 line = 31 ; column = 35 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 854 ; length = 1 line = 31 ; column = 36 ; value ='x'; }
{kind = TOKEN_COMMA; ; index = 855 ; length = 1 line = 31 ; column = 37 ; value =','; }
{kind = TOKEN_IDENTIFIER; ; index = 857 ; length = 3 line = 31 ; column = 39 ; value ='pos'; }
{kind = TOKEN_DOT; ; index = 860 ; length = 1 line = 31 ; column = 42 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 861 ; length = 1 line = 31 ; column = 43 ; value ='y'; }
{kind = TOKEN_RIGHTPAREN; ; index = 862 ; length = 1 line = 31 ; column = 44 ; value =')'; }
{kind = TOKEN_STAR; ; index = 864 ; length = 1 line = 31 ; column = 46 ; value ='*'; }
{kind = TOKEN_IDENTIFIER; ; index = 866 ; length = 13 line = 31 ; column = 48 ; value ='src_half_size'; }
{kind = TOKEN_PLUS; ; index = 880 ; length = 1 line = 31 ; column = 62 ; value ='+'; }
{kind = TOKEN_IDENTIFIER; ; index = 882 ; length = 10 line = 31 ; column = 64 ; value ='src_center'; }
{kind = TOKEN_SEMICOLON; ; index = 892 ; length = 1 line = 31 ; column = 74 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 898 ; length = 6 line = 33 ; column = 0 ; value ='result'; }
{kind = TOKEN_DOT; ; index = 904 ; length = 1 line = 33 ; column = 6 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 905 ; length = 2 line = 33 ; column = 7 ; value ='uv'; }
{kind = TOKEN_ASSIGN; ; index = 908 ; length = 1 line = 33 ; column = 10 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 910 ; length = 6 line = 33 ; column = 12 ; value ='float2'; }
{kind = TOKEN_LEFTPAREN; ; index = 916 ; length = 1 line = 33 ; column = 18 ; value ='('; }
{kind = TOKEN_INTLITERAL; ; index = 917 ; length = 1 line = 33 ; column = 19 ; value ='1'; }
{kind = TOKEN_COMMA; ; index = 918 ; length = 1 line = 33 ; column = 20 ; value =','; }
{kind = TOKEN_INTLITERAL; ; index = 920 ; length = 1 line = 33 ; column = 22 ; value ='1'; }
{kind = TOKEN_RIGHTPAREN; ; index = 921 ; length = 1 line = 33 ; column = 23 ; value =')'; }
{kind = TOKEN_SEMICOLON; ; index = 922 ; length = 1 line = 33 ; column = 24 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 926 ; length = 6 line = 34 ; column = 0 ; value ='result'; }
{kind = TOKEN_DOT; ; index = 932 ; length = 1 line = 34 ; column = 6 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 933 ; length = 3 line = 34 ; column = 7 ; value ='pos'; }
{kind = TOKEN_ASSIGN; ; index = 937 ; length = 1 line = 34 ; column = 11 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 939 ; length = 6 line = 34 ; column = 13 ; value ='float4'; }
{kind = TOKEN_LEFTPAREN; ; index = 945 ; length = 1 line = 34 ; column = 19 ; value ='('; }
{kind = TOKEN_FLOATLITERAL; ; index = 946 ; length = 3 line = 34 ; column = 20 ; value ='2'; }
{kind = TOKEN_STAR; ; index = 950 ; length = 1 line = 34 ; column = 24 ; value ='*'; }
{kind = TOKEN_IDENTIFIER; ; index = 952 ; length = 7 line = 34 ; column = 26 ; value ='dst_pos'; }
{kind = TOKEN_DOT; ; index = 959 ; length = 1 line = 34 ; column = 33 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 960 ; length = 1 line = 34 ; column = 34 ; value ='x'; }
{kind = TOKEN_SLASH; ; index = 962 ; length = 1 line = 34 ; column = 36 ; value ='/'; }
{kind = TOKEN_IDENTIFIER; ; index = 964 ; length = 3 line = 34 ; column = 38 ; value ='res'; }
{kind = TOKEN_DOT; ; index = 967 ; length = 1 line = 34 ; column = 41 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 968 ; length = 1 line = 34 ; column = 42 ; value ='x'; }
{kind = TOKEN_MINUS; ; index = 970 ; length = 1 line = 34 ; column = 44 ; value ='-'; }
{kind = TOKEN_INTLITERAL; ; index = 972 ; length = 1 line = 34 ; column = 46 ; value ='1'; }
{kind = TOKEN_COMMA; ; index = 973 ; length = 1 line = 34 ; column = 47 ; value =','; }
{kind = TOKEN_FLOATLITERAL; ; index = 975 ; length = 3 line = 34 ; column = 49 ; value ='2'; }
{kind = TOKEN_STAR; ; index = 979 ; length = 1 line = 34 ; column = 53 ; value ='*'; }
{kind = TOKEN_IDENTIFIER; ; index = 981 ; length = 7 line = 34 ; column = 55 ; value ='dst_pos'; }
{kind = TOKEN_DOT; ; index = 988 ; length = 1 line = 34 ; column = 62 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 989 ; length = 1 line = 34 ; column = 63 ; value ='y'; }
{kind = TOKEN_SLASH; ; index = 991 ; length = 1 line = 34 ; column = 65 ; value ='/'; }
{kind = TOKEN_IDENTIFIER; ; index = 993 ; length = 3 line = 34 ; column = 67 ; value ='res'; }
{kind = TOKEN_DOT; ; index = 996 ; length = 1 line = 34 ; column = 70 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 997 ; length = 1 line = 34 ; column = 71 ; value ='y'; }
{kind = TOKEN_MINUS; ; index = 999 ; length = 1 line = 34 ; column = 73 ; value ='-'; }
{kind = TOKEN_INTLITERAL; ; index = 1001 ; length = 1 line = 34 ; column = 75 ; value ='1'; }
{kind = TOKEN_COMMA; ; index = 1002 ; length = 1 line = 34 ; column = 76 ; value =','; }
{kind = TOKEN_FLOATLITERAL; ; index = 1004 ; length = 3 line = 34 ; column = 78 ; value ='0'; }
{kind = TOKEN_COMMA; ; index = 1007 ; length = 1 line = 34 ; column = 81 ; value =','; }
{kind = TOKEN_FLOATLITERAL; ; index = 1009 ; length = 3 line = 34 ; column = 83 ; value ='1'; }
{kind = TOKEN_RIGHTPAREN; ; index = 1012 ; length = 1 line = 34 ; column = 86 ; value =')'; }
{kind = TOKEN_SEMICOLON; ; index = 1013 ; length = 1 line = 34 ; column = 87 ; value =';'; }
{kind = TOKEN_RETURN; ; index = 1019 ; length = 6 line = 36 ; column = 0 ; value ='return'; }
{kind = TOKEN_IDENTIFIER; ; index = 1026 ; length = 6 line = 36 ; column = 7 ; value ='result'; }
{kind = TOKEN_SEMICOLON; ; index = 1032 ; length = 1 line = 36 ; column = 13 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 1035 ; length = 1 line = 37 ; column = 0 ; value ='}'; }
{kind = TOKEN_PIXEL; ; index = 1040 ; length = 5 line = 39 ; column = 0 ; value ='pixel'; }
{kind = TOKEN_IDENTIFIER; ; index = 1046 ; length = 4 line = 39 ; column = 6 ; value ='main'; }
{kind = TOKEN_DOUBLECOLON; ; index = 1051 ; length = 2 line = 39 ; column = 11 ; value ='::'; }
{kind = TOKEN_LEFTPAREN; ; index = 1054 ; length = 1 line = 39 ; column = 14 ; value ='('; }
{kind = TOKEN_IDENTIFIER; ; index = 1055 ; length = 5 line = 39 ; column = 15 ; value ='input'; }
{kind = TOKEN_COLON; ; index = 1061 ; length = 1 line = 39 ; column = 21 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 1063 ; length = 8 line = 39 ; column = 23 ; value ='PS_Input'; }
{kind = TOKEN_RIGHTPAREN; ; index = 1071 ; length = 1 line = 39 ; column = 31 ; value =')'; }
{kind = TOKEN_ARROW; ; index = 1073 ; length = 2 line = 39 ; column = 33 ; value ='->'; }
{kind = TOKEN_IDENTIFIER; ; index = 1076 ; length = 6 line = 39 ; column = 36 ; value ='float4'; }
{kind = TOKEN_AT; ; index = 1083 ; length = 1 line = 39 ; column = 43 ; value ='@'; }
{kind = TOKEN_IDENTIFIER; ; index = 1084 ; length = 7 line = 39 ; column = 44 ; value ='target0'; }
{kind = TOKEN_LEFTBRACE; ; index = 1092 ; length = 1 line = 39 ; column = 52 ; value ='{'; }
{kind = TOKEN_IDENTIFIER; ; index = 1096 ; length = 5 line = 40 ; column = 0 ; value ='color'; }
{kind = TOKEN_COLON; ; index = 1102 ; length = 1 line = 40 ; column = 6 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 1104 ; length = 6 line = 40 ; column = 8 ; value ='float4'; }
{kind = TOKEN_ASSIGN; ; index = 1111 ; length = 1 line = 40 ; column = 15 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 1113 ; length = 1 line = 40 ; column = 17 ; value ='p'; }
{kind = TOKEN_DOT; ; index = 1114 ; length = 1 line = 40 ; column = 18 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 1115 ; length = 5 line = 40 ; column = 19 ; value ='color'; }
{kind = TOKEN_SEMICOLON; ; index = 1120 ; length = 1 line = 40 ; column = 24 ; value =';'; }
{kind = TOKEN_RETURN; ; index = 1124 ; length = 6 line = 41 ; column = 0 ; value ='return'; }
{kind = TOKEN_IDENTIFIER; ; index = 1131 ; length = 5 line = 41 ; column = 7 ; value ='color'; }
{kind = TOKEN_SEMICOLON; ; index = 1136 ; length = 1 line = 41 ; column = 12 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 1139 ; length = 1 line = 42 ; column = 0 ; value ='}'; }
{kind = TOKEN_EOF; ; index = 1142 ; length = 0 line = 43 ; column = 0 ; value =''; }
{kind = TOKEN_CONSTANT_BUFFER; ; index = 5 ; length = 15 line = 1 ; column = 5 ; value ='Constant_Buffer'; }
{kind = TOKEN_AT; ; index = 21 ; length = 1 line = 1 ; column = 21 ; value ='@'; }
{kind = TOKEN_IDENTIFIER; ; index = 22 ; length = 10 line = 1 ; column = 22 ; value ='properties'; }
{kind = TOKEN_LEFTBRACE; ; index = 33 ; length = 1 line = 1 ; column = 33 ; value ='{'; }
{kind = TOKEN_IDENTIFIER; ; index = 37 ; length = 5 line = 2 ; column = 0 ; value ='color'; }
{kind = TOKEN_COLON; ; index = 51 ; length = 1 line = 2 ; column = 14 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 53 ; length = 6 line = 2 ; column = 16 ; value ='float4'; }
{kind = TOKEN_SEMICOLON; ; index = 59 ; length = 1 line = 2 ; column = 22 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 63 ; length = 13 line = 3 ; column = 0 ; value ='rect_position'; }
{kind = TOKEN_COLON; ; index = 77 ; length = 1 line = 3 ; column = 14 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 79 ; length = 6 line = 3 ; column = 16 ; value ='float2'; }
{kind = TOKEN_SEMICOLON; ; index = 85 ; length = 1 line = 3 ; column = 22 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 89 ; length = 10 line = 4 ; column = 0 ; value ='rect_scale'; }
{kind = TOKEN_COLON; ; index = 103 ; length = 1 line = 4 ; column = 14 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 105 ; length = 6 line = 4 ; column = 16 ; value ='float2'; }
{kind = TOKEN_SEMICOLON; ; index = 111 ; length = 1 line = 4 ; column = 22 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 115 ; length = 10 line = 5 ; column = 0 ; value ='resolution'; }
{kind = TOKEN_COLON; ; index = 129 ; length = 1 line = 5 ; column = 14 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 131 ; length = 6 line = 5 ; column = 16 ; value ='float2'; }
{kind = TOKEN_SEMICOLON; ; index = 137 ; length = 1 line = 5 ; column = 22 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 141 ; length = 7 line = 6 ; column = 0 ; value ='texture'; }
{kind = TOKEN_COLON; ; index = 155 ; length = 1 line = 6 ; column = 14 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 157 ; length = 9 line = 6 ; column = 16 ; value ='Texture2D'; }
{kind = TOKEN_SEMICOLON; ; index = 166 ; length = 1 line = 6 ; column = 25 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 170 ; length = 7 line = 7 ; column = 0 ; value ='sampler'; }
{kind = TOKEN_COLON; ; index = 184 ; length = 1 line = 7 ; column = 14 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 186 ; length = 7 line = 7 ; column = 16 ; value ='Sampler'; }
{kind = TOKEN_SEMICOLON; ; index = 193 ; length = 1 line = 7 ; column = 23 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 196 ; length = 1 line = 8 ; column = 0 ; value ='}'; }
{kind = TOKEN_IDENTIFIER; ; index = 201 ; length = 8 line = 10 ; column = 0 ; value ='PS_Input'; }
{kind = TOKEN_DOUBLECOLON; ; index = 210 ; length = 2 line = 10 ; column = 9 ; value ='::'; }
{kind = TOKEN_STRUCT; ; index = 213 ; length = 6 line = 10 ; column = 12 ; value ='struct'; }
{kind = TOKEN_LEFTBRACE; ; index = 220 ; length = 1 line = 10 ; column = 19 ; value ='{'; }
{kind = TOKEN_IDENTIFIER; ; index = 224 ; length = 2 line = 11 ; column = 0 ; value ='uv'; }
{kind = TOKEN_COLON; ; index = 227 ; length = 1 line = 11 ; column = 3 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 229 ; length = 6 line = 11 ; column = 5 ; value ='float2'; }
{kind = TOKEN_AT; ; index = 236 ; length = 1 line = 11 ; column = 12 ; value ='@'; }
{kind = TOKEN_IDENTIFIER; ; index = 237 ; length = 2 line = 11 ; column = 13 ; value ='uv'; }
{kind = TOKEN_SEMICOLON; ; index = 239 ; length = 1 line = 11 ; column = 15 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 243 ; length = 3 line = 12 ; column = 0 ; value ='pos'; }
{kind = TOKEN_COLON; ; index = 247 ; length = 1 line = 12 ; column = 4 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 249 ; length = 6 line = 12 ; column = 6 ; value ='float4'; }
{kind = TOKEN_AT; ; index = 256 ; length = 1 line = 12 ; column = 13 ; value ='@'; }
{kind = TOKEN_IDENTIFIER; ; index = 257 ; length = 3 line = 12 ; column = 14 ; value ='pos'; }
{kind = TOKEN_SEMICOLON; ; index = 260 ; length = 1 line = 12 ; column = 17 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 263 ; length = 1 line = 13 ; column = 0 ; value ='}'; }
{kind = TOKEN_VERTEX; ; index = 268 ; length = 6 line = 15 ; column = 0 ; value ='vertex'; }
{kind = TOKEN_IDENTIFIER; ; index = 275 ; length = 4 line = 15 ; column = 7 ; value ='main'; }
{kind = TOKEN_DOUBLECOLON; ; index = 280 ; length = 2 line = 15 ; column = 12 ; value ='::'; }
{kind = TOKEN_LEFTPAREN; ; index = 283 ; length = 1 line = 15 ; column = 15 ; value ='('; }
{kind = TOKEN_IDENTIFIER; ; index = 284 ; length = 3 line = 15 ; column = 16 ; value ='pos'; }
{kind = TOKEN_COLON; ; index = 288 ; length = 1 line = 15 ; column = 20 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 290 ; length = 6 line = 15 ; column = 22 ; value ='float4'; }
{kind = TOKEN_AT; ; index = 297 ; length = 1 line = 15 ; column = 29 ; value ='@'; }
{kind = TOKEN_IDENTIFIER; ; index = 298 ; length = 8 line = 15 ; column = 30 ; value ='position'; }
{kind = TOKEN_RIGHTPAREN; ; index = 306 ; length = 1 line = 15 ; column = 38 ; value =')'; }
{kind = TOKEN_ARROW; ; index = 308 ; length = 2 line = 15 ; column = 40 ; value ='->'; }
{kind = TOKEN_IDENTIFIER; ; index = 311 ; length = 8 line = 15 ; column = 43 ; value ='PS_Input'; }
{kind = TOKEN_LEFTBRACE; ; index = 320 ; length = 1 line = 15 ; column = 52 ; value ='{'; }
{kind = TOKEN_IDENTIFIER; ; index = 324 ; length = 3 line = 16 ; column = 0 ; value ='res'; }
{kind = TOKEN_COLON; ; index = 333 ; length = 1 line = 16 ; column = 9 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 335 ; length = 6 line = 16 ; column = 11 ; value ='float2'; }
{kind = TOKEN_ASSIGN; ; index = 342 ; length = 1 line = 16 ; column = 18 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 344 ; length = 1 line = 16 ; column = 20 ; value ='p'; }
{kind = TOKEN_DOT; ; index = 345 ; length = 1 line = 16 ; column = 21 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 346 ; length = 10 line = 16 ; column = 22 ; value ='resolution'; }
{kind = TOKEN_SEMICOLON; ; index = 356 ; length = 1 line = 16 ; column = 32 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 360 ; length = 5 line = 17 ; column = 0 ; value ='scale'; }
{kind = TOKEN_COLON; ; index = 369 ; length = 1 line = 17 ; column = 9 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 371 ; length = 6 line = 17 ; column = 11 ; value ='float2'; }
{kind = TOKEN_ASSIGN; ; index = 378 ; length = 1 line = 17 ; column = 18 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 380 ; length = 1 line = 17 ; column = 20 ; value ='p'; }
{kind = TOKEN_DOT; ; index = 381 ; length = 1 line = 17 ; column = 21 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 382 ; length = 10 line = 17 ; column = 22 ; value ='rect_scale'; }
{kind = TOKEN_SEMICOLON; ; index = 392 ; length = 1 line = 17 ; column = 32 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 396 ; length = 8 line = 18 ; column = 0 ; value ='rect_pos'; }
{kind = TOKEN_COLON; ; index = 405 ; length = 1 line = 18 ; column = 9 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 407 ; length = 6 line = 18 ; column = 11 ; value ='float2'; }
{kind = TOKEN_ASSIGN; ; index = 414 ; length = 1 line = 18 ; column = 18 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 416 ; length = 1 line = 18 ; column = 20 ; value ='p'; }
{kind = TOKEN_DOT; ; index = 417 ; length = 1 line = 18 ; column = 21 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 418 ; length = 13 line = 18 ; column = 22 ; value ='rect_position'; }
{kind = TOKEN_SEMICOLON; ; index = 431 ; length = 1 line = 18 ; column = 35 ; value =';'; }
{kind = TOKEN_SEMICOLON; ; index = 432 ; length = 1 line = 18 ; column = 36 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 438 ; length = 6 line = 20 ; column = 0 ; value ='center'; }
{kind = TOKEN_COLON; ; index = 445 ; length = 1 line = 20 ; column = 7 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 447 ; length = 6 line = 20 ; column = 9 ; value ='float2'; }
{kind = TOKEN_ASSIGN; ; index = 454 ; length = 1 line = 20 ; column = 16 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 456 ; length = 8 line = 20 ; column = 18 ; value ='rect_pos'; }
{kind = TOKEN_SEMICOLON; ; index = 464 ; length = 1 line = 20 ; column = 26 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 468 ; length = 9 line = 21 ; column = 0 ; value ='half_size'; }
{kind = TOKEN_COLON; ; index = 479 ; length = 1 line = 21 ; column = 11 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 481 ; length = 6 line = 21 ; column = 13 ; value ='float2'; }
{kind = TOKEN_ASSIGN; ; index = 488 ; length = 1 line = 21 ; column = 20 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 490 ; length = 6 line = 21 ; column = 22 ; value ='float2'; }
{kind = TOKEN_LEFTPAREN; ; index = 496 ; length = 1 line = 21 ; column = 28 ; value ='('; }
{kind = TOKEN_IDENTIFIER; ; index = 497 ; length = 5 line = 21 ; column = 29 ; value ='scale'; }
{kind = TOKEN_DOT; ; index = 502 ; length = 1 line = 21 ; column = 34 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 503 ; length = 1 line = 21 ; column = 35 ; value ='x'; }
{kind = TOKEN_SLASH; ; index = 505 ; length = 1 line = 21 ; column = 37 ; value ='/'; }
{kind = TOKEN_INTLITERAL; ; index = 507 ; length = 1 line = 21 ; column = 39 ; value ='2'; }
{kind = TOKEN_COMMA; ; index = 508 ; length = 1 line = 21 ; column = 40 ; value =','; }
{kind = TOKEN_IDENTIFIER; ; index = 510 ; length = 5 line = 21 ; column = 42 ; value ='scale'; }
{kind = TOKEN_DOT; ; index = 515 ; length = 1 line = 21 ; column = 47 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 516 ; length = 1 line = 21 ; column = 48 ; value ='y'; }
{kind = TOKEN_SLASH; ; index = 518 ; length = 1 line = 21 ; column = 50 ; value ='/'; }
{kind = TOKEN_INTLITERAL; ; index = 520 ; length = 1 line = 21 ; column = 52 ; value ='2'; }
{kind = TOKEN_RIGHTPAREN; ; index = 521 ; length = 1 line = 21 ; column = 53 ; value =')'; }
{kind = TOKEN_SEMICOLON; ; index = 522 ; length = 1 line = 21 ; column = 54 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 526 ; length = 7 line = 22 ; column = 0 ; value ='dst_pos'; }
{kind = TOKEN_COLON; ; index = 537 ; length = 1 line = 22 ; column = 11 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 539 ; length = 6 line = 22 ; column = 13 ; value ='float4'; }
{kind = TOKEN_ASSIGN; ; index = 546 ; length = 1 line = 22 ; column = 20 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 548 ; length = 6 line = 22 ; column = 22 ; value ='float4'; }
{kind = TOKEN_LEFTPAREN; ; index = 554 ; length = 1 line = 22 ; column = 28 ; value ='('; }
{kind = TOKEN_IDENTIFIER; ; index = 555 ; length = 3 line = 22 ; column = 29 ; value ='pos'; }
{kind = TOKEN_DOT; ; index = 558 ; length = 1 line = 22 ; column = 32 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 559 ; length = 1 line = 22 ; column = 33 ; value ='x'; }
{kind = TOKEN_STAR; ; index = 561 ; length = 1 line = 22 ; column = 35 ; value ='*'; }
{kind = TOKEN_IDENTIFIER; ; index = 563 ; length = 9 line = 22 ; column = 37 ; value ='half_size'; }
{kind = TOKEN_DOT; ; index = 572 ; length = 1 line = 22 ; column = 46 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 573 ; length = 1 line = 22 ; column = 47 ; value ='x'; }
{kind = TOKEN_PLUS; ; index = 575 ; length = 1 line = 22 ; column = 49 ; value ='+'; }
{kind = TOKEN_IDENTIFIER; ; index = 577 ; length = 6 line = 22 ; column = 51 ; value ='center'; }
{kind = TOKEN_DOT; ; index = 583 ; length = 1 line = 22 ; column = 57 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 584 ; length = 1 line = 22 ; column = 58 ; value ='x'; }
{kind = TOKEN_COMMA; ; index = 585 ; length = 1 line = 22 ; column = 59 ; value =','; }
{kind = TOKEN_IDENTIFIER; ; index = 587 ; length = 3 line = 22 ; column = 61 ; value ='pos'; }
{kind = TOKEN_DOT; ; index = 590 ; length = 1 line = 22 ; column = 64 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 591 ; length = 1 line = 22 ; column = 65 ; value ='y'; }
{kind = TOKEN_STAR; ; index = 593 ; length = 1 line = 22 ; column = 67 ; value ='*'; }
{kind = TOKEN_IDENTIFIER; ; index = 595 ; length = 9 line = 22 ; column = 69 ; value ='half_size'; }
{kind = TOKEN_DOT; ; index = 604 ; length = 1 line = 22 ; column = 78 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 605 ; length = 1 line = 22 ; column = 79 ; value ='y'; }
{kind = TOKEN_PLUS; ; index = 607 ; length = 1 line = 22 ; column = 81 ; value ='+'; }
{kind = TOKEN_IDENTIFIER; ; index = 609 ; length = 6 line = 22 ; column = 83 ; value ='center'; }
{kind = TOKEN_DOT; ; index = 615 ; length = 1 line = 22 ; column = 89 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 616 ; length = 1 line = 22 ; column = 90 ; value ='y'; }
{kind = TOKEN_COMMA; ; index = 617 ; length = 1 line = 22 ; column = 91 ; value =','; }
{kind = TOKEN_FLOATLITERAL; ; index = 619 ; length = 3 line = 22 ; column = 93 ; value ='0'; }
{kind = TOKEN_COMMA; ; index = 622 ; length = 1 line = 22 ; column = 96 ; value =','; }
{kind = TOKEN_FLOATLITERAL; ; index = 624 ; length = 3 line = 22 ; column = 98 ; value ='1'; }
{kind = TOKEN_RIGHTPAREN; ; index = 627 ; length = 1 line = 22 ; column = 101 ; value =')'; }
{kind = TOKEN_SEMICOLON; ; index = 628 ; length = 1 line = 22 ; column = 102 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 634 ; length = 6 line = 24 ; column = 0 ; value ='result'; }
{kind = TOKEN_COLON; ; index = 641 ; length = 1 line = 24 ; column = 7 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 643 ; length = 8 line = 24 ; column = 9 ; value ='PS_Input'; }
{kind = TOKEN_SEMICOLON; ; index = 651 ; length = 1 line = 24 ; column = 17 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 657 ; length = 6 line = 26 ; column = 0 ; value ='src_p0'; }
{kind = TOKEN_COLON; ; index = 664 ; length = 1 line = 26 ; column = 7 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 666 ; length = 6 line = 26 ; column = 9 ; value ='float2'; }
{kind = TOKEN_ASSIGN; ; index = 673 ; length = 1 line = 26 ; column = 16 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 675 ; length = 6 line = 26 ; column = 18 ; value ='float2'; }
{kind = TOKEN_LEFTPAREN; ; index = 681 ; length = 1 line = 26 ; column = 24 ; value ='('; }
{kind = TOKEN_FLOATLITERAL; ; index = 682 ; length = 3 line = 26 ; column = 25 ; value ='0'; }
{kind = TOKEN_COMMA; ; index = 685 ; length = 1 line = 26 ; column = 28 ; value =','; }
{kind = TOKEN_FLOATLITERAL; ; index = 687 ; length = 3 line = 26 ; column = 30 ; value ='1'; }
{kind = TOKEN_RIGHTPAREN; ; index = 690 ; length = 1 line = 26 ; column = 33 ; value =')'; }
{kind = TOKEN_SEMICOLON; ; index = 691 ; length = 1 line = 26 ; column = 34 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 695 ; length = 6 line = 27 ; column = 0 ; value ='src_p1'; }
{kind = TOKEN_COLON; ; index = 702 ; length = 1 line = 27 ; column = 7 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 704 ; length = 6 line = 27 ; column = 9 ; value ='float2'; }
{kind = TOKEN_ASSIGN; ; index = 711 ; length = 1 line = 27 ; column = 16 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 713 ; length = 6 line = 27 ; column = 18 ; value ='float2'; }
{kind = TOKEN_LEFTPAREN; ; index = 719 ; length = 1 line = 27 ; column = 24 ; value ='('; }
{kind = TOKEN_FLOATLITERAL; ; index = 720 ; length = 3 line = 27 ; column = 25 ; value ='1'; }
{kind = TOKEN_COMMA; ; index = 723 ; length = 1 line = 27 ; column = 28 ; value =','; }
{kind = TOKEN_FLOATLITERAL; ; index = 725 ; length = 3 line = 27 ; column = 30 ; value ='0'; }
{kind = TOKEN_RIGHTPAREN; ; index = 728 ; length = 1 line = 27 ; column = 33 ; value =')'; }
{kind = TOKEN_SEMICOLON; ; index = 729 ; length = 1 line = 27 ; column = 34 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 735 ; length = 13 line = 29 ; column = 0 ; value ='src_half_size'; }
{kind = TOKEN_COLON; ; index = 749 ; length = 1 line = 29 ; column = 14 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 751 ; length = 6 line = 29 ; column = 16 ; value ='float2'; }
{kind = TOKEN_ASSIGN; ; index = 758 ; length = 1 line = 29 ; column = 23 ; value ='='; }
{kind = TOKEN_LEFTPAREN; ; index = 760 ; length = 1 line = 29 ; column = 25 ; value ='('; }
{kind = TOKEN_IDENTIFIER; ; index = 761 ; length = 6 line = 29 ; column = 26 ; value ='src_p1'; }
{kind = TOKEN_MINUS; ; index = 768 ; length = 1 line = 29 ; column = 33 ; value ='-'; }
{kind = TOKEN_IDENTIFIER; ; index = 770 ; length = 6 line = 29 ; column = 35 ; value ='src_p0'; }
{kind = TOKEN_RIGHTPAREN; ; index = 776 ; length = 1 line = 29 ; column = 41 ; value =')'; }
{kind = TOKEN_SLASH; ; index = 778 ; length = 1 line = 29 ; column = 43 ; value ='/'; }
{kind = TOKEN_INTLITERAL; ; index = 780 ; length = 1 line = 29 ; column = 45 ; value ='2'; }
{kind = TOKEN_SEMICOLON; ; index = 781 ; length = 1 line = 29 ; column = 46 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 785 ; length = 10 line = 30 ; column = 0 ; value ='src_center'; }
{kind = TOKEN_COLON; ; index = 799 ; length = 1 line = 30 ; column = 14 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 801 ; length = 6 line = 30 ; column = 16 ; value ='float2'; }
{kind = TOKEN_ASSIGN; ; index = 808 ; length = 1 line = 30 ; column = 23 ; value ='='; }
{kind = TOKEN_LEFTPAREN; ; index = 810 ; length = 1 line = 30 ; column = 25 ; value ='('; }
{kind = TOKEN_IDENTIFIER; ; index = 811 ; length = 6 line = 30 ; column = 26 ; value ='src_p1'; }
{kind = TOKEN_PLUS; ; index = 818 ; length = 1 line = 30 ; column = 33 ; value ='+'; }
{kind = TOKEN_IDENTIFIER; ; index = 820 ; length = 6 line = 30 ; column = 35 ; value ='src_p0'; }
{kind = TOKEN_RIGHTPAREN; ; index = 826 ; length = 1 line = 30 ; column = 41 ; value =')'; }
{kind = TOKEN_SLASH; ; index = 828 ; length = 1 line = 30 ; column = 43 ; value ='/'; }
{kind = TOKEN_INTLITERAL; ; index = 830 ; length = 1 line = 30 ; column = 45 ; value ='2'; }
{kind = TOKEN_SEMICOLON; ; index = 831 ; length = 1 line = 30 ; column = 46 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 835 ; length = 7 line = 31 ; column = 0 ; value ='src_pos'; }
{kind = TOKEN_COLON; ; index = 849 ; length = 1 line = 31 ; column = 14 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 851 ; length = 6 line = 31 ; column = 16 ; value ='float2'; }
{kind = TOKEN_ASSIGN; ; index = 858 ; length = 1 line = 31 ; column = 23 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 860 ; length = 6 line = 31 ; column = 25 ; value ='float2'; }
{kind = TOKEN_LEFTPAREN; ; index = 866 ; length = 1 line = 31 ; column = 31 ; value ='('; }
{kind = TOKEN_IDENTIFIER; ; index = 867 ; length = 3 line = 31 ; column = 32 ; value ='pos'; }
{kind = TOKEN_DOT; ; index = 870 ; length = 1 line = 31 ; column = 35 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 871 ; length = 1 line = 31 ; column = 36 ; value ='x'; }
{kind = TOKEN_COMMA; ; index = 872 ; length = 1 line = 31 ; column = 37 ; value =','; }
{kind = TOKEN_IDENTIFIER; ; index = 874 ; length = 3 line = 31 ; column = 39 ; value ='pos'; }
{kind = TOKEN_DOT; ; index = 877 ; length = 1 line = 31 ; column = 42 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 878 ; length = 1 line = 31 ; column = 43 ; value ='y'; }
{kind = TOKEN_RIGHTPAREN; ; index = 879 ; length = 1 line = 31 ; column = 44 ; value =')'; }
{kind = TOKEN_STAR; ; index = 881 ; length = 1 line = 31 ; column = 46 ; value ='*'; }
{kind = TOKEN_IDENTIFIER; ; index = 883 ; length = 13 line = 31 ; column = 48 ; value ='src_half_size'; }
{kind = TOKEN_PLUS; ; index = 897 ; length = 1 line = 31 ; column = 62 ; value ='+'; }
{kind = TOKEN_IDENTIFIER; ; index = 899 ; length = 10 line = 31 ; column = 64 ; value ='src_center'; }
{kind = TOKEN_SEMICOLON; ; index = 909 ; length = 1 line = 31 ; column = 74 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 915 ; length = 6 line = 33 ; column = 0 ; value ='result'; }
{kind = TOKEN_DOT; ; index = 921 ; length = 1 line = 33 ; column = 6 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 922 ; length = 2 line = 33 ; column = 7 ; value ='uv'; }
{kind = TOKEN_ASSIGN; ; index = 925 ; length = 1 line = 33 ; column = 10 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 927 ; length = 6 line = 33 ; column = 12 ; value ='float2'; }
{kind = TOKEN_LEFTPAREN; ; index = 933 ; length = 1 line = 33 ; column = 18 ; value ='('; }
{kind = TOKEN_INTLITERAL; ; index = 934 ; length = 1 line = 33 ; column = 19 ; value ='1'; }
{kind = TOKEN_COMMA; ; index = 935 ; length = 1 line = 33 ; column = 20 ; value =','; }
{kind = TOKEN_INTLITERAL; ; index = 937 ; length = 1 line = 33 ; column = 22 ; value ='1'; }
{kind = TOKEN_RIGHTPAREN; ; index = 938 ; length = 1 line = 33 ; column = 23 ; value =')'; }
{kind = TOKEN_SEMICOLON; ; index = 939 ; length = 1 line = 33 ; column = 24 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 943 ; length = 6 line = 34 ; column = 0 ; value ='result'; }
{kind = TOKEN_DOT; ; index = 949 ; length = 1 line = 34 ; column = 6 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 950 ; length = 3 line = 34 ; column = 7 ; value ='pos'; }
{kind = TOKEN_ASSIGN; ; index = 954 ; length = 1 line = 34 ; column = 11 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 956 ; length = 6 line = 34 ; column = 13 ; value ='float4'; }
{kind = TOKEN_LEFTPAREN; ; index = 962 ; length = 1 line = 34 ; column = 19 ; value ='('; }
{kind = TOKEN_FLOATLITERAL; ; index = 963 ; length = 3 line = 34 ; column = 20 ; value ='2'; }
{kind = TOKEN_STAR; ; index = 967 ; length = 1 line = 34 ; column = 24 ; value ='*'; }
{kind = TOKEN_IDENTIFIER; ; index = 969 ; length = 7 line = 34 ; column = 26 ; value ='dst_pos'; }
{kind = TOKEN_DOT; ; index = 976 ; length = 1 line = 34 ; column = 33 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 977 ; length = 1 line = 34 ; column = 34 ; value ='x'; }
{kind = TOKEN_SLASH; ; index = 979 ; length = 1 line = 34 ; column = 36 ; value ='/'; }
{kind = TOKEN_IDENTIFIER; ; index = 981 ; length = 3 line = 34 ; column = 38 ; value ='res'; }
{kind = TOKEN_DOT; ; index = 984 ; length = 1 line = 34 ; column = 41 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 985 ; length = 1 line = 34 ; column = 42 ; value ='x'; }
{kind = TOKEN_MINUS; ; index = 987 ; length = 1 line = 34 ; column = 44 ; value ='-'; }
{kind = TOKEN_INTLITERAL; ; index = 989 ; length = 1 line = 34 ; column = 46 ; value ='1'; }
{kind = TOKEN_COMMA; ; index = 990 ; length = 1 line = 34 ; column = 47 ; value =','; }
{kind = TOKEN_FLOATLITERAL; ; index = 992 ; length = 3 line = 34 ; column = 49 ; value ='2'; }
{kind = TOKEN_STAR; ; index = 996 ; length = 1 line = 34 ; column = 53 ; value ='*'; }
{kind = TOKEN_IDENTIFIER; ; index = 998 ; length = 7 line = 34 ; column = 55 ; value ='dst_pos'; }
{kind = TOKEN_DOT; ; index = 1005 ; length = 1 line = 34 ; column = 62 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 1006 ; length = 1 line = 34 ; column = 63 ; value ='y'; }
{kind = TOKEN_SLASH; ; index = 1008 ; length = 1 line = 34 ; column = 65 ; value ='/'; }
{kind = TOKEN_IDENTIFIER; ; index = 1010 ; length = 3 line = 34 ; column = 67 ; value ='res'; }
{kind = TOKEN_DOT; ; index = 1013 ; length = 1 line = 34 ; column = 70 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 1014 ; length = 1 line = 34 ; column = 71 ; value ='y'; }
{kind = TOKEN_MINUS; ; index = 1016 ; length = 1 line = 34 ; column = 73 ; value ='-'; }
{kind = TOKEN_INTLITERAL; ; index = 1018 ; length = 1 line = 34 ; column = 75 ; value ='1'; }
{kind = TOKEN_COMMA; ; index = 1019 ; length = 1 line = 34 ; column = 76 ; value =','; }
{kind = TOKEN_FLOATLITERAL; ; index = 1021 ; length = 3 line = 34 ; column = 78 ; value ='0'; }
{kind = TOKEN_COMMA; ; index = 1024 ; length = 1 line = 34 ; column = 81 ; value =','; }
{kind = TOKEN_FLOATLITERAL; ; index = 1026 ; length = 3 line = 34 ; column = 83 ; value ='1'; }
{kind = TOKEN_RIGHTPAREN; ; index = 1029 ; length = 1 line = 34 ; column = 86 ; value =')'; }
{kind = TOKEN_SEMICOLON; ; index = 1030 ; length = 1 line = 34 ; column = 87 ; value =';'; }
{kind = TOKEN_RETURN; ; index = 1036 ; length = 6 line = 36 ; column = 0 ; value ='return'; }
{kind = TOKEN_IDENTIFIER; ; index = 1043 ; length = 6 line = 36 ; column = 7 ; value ='result'; }
{kind = TOKEN_SEMICOLON; ; index = 1049 ; length = 1 line = 36 ; column = 13 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 1052 ; length = 1 line = 37 ; column = 0 ; value ='}'; }
{kind = TOKEN_PIXEL; ; index = 1057 ; length = 5 line = 39 ; column = 0 ; value ='pixel'; }
{kind = TOKEN_IDENTIFIER; ; index = 1063 ; length = 4 line = 39 ; column = 6 ; value ='main'; }
{kind = TOKEN_DOUBLECOLON; ; index = 1068 ; length = 2 line = 39 ; column = 11 ; value ='::'; }
{kind = TOKEN_LEFTPAREN; ; index = 1071 ; length = 1 line = 39 ; column = 14 ; value ='('; }
{kind = TOKEN_IDENTIFIER; ; index = 1072 ; length = 5 line = 39 ; column = 15 ; value ='input'; }
{kind = TOKEN_COLON; ; index = 1078 ; length = 1 line = 39 ; column = 21 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 1080 ; length = 8 line = 39 ; column = 23 ; value ='PS_Input'; }
{kind = TOKEN_RIGHTPAREN; ; index = 1088 ; length = 1 line = 39 ; column = 31 ; value =')'; }
{kind = TOKEN_ARROW; ; index = 1090 ; length = 2 line = 39 ; column = 33 ; value ='->'; }
{kind = TOKEN_IDENTIFIER; ; index = 1093 ; length = 6 line = 39 ; column = 36 ; value ='float4'; }
{kind = TOKEN_AT; ; index = 1100 ; length = 1 line = 39 ; column = 43 ; value ='@'; }
{kind = TOKEN_IDENTIFIER; ; index = 1101 ; length = 7 line = 39 ; column = 44 ; value ='target0'; }
{kind = TOKEN_LEFTBRACE; ; index = 1109 ; length = 1 line = 39 ; column = 52 ; value ='{'; }
{kind = TOKEN_IDENTIFIER; ; index = 1113 ; length = 5 line = 40 ; column = 0 ; value ='color'; }
{kind = TOKEN_COLON; ; index = 1119 ; length = 1 line = 40 ; column = 6 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 1121 ; length = 6 line = 40 ; column = 8 ; value ='float4'; }
{kind = TOKEN_ASSIGN; ; index = 1128 ; length = 1 line = 40 ; column = 15 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 1130 ; length = 1 line = 40 ; column = 17 ; value ='p'; }
{kind = TOKEN_DOT; ; index = 1131 ; length = 1 line = 40 ; column = 18 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 1132 ; length = 5 line = 40 ; column = 19 ; value ='color'; }
{kind = TOKEN_SEMICOLON; ; index = 1137 ; length = 1 line = 40 ; column = 24 ; value =';'; }
{kind = TOKEN_RETURN; ; index = 1141 ; length = 6 line = 41 ; column = 0 ; value ='return'; }
{kind = TOKEN_IDENTIFIER; ; index = 1148 ; length = 5 line = 41 ; column = 7 ; value ='color'; }
{kind = TOKEN_SEMICOLON; ; index = 1153 ; length = 1 line = 41 ; column = 12 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 1156 ; length = 1 line = 42 ; column = 0 ; value ='}'; }
{kind = TOKEN_EOF; ; index = 1159 ; length = 0 line = 43 ; column = 0 ; value =''; }

View File

@@ -0,0 +1,27 @@
{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 ='a'; }
{kind = TOKEN_COLON; ; index = 24 ; length = 1 line = 2 ; column = 2 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 26 ; length = 6 line = 2 ; column = 4 ; value ='float2'; }
{kind = TOKEN_SEMICOLON; ; index = 32 ; length = 1 line = 2 ; column = 10 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 36 ; length = 1 line = 3 ; column = 0 ; value ='b'; }
{kind = TOKEN_COLON; ; index = 38 ; length = 1 line = 3 ; column = 2 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 40 ; length = 6 line = 3 ; column = 4 ; value ='float2'; }
{kind = TOKEN_SEMICOLON; ; index = 46 ; length = 1 line = 3 ; column = 10 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 52 ; length = 1 line = 5 ; column = 0 ; value ='x'; }
{kind = TOKEN_COLON; ; index = 54 ; length = 1 line = 5 ; column = 2 ; value =':'; }
{kind = TOKEN_ASSIGN; ; index = 55 ; length = 1 line = 5 ; column = 3 ; value ='='; }
{kind = TOKEN_LEFTPAREN; ; index = 57 ; length = 1 line = 5 ; column = 5 ; value ='('; }
{kind = TOKEN_IDENTIFIER; ; index = 58 ; length = 1 line = 5 ; column = 6 ; value ='a'; }
{kind = TOKEN_PLUS; ; index = 60 ; length = 1 line = 5 ; column = 8 ; value ='+'; }
{kind = TOKEN_IDENTIFIER; ; index = 62 ; length = 1 line = 5 ; column = 10 ; value ='b'; }
{kind = TOKEN_RIGHTPAREN; ; index = 63 ; length = 1 line = 5 ; column = 11 ; value =')'; }
{kind = TOKEN_DOT; ; index = 64 ; length = 1 line = 5 ; column = 12 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 65 ; length = 1 line = 5 ; column = 13 ; value ='x'; }
{kind = TOKEN_SEMICOLON; ; index = 66 ; length = 1 line = 5 ; column = 14 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 69 ; length = 1 line = 6 ; column = 0 ; value ='}'; }
{kind = TOKEN_EOF; ; index = 72 ; length = 0 line = 7 ; column = 0 ; value =''; }

View File

@@ -0,0 +1,26 @@
{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 ='a'; }
{kind = TOKEN_COLON; ; index = 24 ; length = 1 line = 2 ; column = 2 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 26 ; length = 6 line = 2 ; column = 4 ; value ='float2'; }
{kind = TOKEN_SEMICOLON; ; index = 32 ; length = 1 line = 2 ; column = 10 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 36 ; length = 1 line = 3 ; column = 0 ; value ='b'; }
{kind = TOKEN_COLON; ; index = 38 ; length = 1 line = 3 ; column = 2 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 40 ; length = 6 line = 3 ; column = 4 ; value ='float2'; }
{kind = TOKEN_SEMICOLON; ; index = 46 ; length = 1 line = 3 ; column = 10 ; value =';'; }
{kind = TOKEN_LEFTPAREN; ; index = 52 ; length = 1 line = 5 ; column = 0 ; value ='('; }
{kind = TOKEN_IDENTIFIER; ; index = 53 ; length = 1 line = 5 ; column = 1 ; value ='a'; }
{kind = TOKEN_PLUS; ; index = 55 ; length = 1 line = 5 ; column = 3 ; value ='+'; }
{kind = TOKEN_IDENTIFIER; ; index = 57 ; length = 1 line = 5 ; column = 5 ; value ='b'; }
{kind = TOKEN_RIGHTPAREN; ; index = 58 ; length = 1 line = 5 ; column = 6 ; value =')'; }
{kind = TOKEN_DOT; ; index = 59 ; length = 1 line = 5 ; column = 7 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 60 ; length = 1 line = 5 ; column = 8 ; value ='x'; }
{kind = TOKEN_ASSIGN; ; index = 62 ; length = 1 line = 5 ; column = 10 ; value ='='; }
{kind = TOKEN_FLOATLITERAL; ; index = 64 ; length = 3 line = 5 ; column = 12 ; value ='2'; }
{kind = TOKEN_SEMICOLON; ; index = 67 ; length = 1 line = 5 ; column = 15 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 70 ; length = 1 line = 6 ; column = 0 ; value ='}'; }
{kind = TOKEN_EOF; ; index = 73 ; length = 0 line = 7 ; column = 0 ; value =''; }

View File

@@ -1,8 +1,11 @@
test/assign_arithmetic_expression.ink lex
test/arithmetic_parens.ink lex
test/bad_double_access.ink lex
test/basic_property_and_return_value.ink lex
test/builtin_types.ink lex
test/complicated_computation.ink lex
test/constant_buffer.ink lex
test/double_access.ink lex
test/else_if_after_else.ink lex
test/empty_struct.ink lex
test/empty_vertex_main.ink lex
@@ -26,21 +29,21 @@ test/if_def_expression.ink lex
test/if_if_if.ink lex
test/inferred_types.ink lex
test/large_block.ink lex
test/meta_block.ink lex
test/multiple_functions.ink lex
test/multiple_semicolons_everywhere.ink lex
test/nested_if.ink lex
test/non_bool_cond.ink lex
test/pass_and_access_struct_fields_in_functions.ink lex
test/passthrough.ink lex
test/property_rename.ink lex
test/redeclared_variable.ink lex
test/rvalue_binary.ink lex
test/simple_else_if.ink lex
test/simple_if_else.ink lex
test/simple_if.ink lex
test/simple_struct_access.ink lex
test/struct_access_primitive_type.ink lex
test/struct_within_struct.ink lex
test/temp_access.ink lex
test/type_as_variable_name.ink lex
test/unary.ink lex
test/undeclared_function.ink lex

View File

@@ -1,16 +0,0 @@
meta {
name : LitBasic;
category : Scene;
}
properties {
color : float4;
}
vertex main :: (pos : float3 @position, uv : float2 @uv) -> float3 @position {
return pos;
}
pixel main :: () -> float4 @target0 {
return properties.color;
}

View File

@@ -0,0 +1,5 @@
(program
(fun vertex vs_main
[]
(:= v float2)
(= v.x (* (+ 2 (* (- 4 2) 1.5)) 3))))

View File

@@ -0,0 +1,8 @@
(program
(struct P
[(:= v float2)])
(fun vertex vs_main
[]
(:= p P)
(= p.v.x.y 2)))

View File

@@ -1,5 +1,5 @@
(program
(properties
(constant_buffer properties (@properties)
[(:= color float4)])
(fun vertex vs_main -> float3 (@position)

10
test/parse/buffers.golden Normal file
View File

@@ -0,0 +1,10 @@
(program
(buffer property_buffer
[(:= color float4)])
(constant_buffer cbuffer
[(:= color float4)])
(fun pixel ps_main
[(:= index int)]
(return property_buffer[index].color)))

View File

@@ -0,0 +1,7 @@
(program
(constant_buffer p
[(:= v float2)])
(fun vertex vs_main
[]
(:= x float (/ p.v.x p.v.y))))

View File

@@ -0,0 +1,10 @@
(program
(constant_buffer props (@properties)
[(:= projection float4x4 (@projection))
(:= view float4x4 (@view))])
(fun vertex vs_main -> float4 (@position)
[(:= pos float4 (@position))]
(:= mv float4 (mul props.view pos))
(:= mvp float4 (mul props.projection mv))
(return mvp)))

View File

@@ -1,5 +1,5 @@
(program
(properties p
(constant_buffer p (@properties)
[(:= color float4)
(:= rect_position float2)
(:= rect_scale float2)

View File

@@ -0,0 +1,6 @@
(program
(fun vertex vs_main
[]
(:= a float2)
(:= b float2)
(:= x (+ a b).x)))

View File

@@ -0,0 +1,6 @@
(program
(fun vertex vs_main
[]
(:= a float2)
(:= b float2)
(= (+ a b).x 2)))

View File

@@ -1,8 +1,11 @@
test/assign_arithmetic_expression.ink parse
test/arithmetic_parens.ink parse
test/bad_double_access.ink parse
test/basic_property_and_return_value.ink parse
test/builtin_types.ink parse
test/complicated_computation.ink parse
test/constant_buffer.ink parse
test/double_access.ink parse
test/else_if_after_else.ink parse
test/empty_struct.ink parse
test/empty_vertex_main.ink parse
@@ -26,21 +29,21 @@ test/if_def_expression.ink parse
test/if_if_if.ink parse
test/inferred_types.ink parse
test/large_block.ink parse
test/meta_block.ink parse
test/multiple_functions.ink parse
test/multiple_semicolons_everywhere.ink parse
test/nested_if.ink parse
test/non_bool_cond.ink parse
test/pass_and_access_struct_fields_in_functions.ink parse
test/passthrough.ink parse
test/property_rename.ink parse
test/redeclared_variable.ink parse
test/rvalue_binary.ink parse
test/simple_else_if.ink parse
test/simple_if_else.ink parse
test/simple_if.ink parse
test/simple_struct_access.ink parse
test/struct_access_primitive_type.ink parse
test/struct_within_struct.ink parse
test/temp_access.ink parse
test/type_as_variable_name.ink parse
test/unary.ink parse
test/undeclared_function.ink parse

View File

@@ -1,11 +0,0 @@
props :: properties {
color : float4;
}
vertex main :: (pos : float4 @position) -> float4 @position {
return pos;
}
pixel main :: () -> float4 @target0 {
return props.color;
}

6
test/rvalue_binary.ink Normal file
View File

@@ -0,0 +1,6 @@
vertex main :: () {
a : float2;
b : float2;
x := (a + b).x;
}

6
test/temp_access.ink Normal file
View File

@@ -0,0 +1,6 @@
vertex main :: () {
a : float2;
b : float2;
(a + b).x = 2.0;
}