Skip to content

Commit

Permalink
Merge pull request #10625 from ethereum/reportIllegalTokens
Browse files Browse the repository at this point in the history
Report illegal tokens in the Yul parser.
  • Loading branch information
chriseth authored Dec 16, 2020
2 parents cd7795f + 5c40fb0 commit e347545
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions libyul/AsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ contract C {
}
}
// ----
// ParserError 1856: (72-73): Literal or identifier expected.
// ParserError 1465: (72-73): Illegal token: Octal numbers not allowed.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit e347545

Please sign in to comment.