From 4aa310034cca09d1901d9606d6c33d92cce6f072 Mon Sep 17 00:00:00 2001 From: Matheus Aguiar Date: Sat, 25 Mar 2023 17:04:02 -0300 Subject: [PATCH] Added missing keyword unicode to Lexer --- docs/grammar/SolidityLexer.g4 | 1 + .../freeFunctions/invalid_function_named_unicode.sol | 4 ++++ .../syntaxTests/parsing/invalid_variable_named_unicode.sol | 6 ++++++ 3 files changed, 11 insertions(+) create mode 100644 test/libsolidity/syntaxTests/freeFunctions/invalid_function_named_unicode.sol create mode 100644 test/libsolidity/syntaxTests/parsing/invalid_variable_named_unicode.sol diff --git a/docs/grammar/SolidityLexer.g4 b/docs/grammar/SolidityLexer.g4 index 306afd92f..0452f9fa0 100644 --- a/docs/grammar/SolidityLexer.g4 +++ b/docs/grammar/SolidityLexer.g4 @@ -90,6 +90,7 @@ Try: 'try'; Type: 'type'; Ufixed: 'ufixed' | ('ufixed' [1-9][0-9]+ 'x' [1-9][0-9]+); Unchecked: 'unchecked'; +Unicode: 'unicode'; /** * Sized unsigned integer types. * uint is an alias of uint256. diff --git a/test/libsolidity/syntaxTests/freeFunctions/invalid_function_named_unicode.sol b/test/libsolidity/syntaxTests/freeFunctions/invalid_function_named_unicode.sol new file mode 100644 index 000000000..889d7df21 --- /dev/null +++ b/test/libsolidity/syntaxTests/freeFunctions/invalid_function_named_unicode.sol @@ -0,0 +1,4 @@ +function unicode() returns {} + +// ---- +// ParserError 2314: (9-16): Expected identifier but got 'ILLEGAL' diff --git a/test/libsolidity/syntaxTests/parsing/invalid_variable_named_unicode.sol b/test/libsolidity/syntaxTests/parsing/invalid_variable_named_unicode.sol new file mode 100644 index 000000000..0180ebf73 --- /dev/null +++ b/test/libsolidity/syntaxTests/parsing/invalid_variable_named_unicode.sol @@ -0,0 +1,6 @@ +contract C +{ + string unicode = "abc"; +} +// ---- +// ParserError 2314: (24-31): Expected identifier but got 'ILLEGAL'