mirror of
https://github.com/irmen/prog8.git
synced 2024-12-25 23:29:55 +00:00
parent
e14b854d7b
commit
b7279a3d9e
@ -440,5 +440,20 @@ main {
|
||||
forloop.body.statements[1] shouldBe instanceOf<Assignment>()
|
||||
forloop.body.statements[2] shouldBe instanceOf<Assignment>()
|
||||
}
|
||||
|
||||
test("'not in' operator parsing") {
|
||||
val src="""
|
||||
main {
|
||||
sub start() {
|
||||
str test = "test"
|
||||
ubyte insync
|
||||
if not insync
|
||||
insync++
|
||||
if insync not in test
|
||||
insync++
|
||||
}
|
||||
}"""
|
||||
compileText(VMTarget(), optimize=false, src, writeAssembly=false) shouldNotBe null
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -468,7 +468,7 @@ private fun ExpressionContext.toAst() : Expression {
|
||||
return scoped_identifier().toAst()
|
||||
|
||||
if(bop!=null)
|
||||
return BinaryExpression(left.toAst(), bop.text, right.toAst(), toPosition())
|
||||
return BinaryExpression(left.toAst(), bop.text.trim(), right.toAst(), toPosition())
|
||||
|
||||
if(prefix!=null)
|
||||
return PrefixExpression(prefix.text, expression(0).toAst(), toPosition())
|
||||
|
@ -219,7 +219,7 @@ class BinaryExpression(var left: Expression, var operator: String, var right: Ex
|
||||
"and", "or", "xor", "not" -> InferredTypes.knownFor(DataType.BOOL)
|
||||
"<", ">",
|
||||
"<=", ">=",
|
||||
"==", "!=", "in" -> InferredTypes.knownFor(DataType.BOOL)
|
||||
"==", "!=", "in", "not in" -> InferredTypes.knownFor(DataType.BOOL)
|
||||
"<<", ">>" -> leftDt
|
||||
else -> throw FatalAstException("resulting datatype check for invalid operator $operator")
|
||||
}
|
||||
|
@ -2,6 +2,9 @@
|
||||
TODO
|
||||
====
|
||||
|
||||
- fix the 'message' github compiler error (github)
|
||||
|
||||
|
||||
- verafx vram-vram copy routine?
|
||||
set the cache fill and cache write bits in fx ctrl, set one data port's increment to 1 and the other one to 4,
|
||||
Assuming your writes are aligned to 32-bit boundaries, do four reads from the increment-1 port
|
||||
@ -87,5 +90,6 @@ Other language/syntax features to think about
|
||||
|
||||
- add (rom/ram)bank support to romsub. A call will then automatically switch banks, use callfar and something else when in banked ram.
|
||||
challenges: how to not make this too X16 specific? How does the compiler know what bank to switch (ram/rom)?
|
||||
How to make it performant when we want to (i.e. NOT have it use callfar/auto bank switching) ?
|
||||
- chained comparisons `10<x<20` , `x==y==z` (desugars to `10<x and x<20`, `x==y and y==z`) BUT this changes the semantics of what it is right now ! (x==(y==z) --> x==true)
|
||||
- negative array index to refer to an element from the end of the array. Python `[-1]` or Raku syntax `[\*-1]` , `[\*/2]` .... \*=size of the array
|
||||
|
@ -178,7 +178,7 @@ expression :
|
||||
| left = expression EOL? bop = ('==' | '!=') EOL? right = expression
|
||||
| rangefrom = expression rto = ('to'|'downto') rangeto = expression ('step' rangestep = expression)? // can't create separate rule due to mutual left-recursion
|
||||
| left = expression EOL? bop = 'in' EOL? right = expression
|
||||
| left = expression EOL? bop = 'not in' EOL? right = expression
|
||||
| left = expression EOL? bop = ('not in ' | 'not in\t' | 'not in\n' | 'not in\r') EOL? right = expression
|
||||
| prefix = 'not' expression
|
||||
| left = expression EOL? bop = 'and' EOL? right = expression
|
||||
| left = expression EOL? bop = 'or' EOL? right = expression
|
||||
|
Loading…
Reference in New Issue
Block a user