solhint icon indicating copy to clipboard operation
solhint copied to clipboard

Upgrade parser

Open fvictorio opened this issue 3 years ago • 4 comments

fvictorio avatar Feb 10 '22 12:02 fvictorio

@fvictorio do you think this will resolve this error I'm getting on a block of assembly?

Linter: Parse error: extraneous input ',' expecting {'from', '{', '}', '(', 'error', 'for', 'function', 'address', 'calldata', 'if', 'assembly', 'return', 'revert', 'byte', 'let', '=:', 'switch', 'callback', DecimalNumber, HexNumber, HexLiteralFragment, 'break', 'continue', 'leave', 'payable', 'constructor', 'receive', Identifier, StringLiteralFragment} [undefined]

Code:

let p := j
let word := mload(add(dataPtr, p))
let h, l := byteToHex(word, hexCharsPtr)

The error happens on the 3rd line, but the contract compiles as expected.

potomak avatar Feb 20 '22 20:02 potomak

@potomak can you give me a full (compilable) example that includes an assembly block with a let a, b := ... assignment?

fvictorio avatar Feb 21 '22 13:02 fvictorio

Example:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;

contract Test {
    function foo() public pure {
        assembly {
            function bar() -> a, b {
                a := 1
                b := 2
            }

            let i, j := bar()
        }
    }
}

potomak avatar Feb 21 '22 14:02 potomak

Thank you. The parser doesn't support that syntax yet, so upgrading won't fix your problem. I created an issue in the parser's repo about this.

fvictorio avatar Feb 21 '22 21:02 fvictorio