aboutsummaryrefslogtreecommitdiffstats
path: root/liblll/Parser.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2016-10-19 16:26:21 +0800
committerGitHub <noreply@github.com>2016-10-19 16:26:21 +0800
commit0fd6f2b5a6f5b3a977f4cabbe32582684a91bb2f (patch)
tree978a3240edc68fd45da3b68c7f9dcb44715ac609 /liblll/Parser.cpp
parent0a9eb64562d8366f47913ecfd762144ed203fa73 (diff)
parent27fca416ba6be6f1b78793e1202bcd3b2954b4a2 (diff)
downloaddexon-solidity-0fd6f2b5a6f5b3a977f4cabbe32582684a91bb2f.tar.gz
dexon-solidity-0fd6f2b5a6f5b3a977f4cabbe32582684a91bb2f.tar.zst
dexon-solidity-0fd6f2b5a6f5b3a977f4cabbe32582684a91bb2f.zip
Merge pull request #1228 from ethereum/lll-units-parser
LLL: move broken parsing of Ethereum subunits to macros
Diffstat (limited to 'liblll/Parser.cpp')
-rw-r--r--liblll/Parser.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/liblll/Parser.cpp b/liblll/Parser.cpp
index daced13c..2754e9f5 100644
--- a/liblll/Parser.cpp
+++ b/liblll/Parser.cpp
@@ -96,19 +96,13 @@ void dev::eth::parseTreeLLL(string const& _s, sp::utree& o_out)
using symbol_type = sp::basic_string<std::string, sp::utree_type::symbol_type>;
using it = string::const_iterator;
- static const u256 ether = u256(1000000000) * 1000000000;
- static const u256 finney = u256(1000000000) * 1000000;
- static const u256 szabo = u256(1000000000) * 1000;
-
qi::rule<it, space_type, sp::utree()> element;
qi::rule<it, string()> str = '"' > qi::lexeme[+(~qi::char_(std::string("\"") + '\0'))] > '"';
qi::rule<it, string()> strsh = '\'' > qi::lexeme[+(~qi::char_(std::string(" ;$@()[]{}:\n\t") + '\0'))];
qi::rule<it, symbol_type()> symbol = qi::lexeme[+(~qi::char_(std::string(" $@[]{}:();\"\x01-\x1f\x7f") + '\0'))];
qi::rule<it, string()> intstr = qi::lexeme[ qi::no_case["0x"][qi::_val = "0x"] >> *qi::char_("0-9a-fA-F")[qi::_val += qi::_1]] | qi::lexeme[+qi::char_("0-9")[qi::_val += qi::_1]];
qi::rule<it, bigint()> integer = intstr;
- qi::rule<it, bigint()> multiplier = qi::lit("wei")[qi::_val = 1] | qi::lit("szabo")[qi::_val = szabo] | qi::lit("finney")[qi::_val = finney] | qi::lit("ether")[qi::_val = ether];
- qi::rule<it, space_type, bigint()> quantity = integer[qi::_val = qi::_1] >> -multiplier[qi::_val *= qi::_1];
- qi::rule<it, space_type, sp::utree()> atom = quantity[qi::_val = px::construct<sp::any_ptr>(px::new_<bigint>(qi::_1))] | (str | strsh)[qi::_val = qi::_1] | symbol[qi::_val = qi::_1];
+ qi::rule<it, space_type, sp::utree()> atom = integer[qi::_val = px::construct<sp::any_ptr>(px::new_<bigint>(qi::_1))] | (str | strsh)[qi::_val = qi::_1] | symbol[qi::_val = qi::_1];
qi::rule<it, space_type, sp::utree::list_type()> seq = '{' > *element > '}';
qi::rule<it, space_type, sp::utree::list_type()> mload = '@' > element;
qi::rule<it, space_type, sp::utree::list_type()> sload = qi::lit("@@") > element;