ParserError: Expected identifier but got '&'

While verifying Etherscan Contract with pragma solidity ^0.8.0;

CODE

function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

ERROR

ParserError: Expected identifier but got '&'
 --> myc:1:8:
  |
1 | DEPLOY & RUN TRANSACTIONS
  |        ^

Thanks

Hey, welcome to the OZ forums :slight_smile:

Can you posed more of the file in question? It is possible that you used "&" in your string "DEPLOY & RUN TRANSACTIONS" and the compiler thinks it is part of the code due to some reason.

1 Like

This was answered in the GitHub issue: