Compare commits

...

10 Commits

99 changed files with 1421 additions and 1115 deletions

75
AST.jai
View File

@@ -8,11 +8,6 @@ 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;
@@ -262,9 +257,14 @@ pretty_print_binary :: (node : *AST_Node, indentation : int, builder : *String_B
indent(builder, indentation);
}
append(builder, "(");
is_array_access := false;
if node.token.kind == .TOKEN_LEFTBRACKET {
print_to_builder(builder, "[]");
} else {
op := node.token;
print_to_builder(builder, op_to_string(op));
}
append(builder, " ");
pretty_print_node(node.children[0], 0, builder);
@@ -356,6 +356,29 @@ pretty_print_node :: (node : *AST_Node, indentation : int, builder : *String_Bui
case .If; {
pretty_print_if(node, indentation, builder, skip_indent);
}
case .If_Directive; {
if !skip_indent {
indent(builder, indentation);
}
append(builder, "(#if ");
condition := node.children[0];
pretty_print_node(condition, 0, builder);
append(builder, "\n");
body := node.children[1];
// indent(builder,indentation + 4);
// append(builder, "(");
pretty_print_node(body, indentation + 4, builder);
// append(builder, ")");
if node.children.count == 3 { //@Note: Else branch
append(builder, "\n");
pretty_print_node(node.children[2], indentation + 4, builder);
}
append(builder, ")");
}
case .For; {
pretty_print_for(node, indentation, builder, skip_indent);
}
@@ -446,23 +469,22 @@ 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 ");
}
print_to_builder(builder, "%", declaration.name);
if declaration.kind == .CBuffer {
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{
@@ -479,9 +501,26 @@ pretty_print_declaration :: (declaration : *AST_Node, indentation : int, builder
pretty_print_node(declaration.children[0], 0, builder);
append(builder, "\n");
pretty_print_node(declaration.children[1], indentation + 5, builder);
if declaration.children.count > 2 {
append(builder, "\n");
if declaration.children[2].kind == .If_Directive {
pretty_print_declaration(declaration.children[2], indentation + 5, builder);
} else {
pretty_print_node(declaration.children[2], indentation + 5, builder);
}
}
} else {
print_to_builder(builder, "\n");
pretty_print_children(declaration, indentation + 1, builder, flags = .NewLine);
flags := Children_Print_Flags.NewLine;
if declaration.parent && declaration.parent.parent {
if declaration.parent.parent.kind == .If_Directive {
indent(builder, indentation - 1); //@Note: Hack the indent for now... Wow this is stupid, but it works!
}
}
pretty_print_children(declaration, indentation + 1, builder, flags = flags);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -5,23 +5,19 @@
/////////////////////////////////////
//~ nbr: Codegen TODOs
//
// [ ] Prefix output of property values with __PROPERTIES so we don't get name clashes
Output_Language :: enum {
HLSL;
GLSL; // @Incomplete
MLSL; // @Incomplete
// SPIRV; // @Incomplete: Should we do this?
}
Codegen_State :: struct {
path : string;
// scope_stack : Scope_Stack;
current_scope : Scope_Handle;
// type_variables : []Type_Variable;
// root : *AST_Node;
output_language : Output_Language;
builder : String_Builder;
@@ -29,14 +25,6 @@ Codegen_State :: struct {
result : *Compiler_Context;
}
// Codegen_Result :: struct {
// messages : [..]Compiler_Message;
// had_error : bool;
// result_text : string; // @Incomplete(nb): Result for now, should likely be far more sophisticated.
// }
Reserved_HLSL_Words :: string.[
"texture",
"sampler",
@@ -110,13 +98,6 @@ emit_field :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
print_to_builder(*state.builder, "% ", hlsl_type_to_string(field));
if field.struct_field_parent {
parent_tv := from_handle(state.result.type_variables, field.struct_field_parent.type_variable);
if parent_tv.typename == "properties" {
append(*state.builder, "__PROPERTIES__");
}
}
print_to_builder(*state.builder, "%", node.name);
if field.type == .Sampler {
@@ -132,26 +113,23 @@ emit_field :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
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]);
emit_node(state, child.source_node, 0);
}
for hint : node.hint_tokens {
if hint.ident_value == "position" {
// @Incomplete(nb): Should be a lookup table somewhere
if lookup_hint(hint.ident_value) == .Position {
append(*state.builder, " : POSITION");
} else if hint.ident_value == "uv" {
} else if lookup_hint(hint.ident_value) == .UV {
append(*state.builder, " : TEXCOORD0");
} else if hint.ident_value == "outposition" {
} else if lookup_hint(hint.ident_value) == .Output_Position {
append(*state.builder, " : SV_POSITION");
}
}
@@ -226,56 +204,6 @@ 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);
@@ -421,9 +349,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);
@@ -436,23 +361,11 @@ emit_node :: (state : *Codegen_State, node : *AST_Node, indentation : int) {
indent(*state.builder, indentation);
type_var := from_handle(state.result.type_variables, node.type_variable);
is_properties := type_var.typename == "properties";
if !is_properties {
if type_var.struct_field_parent {
parent_tv := from_handle(state.result.type_variables, type_var.struct_field_parent.type_variable);
if parent_tv.typename == "properties" {
append(*state.builder, "__PROPERTIES__");
}
}
print_to_builder(*state.builder, "%", node.name);
}
if node.children.count > 0 {
if !is_properties {
append(*state.builder, ".");
}
emit_node(state, node.children[0], 0);
}
}
@@ -615,9 +528,6 @@ emit_declaration :: (state : *Codegen_State, node : *AST_Node) {
case .Function; {
emit_function(state, node, 0);
}
case .Properties; {
emit_properties(state, node, 0);
}
case .CBuffer; {
emit_cbuffer(state, node, 0);
}

View File

@@ -102,20 +102,20 @@ copy_messages :: (source : []Compiler_Message, dest : *[..]Compiler_Message) {
}
}
report_messages :: (messages : []Compiler_Message) -> string {
report_messages :: (ctx : *Compiler_Context, messages : []Compiler_Message) -> string {
builder : String_Builder;
init_string_builder(*builder);
for message : messages {
report_message(*builder, message);
report_message(ctx, *builder, message);
}
return builder_to_string(*builder);
}
report_message :: (builder : *String_Builder, message : Compiler_Message) {
report_message(builder, message.path, message.message, message.source_locations, message.message_kind, message.report_source_location);
report_message :: (ctx : *Compiler_Context, builder : *String_Builder, message : Compiler_Message) {
report_message(ctx, builder, message.path, message.message, message.source_locations, message.message_kind, message.report_source_location);
}
report_message :: (builder : *String_Builder, path : string, message : string, source_locations : []Source_Range, kind : Message_Kind, report_source_location : bool = false) {
report_message :: (ctx : *Compiler_Context, builder : *String_Builder, path : string, message : string, source_locations : []Source_Range, kind : Message_Kind, report_source_location : bool = false) {
append(builder, "\x1b[1;37m");
if path.count > 0 {
print_to_builder(builder, "%:", path);
@@ -140,7 +140,7 @@ report_message :: (builder : *String_Builder, path : string, message : string, s
if report_source_location {
for location : source_locations {
append(builder, "\t");
print_from_source_location(builder, location);
print_from_source_location(ctx, builder, location);
append(builder, "\n\t");
begin := location.begin;

58
Ink.jai
View File

@@ -23,7 +23,7 @@ LEXER_FOLDER :: "lex";
PARSER_FOLDER :: "parse";
CODEGEN_FOLDER :: "codegen";
COMPILED_FOLDER :: "compiled";
SEMANTIC_ANALYSIS_FOLDER :: "semant";
CHECK_FOLDER :: "check";
TESTS_FOLDER :: "test";
SHADER_EXTENSION :: "ink";
@@ -32,7 +32,7 @@ SUITE_EXTENSION :: "suite";
Stage_Flags :: enum_flags u16 {
Lexer :: 0x1;
Parser :: 0x2;
Semantic_Analysis :: 0x4;
Check :: 0x4;
Codegen :: 0x8;
Compile :: 0x10;
}
@@ -97,10 +97,10 @@ get_golden_path :: (file_path : string, stage : Stage_Flags) -> string {
make_directory_if_it_does_not_exist(dir);
array_add(*path.words, PARSER_FOLDER);
}
case .Semantic_Analysis; {
dir := tprint("%/%", TESTS_FOLDER, SEMANTIC_ANALYSIS_FOLDER);
case .Check; {
dir := tprint("%/%", TESTS_FOLDER, CHECK_FOLDER);
make_directory_if_it_does_not_exist(dir);
array_add(*path.words, SEMANTIC_ANALYSIS_FOLDER);
array_add(*path.words, CHECK_FOLDER);
}
case .Codegen; {
dir := tprint("%/%", TESTS_FOLDER, CODEGEN_FOLDER);
@@ -189,7 +189,7 @@ run_codegen_test :: (ctx : *Compiler_Context, output_type : Output_Type = 0) ->
if ctx.had_error {
result.type = .Failed;
result_text = report_messages(ctx.messages);
result_text = report_messages(ctx, ctx.messages);
return result;
}
@@ -228,12 +228,22 @@ run_compile_test :: (path : string, output_type : Output_Type = 0) -> Result, Co
}
for cb : ctx.cbuffers {
print_to_builder(*sb, "[constant_buffer] - % - %\n", cb.name, cb.buffer_index);
print_to_builder(*sb, "[constant_buffer] - % - %", cb.name, cb.buffer_index);
if cb.hints.count > 0 {
for hint : cb.hints {
print_to_builder(*sb, " (@%)", hint.custom_hint_name);
}
}
append(*sb, "\n");
indent(*sb, 1);
for field : cb.fields {
append(*sb, "[field] - ");
pretty_print_field(*sb, *field.base_field);
pretty_print_field(*sb, *field);
append(*sb, "\n");
indent(*sb, 1);
}
}
@@ -261,7 +271,7 @@ run_lexer_test :: (file_path : string, ctx : *Compiler_Context, output_type : Ou
lex(ctx);
if ctx.had_error {
result.type = .Failed;
result_text = report_messages(ctx.messages);
result_text = report_messages(ctx, ctx.messages);
} else {
result_text = pretty_print_tokens(ctx.tokens, context.allocator);
}
@@ -300,7 +310,7 @@ run_parser_test :: (ctx : *Compiler_Context, output_type : Output_Type = 0) -> R
if ctx.had_error {
result.type = .Failed;
result_text = report_messages(ctx.messages);
result_text = report_messages(ctx, ctx.messages);
} else {
result_text = pretty_print_ast(ctx.root, context.allocator);
}
@@ -316,7 +326,7 @@ run_parser_test :: (ctx : *Compiler_Context, output_type : Output_Type = 0) -> R
return result;
}
run_semantic_analysis_test :: (ctx : *Compiler_Context, output_type : Output_Type = 0) -> Result {
run_check_test :: (ctx : *Compiler_Context, output_type : Output_Type = 0) -> Result {
result : Result;
result.path = ctx.file.path;
result_text : string;
@@ -325,7 +335,7 @@ run_semantic_analysis_test :: (ctx : *Compiler_Context, output_type : Output_Typ
if ctx.had_error {
result.type = .Failed;
result_text = report_messages(ctx.messages);
result_text = report_messages(ctx, ctx.messages);
} else {
result_text = pretty_print_symbol_table(ctx, context.allocator);
}
@@ -336,12 +346,12 @@ run_semantic_analysis_test :: (ctx : *Compiler_Context, output_type : Output_Typ
return result;
}
golden_path := get_golden_path(ctx.file.path, .Semantic_Analysis);
golden_path := get_golden_path(ctx.file.path, .Check);
do_golden_comparison(golden_path, result_text, *result, output_type);
return result;
}
run_semantic_analysis_test :: (file_path : string, ctx : *Compiler_Context, output_type : Output_Type = 0) -> Result {
run_check_test :: (file_path : string, ctx : *Compiler_Context, output_type : Output_Type = 0) -> Result {
result : Result;
result.path = file_path;
@@ -352,7 +362,7 @@ run_semantic_analysis_test :: (file_path : string, ctx : *Compiler_Context, outp
return result;
}
result = run_semantic_analysis_test(ctx, output_type);
result = run_check_test(ctx, output_type);
return result;
}
@@ -389,17 +399,17 @@ run_test_new :: (file_path : string, stage_flags : Stage_Flags, results : *[..]R
record_result(results, result);
}
if stage_flags & .Semantic_Analysis {
if stage_flags & .Check {
if stage_flags & .Parser && (result.type == .Passed || result.type == .Golden_Output) {
result = run_semantic_analysis_test(*ctx, output_type);
result = run_check_test(*ctx, output_type);
} else {
result = run_semantic_analysis_test(file_path, *ctx, output_type);
result = run_check_test(file_path, *ctx, output_type);
}
record_result(results, result);
}
if stage_flags & .Codegen {
if stage_flags & .Semantic_Analysis && (result.type == .Passed || result.type == .Golden_Output) {
if stage_flags & .Check && (result.type == .Passed || result.type == .Golden_Output) {
result = run_codegen_test(*ctx, output_type);
} else {
result = run_codegen_test(file_path, *ctx, output_type);
@@ -554,8 +564,8 @@ read_suite :: (file_path : string, suite : *Test_Suite, allocator := temp) -> bo
stage_flags |= .Lexer;
} else if equal(trimmed, "parse") {
stage_flags |= .Parser;
} else if equal(trimmed, "semant") {
stage_flags |= .Semantic_Analysis;
} else if equal(trimmed, "check") {
stage_flags |= .Check;
} else if equal(trimmed, "codegen") {
stage_flags |= .Codegen;
} else if equal(trimmed, "compile") {
@@ -577,7 +587,7 @@ stage_to_string :: (stage : Stage_Flags) -> string {
if #complete stage == {
case .Lexer; return "lexing";
case .Parser; return "parsing";
case .Semantic_Analysis; return "semantic checking";
case .Check; return "checking";
case .Codegen; return "codegen";
case .Compile; return "compiled";
case; return "";
@@ -671,8 +681,8 @@ main :: () {
current_suite.test_cases[cases - 1].stage_flags |= .Lexer;
} else if arg == "-parse" {
current_suite.test_cases[cases - 1].stage_flags |= .Parser;
} else if arg == "-semant" {
current_suite.test_cases[cases - 1].stage_flags |= .Semantic_Analysis;
} else if arg == "-check" {
current_suite.test_cases[cases - 1].stage_flags |= .Check;
} else if arg == "-codegen" {
current_suite.test_cases[cases - 1].stage_flags |= .Codegen;
} else if arg == "-compile" {

View File

@@ -11,6 +11,7 @@ Lexer :: struct {
}
Token_Kind :: enum {
TOKEN_INVALID :: 0;
TOKEN_FLOATLITERAL;
TOKEN_INTLITERAL;
@@ -54,6 +55,7 @@ Token_Kind :: enum {
// Keywords
TOKEN_BOOL;
TOKEN_BUFFER;
TOKEN_CASE;
TOKEN_CBUFFER;
@@ -90,7 +92,6 @@ Token_Kind :: enum {
TOKEN_OUT;
TOKEN_PIXEL;
TOKEN_PROPERTIES;
TOKEN_RETURN;
TOKEN_REGISTER;
@@ -215,6 +216,7 @@ 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;
@@ -242,7 +244,6 @@ 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;
@@ -386,7 +387,12 @@ make_directive :: (lexer : *Lexer) -> *Token {
for tok : ctx.tokens {
lexer.ctx.tokens[it_index] = tok;
}
return scan_next_token(lexer);;
return scan_next_token(lexer);
} else if ident.ident_value == "add_define" {
new_define := scan_next_token(lexer);
add_define(*lexer.ctx.environment, new_define.ident_value);
lexer.ctx.tokens.count -= 2;
return scan_next_token(lexer);
}
return ident;
}
@@ -739,10 +745,25 @@ print_token_pointer :: (builder : *String_Builder, token : Token) {
}
}
print_from_source_location :: (builder : *String_Builder, source_location : Source_Range, indentation : int = 0) {
print_from_source_location :: (ctx : *Compiler_Context, builder : *String_Builder, source_location : Source_Range, indentation : int = 0) {
current := source_location.begin;
begin := source_location.begin;
end := source_location.end;
if begin.builtin {
for i : begin.index..end.index - 1 {
tok := ctx.tokens[i];
text : string;
text.data = tok.source;
text.count = tok.length;
print_to_builder(builder, "%", text);
}
return;
} else {
}
begin_pos := 0;
token_string : string;
count := end.index - begin.index + end.length;
@@ -769,12 +790,12 @@ print_from_source_location :: (builder : *String_Builder, source_location : Sour
}
}
print_from_source_location :: (source_location : Source_Range, allocator := context.allocator, indentation : int = 0) -> string {
print_from_source_location :: (ctx : *Compiler_Context, source_location : Source_Range, allocator := context.allocator, indentation : int = 0) -> string {
sc := get_scratch();
defer scratch_end(sc);
builder : String_Builder;
init_string_builder(*builder,, sc.allocator);
print_from_source_location(*builder, source_location,, sc.allocator);
print_from_source_location(ctx, *builder, source_location,, sc.allocator);
return builder_to_string(*builder,, allocator);
}

View File

@@ -75,7 +75,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};
@@ -186,7 +186,7 @@ unexpected_token :: (state : *Parse_State, token : Token, message : string) {
indent(*builder, 1);
cyan(*builder);
print_to_builder(*builder, "%\n", print_from_source_location(location));
print_to_builder(*builder, "%\n", print_from_source_location(state.ctx, location));
indent(*builder, 1);
print_token_pointer(*builder, token);
@@ -207,7 +207,7 @@ else_if_without_if :: (state : *Parse_State) {
indent(*builder, 1);
cyan(*builder);
print_to_builder(*builder, "%\n", print_from_source_location(location));
print_to_builder(*builder, "%\n", print_from_source_location(state.ctx, location));
indent(*builder, 1);
print_token_pointer(*builder, token);
@@ -229,7 +229,7 @@ else_without_if :: (state : *Parse_State) {
indent(*builder, 1);
cyan(*builder);
print_to_builder(*builder, "%\n", print_from_source_location(location));
print_to_builder(*builder, "%\n", print_from_source_location(state.ctx, location));
indent(*builder, 1);
print_token_pointer(*builder, token);
@@ -249,7 +249,7 @@ unable_to_parse_statement :: (state : *Parse_State, token : Token, message : str
indent(*builder, 1);
cyan(*builder);
print_to_builder(*builder, "%\n", print_from_source_location(location));
print_to_builder(*builder, "%\n", print_from_source_location(state.ctx, location));
indent(*builder, 1);
@@ -269,7 +269,7 @@ expected_expression :: (state : *Parse_State, token : Token, message : string) {
indent(*builder, 1);
cyan(*builder);
print_to_builder(*builder, "%\n", print_from_source_location(location));
print_to_builder(*builder, "%\n", print_from_source_location(state.ctx, location));
indent(*builder, 1);
print_token_pointer(*builder, token);
@@ -288,7 +288,7 @@ missing_type_specifier :: (state : *Parse_State, token : Token, message : string
indent(*builder, 1);
cyan(*builder);
print_to_builder(*builder, "%\n", print_from_source_location(location));
print_to_builder(*builder, "%\n", print_from_source_location(state.ctx, location));
indent(*builder, 1);
loc := location.begin;
@@ -312,7 +312,7 @@ empty_block :: (state : *Parse_State, token : Token, message : string) {
indent(*builder, 1);
cyan(*builder);
print_to_builder(*builder, "%\n", print_from_source_location(location));
print_to_builder(*builder, "%\n", print_from_source_location(state.ctx, location));
indent(*builder, 1);
loc := location.begin;
@@ -336,7 +336,26 @@ unable_to_open_file :: (state : *Parse_State, path : string, token : Token) {
indent(*builder, 1);
cyan(*builder);
print_to_builder(*builder, "%\n", print_from_source_location(location));
print_to_builder(*builder, "%\n", print_from_source_location(state.ctx, location));
indent(*builder, 1);
loc := location.begin;
print_token_pointer(*builder, loc);
final_message := builder_to_string(*builder);
record_error(state, token, final_message, false);
}
entry_point_requires_return_value :: (state : *Parse_State, token : Token) {
builder : String_Builder;
init_string_builder(*builder,, temp);
print_to_builder(*builder, "Entry point '%' requires return value\n\n", token.ident_value);
location := generate_source_location_from_token(state, token);
indent(*builder, 1);
cyan(*builder);
print_to_builder(*builder, "%\n", print_from_source_location(state.ctx, location));
indent(*builder, 1);
loc := location.begin;
@@ -383,29 +402,14 @@ make_node :: (parse_state : *Parse_State, kind : AST_Kind) -> *AST_Node {
return make_node(*parse_state.ctx.nodes, kind);
}
// new_builtin_node :: (nodes : *[..]AST_Node, kind : AST_Kind) -> *AST_Node {
// node := make_node(parse_state, kind);
// node.builtin = true;
// return node;
// }
make_builtin_token :: (tokens : *[..]Token, builder : *String_Builder, kind : Token_Kind, text : string, col : *int, line : *int) -> *Token {
make_builtin_token :: (tokens : *[..]Token, kind : Token_Kind, text : string, col : *int, line : *int) -> *Token {
tok : Token;
tok.kind = kind;
start := 0;
buffer := get_current_buffer(builder);
if buffer {
start := buffer.count;
}
tok.column = col.*;
print_to_builder(builder, "%", text);
buffer = get_current_buffer(builder);
end := buffer.count;
for c : text {
if c == #char "\n" {
line.* ++ 1;
@@ -415,9 +419,11 @@ make_builtin_token :: (tokens : *[..]Token, builder : *String_Builder, kind : To
}
}
tok.index = buffer.count - text.count;
tok.index = tokens.count;
tok.length = text.count;
tok.builtin = true;
tok.source = text.data;
tok.ident_value = text;
array_add(tokens, tok);
@@ -427,9 +433,6 @@ make_builtin_token :: (tokens : *[..]Token, builder : *String_Builder, kind : To
new_builtin_struct_node :: (ctx : *Compiler_Context, name : string, members : []Arg) -> *AST_Node {
sc := get_scratch(context.allocator);
defer scratch_end(sc);
builder : String_Builder;
builder.allocator = sc.allocator; // I want to find a good way to use scratch here...
node := make_node(*ctx.nodes, .Struct);
source_location : Source_Range;
@@ -439,17 +442,13 @@ new_builtin_struct_node :: (ctx : *Compiler_Context, name : string, members : []
tok_index := ctx.tokens.count;
ident_token := make_builtin_token(*ctx.tokens, *builder, .TOKEN_IDENTIFIER, tprint("%", name), *col, *line);
ident_token := make_builtin_token(*ctx.tokens, .TOKEN_IDENTIFIER, name, *col, *line);
ident_token.ident_value = name;
source_location.begin = ident_token;
append(*builder, " ");
make_builtin_token(*ctx.tokens, *builder, .TOKEN_DOUBLECOLON, "::", *col, *line);
append(*builder, " ");
make_builtin_token(*ctx.tokens, *builder, .TOKEN_STRUCT, "struct", *col, *line);
append(*builder, " ");
make_builtin_token(*ctx.tokens, *builder, .TOKEN_LEFTBRACE, "{", *col, *line);
append(*builder, "\n");
make_builtin_token(*ctx.tokens, .TOKEN_DOUBLECOLON, " :: ", *col, *line);
make_builtin_token(*ctx.tokens, .TOKEN_STRUCT, "struct ", *col, *line);
make_builtin_token(*ctx.tokens, .TOKEN_LEFTBRACE, "{\n\t", *col, *line);
line += 1;
col = 0;
@@ -460,18 +459,14 @@ new_builtin_struct_node :: (ctx : *Compiler_Context, name : string, members : []
field := make_node(*ctx.nodes, .Field);
field_source_loc : Source_Range;
indent(*builder, 1);
field_ident := make_builtin_token(*ctx.tokens, *builder, .TOKEN_IDENTIFIER, tprint("%", member.name), *col, *line);
field_ident := make_builtin_token(*ctx.tokens, .TOKEN_IDENTIFIER, member.name, *col, *line);
field_source_loc.begin = field_ident;
field.token = field_ident;
field.name = member.name;
append(*builder, " ");
make_builtin_token(*ctx.tokens, *builder, .TOKEN_COLON, ":", *col, *line);
append(*builder, " ");
make_builtin_token(*ctx.tokens, *builder, .TOKEN_IDENTIFIER, tprint("%", member.typename), *col, *line);
semicolon_tok := make_builtin_token(*ctx.tokens, *builder, .TOKEN_SEMICOLON, ";", *col, *line);
append(*builder, "\n");
make_builtin_token(*ctx.tokens, .TOKEN_COLON, ": ", *col, *line);
make_builtin_token(*ctx.tokens, .TOKEN_IDENTIFIER, member.typename, *col, *line);
semicolon_tok := make_builtin_token(*ctx.tokens, .TOKEN_SEMICOLON, ";", *col, *line);
col = 0;
line += 1;
@@ -481,27 +476,10 @@ new_builtin_struct_node :: (ctx : *Compiler_Context, name : string, members : []
add_child(field_list, field);
}
brace_token := make_builtin_token(*ctx.tokens, *builder, .TOKEN_RIGHTBRACE, "}", *col, *line);
append(*builder, "\n");
brace_token := make_builtin_token(*ctx.tokens, .TOKEN_RIGHTBRACE, "\n}", *col, *line);
source_location.end = brace_token;
source := builder_to_string(*builder,, context.allocator);
source_location.begin.source = *source.data[source_location.begin.column];
source_location.end.source = *source.data[source_location.end.column];
for i : tok_index..ctx.tokens.count - 1 {
tok := ctx.tokens[i];
tok.source = *source.data[tok.column];
}
for field : field_list.children {
field.source_location.begin.source = *source.data[field.source_location.begin.column];
field.source_location.end.source = *source.data[field.source_location.end.column];
// field.source_location.main_token.source = *source.data[tok.column];
}
node.source_location = source_location;
return node;
@@ -510,8 +488,6 @@ new_builtin_struct_node :: (ctx : *Compiler_Context, name : string, members : []
new_builtin_function_node :: (ctx : *Compiler_Context, name : string, members : []Arg, return_var : Arg) -> *AST_Node {
sc := get_scratch(context.allocator);
defer scratch_end(sc);
builder : String_Builder;
builder.allocator = sc.allocator; // I want to find a good way to use scratch here...
node := make_node(*ctx.nodes, .Function);
@@ -522,13 +498,11 @@ new_builtin_function_node :: (ctx : *Compiler_Context, name : string, members :
tok_index := ctx.tokens.count;
ident_token := make_builtin_token(*ctx.tokens, *builder, .TOKEN_IDENTIFIER, tprint("%", name), *col, *line);
ident_token := make_builtin_token(*ctx.tokens, .TOKEN_IDENTIFIER, name, *col, *line);
source_location.begin = ident_token;
append(*builder, " ");
make_builtin_token(*ctx.tokens, *builder, .TOKEN_DOUBLECOLON, "::", *col, *line);
append(*builder, " ");
make_builtin_token(*ctx.tokens, *builder, .TOKEN_LEFTPAREN, "(", *col, *line);
make_builtin_token(*ctx.tokens, .TOKEN_DOUBLECOLON, " :: ", *col, *line);
make_builtin_token(*ctx.tokens, .TOKEN_LEFTPAREN, "(", *col, *line);
field_list := make_node(*ctx.nodes, .FieldList);
add_child(node, field_list);
@@ -536,14 +510,12 @@ new_builtin_function_node :: (ctx : *Compiler_Context, name : string, members :
field := make_node(*ctx.nodes, .Field);
field_source_loc : Source_Range;
// field_ident := make_builtin_token(*ctx.tokens, *builder, .TOKEN_IDENTIFIER, tprint("%", member.name), *col, *line);
type_tok := make_builtin_token(*ctx.tokens, *builder, .TOKEN_IDENTIFIER, tprint("%", member.typename), *col, *line);
type_tok := make_builtin_token(*ctx.tokens, .TOKEN_IDENTIFIER, member.typename, *col, *line);
field_source_loc.begin = type_tok;
field.token = type_tok;
if it_index < members.count - 1 {
make_builtin_token(*ctx.tokens, *builder, .TOKEN_COMMA, ",", *col, *line);
append(*builder, " ");
make_builtin_token(*ctx.tokens, .TOKEN_COMMA, ", ", *col, *line);
}
field_source_loc.end = type_tok;
@@ -552,34 +524,18 @@ new_builtin_function_node :: (ctx : *Compiler_Context, name : string, members :
add_child(field_list, field);
}
make_builtin_token(*ctx.tokens, *builder, .TOKEN_RIGHTPAREN, ")", *col, *line);
semicolon_tok := make_builtin_token(*ctx.tokens, *builder, .TOKEN_SEMICOLON, ";", *col, *line);
make_builtin_token(*ctx.tokens, .TOKEN_RIGHTPAREN, ")", *col, *line);
semicolon_tok := make_builtin_token(*ctx.tokens, .TOKEN_SEMICOLON, ";", *col, *line);
source_location.end = semicolon_tok;
source := builder_to_string(*builder,, context.allocator);
source_location.begin.source = *source.data[source_location.begin.column];
source_location.end.source = *source.data[source_location.end.column];
for i : tok_index..ctx.tokens.count - 1 {
tok := ctx.tokens[i];
tok.source = *source.data[tok.column];
}
for field : field_list.children {
field.source_location.begin.source = *source.data[field.source_location.begin.column];
field.source_location.end.source = *source.data[field.source_location.end.column];
// field.source_location.main_token.source = *source.data[tok.column];
}
node.source_location = source_location;
return node;
}
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];
}
@@ -771,13 +727,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;
@@ -794,8 +749,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 {
@@ -838,16 +793,28 @@ directive :: (state : *Parse_State) -> *AST_Node {
if_directive := make_node(state, .If_Directive);
source_location : Source_Range;
// source_location.begin = state.previous;
if state.previous {
source_location.begin = state.previous;
} else {
source_location.begin = state.current;
}
advance(state);
cond := expression(state);
add_child(if_directive, cond);
source_location.end = state.previous;
advance_to_sync_point(state);
if_body := block(state);
add_child(if_directive, if_body);
if match(state, .TOKEN_ELSE) {
else_node := else_statement(state);
add_child(if_directive, else_node);
}
if_directive.source_location = source_location;
return if_directive;
@@ -1256,13 +1223,15 @@ statement :: (parse_state : *Parse_State) -> *AST_Node {
else_statement :: (parse_state : *Parse_State) -> *AST_Node {
if check(parse_state, .TOKEN_IF) {
return statement(parse_state);
} else if check(parse_state, .TOKEN_DIRECTIVE) && parse_state.current.ident_value == "if" {
return directive(parse_state);
}
return block(parse_state);
}
block :: (parse_state : *Parse_State) -> *AST_Node {
node : *AST_Node = make_node(parse_state, .Block);
array_reserve(*node.children, 1024);
array_reserve(*node.children, 32);
source_location : Source_Range;
@@ -1361,10 +1330,22 @@ function_declaration :: (parse_state : *Parse_State, identifier_token : *Token,
case .Vertex; {
node.vertex_entry_point = true;
name = sprint("vs_%", function_name_token.ident_value);
// if return_type_token.kind == .TOKEN_INVALID {
// entry_point_requires_return_value(parse_state, function_name_token);
// advance_to_sync_point(parse_state);
// return error_node(parse_state, "");
// }
}
case .Pixel; {
node.pixel_entry_point = true;
name = sprint("ps_%", function_name_token.ident_value);
// if return_type_token.kind == .TOKEN_INVALID {
// entry_point_requires_return_value(parse_state, function_name_token);
// advance_to_sync_point(parse_state);
// return error_node(parse_state, "");
// }
}
}
@@ -1386,67 +1367,13 @@ function_declaration :: (parse_state : *Parse_State, identifier_token : *Token,
return node;
}
instance_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 'instance' keyword");
properties := field_list(parse_state, .Semicolon);
node = make_node(parse_state, .Instance);
add_child(node, properties);
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);
consume(parse_state, .TOKEN_RIGHTBRACE, "Expect '}' after 'property' keyword");
source_location.end = parse_state.previous;
node.source_location = source_location;
return node;
buffer :: (state : *Parse_State, identifier_token : *Token = null) -> *AST_Node {
internal_error_message(*state.ctx.messages, "Buffers are not yet implemented in the language.", state.ctx.file.path);
return null;
}
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;
@@ -1464,7 +1391,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;
}
@@ -1506,10 +1432,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.*));
}
@@ -1517,13 +1443,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;

View File

@@ -20,15 +20,15 @@ There is basic support for most HLSL built-in math functions for the following t
- Vector types: float2, float3, float4, int2, int3, int4
- Matrices: float4x4
All of the above can be constructed with their namesake constructors i.e. `float4(x, y, z, w);`.
We don't yet support textures and samplers.
We also support Samplers and Texture2D
If you want to declare and use variables you can do it as follows
```hlsl
x : float = 2.0; // no 'f' suffix required or even supported (it gives an error)
y : float = 4.0;
v : float2 = float2(x, y);
v2 := float2(x, y);
```
For now it is required to specify the type of the variable (no type inference).
You can also do arithmetic as you would expect
```
@@ -43,6 +43,7 @@ Camera_Data :: struct {
}
```
And there is a special struct called `properties`, which is used for custom data you want to pass in.
#### ** Note: Properties will likely be deprecated, since the language now supports `@` hints to easily mark buffers and values with metadata.**
```hlsl
properties {
projection : float4x4;
@@ -53,13 +54,14 @@ which will be exposed in the compiled result. `properties` can be renamed to a c
```
p :: properties {
...
}
```
You can also define constant buffers
```
camera :: Constant_Buffer {
camera :: constant_buffer {
projection : float4x4;
view : float4x4;
}
@@ -70,69 +72,68 @@ camera :: Constant_Buffer {
To compile a shader and use the result, you can do the following in jai
```jai
parse_shader :: (path : string, allocator : Allocator) -> Compilation_Result {
// In the future, you can pass environment defines to the compiler.
compiler : Shader_Compiler;
ctx : Compiler_Context;
compile_file(*compiler, "shader.shd", allocator);
return compile_file(*compiler, path,, allocator);
}
result := parse_shader("shader.shd", allocator);
if result.had_error {
log_error("%\n", report_messages(result.messages),, temp);
if ctx.had_error {
log_error("%\n", report_messages(ctx.messages),, temp);
return;
}
collection := result.collection;
variant := collection.variants[0];
}
// The ctx now contains all the needed information like the source text, entry points, constant buffers etc.
```
When parsing a shader you get the following struct as a result
```
Compilation_Result :: struct {
messages : [..]Compiler_Message;
Compiler_Context :: struct {
file : Input_File;
had_error : bool;
environment : Environment;
collection : Shader_Variant_Collection;
}
```
tokens : [..]Token;;
root : *AST_Node;
nodes : [..]AST_Node;
A `Shader_Variant_Collection` looks as follows
```
Shader_Variant_Collection :: struct {
properties : Properties;
codegen_result_text : string;
max_constant_buffers :: 16;
cbuffers : Static_Array(Constant_Buffer, max_constant_buffers);
constant_buffers : Static_Array(Type_Variable_Handle, 16);
variants : [..]Shader_Variant;
}
scope_stack : Scope_Stack;
type_variables : [..]Type_Variable;
Shader_Variant :: struct {
text : string;
property_name : string;
vertex_entry_point : struct {
node : *AST_Node;
name : string;
input : [..]Field;
}
pixel_entry_point : struct {
node : *AST_Node;
name : string;
return_value : Field;
}
properties : Properties;
max_constant_buffers :: 16;
cbuffers : Static_Array(Constant_Buffer, max_constant_buffers);
had_error : bool;
messages : [..]Compiler_Message;
}
Constant_Buffer :: struct {
register : int;
name : string;
fields : Static_Array(Property_Field, 16);
// hints : Field_Hint; // optional hint...
hints : [..]Field_Hint;
buffer_index : u32;
}
@@ -192,11 +193,10 @@ Hint_Kind :: enum {
## Notable missing features
- Control flow: if/else, for, while, switch etc.
- While
- Arrays
- Textures and samplers
- Multiple render targets
- Custom buffers/structured buffers
- Interpolation specifiers
- Proper variant handling with environment defines
- Include/importing files such as shared utils etc.
- Importing files such as shared utils etc. with something other than textual `#load`

View File

@@ -17,42 +17,29 @@ build :: () {
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,11 +1,35 @@
#load "Lexing.jai";
#load "Error.jai";
#load "Parsing.jai";
#load "Semantic_Analysis.jai";
#load "Check.jai";
#load "Codegen.jai";
#import "File_Utilities";
/* TODO
- [x] Remove builtin stringbuilding and replace it with ad-hoc string building when error reporting. In that case we are already building a string anyway, so we can just pass in the string builder
- [ ] Support structured buffers (ro, rw, w)
- [ ] Support mesh and amplification shaders
- [ ] Support compute shaders
- [x] Support #if at top level
- [x] Support #if at block level
- [x] Remove properties block and just use hinted constant buffers instead
```
props :: constant_buffer @properties {
[...]
}
```
- [ ] 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) {
for define : env.defines {
if define == key {
@@ -55,10 +79,33 @@ Hint_Kind :: enum {
Position;
UV;
Target;
Output_Position;
Custom;
}
Hint_Names :: #run -> [(cast(int)Hint_Kind.Target) + 1]string {
names : [(cast(int)Hint_Kind.Target) + 1]string;
names[Hint_Kind.Position] = "position";
names[Hint_Kind.UV] = "uv";
names[Hint_Kind.Target] = "target";
return names;
}
lookup_hint :: (name : string) -> Hint_Kind {
if name == "position" {
return Hint_Kind.Position;
} else if name == "uv" {
return Hint_Kind.UV;
} else if starts_with(name, "target") {
return Hint_Kind.Target;
} else if name == "outposition" {
return Hint_Kind.Output_Position;
}
return .None;
}
Field_Hint :: struct {
kind : Hint_Kind;
@@ -81,57 +128,16 @@ Entry_Point :: struct {
return_value : Field;
}
Shader_Variant :: struct {
text : string;
vertex_entry_point : struct {
name : string;
input : [..]Field;
}
pixel_entry_point : struct {
name : string;
return_value : Field;
}
}
Property_Field :: struct {
base_field : Field;
// @Incomplete(nb): Editor information, min max, etc.
// This should also be compiled out for ship
}
Properties :: struct {
fields : [..]Property_Field;
buffer_index : u32;
}
Constant_Buffer :: struct {
register : int;
name : string;
fields : Static_Array(Property_Field, 16);
fields : Static_Array(Field, 16);
// hints : Field_Hint; // optional hint...
hints : [..]Field_Hint;
buffer_index : u32;
}
Shader_Variant_Collection :: struct {
properties : Properties;
max_constant_buffers :: 16;
cbuffers : Static_Array(Constant_Buffer, max_constant_buffers);
variants : [..]Shader_Variant;
}
Input_File :: struct {
source : string;
path : string;
@@ -153,8 +159,6 @@ Compiler_Context :: struct {
scope_stack : Scope_Stack;
type_variables : [..]Type_Variable;
property_name : string;
vertex_entry_point : struct {
node : *AST_Node;
name : string;
@@ -167,8 +171,6 @@ Compiler_Context :: struct {
return_value : Field;
}
properties : Properties;
max_constant_buffers :: 16;
cbuffers : Static_Array(Constant_Buffer, max_constant_buffers);
@@ -250,7 +252,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 - ");
}
@@ -279,10 +281,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);
}
}
@@ -312,7 +321,7 @@ pretty_print_field :: (builder : *String_Builder, field : *Field) {
}
}
type_variable_to_field :: (checker : *Semantic_Checker, variable : Type_Variable_Handle) -> Field {
type_variable_to_field :: (checker : *Checker, variable : Type_Variable_Handle) -> Field {
return type_variable_to_field(checker, from_handle(checker, variable));
}
@@ -367,13 +376,11 @@ type_variable_to_field :: (type_variables : []Type_Variable, scope_stack : Scope
for hint : variable.source_node.hint_tokens {
field_hint : Field_Hint;
if hint.ident_value == "position" {
// @Incomplete(nb): Should be a lookup table somewhere
if lookup_hint(hint.ident_value) == .Position {
field_hint.kind = .Position;
} else if hint.ident_value == "uv" {
} else if lookup_hint(hint.ident_value) == .UV {
field_hint.kind = .UV;
} else if starts_with(hint.ident_value, "target") {
// @Incomplete(nb): Should be a lookup table somewhere
} else if lookup_hint(hint.ident_value) == .Target {
index_str : string;
index_str.data = *hint.ident_value.data[7];
index_str.count = 1;
@@ -399,7 +406,7 @@ type_variable_to_field :: (type_variables : []Type_Variable, scope_stack : Scope
return type_variable_to_field(type_variables, scope_stack, from_handle(type_variables, variable));
}
type_variable_to_field :: (checker : *Semantic_Checker, variable : *Type_Variable) -> Field {
type_variable_to_field :: (checker : *Checker, variable : *Type_Variable) -> Field {
return type_variable_to_field(checker.ctx.type_variables, checker.ctx.scope_stack, variable);
}
@@ -431,11 +438,11 @@ generate_output_data :: (ctx : *Compiler_Context) {
variable := from_handle(ctx.type_variables, buffer_variable);
cb := array_add(*ctx.cbuffers);
cb.name = variable.name;
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));
field : Field = type_variable_to_field(ctx.type_variables, ctx.scope_stack, from_handle(ctx.type_variables, child));
array_add(*cb.fields, field);
}
@@ -449,36 +456,20 @@ generate_output_data :: (ctx : *Compiler_Context) {
}
}
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;
}
if ctx.pixel_entry_point.node {
ctx.pixel_entry_point.name = ctx.pixel_entry_point.node.name;
type_variable := from_handle(ctx.type_variables, ctx.pixel_entry_point.node.type_variable);
assert(type_variable.type == .Function);
if type_variable.return_type_variable > 0 {
field := type_variable_to_field(ctx.type_variables, ctx.scope_stack, type_variable.return_type_variable);
for hint : type_variable.source_node.hint_tokens {
field_hint : Field_Hint;
if hint.ident_value == "position" {
// @Incomplete(nb): Should be a lookup table somewhere
if lookup_hint(hint.ident_value) == .Position {
field_hint.kind = .Position;
} else if starts_with(hint.ident_value, "target") {
// @Incomplete(nb): Should be a lookup table somewhere
} else if lookup_hint(hint.ident_value) == .Target {
index_str : string;
index_str.data = *hint.ident_value.data[7];
index_str.count = 1;
@@ -493,10 +484,10 @@ generate_output_data :: (ctx : *Compiler_Context) {
}
array_add(*field.hints, field_hint);
}
ctx.pixel_entry_point.return_value = field;
}
}
}
compile_file :: (ctx : *Compiler_Context, path : string, allocator : Allocator = temp) {
new_context := context;

View File

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

View File

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

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

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

View File

@@ -0,0 +1,4 @@
scope (global) [
[vertex__vs_console_main] : ()
scope (vertex__vs_console_main) []
]

8
test/check/ifdefs.golden Normal file
View File

@@ -0,0 +1,8 @@
scope (global) [
[vertex__vs_skinning_main] : ()
[pixel__ps_main] : ()
scope (vertex__vs_skinning_main) [
[x] : float
]
scope (pixel__ps_main) []
]

View File

@@ -7,15 +7,15 @@
 result : float4 = float4(1.0, foo * res, 0.0, 1.0);
^
 Possible overloads:
 float4 :: (float, float, float, float); (test/wrong_multiply.ink:0)
 float4 :: (float2, float2); (test/wrong_multiply.ink:0)
 float4 :: (float2, float, float); (test/wrong_multiply.ink:0)
 float4 :: (float, float2, float); (test/wrong_multiply.ink:0)
 float4 :: (float, float, float2); (test/wrong_multiply.ink:0)
 float4 :: (float, float3); (test/wrong_multiply.ink:0)
 float4 :: (float3, float); (test/wrong_multiply.ink:0)
 float4 :: (float4); (test/wrong_multiply.ink:0)
 float4 :: (float); (test/wrong_multiply.ink:0)
 float4 :: (float, float, float, float)
 float4 :: (float2, float2)
 float4 :: (float2, float, float)
 float4 :: (float, float2, float)
 float4 :: (float, float, float2)
 float4 :: (float, float3)
 float4 :: (float3, float)
 float4 :: (float4)
 float4 :: (float)
test/wrong_multiply.ink:4,34: error: Type mismatch. Expected float got float2
 found:

View File

@@ -0,0 +1,30 @@
test/wrong_type_for_function.ink:11,17: error: Procedure call did not match any of the possible overloads for 'float4'
 found:
color : float4 = float4(y, 1.0, 1.0, 1.0);
^^^^^^
 While matching argument 1 in function call.
 color : float4 = float4(y, 1.0, 1.0, 1.0);
^
 Possible overloads:
 float4 :: (float, float, float, float)
 float4 :: (float2, float2)
 float4 :: (float2, float, float)
 float4 :: (float, float2, float)
 float4 :: (float, float, float2)
 float4 :: (float, float3)
 float4 :: (float3, float)
 float4 :: (float4)
 float4 :: (float)
test/wrong_type_for_function.ink:11,24: error: Type mismatch. Expected float got float2
 found:
color : float4 = float4(y, 1.0, 1.0, 1.0);
^
expected:
float
got:
y : float2 = foo()


42
test/check_all.suite Normal file
View File

@@ -0,0 +1,42 @@
test/assign_arithmetic_expression.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/empty_struct.ink check
test/empty_vertex_main.ink check
test/empty_vertex_main_with_position_parameter.ink check
test/field_assignment.ink check
test/for_i_loop.ink check
test/function_call.ink check
test/function_call_out_of_order_declaration.ink check
test/function_call_return.ink check
test/functions_with_same_name.ink check
test/function_with_int_return.ink check
test/if_cond_assign.ink check
test/ifdefs.ink check
test/if_def_block.ink check
test/if_def_expression.ink check
test/inferred_types.ink check
test/multiple_functions.ink check
test/multiple_semicolons_everywhere.ink check
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/redeclared_variable.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/type_as_variable_name.ink check
test/unary.ink check
test/undeclared_function.ink check
test/undeclared_symbol.ink check
test/unknown_overload.ink check
test/use_builtin_functions.ink check
test/wrong_argument_count.ink check
test/wrong_multiply.ink check
test/wrong_type_for_function.ink check

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

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

@@ -0,0 +1,7 @@
void ps_main()
{
float4 alpha_color = float4(1, 0, 0, 1);
float f = 2.0f;
}

View File

@@ -0,0 +1,4 @@
void vs_console_main()
{
}

View File

@@ -0,0 +1,9 @@
void ps_main()
{
}
void vs_skinning_main()
{
float x = 5.0f;
}

View File

@@ -10,14 +10,15 @@ test/field_assignment.ink codegen
test/function_call.ink codegen
test/function_call_out_of_order_declaration.ink codegen
test/function_call_return.ink codegen
test/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/simple_else_if.ink codegen
test/simple_if_else.ink codegen
test/simple_if.ink codegen

View File

@@ -11,8 +11,10 @@ test/function_call.ink compile
test/function_call_out_of_order_declaration.ink compile
test/function_call_return.ink compile
test/functions_with_same_name.ink compile
test/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

View File

@@ -0,0 +1 @@
[vertex entry point] - vs_main

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

@@ -0,0 +1 @@
[pixel entry point] - ps_main

View File

@@ -0,0 +1 @@
[vertex entry point] - vs_console_main

View File

@@ -0,0 +1,2 @@
[vertex entry point] - vs_skinning_main
[pixel entry point] - ps_main

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

11
test/if_def_block.ink Normal file
View File

@@ -0,0 +1,11 @@
#add_define Alpha
pixel main :: () {
#if Env.Alpha {
alpha_color := float4(1, 0, 0, 1);
f := 2.0;
} else {
color := float3(0, 0, 0);
g := 5.0;
}
}

View File

@@ -0,0 +1,13 @@
#add_define PS5
#add_define XSX
#add_define Switch2
#if (Env.PS5 && Env.XSX) || Env.Switch2 {
vertex console_main :: () {
}
} else {
vertex windows_main :: () {
}
}

View File

@@ -1,5 +1,17 @@
#if Defines.Skinning {
vertex main :: () {
// Stub
#add_define Skinning
#add_define UV
#if Env.Skinning {
vertex skinning_main :: () {
x : float = 5.0;
}
} else #if Env.UV {
vertex texture_mapping_main :: () {
x : float2 = float2(2.0, 2.0);
}
}
pixel main :: () {
}

View File

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

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

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

@@ -0,0 +1,53 @@
{kind = TOKEN_PIXEL; ; index = 21 ; length = 5 line = 3 ; column = 0 ; value ='pixel'; }
{kind = TOKEN_IDENTIFIER; ; index = 27 ; length = 4 line = 3 ; column = 6 ; value ='main'; }
{kind = TOKEN_DOUBLECOLON; ; index = 32 ; length = 2 line = 3 ; column = 11 ; value ='::'; }
{kind = TOKEN_LEFTPAREN; ; index = 35 ; length = 1 line = 3 ; column = 14 ; value ='('; }
{kind = TOKEN_RIGHTPAREN; ; index = 36 ; length = 1 line = 3 ; column = 15 ; value =')'; }
{kind = TOKEN_LEFTBRACE; ; index = 38 ; length = 1 line = 3 ; column = 17 ; value ='{'; }
{kind = TOKEN_DIRECTIVE; ; index = 42 ; length = 2 line = 4 ; column = 0 ; value ='if'; }
{kind = TOKEN_IDENTIFIER; ; index = 45 ; length = 3 line = 4 ; column = 3 ; value ='Env'; }
{kind = TOKEN_DOT; ; index = 48 ; length = 1 line = 4 ; column = 6 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 49 ; length = 5 line = 4 ; column = 7 ; value ='Alpha'; }
{kind = TOKEN_LEFTBRACE; ; index = 55 ; length = 1 line = 4 ; column = 13 ; value ='{'; }
{kind = TOKEN_IDENTIFIER; ; index = 59 ; length = 11 line = 5 ; column = 0 ; value ='alpha_color'; }
{kind = TOKEN_COLON; ; index = 71 ; length = 1 line = 5 ; column = 12 ; value =':'; }
{kind = TOKEN_ASSIGN; ; index = 72 ; length = 1 line = 5 ; column = 13 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 74 ; length = 6 line = 5 ; column = 15 ; value ='float4'; }
{kind = TOKEN_LEFTPAREN; ; index = 80 ; length = 1 line = 5 ; column = 21 ; value ='('; }
{kind = TOKEN_INTLITERAL; ; index = 81 ; length = 1 line = 5 ; column = 22 ; value ='1'; }
{kind = TOKEN_COMMA; ; index = 82 ; length = 1 line = 5 ; column = 23 ; value =','; }
{kind = TOKEN_INTLITERAL; ; index = 84 ; length = 1 line = 5 ; column = 25 ; value ='0'; }
{kind = TOKEN_COMMA; ; index = 85 ; length = 1 line = 5 ; column = 26 ; value =','; }
{kind = TOKEN_INTLITERAL; ; index = 87 ; length = 1 line = 5 ; column = 28 ; value ='0'; }
{kind = TOKEN_COMMA; ; index = 88 ; length = 1 line = 5 ; column = 29 ; value =','; }
{kind = TOKEN_INTLITERAL; ; index = 90 ; length = 1 line = 5 ; column = 31 ; value ='1'; }
{kind = TOKEN_RIGHTPAREN; ; index = 91 ; length = 1 line = 5 ; column = 32 ; value =')'; }
{kind = TOKEN_SEMICOLON; ; index = 92 ; length = 1 line = 5 ; column = 33 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 96 ; length = 1 line = 6 ; column = 0 ; value ='f'; }
{kind = TOKEN_COLON; ; index = 98 ; length = 1 line = 6 ; column = 2 ; value =':'; }
{kind = TOKEN_ASSIGN; ; index = 99 ; length = 1 line = 6 ; column = 3 ; value ='='; }
{kind = TOKEN_FLOATLITERAL; ; index = 101 ; length = 3 line = 6 ; column = 5 ; value ='2'; }
{kind = TOKEN_SEMICOLON; ; index = 104 ; length = 1 line = 6 ; column = 8 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 107 ; length = 1 line = 7 ; column = 0 ; value ='}'; }
{kind = TOKEN_ELSE; ; index = 109 ; length = 4 line = 7 ; column = 2 ; value ='else'; }
{kind = TOKEN_LEFTBRACE; ; index = 114 ; length = 1 line = 7 ; column = 7 ; value ='{'; }
{kind = TOKEN_IDENTIFIER; ; index = 118 ; length = 5 line = 8 ; column = 0 ; value ='color'; }
{kind = TOKEN_COLON; ; index = 124 ; length = 1 line = 8 ; column = 6 ; value =':'; }
{kind = TOKEN_ASSIGN; ; index = 125 ; length = 1 line = 8 ; column = 7 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 127 ; length = 6 line = 8 ; column = 9 ; value ='float3'; }
{kind = TOKEN_LEFTPAREN; ; index = 133 ; length = 1 line = 8 ; column = 15 ; value ='('; }
{kind = TOKEN_INTLITERAL; ; index = 134 ; length = 1 line = 8 ; column = 16 ; value ='0'; }
{kind = TOKEN_COMMA; ; index = 135 ; length = 1 line = 8 ; column = 17 ; value =','; }
{kind = TOKEN_INTLITERAL; ; index = 137 ; length = 1 line = 8 ; column = 19 ; value ='0'; }
{kind = TOKEN_COMMA; ; index = 138 ; length = 1 line = 8 ; column = 20 ; value =','; }
{kind = TOKEN_INTLITERAL; ; index = 140 ; length = 1 line = 8 ; column = 22 ; value ='0'; }
{kind = TOKEN_RIGHTPAREN; ; index = 141 ; length = 1 line = 8 ; column = 23 ; value =')'; }
{kind = TOKEN_SEMICOLON; ; index = 142 ; length = 1 line = 8 ; column = 24 ; value =';'; }
{kind = TOKEN_IDENTIFIER; ; index = 146 ; length = 1 line = 9 ; column = 0 ; value ='g'; }
{kind = TOKEN_COLON; ; index = 148 ; length = 1 line = 9 ; column = 2 ; value =':'; }
{kind = TOKEN_ASSIGN; ; index = 149 ; length = 1 line = 9 ; column = 3 ; value ='='; }
{kind = TOKEN_FLOATLITERAL; ; index = 151 ; length = 3 line = 9 ; column = 5 ; value ='5'; }
{kind = TOKEN_SEMICOLON; ; index = 154 ; length = 1 line = 9 ; column = 8 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 157 ; length = 1 line = 10 ; column = 0 ; value ='}'; }
{kind = TOKEN_RIGHTBRACE; ; index = 160 ; length = 1 line = 11 ; column = 0 ; value ='}'; }
{kind = TOKEN_EOF; ; index = 163 ; length = 0 line = 12 ; column = 0 ; value =''; }

View File

@@ -0,0 +1,34 @@
{kind = TOKEN_DIRECTIVE; ; index = 58 ; length = 2 line = 5 ; column = 0 ; value ='if'; }
{kind = TOKEN_LEFTPAREN; ; index = 61 ; length = 1 line = 5 ; column = 3 ; value ='('; }
{kind = TOKEN_IDENTIFIER; ; index = 62 ; length = 3 line = 5 ; column = 4 ; value ='Env'; }
{kind = TOKEN_DOT; ; index = 65 ; length = 1 line = 5 ; column = 7 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 66 ; length = 3 line = 5 ; column = 8 ; value ='PS5'; }
{kind = TOKEN_LOGICALAND; ; index = 70 ; length = 2 line = 5 ; column = 12 ; value ='&&'; }
{kind = TOKEN_IDENTIFIER; ; index = 73 ; length = 3 line = 5 ; column = 15 ; value ='Env'; }
{kind = TOKEN_DOT; ; index = 76 ; length = 1 line = 5 ; column = 18 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 77 ; length = 3 line = 5 ; column = 19 ; value ='XSX'; }
{kind = TOKEN_RIGHTPAREN; ; index = 80 ; length = 1 line = 5 ; column = 22 ; value =')'; }
{kind = TOKEN_LOGICALOR; ; index = 82 ; length = 2 line = 5 ; column = 24 ; value ='||'; }
{kind = TOKEN_IDENTIFIER; ; index = 85 ; length = 3 line = 5 ; column = 27 ; value ='Env'; }
{kind = TOKEN_DOT; ; index = 88 ; length = 1 line = 5 ; column = 30 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 89 ; length = 7 line = 5 ; column = 31 ; value ='Switch2'; }
{kind = TOKEN_LEFTBRACE; ; index = 97 ; length = 1 line = 5 ; column = 39 ; value ='{'; }
{kind = TOKEN_VERTEX; ; index = 101 ; length = 6 line = 6 ; column = 0 ; value ='vertex'; }
{kind = TOKEN_IDENTIFIER; ; index = 108 ; length = 12 line = 6 ; column = 7 ; value ='console_main'; }
{kind = TOKEN_DOUBLECOLON; ; index = 121 ; length = 2 line = 6 ; column = 20 ; value ='::'; }
{kind = TOKEN_LEFTPAREN; ; index = 124 ; length = 1 line = 6 ; column = 23 ; value ='('; }
{kind = TOKEN_RIGHTPAREN; ; index = 125 ; length = 1 line = 6 ; column = 24 ; value =')'; }
{kind = TOKEN_LEFTBRACE; ; index = 127 ; length = 1 line = 6 ; column = 26 ; value ='{'; }
{kind = TOKEN_RIGHTBRACE; ; index = 133 ; length = 1 line = 8 ; column = 0 ; value ='}'; }
{kind = TOKEN_RIGHTBRACE; ; index = 136 ; length = 1 line = 9 ; column = 0 ; value ='}'; }
{kind = TOKEN_ELSE; ; index = 138 ; length = 4 line = 9 ; column = 2 ; value ='else'; }
{kind = TOKEN_LEFTBRACE; ; index = 143 ; length = 1 line = 9 ; column = 7 ; value ='{'; }
{kind = TOKEN_VERTEX; ; index = 147 ; length = 6 line = 10 ; column = 0 ; value ='vertex'; }
{kind = TOKEN_IDENTIFIER; ; index = 154 ; length = 12 line = 10 ; column = 7 ; value ='windows_main'; }
{kind = TOKEN_DOUBLECOLON; ; index = 167 ; length = 2 line = 10 ; column = 20 ; value ='::'; }
{kind = TOKEN_LEFTPAREN; ; index = 170 ; length = 1 line = 10 ; column = 23 ; value ='('; }
{kind = TOKEN_RIGHTPAREN; ; index = 171 ; length = 1 line = 10 ; column = 24 ; value =')'; }
{kind = TOKEN_LEFTBRACE; ; index = 173 ; length = 1 line = 10 ; column = 26 ; value ='{'; }
{kind = TOKEN_RIGHTBRACE; ; index = 179 ; length = 1 line = 12 ; column = 0 ; value ='}'; }
{kind = TOKEN_RIGHTBRACE; ; index = 182 ; length = 1 line = 13 ; column = 0 ; value ='}'; }
{kind = TOKEN_EOF; ; index = 185 ; length = 0 line = 14 ; column = 0 ; value =''; }

52
test/lex/ifdefs.golden Normal file
View File

@@ -0,0 +1,52 @@
{kind = TOKEN_DIRECTIVE; ; index = 43 ; length = 2 line = 5 ; column = 0 ; value ='if'; }
{kind = TOKEN_IDENTIFIER; ; index = 46 ; length = 3 line = 5 ; column = 3 ; value ='Env'; }
{kind = TOKEN_DOT; ; index = 49 ; length = 1 line = 5 ; column = 6 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 50 ; length = 8 line = 5 ; column = 7 ; value ='Skinning'; }
{kind = TOKEN_LEFTBRACE; ; index = 59 ; length = 1 line = 5 ; column = 16 ; value ='{'; }
{kind = TOKEN_VERTEX; ; index = 63 ; length = 6 line = 6 ; column = 0 ; value ='vertex'; }
{kind = TOKEN_IDENTIFIER; ; index = 70 ; length = 13 line = 6 ; column = 7 ; value ='skinning_main'; }
{kind = TOKEN_DOUBLECOLON; ; index = 84 ; length = 2 line = 6 ; column = 21 ; value ='::'; }
{kind = TOKEN_LEFTPAREN; ; index = 87 ; length = 1 line = 6 ; column = 24 ; value ='('; }
{kind = TOKEN_RIGHTPAREN; ; index = 88 ; length = 1 line = 6 ; column = 25 ; value =')'; }
{kind = TOKEN_LEFTBRACE; ; index = 90 ; length = 1 line = 6 ; column = 27 ; value ='{'; }
{kind = TOKEN_IDENTIFIER; ; index = 95 ; length = 1 line = 7 ; column = 0 ; value ='x'; }
{kind = TOKEN_COLON; ; index = 97 ; length = 1 line = 7 ; column = 2 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 99 ; length = 5 line = 7 ; column = 4 ; value ='float'; }
{kind = TOKEN_ASSIGN; ; index = 105 ; length = 1 line = 7 ; column = 10 ; value ='='; }
{kind = TOKEN_FLOATLITERAL; ; index = 107 ; length = 3 line = 7 ; column = 12 ; value ='5'; }
{kind = TOKEN_SEMICOLON; ; index = 110 ; length = 1 line = 7 ; column = 15 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 114 ; length = 1 line = 8 ; column = 0 ; value ='}'; }
{kind = TOKEN_RIGHTBRACE; ; index = 117 ; length = 1 line = 9 ; column = 0 ; value ='}'; }
{kind = TOKEN_ELSE; ; index = 119 ; length = 4 line = 9 ; column = 2 ; value ='else'; }
{kind = TOKEN_DIRECTIVE; ; index = 125 ; length = 2 line = 9 ; column = 7 ; value ='if'; }
{kind = TOKEN_IDENTIFIER; ; index = 128 ; length = 3 line = 9 ; column = 10 ; value ='Env'; }
{kind = TOKEN_DOT; ; index = 131 ; length = 1 line = 9 ; column = 13 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 132 ; length = 2 line = 9 ; column = 14 ; value ='UV'; }
{kind = TOKEN_LEFTBRACE; ; index = 135 ; length = 1 line = 9 ; column = 17 ; value ='{'; }
{kind = TOKEN_VERTEX; ; index = 139 ; length = 6 line = 10 ; column = 0 ; value ='vertex'; }
{kind = TOKEN_IDENTIFIER; ; index = 146 ; length = 20 line = 10 ; column = 7 ; value ='texture_mapping_main'; }
{kind = TOKEN_DOUBLECOLON; ; index = 167 ; length = 2 line = 10 ; column = 28 ; value ='::'; }
{kind = TOKEN_LEFTPAREN; ; index = 170 ; length = 1 line = 10 ; column = 31 ; value ='('; }
{kind = TOKEN_RIGHTPAREN; ; index = 171 ; length = 1 line = 10 ; column = 32 ; value =')'; }
{kind = TOKEN_LEFTBRACE; ; index = 173 ; length = 1 line = 10 ; column = 34 ; value ='{'; }
{kind = TOKEN_IDENTIFIER; ; index = 178 ; length = 1 line = 11 ; column = 0 ; value ='x'; }
{kind = TOKEN_COLON; ; index = 180 ; length = 1 line = 11 ; column = 2 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 182 ; length = 6 line = 11 ; column = 4 ; value ='float2'; }
{kind = TOKEN_ASSIGN; ; index = 189 ; length = 1 line = 11 ; column = 11 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 191 ; length = 6 line = 11 ; column = 13 ; value ='float2'; }
{kind = TOKEN_LEFTPAREN; ; index = 197 ; length = 1 line = 11 ; column = 19 ; value ='('; }
{kind = TOKEN_FLOATLITERAL; ; index = 198 ; length = 3 line = 11 ; column = 20 ; value ='2'; }
{kind = TOKEN_COMMA; ; index = 201 ; length = 1 line = 11 ; column = 23 ; value =','; }
{kind = TOKEN_FLOATLITERAL; ; index = 203 ; length = 3 line = 11 ; column = 25 ; value ='2'; }
{kind = TOKEN_RIGHTPAREN; ; index = 206 ; length = 1 line = 11 ; column = 28 ; value =')'; }
{kind = TOKEN_SEMICOLON; ; index = 207 ; length = 1 line = 11 ; column = 29 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 211 ; length = 1 line = 12 ; column = 0 ; value ='}'; }
{kind = TOKEN_RIGHTBRACE; ; index = 214 ; length = 1 line = 13 ; column = 0 ; value ='}'; }
{kind = TOKEN_PIXEL; ; index = 219 ; length = 5 line = 15 ; column = 0 ; value ='pixel'; }
{kind = TOKEN_IDENTIFIER; ; index = 225 ; length = 4 line = 15 ; column = 6 ; value ='main'; }
{kind = TOKEN_DOUBLECOLON; ; index = 230 ; length = 2 line = 15 ; column = 11 ; value ='::'; }
{kind = TOKEN_LEFTPAREN; ; index = 233 ; length = 1 line = 15 ; column = 14 ; value ='('; }
{kind = TOKEN_RIGHTPAREN; ; index = 234 ; length = 1 line = 15 ; column = 15 ; value =')'; }
{kind = TOKEN_LEFTBRACE; ; index = 236 ; length = 1 line = 15 ; column = 17 ; value ='{'; }
{kind = TOKEN_RIGHTBRACE; ; index = 241 ; length = 1 line = 17 ; column = 0 ; value ='}'; }
{kind = TOKEN_EOF; ; index = 244 ; length = 0 line = 18 ; 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

@@ -20,17 +20,18 @@ test/function_call_return.ink lex
test/functions_with_same_name.ink lex
test/function_with_int_return.ink lex
test/if_cond_assign.ink lex
test/ifdefs.ink lex
test/if_def_block.ink lex
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/simple_else_if.ink lex
test/simple_if_else.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

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

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

@@ -0,0 +1,8 @@
(program
(fun pixel ps_main
[]
(#if Env.Alpha
(:= alpha_color (float4 1 0 0 1))
(:= f 2)
(:= color (float3 0 0 0))
(:= g 5))))

View File

@@ -0,0 +1,6 @@
(program
(#if (|| (&& Env.PS5 Env.XSX) Env.Switch2)
(fun vertex vs_console_main
[])
(fun vertex vs_windows_main
[])))

12
test/parse/ifdefs.golden Normal file
View File

@@ -0,0 +1,12 @@
(program
(#if Env.Skinning
(fun vertex vs_skinning_main
[]
(:= x float 5))
(#if Env.UV
(fun vertex vs_texture_mapping_main
[]
(:= x float2 (float2 2 2)))))
(fun pixel ps_main
[]))

View File

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

View File

@@ -20,17 +20,18 @@ test/function_call_return.ink parse
test/functions_with_same_name.ink parse
test/function_with_int_return.ink parse
test/if_cond_assign.ink parse
test/ifdefs.ink parse
test/if_def_block.ink parse
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/simple_else_if.ink parse
test/simple_if_else.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;
}

View File

@@ -1,30 +0,0 @@
test/wrong_type_for_function.ink:11,17: error: Procedure call did not match any of the possible overloads for 'float4'
 found:
color : float4 = float4(y, 1.0, 1.0, 1.0);
^^^^^^
 While matching argument 1 in function call.
 color : float4 = float4(y, 1.0, 1.0, 1.0);
^
 Possible overloads:
 float4 :: (float, float, float, float); (test/wrong_type_for_function.ink:0)
 float4 :: (float2, float2); (test/wrong_type_for_function.ink:0)
 float4 :: (float2, float, float); (test/wrong_type_for_function.ink:0)
 float4 :: (float, float2, float); (test/wrong_type_for_function.ink:0)
 float4 :: (float, float, float2); (test/wrong_type_for_function.ink:0)
 float4 :: (float, float3); (test/wrong_type_for_function.ink:0)
 float4 :: (float3, float); (test/wrong_type_for_function.ink:0)
 float4 :: (float4); (test/wrong_type_for_function.ink:0)
 float4 :: (float); (test/wrong_type_for_function.ink:0)
test/wrong_type_for_function.ink:11,24: error: Type mismatch. Expected float got float2
 found:
color : float4 = float4(y, 1.0, 1.0, 1.0);
^
expected:
float
got:
y : float2 = foo()


View File

@@ -1,40 +0,0 @@
test/assign_arithmetic_expression.ink semant
test/basic_property_and_return_value.ink semant
test/builtin_types.ink semant
test/complicated_computation.ink semant
test/constant_buffer.ink semant
test/empty_struct.ink semant
test/empty_vertex_main.ink semant
test/empty_vertex_main_with_position_parameter.ink semant
test/field_assignment.ink semant
test/for_i_loop.ink semant
test/function_call.ink semant
test/function_call_out_of_order_declaration.ink semant
test/function_call_return.ink semant
test/functions_with_same_name.ink semant
test/function_with_int_return.ink semant
test/if_cond_assign.ink semant
test/inferred_types.ink semant
test/multiple_functions.ink semant
test/multiple_semicolons_everywhere.ink semant
test/nested_if.ink semant
test/non_bool_cond.ink semant
test/pass_and_access_struct_fields_in_functions.ink semant
test/passthrough.ink semant
test/property_rename.ink semant
test/redeclared_variable.ink semant
test/simple_else_if.ink semant
test/simple_if_else.ink semant
test/simple_if.ink semant
test/simple_struct_access.ink semant
test/struct_access_primitive_type.ink semant
test/struct_within_struct.ink semant
test/type_as_variable_name.ink semant
test/unary.ink semant
test/undeclared_function.ink semant
test/undeclared_symbol.ink semant
test/unknown_overload.ink semant
test/use_builtin_functions.ink semant
test/wrong_argument_count.ink semant
test/wrong_multiply.ink semant
test/wrong_type_for_function.ink semant