Add extra token for assembly assignment

Adding an extra token for := prevents whitespace between : = being valid
This commit is contained in:
Mathias Baumann
2019-02-21 13:58:21 +01:00
parent 5bf8af8004
commit f395d5bab4
13 changed files with 152 additions and 54 deletions
@@ -0,0 +1,10 @@
contract C {
function f() public pure {
assembly {
let mod := 2
}
}
}
// ----
// ParserError: (67-70): Cannot use instruction names for identifier names.
// ParserError: (71-73): Expected ';' but got ':='
@@ -7,5 +7,5 @@ contract C {
}
}
// ----
// ParserError: (87-88): Literal, identifier or instruction expected.
// ParserError: (87-88): Expected primary expression.
// ParserError: (87-89): Literal, identifier or instruction expected.
// ParserError: (87-89): Expected primary expression.
@@ -0,0 +1,11 @@
contract C {
function f() public pure {
assembly {
function g() -> a,b, c {}
let a, sub, mov := g()
}
}
}
// ----
// ParserError: (102-105): Cannot use instruction names for identifier names.
// ParserError: (105-106): Expected ';' but got ','
@@ -0,0 +1,10 @@
contract C {
function f() public pure {
assembly {
return := 1
}
}
}
// ----
// ParserError: (70-72): Variable name must precede ":=" in assignment.
// ParserError: (70-72): Expected primary expression.
@@ -0,0 +1,10 @@
contract C {
function f() public pure {
assembly {
return : 1
}
}
}
// ----
// ParserError: (70-71): Label name must precede ":".
// ParserError: (70-71): Expected primary expression.
@@ -0,0 +1,10 @@
contract C {
function f() public pure {
assembly {
let x : = mload(0)
}
}
}
// ----
// ParserError: (69-70): Literal, identifier or instruction expected.
// ParserError: (69-70): Expected primary expression.
@@ -0,0 +1,11 @@
contract C {
function f() public pure {
assembly {
function g() -> a,b, c {}
let x, y ,z : = g()
}
}
}
// ----
// ParserError: (107-108): Literal, identifier or instruction expected.
// ParserError: (107-108): Expected primary expression.