Skip to content

Commit 5c3cc90

Browse files
committed
Report illegal tokens in the Yul parser.
1 parent 1729385 commit 5c3cc90

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

libyul/AsmParser.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,9 @@ variant<Literal, Identifier> Parser::parseLiteralOrIdentifier()
327327
case Token::HexStringLiteral:
328328
fatalParserError(3772_error, "Hex literals are not valid in this context.");
329329
break;
330+
case Token::Illegal:
331+
fatalParserError(1465_error, "Illegal token: " + to_string(m_scanner->currentError()));
332+
break;
330333
default:
331334
fatalParserError(1856_error, "Literal or identifier expected.");
332335
}

test/libsolidity/syntaxTests/inlineAssembly/invalid/invalid_number.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ contract C {
66
}
77
}
88
// ----
9-
// ParserError 1856: (72-73): Literal or identifier expected.
9+
// ParserError 1465: (72-73): Illegal token: Octal numbers not allowed.

test/libyul/yulSyntaxTests/invalid/unicode_comment_direction_override.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
// underflow ‬
44
}
55
// ----
6-
// ParserError 1856: (19-32): Literal or identifier expected.
6+
// ParserError 1465: (19-32): Unicode direction override underflow in comment or string literal.

test/libyul/yulSyntaxTests/invalid/unicode_string_direction_override.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
let s := unicode"underflow ‬";
44
}
55
// ----
6-
// ParserError 1856: (35-47): Literal or identifier expected.
6+
// ParserError 1465: (35-47): Invalid character in string.

0 commit comments

Comments
 (0)