Skip to content

Commit

Permalink
Match Solidity identifier regex (#1657).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Jun 10, 2021
1 parent be20e28 commit a6e128f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/abi/src.ts/fragments.ts
Expand Up @@ -1029,7 +1029,8 @@ function verifyType(type: string): string {
return type;
}

const regexIdentifier = new RegExp("^[A-Za-z_][A-Za-z0-9_]*$");
// See: https://github.com/ethereum/solidity/blob/1f8f1a3db93a548d0555e3e14cfc55a10e25b60e/docs/grammar/SolidityLexer.g4#L234
const regexIdentifier = new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");
function verifyIdentifier(value: string): string {
if (!value || !value.match(regexIdentifier)) {
logger.throwArgumentError(`invalid identifier "${ value }"`, "value", value);
Expand Down

0 comments on commit a6e128f

Please sign in to comment.