From f6195c0a462747551ee22aa03ad6c4ad1a9c51bf Mon Sep 17 00:00:00 2001 From: Nicolai Date: Mon, 10 Oct 2016 19:42:42 +0200 Subject: Add HexLiteral to grammar, fixes #1186 --- libsolidity/grammar.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libsolidity') diff --git a/libsolidity/grammar.txt b/libsolidity/grammar.txt index 6d92fc59..eb5bc040 100644 --- a/libsolidity/grammar.txt +++ b/libsolidity/grammar.txt @@ -73,7 +73,7 @@ Expression = | Expression? (',' Expression) | PrimaryExpression -PrimaryExpression = Identifier | BooleanLiteral | NumberLiteral | StringLiteral +PrimaryExpression = Identifier | BooleanLiteral | NumberLiteral | HexLiteral | StringLiteral FunctionCall = Identifier '(' Expression? ( ',' Expression )* ')' NewExpression = 'new' Identifier @@ -84,8 +84,8 @@ BooleanLiteral = 'true' | 'false' NumberLiteral = '0x'? [0-9]+ (' ' NumberUnit)? NumberUnit = 'wei' | 'szabo' | 'finney' | 'ether' | 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'years' +HexLiteral = 'hex' ('"' [0-9a-fA-F]{8} '"' | '\'' [0-9a-fA-F]{8} '\'') StringLiteral = '"' ([^"\r\n\\] | '\\' .)* '"' - Identifier = [a-zA-Z_] [a-zA-Z_0-9]* ElementaryTypeName = 'address' | 'bool' | 'string' | 'var' -- cgit From e923a5e190dc26ef2ea062f8d760b5de78d33350 Mon Sep 17 00:00:00 2001 From: Nicolai Date: Mon, 10 Oct 2016 23:08:44 +0200 Subject: Fix: HexLiteral must be even number of nibbles solc even allow 0 nibbles: bytes a = hex""; --- libsolidity/grammar.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libsolidity') diff --git a/libsolidity/grammar.txt b/libsolidity/grammar.txt index eb5bc040..83ba2bd7 100644 --- a/libsolidity/grammar.txt +++ b/libsolidity/grammar.txt @@ -84,7 +84,7 @@ BooleanLiteral = 'true' | 'false' NumberLiteral = '0x'? [0-9]+ (' ' NumberUnit)? NumberUnit = 'wei' | 'szabo' | 'finney' | 'ether' | 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'years' -HexLiteral = 'hex' ('"' [0-9a-fA-F]{8} '"' | '\'' [0-9a-fA-F]{8} '\'') +HexLiteral = 'hex' ('"' ([0-9a-fA-F]{2})* '"' | '\'' ([0-9a-fA-F]{2})* '\'') StringLiteral = '"' ([^"\r\n\\] | '\\' .)* '"' Identifier = [a-zA-Z_] [a-zA-Z_0-9]* -- cgit