Merge pull request #10625 from ethereum/reportIllegalTokens

Report illegal tokens in the Yul parser.
This commit is contained in:
chriseth 2020-12-16 12:34:20 +01:00 committed by GitHub
commit e347545597
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 4 deletions

View File

@ -327,6 +327,9 @@ variant<Literal, Identifier> Parser::parseLiteralOrIdentifier()
case Token::HexStringLiteral:
fatalParserError(3772_error, "Hex literals are not valid in this context.");
break;
case Token::Illegal:
fatalParserError(1465_error, "Illegal token: " + to_string(m_scanner->currentError()));
break;
default:
fatalParserError(1856_error, "Literal or identifier expected.");
}

View File

@ -6,4 +6,4 @@ contract C {
}
}
// ----
// ParserError 1856: (72-73): Literal or identifier expected.
// ParserError 1465: (72-73): Illegal token: Octal numbers not allowed.

View File

@ -2,4 +2,4 @@
let x := 0100
}
// ----
// ParserError 1856: (15-16): Literal or identifier expected.
// ParserError 1465: (15-16): Illegal token: Octal numbers not allowed.

View File

@ -3,4 +3,4 @@
// underflow
}
// ----
// ParserError 1856: (19-32): Literal or identifier expected.
// ParserError 1465: (19-32): Illegal token: Unicode direction override underflow in comment or string literal.

View File

@ -3,4 +3,4 @@
let s := unicode"underflow ";
}
// ----
// ParserError 1856: (35-47): Literal or identifier expected.
// ParserError 1465: (35-47): Illegal token: Invalid character in string.