separate number into float and integer

This commit is contained in:
Neemek 2026-07-07 23:24:44 +02:00
parent 10f55313b0
commit daab50d54c
Signed by: neemek
GPG key ID: 84FFE4D7D40AB25E
22 changed files with 848 additions and 428 deletions

View file

@ -69,7 +69,7 @@ func GetCompileTestData() map[string]CompileTestData {
[]Node{
&AssignNode{
"a",
&NumberNode{
&FloatNode{
0,
0, 0,
},
@ -85,7 +85,7 @@ func GetCompileTestData() map[string]CompileTestData {
[]Node{
&AssignNode{
"a",
&NumberNode{
&FloatNode{
1,
0, 0,
},
@ -106,7 +106,7 @@ func GetCompileTestData() map[string]CompileTestData {
[]Value{
&VariableValue{
"a",
&NumberValue{0},
&FloatValue{0},
0,
},
},
@ -118,7 +118,7 @@ func GetCompileTestData() map[string]CompileTestData {
[]Node{
&AssignNode{
"a",
&NumberNode{
&FloatNode{
0,
0, 0,
},
@ -134,7 +134,7 @@ func GetCompileTestData() map[string]CompileTestData {
[]Node{
&AssignNode{
"a",
&NumberNode{
&FloatNode{
1,
0, 0,
},
@ -155,7 +155,7 @@ func GetCompileTestData() map[string]CompileTestData {
[]Value{
&VariableValue{
"a",
&NumberValue{1},
&FloatValue{1},
0,
},
},
@ -167,7 +167,7 @@ func GetCompileTestData() map[string]CompileTestData {
[]Node{
&AssignNode{
"a",
&NumberNode{
&FloatNode{
0,
0, 0,
},
@ -183,7 +183,7 @@ func GetCompileTestData() map[string]CompileTestData {
[]Node{
&AssignNode{
"a",
&NumberNode{
&FloatNode{
1,
0, 0,
},
@ -197,7 +197,7 @@ func GetCompileTestData() map[string]CompileTestData {
[]Node{
&AssignNode{
"a",
&NumberNode{
&FloatNode{
2,
0, 0,
},
@ -217,7 +217,7 @@ func GetCompileTestData() map[string]CompileTestData {
[]Value{
&VariableValue{
"a",
&NumberValue{2},
&FloatValue{2},
0,
},
},
@ -229,7 +229,7 @@ func GetCompileTestData() map[string]CompileTestData {
[]Node{
&AssignNode{
"a",
&NumberNode{
&FloatNode{
0,
0, 0,
},
@ -245,7 +245,7 @@ func GetCompileTestData() map[string]CompileTestData {
[]Node{
&AssignNode{
"a",
&NumberNode{
&FloatNode{
1,
0, 0,
},
@ -259,7 +259,7 @@ func GetCompileTestData() map[string]CompileTestData {
[]Node{
&AssignNode{
"a",
&NumberNode{
&FloatNode{
2,
0, 0,
},
@ -279,7 +279,7 @@ func GetCompileTestData() map[string]CompileTestData {
[]Value{
&VariableValue{
"a",
&NumberValue{1},
&FloatValue{1},
0,
},
},
@ -293,11 +293,11 @@ func GetCompileTestData() map[string]CompileTestData {
"a",
&BinaryNode{
BinaryAddition,
&NumberNode{
&FloatNode{
1,
0, 0,
},
&NumberNode{
&FloatNode{
2,
0, 0,
},
@ -314,7 +314,7 @@ func GetCompileTestData() map[string]CompileTestData {
[]Value{
&VariableValue{
"a",
&NumberValue{3},
&FloatValue{3},
0,
},
},
@ -331,14 +331,14 @@ func GetCompileTestData() map[string]CompileTestData {
[]FunctionParameter{
{
"a",
&NumberSignature{},
&FloatSignature{},
},
{
"b",
&NumberSignature{},
&FloatSignature{},
},
},
&NumberSignature{},
&FloatSignature{},
&BlockNode{
[]Node{
&ReturnNode{
@ -378,20 +378,20 @@ func GetCompileTestData() map[string]CompileTestData {
[]FunctionParameter{
{
"a",
&NumberSignature{},
&FloatSignature{},
},
{
"b",
&NumberSignature{},
&FloatSignature{},
},
},
&NumberSignature{},
&FloatSignature{},
NewChunk(
[]Bytecode{
InstructionDescend,
InstructionGetLocal, 0,
InstructionGetLocal, 1,
InstructionAdd,
InstructionAddFloat,
InstructionReturn,
InstructionAscend,
},
@ -415,12 +415,12 @@ func GetCompileTestData() map[string]CompileTestData {
&FunctionNode{
"a",
[]FunctionParameter{},
&NumberSignature{},
&FloatSignature{},
&BlockNode{
[]Node{
&AssignNode{
"b",
&NumberNode{
&FloatNode{
1,
0, 0,
},
@ -462,7 +462,7 @@ func GetCompileTestData() map[string]CompileTestData {
&FunctionValue{
"a",
[]FunctionParameter{},
&NumberSignature{},
&FloatSignature{},
NewChunk(
[]Bytecode{
InstructionDescend,
@ -473,7 +473,7 @@ func GetCompileTestData() map[string]CompileTestData {
InstructionAscend,
},
[]Value{
&NumberValue{1}, &StringValue{"b"},
&FloatValue{1}, &StringValue{"b"},
},
),
nil,
@ -491,8 +491,8 @@ func GetCompileTestData() map[string]CompileTestData {
name: "a",
value: &ListNode{
items: []Node{
&NumberNode{value: 1},
&NumberNode{value: 2},
&FloatNode{value: 1},
&FloatNode{value: 2},
},
},
declare: true,
@ -516,8 +516,8 @@ func GetCompileTestData() map[string]CompileTestData {
name: "a",
value: &ListValue{
Items: []Value{
&NumberValue{1},
&NumberValue{2},
&FloatValue{1},
&FloatValue{2},
},
},
scope: 0,
@ -543,7 +543,7 @@ func GetCompileTestData() map[string]CompileTestData {
name: "a",
value: &UnaryNode{
UnaryNegate,
&NumberNode{
&FloatNode{
1,
0, 0,
},
@ -559,7 +559,7 @@ func GetCompileTestData() map[string]CompileTestData {
expectedStack: []Value{
&VariableValue{
name: "a",
value: &NumberValue{-1},
value: &FloatValue{-1},
scope: 0,
},
},