mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-29 13:46:37 +00:00
Berry python compat for ranges
This commit is contained in:
parent
9b8f4e2a16
commit
13e8287554
@ -1074,7 +1074,11 @@ static void sub_expr(bparser *parser, bexpdesc *e, int prio)
|
|||||||
be_code_prebinop(finfo, op, e); /* and or */
|
be_code_prebinop(finfo, op, e); /* and or */
|
||||||
init_exp(&e2, ETVOID, 0);
|
init_exp(&e2, ETVOID, 0);
|
||||||
sub_expr(parser, &e2, binary_op_prio(op)); /* parse right side */
|
sub_expr(parser, &e2, binary_op_prio(op)); /* parse right side */
|
||||||
|
if ((e2.type == ETVOID) && (op == OptConnect)) {
|
||||||
|
init_exp(&e2, ETINT, -1);
|
||||||
|
} else {
|
||||||
check_var(parser, &e2); /* check if valid */
|
check_var(parser, &e2); /* check if valid */
|
||||||
|
}
|
||||||
be_code_binop(finfo, op, e, &e2, -1); /* encode binary op */
|
be_code_binop(finfo, op, e, &e2, -1); /* encode binary op */
|
||||||
op = get_binop(parser); /* is there a following binop? */
|
op = get_binop(parser); /* is there a following binop? */
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ check(45.e+2, 4500)
|
|||||||
|
|
||||||
test_source('x = 5; 0...x;', 'unexpected symbol near \'.\'')
|
test_source('x = 5; 0...x;', 'unexpected symbol near \'.\'')
|
||||||
test_source('x = 5; 0...x;', 'unexpected symbol near \'.\'')
|
test_source('x = 5; 0...x;', 'unexpected symbol near \'.\'')
|
||||||
test_source('45..', 'unexpected symbol near \'EOS\'')
|
# test_source('45..', 'unexpected symbol near \'EOS\'')
|
||||||
test_source('0xg', 'invalid hexadecimal number')
|
test_source('0xg', 'invalid hexadecimal number')
|
||||||
test_source('"\\x5g"', 'invalid hexadecimal number')
|
test_source('"\\x5g"', 'invalid hexadecimal number')
|
||||||
test_source('0x5g', 'malformed number')
|
test_source('0x5g', 'malformed number')
|
||||||
|
@ -34,3 +34,8 @@ assert(s.format("%i%%", 12) == "12%")
|
|||||||
assert(s.format("%i%%%i", 12, 13) == "12%13")
|
assert(s.format("%i%%%i", 12, 13) == "12%13")
|
||||||
assert(s.format("%s%%", "foo") == "foo%")
|
assert(s.format("%s%%", "foo") == "foo%")
|
||||||
assert(s.format("%.1f%%", 3.5) == "3.5%")
|
assert(s.format("%.1f%%", 3.5) == "3.5%")
|
||||||
|
|
||||||
|
s="azerty"
|
||||||
|
assert(s[1..2] == "ze")
|
||||||
|
assert(s[1..] == "zerty")
|
||||||
|
assert(s[1..-1] == "zerty")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user