From 3a91da27edbf3a3f660e6133c16e1fdfa00fc026 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Sat, 15 Oct 2016 14:47:58 +0100 Subject: LLL: remove Ethereum subunits from the parser --- liblll/Parser.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'liblll') diff --git a/liblll/Parser.cpp b/liblll/Parser.cpp index aa4a4de2..7a5fd7fc 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; 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 element; qi::rule str = '"' > qi::lexeme[+(~qi::char_(std::string("\"") + '\0'))] > '"'; qi::rule strsh = '\'' > qi::lexeme[+(~qi::char_(std::string(" ;$@()[]{}:\n\t") + '\0'))]; qi::rule symbol = qi::lexeme[+(~qi::char_(std::string(" $@[]{}:();\"\x01-\x1f\x7f") + '\0'))]; qi::rule 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 integer = intstr; - qi::rule 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 quantity = integer[qi::_val = qi::_1] >> -multiplier[qi::_val *= qi::_1]; - qi::rule atom = quantity[qi::_val = px::construct(px::new_(qi::_1))] | (str | strsh)[qi::_val = qi::_1] | symbol[qi::_val = qi::_1]; + qi::rule atom = integer[qi::_val = px::construct(px::new_(qi::_1))] | (str | strsh)[qi::_val = qi::_1] | symbol[qi::_val = qi::_1]; qi::rule seq = '{' > *element > '}'; qi::rule mload = '@' > element; qi::rule sload = qi::lit("@@") > element; -- cgit From 27fca416ba6be6f1b78793e1202bcd3b2954b4a2 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Sat, 15 Oct 2016 14:48:10 +0100 Subject: LLL: add Ethereum subunit macros --- liblll/CompilerState.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'liblll') diff --git a/liblll/CompilerState.cpp b/liblll/CompilerState.cpp index 1d83192c..91c2452d 100644 --- a/liblll/CompilerState.cpp +++ b/liblll/CompilerState.cpp @@ -69,6 +69,10 @@ void CompilerState::populateStandard() "(def 'ripemd160 (data datasize) (msg allgas 3 0 data datasize))" "(def 'sha256 (val) { [0]:val (sha256 0 32) })" "(def 'ripemd160 (val) { [0]:val (ripemd160 0 32) })" + "(def 'wei 1)" + "(def 'szabo 1000000000000)" + "(def 'finney 1000000000000000)" + "(def 'ether 1000000000000000000)" "}"; CodeFragment::compile(s, *this); } -- cgit