mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-14 16:03:41 +00:00
cgo: implement prefix parsing
This implements expressions such as "-5" and "-5 - 2", in other words, negative numbers.
This commit is contained in:
committed by
Ron Evans
parent
70f8eeaca0
commit
711889bc3f
@@ -44,6 +44,10 @@ func TestParseConst(t *testing.T) {
|
||||
{`(1 - 2) * 3`, `(1 - 2) * 3`},
|
||||
{`1 * 2 - 3`, `1*2 - 3`},
|
||||
{`1 * (2 - 3)`, `1 * (2 - 3)`},
|
||||
// Unary operators.
|
||||
{`-5`, `-5`},
|
||||
{`-5-2`, `-5 - 2`},
|
||||
{`5 - - 2`, `5 - -2`},
|
||||
} {
|
||||
fset := token.NewFileSet()
|
||||
startPos := fset.AddFile("", -1, 1000).Pos(0)
|
||||
|
||||
Reference in New Issue
Block a user