mirror of
https://github.com/Open-Argon/argon-v3.git
synced 2025-12-06 08:56:07 +00:00
make even negative sign not allow any type
This commit is contained in:
@@ -6,6 +6,7 @@ var negativeCompile = makeRegex(`( *)-(.|\n)+( *)`)
|
|||||||
|
|
||||||
type negative struct {
|
type negative struct {
|
||||||
VAL any
|
VAL any
|
||||||
|
sign bool
|
||||||
line int
|
line int
|
||||||
code string
|
code string
|
||||||
path string
|
path string
|
||||||
@@ -26,11 +27,9 @@ func parseNegative(code UNPARSEcode, index int, codeline []UNPARSEcode) (any, bo
|
|||||||
path: code.path,
|
path: code.path,
|
||||||
}, index, codeline, 0)
|
}, index, codeline, 0)
|
||||||
|
|
||||||
if difference%2 == 0 {
|
|
||||||
return resp, worked, err, i
|
|
||||||
}
|
|
||||||
return negative{
|
return negative{
|
||||||
VAL: resp,
|
VAL: resp,
|
||||||
|
sign: difference%2 == 0,
|
||||||
line: code.line,
|
line: code.line,
|
||||||
code: code.realcode,
|
code: code.realcode,
|
||||||
path: code.path,
|
path: code.path,
|
||||||
|
|||||||
@@ -70,7 +70,10 @@ func runVal(line any, stack stack, stacklevel int) (any, ArErr) {
|
|||||||
}
|
}
|
||||||
switch y := resp.(type) {
|
switch y := resp.(type) {
|
||||||
case number:
|
case number:
|
||||||
return newNumber().Neg(y), ArErr{}
|
if !x.sign {
|
||||||
|
return newNumber().Neg(y), ArErr{}
|
||||||
|
}
|
||||||
|
return y, ArErr{}
|
||||||
}
|
}
|
||||||
return nil, ArErr{
|
return nil, ArErr{
|
||||||
TYPE: "TypeError",
|
TYPE: "TypeError",
|
||||||
|
|||||||
Reference in New Issue
Block a user