Skip to content

Report illegal tokens in the Yul parser. #10625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

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.