init commit
This commit is contained in:
4
test/parse/assign_arithmetic_expression.golden
Normal file
4
test/parse/assign_arithmetic_expression.golden
Normal file
@@ -0,0 +1,4 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= x float (+ 2 5))))
|
||||
11
test/parse/basic_property_and_return_value.golden
Normal file
11
test/parse/basic_property_and_return_value.golden
Normal file
@@ -0,0 +1,11 @@
|
||||
(program
|
||||
(properties
|
||||
[(:= color float4)])
|
||||
|
||||
(fun vertex vs_main -> float3 (@position)
|
||||
[(:= pos float3 (@position))]
|
||||
(return pos))
|
||||
|
||||
(fun pixel ps_main -> float4 (@target0)
|
||||
[]
|
||||
(return properties.color)))
|
||||
6
test/parse/complicated_computation.golden
Normal file
6
test/parse/complicated_computation.golden
Normal file
@@ -0,0 +1,6 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= x float 5)
|
||||
(:= y float 3000)
|
||||
(:= z float (+ (* y y) x))))
|
||||
3
test/parse/empty_struct.golden
Normal file
3
test/parse/empty_struct.golden
Normal file
@@ -0,0 +1,3 @@
|
||||
(program
|
||||
(struct Foo
|
||||
[]))
|
||||
3
test/parse/empty_vertex_main.golden
Normal file
3
test/parse/empty_vertex_main.golden
Normal file
@@ -0,0 +1,3 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]))
|
||||
@@ -0,0 +1,4 @@
|
||||
(program
|
||||
(fun vertex vs_main -> float3
|
||||
[(:= pos float3 (@position))]
|
||||
(return pos)))
|
||||
5
test/parse/field_assignment.golden
Normal file
5
test/parse/field_assignment.golden
Normal file
@@ -0,0 +1,5 @@
|
||||
(program
|
||||
(fun vertex vs_main -> float4 (@position)
|
||||
[(:= pos float4 (@position))]
|
||||
(:= x float 5)
|
||||
(= x 7)))
|
||||
4
test/parse/field_without_type_specifier.golden
Normal file
4
test/parse/field_without_type_specifier.golden
Normal file
@@ -0,0 +1,4 @@
|
||||
[1;37mtest/field_without_type_specifier.shd:2,0: [31merror: [37mExpected type specifier after field name.
|
||||
[96mx := 5.0;
|
||||
^
|
||||
[36m[37m
|
||||
15
test/parse/foreign_function.golden
Normal file
15
test/parse/foreign_function.golden
Normal file
@@ -0,0 +1,15 @@
|
||||
(program
|
||||
(foreign fun float2 -> float2
|
||||
[(:= float)
|
||||
(:= float)])
|
||||
|
||||
(foreign fun float3 -> float3
|
||||
[(:= float)
|
||||
(:= float)
|
||||
(:= float)])
|
||||
|
||||
(foreign fun float4 -> float4
|
||||
[(:= float)
|
||||
(:= float)
|
||||
(:= float)
|
||||
(:= float)]))
|
||||
26
test/parse/foreign_overload.golden
Normal file
26
test/parse/foreign_overload.golden
Normal file
@@ -0,0 +1,26 @@
|
||||
(program
|
||||
(foreign fun mul -> float2
|
||||
[(:= float2)
|
||||
(:= float2)])
|
||||
|
||||
(foreign fun mul -> float3
|
||||
[(:= float3)
|
||||
(:= float3)])
|
||||
|
||||
(foreign fun mul -> float4
|
||||
[(:= float4)
|
||||
(:= float4)])
|
||||
|
||||
(foreign fun mul -> float4x4
|
||||
[(:= float4x4)
|
||||
(:= float4x4)])
|
||||
|
||||
(foreign fun float2 -> float2
|
||||
[(:= float)
|
||||
(:= float)])
|
||||
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= v1 float2 (float2 1 1))
|
||||
(:= v2 float2 (float2 3 3))
|
||||
(:= v3 float2 (mul v1 v2))))
|
||||
8
test/parse/function_call.golden
Normal file
8
test/parse/function_call.golden
Normal file
@@ -0,0 +1,8 @@
|
||||
(program
|
||||
(fun foo -> int
|
||||
[]
|
||||
(return 4))
|
||||
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(foo)))
|
||||
7
test/parse/function_call_out_of_order_declaration.golden
Normal file
7
test/parse/function_call_out_of_order_declaration.golden
Normal file
@@ -0,0 +1,7 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(foo))
|
||||
|
||||
(fun foo
|
||||
[]))
|
||||
7
test/parse/function_call_return.golden
Normal file
7
test/parse/function_call_return.golden
Normal file
@@ -0,0 +1,7 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[])
|
||||
|
||||
(fun pixel ps_main -> float4 (@target0)
|
||||
[]
|
||||
(return (float4 1 1 1 1))))
|
||||
3
test/parse/function_with_int_return.golden
Normal file
3
test/parse/function_with_int_return.golden
Normal file
@@ -0,0 +1,3 @@
|
||||
(program
|
||||
(fun vertex vs_main -> int
|
||||
[(:= pos float3)]))
|
||||
12
test/parse/functions_with_same_name.golden
Normal file
12
test/parse/functions_with_same_name.golden
Normal file
@@ -0,0 +1,12 @@
|
||||
(program
|
||||
(fun foo
|
||||
[])
|
||||
|
||||
(fun foo
|
||||
[])
|
||||
|
||||
(fun bar
|
||||
[])
|
||||
|
||||
(fun vertex vs_main
|
||||
[]))
|
||||
16
test/parse/meta_block.golden
Normal file
16
test/parse/meta_block.golden
Normal file
@@ -0,0 +1,16 @@
|
||||
(program
|
||||
(meta
|
||||
[(:= name LitBasic)
|
||||
(:= category Scene)])
|
||||
|
||||
(properties
|
||||
[(:= color float4)])
|
||||
|
||||
(fun vertex vs_main -> float3 (@position)
|
||||
[(:= pos float3 (@position))
|
||||
(:= uv float2 (@uv))]
|
||||
(return pos))
|
||||
|
||||
(fun pixel ps_main -> float4 (@target0)
|
||||
[]
|
||||
(return properties.color)))
|
||||
13
test/parse/multiple_functions.golden
Normal file
13
test/parse/multiple_functions.golden
Normal file
@@ -0,0 +1,13 @@
|
||||
(program
|
||||
(fun foo -> int
|
||||
[]
|
||||
(return 5))
|
||||
|
||||
(fun bar -> float
|
||||
[]
|
||||
(return (* 1235 500)))
|
||||
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= x int (foo))
|
||||
(:= y float (bar))))
|
||||
14
test/parse/multiple_semicolons_everywhere.golden
Normal file
14
test/parse/multiple_semicolons_everywhere.golden
Normal file
@@ -0,0 +1,14 @@
|
||||
(program
|
||||
(fun vertex vs_main -> float3 (@position)
|
||||
[(:= pos float3 (@position))]
|
||||
(return pos))
|
||||
|
||||
(fun foo -> float4
|
||||
[]
|
||||
(return (float4 1 1 1 1)))
|
||||
|
||||
(fun pixel ps_main -> float4 (@target0)
|
||||
[]
|
||||
(:= y float4 (foo))
|
||||
(:= color float4 y)
|
||||
(return color)))
|
||||
13
test/parse/pass_and_access_struct_fields_in_functions.golden
Normal file
13
test/parse/pass_and_access_struct_fields_in_functions.golden
Normal file
@@ -0,0 +1,13 @@
|
||||
(program
|
||||
(struct Foo
|
||||
[(:= some_data float)])
|
||||
|
||||
(fun foo -> float
|
||||
[(:= f Foo)]
|
||||
(return (* f.some_data 2)))
|
||||
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= f Foo)
|
||||
(= f.some_data 4)
|
||||
(:= d float (foo f))))
|
||||
8
test/parse/passthrough.golden
Normal file
8
test/parse/passthrough.golden
Normal file
@@ -0,0 +1,8 @@
|
||||
(program
|
||||
(fun vertex vs_main -> float3 (@position)
|
||||
[(:= pos float3 (@position))]
|
||||
(return pos))
|
||||
|
||||
(fun pixel ps_main -> float4 (@target0)
|
||||
[]
|
||||
(return (float4 1 1 1 1))))
|
||||
7
test/parse/precedence_test.golden
Normal file
7
test/parse/precedence_test.golden
Normal file
@@ -0,0 +1,7 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= x float 2)
|
||||
(:= y float 5)
|
||||
(:= z float 10)
|
||||
(:= w float (+ (* x y) (* y (- z (/ x (* y x))))))))
|
||||
5
test/parse/redeclared_variable.golden
Normal file
5
test/parse/redeclared_variable.golden
Normal file
@@ -0,0 +1,5 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= x float 1)
|
||||
(:= x float 5)))
|
||||
8
test/parse/simple_struct_access.golden
Normal file
8
test/parse/simple_struct_access.golden
Normal file
@@ -0,0 +1,8 @@
|
||||
(program
|
||||
(struct Data
|
||||
[(:= color float4)])
|
||||
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= d Data)
|
||||
(:= x float4 d.color)))
|
||||
5
test/parse/struct_access_primitive_type.golden
Normal file
5
test/parse/struct_access_primitive_type.golden
Normal file
@@ -0,0 +1,5 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= x int 5)
|
||||
(= x.d 4)))
|
||||
31
test/parse/struct_field_access_test.golden
Normal file
31
test/parse/struct_field_access_test.golden
Normal file
@@ -0,0 +1,31 @@
|
||||
(program
|
||||
(struct Vertex_Out
|
||||
[(:= position float3 (@position))
|
||||
(:= normal float3 (@normal))
|
||||
(:= uv float3 (@uv))
|
||||
(:= frag_pos float3 (@interp))])
|
||||
|
||||
(instance
|
||||
[(:= model float4x4 (@model))])
|
||||
|
||||
(fun vertex main
|
||||
[(:= position float3 (@position))
|
||||
(:= uv float2 (@uv))
|
||||
(:= normal float3 (@normal))]
|
||||
(:= v_out Vertex_Out)
|
||||
(= v_out.position (mul position model))
|
||||
(= v_out.normal normal)
|
||||
(= v_out.uv uv)
|
||||
(= v_out.frag_pos position)
|
||||
(return v_out))
|
||||
|
||||
(struct Pixel_Out
|
||||
[(:= color float4 (@target0))
|
||||
(:= emission float4 (@target1))])
|
||||
|
||||
(fun pixel main
|
||||
[(:= v_in Vertex_Out)]
|
||||
(:= p_out Pixel_Out)
|
||||
(= p_out.color (float4 1 0.5 1 1))
|
||||
(= p_out.emission (float4 2 2 2 2))
|
||||
(return p_out)))
|
||||
12
test/parse/struct_within_struct.golden
Normal file
12
test/parse/struct_within_struct.golden
Normal file
@@ -0,0 +1,12 @@
|
||||
(program
|
||||
(struct Foo
|
||||
[(:= color float4)])
|
||||
|
||||
(struct Bar
|
||||
[(:= t Foo)])
|
||||
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= f Foo)
|
||||
(:= b Bar)
|
||||
(= b.t f)))
|
||||
3
test/parse/type_as_function_name.golden
Normal file
3
test/parse/type_as_function_name.golden
Normal file
@@ -0,0 +1,3 @@
|
||||
(program
|
||||
(fun int
|
||||
[]))
|
||||
4
test/parse/type_as_variable_name.golden
Normal file
4
test/parse/type_as_variable_name.golden
Normal file
@@ -0,0 +1,4 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= int float 4)))
|
||||
4
test/parse/undeclared_function.golden
Normal file
4
test/parse/undeclared_function.golden
Normal file
@@ -0,0 +1,4 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(foo)))
|
||||
4
test/parse/undeclared_symbol.golden
Normal file
4
test/parse/undeclared_symbol.golden
Normal file
@@ -0,0 +1,4 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= b int f)))
|
||||
14
test/parse/unknown_overload.golden
Normal file
14
test/parse/unknown_overload.golden
Normal file
@@ -0,0 +1,14 @@
|
||||
(program
|
||||
(fun foo
|
||||
[(:= v1 float3)
|
||||
(:= v2 float3)])
|
||||
|
||||
(fun foo
|
||||
[(:= v1 float2)
|
||||
(:= v2 float2)
|
||||
(:= v3 float2)])
|
||||
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= v float 2)
|
||||
(foo v v)))
|
||||
4
test/parse/use_builtin_functions.golden
Normal file
4
test/parse/use_builtin_functions.golden
Normal file
@@ -0,0 +1,4 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= f float4 (float4 1 1 1 1))))
|
||||
17
test/parse/wrong_argument_count.golden
Normal file
17
test/parse/wrong_argument_count.golden
Normal file
@@ -0,0 +1,17 @@
|
||||
(program
|
||||
(fun foo -> float
|
||||
[(:= x float)
|
||||
(:= y float)
|
||||
(:= z float)]
|
||||
(return (* (* x y) z)))
|
||||
|
||||
(fun foo -> float
|
||||
[(:= x float)
|
||||
(:= y float)
|
||||
(:= z float)
|
||||
(:= w float)]
|
||||
(return (* (* (* x y) z) w)))
|
||||
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(foo 2 3)))
|
||||
7
test/parse/wrong_multiply.golden
Normal file
7
test/parse/wrong_multiply.golden
Normal file
@@ -0,0 +1,7 @@
|
||||
(program
|
||||
(fun vertex vs_main -> float4 (@position)
|
||||
[(:= pos float4 (@position))]
|
||||
(:= res float2 (float2 2 2))
|
||||
(:= foo float 1)
|
||||
(:= result float4 (float4 1 (* foo res) 0 1))
|
||||
(return result)))
|
||||
14
test/parse/wrong_type_for_function.golden
Normal file
14
test/parse/wrong_type_for_function.golden
Normal file
@@ -0,0 +1,14 @@
|
||||
(program
|
||||
(fun vertex vs_main -> float3 (@position)
|
||||
[(:= pos float3 (@position))]
|
||||
(return pos))
|
||||
|
||||
(fun foo -> float2
|
||||
[]
|
||||
(return (float2 1 1)))
|
||||
|
||||
(fun pixel ps_main -> float4 (@target0)
|
||||
[]
|
||||
(:= y float2 (foo))
|
||||
(:= color float4 (float4 y 1 1 1))
|
||||
(return color)))
|
||||
Reference in New Issue
Block a user