Fix some if directive stuff. Fix a property output issue. Will be deprecated next commit anyway.

This commit is contained in:
2025-09-17 12:30:36 +02:00
parent 7fefe0ecf6
commit 8b2141df16
19 changed files with 174 additions and 95 deletions

View File

@@ -372,7 +372,7 @@ pretty_print_node :: (node : *AST_Node, indentation : int, builder : *String_Bui
pretty_print_node(body, indentation + 4, builder); pretty_print_node(body, indentation + 4, builder);
// append(builder, ")"); // append(builder, ")");
if node.children.count == 3 { if node.children.count == 3 { //@Note: Else branch
append(builder, "\n"); append(builder, "\n");
pretty_print_node(node.children[2], indentation + 4, builder); pretty_print_node(node.children[2], indentation + 4, builder);
} }
@@ -485,8 +485,10 @@ pretty_print_declaration :: (declaration : *AST_Node, indentation : int, builder
} else if declaration.kind == .CBuffer { } else if declaration.kind == .CBuffer {
append(builder, "constant_buffer "); append(builder, "constant_buffer ");
} }
if declaration.kind != .If_Directive {
print_to_builder(builder, "%", declaration.name); print_to_builder(builder, "%", declaration.name);
} }
}
if declaration.kind == .Function && declaration.token.kind == .TOKEN_IDENTIFIER{ if declaration.kind == .Function && declaration.token.kind == .TOKEN_IDENTIFIER{
print_to_builder(builder, " -> %", declaration.token.ident_value); print_to_builder(builder, " -> %", declaration.token.ident_value);

View File

@@ -1048,6 +1048,8 @@ declare_properties :: (checker : *Checker, node : *AST_Node) -> Type_Variable_Ha
if node.name.count > 0 { if node.name.count > 0 {
checker.ctx.property_name = name; checker.ctx.property_name = name;
} else {
checker.ctx.property_name = "properties";
} }
type_var := declare_struct(checker, node, name); type_var := declare_struct(checker, node, name);
var := from_handle(checker, type_var); var := from_handle(checker, type_var);

16
Ink.jai
View File

@@ -227,6 +227,22 @@ run_compile_test :: (path : string, output_type : Output_Type = 0) -> Result, Co
print_to_builder(*sb, "[pixel entry point] - %\n", ctx.pixel_entry_point.name); print_to_builder(*sb, "[pixel entry point] - %\n", ctx.pixel_entry_point.name);
} }
if ctx.properties.fields.count > 0{
props := ctx.properties;
append(*sb, "[");
if ctx.property_name.count > 0 {
print_to_builder(*sb, "% :: ", ctx.property_name);
}
print_to_builder(*sb, "properties] - %\n", props.buffer_index);
indent(*sb, 1);
for field : props.fields {
append(*sb, "[field] - ");
pretty_print_field(*sb, *field.base_field);
}
}
for cb : ctx.cbuffers { for cb : ctx.cbuffers {
print_to_builder(*sb, "[constant_buffer] - % - %\n", cb.name, cb.buffer_index); print_to_builder(*sb, "[constant_buffer] - % - %\n", cb.name, cb.buffer_index);

View File

@@ -7,12 +7,21 @@
#import "File_Utilities"; #import "File_Utilities";
/* TODO /* TODO
- [ ] 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 - [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 structured buffers (ro, rw, w)
- [ ] Support mesh and amplification shaders - [ ] Support mesh and amplification shaders
- [ ] Support compute shaders - [ ] Support compute shaders
- [ ] Support #if - [x] Support #if at top level
- [x] Support #if at block level
- [ ] Remove properties block and just use hinted constant buffers instead
```
props :: constant_buffer @properties {
[...]
}
```
- [ ] while loops
- [ ] for-each loops
- [ ]
*/ */
add_define :: (env : *Environment, key : string) { add_define :: (env : *Environment, key : string) {
@@ -453,6 +462,7 @@ generate_output_data :: (ctx : *Compiler_Context) {
find_result := find_symbol(*ctx.scope_stack, ctx.property_name, xx 1); find_result := find_symbol(*ctx.scope_stack, ctx.property_name, xx 1);
if find_result { if find_result {
property_variable := from_handle(ctx.type_variables, find_result.type_variable); property_variable := from_handle(ctx.type_variables, find_result.type_variable);
for i : 0..property_variable.children.count - 1 { for i : 0..property_variable.children.count - 1 {

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

@@ -1,7 +1,7 @@
void ps_main() void ps_main()
{ {
float4 color = float4(1, 0, 0, 1); float4 alpha_color = float4(1, 0, 0, 1);
float f = 2.0f; 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

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

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

View File

@@ -1,6 +1,6 @@
//#add_define PS5 #add_define PS5
#add_define XSX #add_define XSX
//#add_define Switch2 #add_define Switch2
#if (Env.PS5 && Env.XSX) || Env.Switch2 { #if (Env.PS5 && Env.XSX) || Env.Switch2 {
vertex console_main :: () { vertex console_main :: () {

View File

@@ -1,4 +1,4 @@
//#add_define Skinning #add_define Skinning
#add_define UV #add_define UV

View File

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

View File

@@ -1,52 +1,52 @@
{kind = TOKEN_DIRECTIVE; ; index = 45 ; length = 2 line = 5 ; column = 0 ; value ='if'; } {kind = TOKEN_DIRECTIVE; ; index = 43 ; length = 2 line = 5 ; column = 0 ; value ='if'; }
{kind = TOKEN_IDENTIFIER; ; index = 48 ; length = 3 line = 5 ; column = 3 ; value ='Env'; } {kind = TOKEN_IDENTIFIER; ; index = 46 ; length = 3 line = 5 ; column = 3 ; value ='Env'; }
{kind = TOKEN_DOT; ; index = 51 ; length = 1 line = 5 ; column = 6 ; value ='.'; } {kind = TOKEN_DOT; ; index = 49 ; length = 1 line = 5 ; column = 6 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 52 ; length = 8 line = 5 ; column = 7 ; value ='Skinning'; } {kind = TOKEN_IDENTIFIER; ; index = 50 ; length = 8 line = 5 ; column = 7 ; value ='Skinning'; }
{kind = TOKEN_LEFTBRACE; ; index = 61 ; length = 1 line = 5 ; column = 16 ; value ='{'; } {kind = TOKEN_LEFTBRACE; ; index = 59 ; length = 1 line = 5 ; column = 16 ; value ='{'; }
{kind = TOKEN_VERTEX; ; index = 65 ; length = 6 line = 6 ; column = 0 ; value ='vertex'; } {kind = TOKEN_VERTEX; ; index = 63 ; length = 6 line = 6 ; column = 0 ; value ='vertex'; }
{kind = TOKEN_IDENTIFIER; ; index = 72 ; length = 13 line = 6 ; column = 7 ; value ='skinning_main'; } {kind = TOKEN_IDENTIFIER; ; index = 70 ; length = 13 line = 6 ; column = 7 ; value ='skinning_main'; }
{kind = TOKEN_DOUBLECOLON; ; index = 86 ; length = 2 line = 6 ; column = 21 ; value ='::'; } {kind = TOKEN_DOUBLECOLON; ; index = 84 ; length = 2 line = 6 ; column = 21 ; value ='::'; }
{kind = TOKEN_LEFTPAREN; ; index = 89 ; length = 1 line = 6 ; column = 24 ; value ='('; } {kind = TOKEN_LEFTPAREN; ; index = 87 ; length = 1 line = 6 ; column = 24 ; value ='('; }
{kind = TOKEN_RIGHTPAREN; ; index = 90 ; length = 1 line = 6 ; column = 25 ; value =')'; } {kind = TOKEN_RIGHTPAREN; ; index = 88 ; length = 1 line = 6 ; column = 25 ; value =')'; }
{kind = TOKEN_LEFTBRACE; ; index = 92 ; length = 1 line = 6 ; column = 27 ; value ='{'; } {kind = TOKEN_LEFTBRACE; ; index = 90 ; length = 1 line = 6 ; column = 27 ; value ='{'; }
{kind = TOKEN_IDENTIFIER; ; index = 97 ; length = 1 line = 7 ; column = 0 ; value ='x'; } {kind = TOKEN_IDENTIFIER; ; index = 95 ; length = 1 line = 7 ; column = 0 ; value ='x'; }
{kind = TOKEN_COLON; ; index = 99 ; length = 1 line = 7 ; column = 2 ; value =':'; } {kind = TOKEN_COLON; ; index = 97 ; length = 1 line = 7 ; column = 2 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 101 ; length = 5 line = 7 ; column = 4 ; value ='float'; } {kind = TOKEN_IDENTIFIER; ; index = 99 ; length = 5 line = 7 ; column = 4 ; value ='float'; }
{kind = TOKEN_ASSIGN; ; index = 107 ; length = 1 line = 7 ; column = 10 ; value ='='; } {kind = TOKEN_ASSIGN; ; index = 105 ; length = 1 line = 7 ; column = 10 ; value ='='; }
{kind = TOKEN_FLOATLITERAL; ; index = 109 ; length = 3 line = 7 ; column = 12 ; value ='5'; } {kind = TOKEN_FLOATLITERAL; ; index = 107 ; length = 3 line = 7 ; column = 12 ; value ='5'; }
{kind = TOKEN_SEMICOLON; ; index = 112 ; length = 1 line = 7 ; column = 15 ; value =';'; } {kind = TOKEN_SEMICOLON; ; index = 110 ; length = 1 line = 7 ; column = 15 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 116 ; length = 1 line = 8 ; column = 0 ; value ='}'; } {kind = TOKEN_RIGHTBRACE; ; index = 114 ; length = 1 line = 8 ; column = 0 ; value ='}'; }
{kind = TOKEN_RIGHTBRACE; ; index = 119 ; length = 1 line = 9 ; column = 0 ; value ='}'; } {kind = TOKEN_RIGHTBRACE; ; index = 117 ; length = 1 line = 9 ; column = 0 ; value ='}'; }
{kind = TOKEN_ELSE; ; index = 121 ; length = 4 line = 9 ; column = 2 ; value ='else'; } {kind = TOKEN_ELSE; ; index = 119 ; length = 4 line = 9 ; column = 2 ; value ='else'; }
{kind = TOKEN_DIRECTIVE; ; index = 127 ; length = 2 line = 9 ; column = 7 ; value ='if'; } {kind = TOKEN_DIRECTIVE; ; index = 125 ; length = 2 line = 9 ; column = 7 ; value ='if'; }
{kind = TOKEN_IDENTIFIER; ; index = 130 ; length = 3 line = 9 ; column = 10 ; value ='Env'; } {kind = TOKEN_IDENTIFIER; ; index = 128 ; length = 3 line = 9 ; column = 10 ; value ='Env'; }
{kind = TOKEN_DOT; ; index = 133 ; length = 1 line = 9 ; column = 13 ; value ='.'; } {kind = TOKEN_DOT; ; index = 131 ; length = 1 line = 9 ; column = 13 ; value ='.'; }
{kind = TOKEN_IDENTIFIER; ; index = 134 ; length = 2 line = 9 ; column = 14 ; value ='UV'; } {kind = TOKEN_IDENTIFIER; ; index = 132 ; length = 2 line = 9 ; column = 14 ; value ='UV'; }
{kind = TOKEN_LEFTBRACE; ; index = 137 ; length = 1 line = 9 ; column = 17 ; value ='{'; } {kind = TOKEN_LEFTBRACE; ; index = 135 ; length = 1 line = 9 ; column = 17 ; value ='{'; }
{kind = TOKEN_VERTEX; ; index = 141 ; length = 6 line = 10 ; column = 0 ; value ='vertex'; } {kind = TOKEN_VERTEX; ; index = 139 ; length = 6 line = 10 ; column = 0 ; value ='vertex'; }
{kind = TOKEN_IDENTIFIER; ; index = 148 ; length = 20 line = 10 ; column = 7 ; value ='texture_mapping_main'; } {kind = TOKEN_IDENTIFIER; ; index = 146 ; length = 20 line = 10 ; column = 7 ; value ='texture_mapping_main'; }
{kind = TOKEN_DOUBLECOLON; ; index = 169 ; length = 2 line = 10 ; column = 28 ; value ='::'; } {kind = TOKEN_DOUBLECOLON; ; index = 167 ; length = 2 line = 10 ; column = 28 ; value ='::'; }
{kind = TOKEN_LEFTPAREN; ; index = 172 ; length = 1 line = 10 ; column = 31 ; value ='('; } {kind = TOKEN_LEFTPAREN; ; index = 170 ; length = 1 line = 10 ; column = 31 ; value ='('; }
{kind = TOKEN_RIGHTPAREN; ; index = 173 ; length = 1 line = 10 ; column = 32 ; value =')'; } {kind = TOKEN_RIGHTPAREN; ; index = 171 ; length = 1 line = 10 ; column = 32 ; value =')'; }
{kind = TOKEN_LEFTBRACE; ; index = 175 ; length = 1 line = 10 ; column = 34 ; value ='{'; } {kind = TOKEN_LEFTBRACE; ; index = 173 ; length = 1 line = 10 ; column = 34 ; value ='{'; }
{kind = TOKEN_IDENTIFIER; ; index = 180 ; length = 1 line = 11 ; column = 0 ; value ='x'; } {kind = TOKEN_IDENTIFIER; ; index = 178 ; length = 1 line = 11 ; column = 0 ; value ='x'; }
{kind = TOKEN_COLON; ; index = 182 ; length = 1 line = 11 ; column = 2 ; value =':'; } {kind = TOKEN_COLON; ; index = 180 ; length = 1 line = 11 ; column = 2 ; value =':'; }
{kind = TOKEN_IDENTIFIER; ; index = 184 ; length = 6 line = 11 ; column = 4 ; value ='float2'; } {kind = TOKEN_IDENTIFIER; ; index = 182 ; length = 6 line = 11 ; column = 4 ; value ='float2'; }
{kind = TOKEN_ASSIGN; ; index = 191 ; length = 1 line = 11 ; column = 11 ; value ='='; } {kind = TOKEN_ASSIGN; ; index = 189 ; length = 1 line = 11 ; column = 11 ; value ='='; }
{kind = TOKEN_IDENTIFIER; ; index = 193 ; length = 6 line = 11 ; column = 13 ; value ='float2'; } {kind = TOKEN_IDENTIFIER; ; index = 191 ; length = 6 line = 11 ; column = 13 ; value ='float2'; }
{kind = TOKEN_LEFTPAREN; ; index = 199 ; length = 1 line = 11 ; column = 19 ; value ='('; } {kind = TOKEN_LEFTPAREN; ; index = 197 ; length = 1 line = 11 ; column = 19 ; value ='('; }
{kind = TOKEN_FLOATLITERAL; ; index = 200 ; length = 3 line = 11 ; column = 20 ; value ='2'; } {kind = TOKEN_FLOATLITERAL; ; index = 198 ; length = 3 line = 11 ; column = 20 ; value ='2'; }
{kind = TOKEN_COMMA; ; index = 203 ; length = 1 line = 11 ; column = 23 ; value =','; } {kind = TOKEN_COMMA; ; index = 201 ; length = 1 line = 11 ; column = 23 ; value =','; }
{kind = TOKEN_FLOATLITERAL; ; index = 205 ; length = 3 line = 11 ; column = 25 ; value ='2'; } {kind = TOKEN_FLOATLITERAL; ; index = 203 ; length = 3 line = 11 ; column = 25 ; value ='2'; }
{kind = TOKEN_RIGHTPAREN; ; index = 208 ; length = 1 line = 11 ; column = 28 ; value =')'; } {kind = TOKEN_RIGHTPAREN; ; index = 206 ; length = 1 line = 11 ; column = 28 ; value =')'; }
{kind = TOKEN_SEMICOLON; ; index = 209 ; length = 1 line = 11 ; column = 29 ; value =';'; } {kind = TOKEN_SEMICOLON; ; index = 207 ; length = 1 line = 11 ; column = 29 ; value =';'; }
{kind = TOKEN_RIGHTBRACE; ; index = 213 ; length = 1 line = 12 ; column = 0 ; value ='}'; } {kind = TOKEN_RIGHTBRACE; ; index = 211 ; length = 1 line = 12 ; column = 0 ; value ='}'; }
{kind = TOKEN_RIGHTBRACE; ; index = 216 ; length = 1 line = 13 ; column = 0 ; value ='}'; } {kind = TOKEN_RIGHTBRACE; ; index = 214 ; length = 1 line = 13 ; column = 0 ; value ='}'; }
{kind = TOKEN_PIXEL; ; index = 221 ; length = 5 line = 15 ; column = 0 ; value ='pixel'; } {kind = TOKEN_PIXEL; ; index = 219 ; length = 5 line = 15 ; column = 0 ; value ='pixel'; }
{kind = TOKEN_IDENTIFIER; ; index = 227 ; length = 4 line = 15 ; column = 6 ; value ='main'; } {kind = TOKEN_IDENTIFIER; ; index = 225 ; length = 4 line = 15 ; column = 6 ; value ='main'; }
{kind = TOKEN_DOUBLECOLON; ; index = 232 ; length = 2 line = 15 ; column = 11 ; value ='::'; } {kind = TOKEN_DOUBLECOLON; ; index = 230 ; length = 2 line = 15 ; column = 11 ; value ='::'; }
{kind = TOKEN_LEFTPAREN; ; index = 235 ; length = 1 line = 15 ; column = 14 ; value ='('; } {kind = TOKEN_LEFTPAREN; ; index = 233 ; length = 1 line = 15 ; column = 14 ; value ='('; }
{kind = TOKEN_RIGHTPAREN; ; index = 236 ; length = 1 line = 15 ; column = 15 ; value =')'; } {kind = TOKEN_RIGHTPAREN; ; index = 234 ; length = 1 line = 15 ; column = 15 ; value =')'; }
{kind = TOKEN_LEFTBRACE; ; index = 238 ; length = 1 line = 15 ; column = 17 ; value ='{'; } {kind = TOKEN_LEFTBRACE; ; index = 236 ; length = 1 line = 15 ; column = 17 ; value ='{'; }
{kind = TOKEN_RIGHTBRACE; ; index = 243 ; length = 1 line = 17 ; column = 0 ; value ='}'; } {kind = TOKEN_RIGHTBRACE; ; index = 241 ; length = 1 line = 17 ; column = 0 ; value ='}'; }
{kind = TOKEN_EOF; ; index = 246 ; length = 0 line = 18 ; column = 0 ; value =''; } {kind = TOKEN_EOF; ; index = 244 ; length = 0 line = 18 ; column = 0 ; value =''; }

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
[]))