aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/types.rst8
-rw-r--r--liblll/CodeFragment.cpp18
-rw-r--r--liblll/Parser.cpp4
-rw-r--r--libsolidity/parsing/Scanner.cpp7
-rw-r--r--solc/CommandLineInterface.cpp2
-rw-r--r--test/liblll/Parser.cpp4
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp12
-rw-r--r--test/libsolidity/SolidityNatspecJSON.cpp2
-rw-r--r--test/libsolidity/SolidityParser.cpp13
9 files changed, 52 insertions, 18 deletions
diff --git a/docs/types.rst b/docs/types.rst
index 0436fc70..896910ff 100644
--- a/docs/types.rst
+++ b/docs/types.rst
@@ -169,6 +169,14 @@ Fixed Point Numbers
Rational and Integer Literals
-----------------------------
+Integer literals are formed from a sequence of numbers in the range 0-9.
+They are interpreted as decimals. For example, ``69`` means sixty nine.
+Octal literals do not exist in Solidity and leading zeros are ignored.
+For example, ``0100`` means one hundred.
+
+Decimal literals are formed by a ``.`` with at least one number on
+one side. Examples include ``1.``, ``.1`` and ``1.3``.
+
Number literal expressions retain arbitrary precision until they are converted to a non-literal type (i.e. by
using them together with a non-literal expression).
This means that computations do not overflow and divisions do not truncate
diff --git a/liblll/CodeFragment.cpp b/liblll/CodeFragment.cpp
index 35ad4e59..af7d7f0a 100644
--- a/liblll/CodeFragment.cpp
+++ b/liblll/CodeFragment.cpp
@@ -91,15 +91,11 @@ CodeFragment::CodeFragment(sp::utree const& _t, CompilerState& _s, bool _allowAS
{
auto it = _s.vars.find(s);
if (it == _s.vars.end())
- {
- bool ok;
- tie(it, ok) = _s.vars.insert(make_pair(s, make_pair(_s.stackSize, 32)));
- _s.stackSize += 32;
- }
+ error<InvalidName>(std::string("Symbol not found: ") + s);
m_asm.append((u256)it->second.first);
}
else
- error<BareSymbol>();
+ error<BareSymbol>(s);
break;
}
@@ -111,7 +107,9 @@ CodeFragment::CodeFragment(sp::utree const& _t, CompilerState& _s, bool _allowAS
m_asm.append((u256)i);
break;
}
- default: break;
+ default:
+ error<CompilerException>("Unexpected fragment type");
+ break;
}
}
@@ -177,11 +175,7 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
{
auto it = _s.vars.find(n);
if (it == _s.vars.end())
- {
- bool ok;
- tie(it, ok) = _s.vars.insert(make_pair(n, make_pair(_s.stackSize, 32)));
- _s.stackSize += 32;
- }
+ error<InvalidName>(std::string("Symbol not found: ") + s);
return it->second.first;
};
diff --git a/liblll/Parser.cpp b/liblll/Parser.cpp
index 219d4f54..ad5e1885 100644
--- a/liblll/Parser.cpp
+++ b/liblll/Parser.cpp
@@ -100,7 +100,7 @@ void dev::eth::parseTreeLLL(string const& _s, sp::utree& o_out)
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, 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, sp::utree()> integer = intstr[qi::_val = px::construct<sp::any_ptr>(px::new_<bigint>(qi::_1))];
qi::rule<it, space_type, sp::utree()> atom = integer[qi::_val = qi::_1] | (str | strsh)[qi::_val = qi::_1] | symbol[qi::_val = qi::_1];
qi::rule<it, space_type, sp::utree::list_type()> seq = '{' > *element > '}';
@@ -109,7 +109,7 @@ void dev::eth::parseTreeLLL(string const& _s, sp::utree& o_out)
qi::rule<it, space_type, sp::utree::list_type()> mstore = '[' > element > ']' > -qi::lit(":") > element;
qi::rule<it, space_type, sp::utree::list_type()> sstore = qi::lit("[[") > element > qi::lit("]]") > -qi::lit(":") > element;
qi::rule<it, space_type, sp::utree::list_type()> calldataload = qi::lit("$") > element;
- qi::rule<it, space_type, sp::utree::list_type()> list = '(' > *element > ')';
+ qi::rule<it, space_type, sp::utree::list_type()> list = '(' > +element > ')';
qi::rule<it, space_type, sp::utree()> extra = sload[tagNode<2>()] | mload[tagNode<1>()] | sstore[tagNode<4>()] | mstore[tagNode<3>()] | seq[tagNode<5>()] | calldataload[tagNode<6>()];
element = atom | list | extra;
diff --git a/libsolidity/parsing/Scanner.cpp b/libsolidity/parsing/Scanner.cpp
index 6115101e..3623f23f 100644
--- a/libsolidity/parsing/Scanner.cpp
+++ b/libsolidity/parsing/Scanner.cpp
@@ -327,7 +327,12 @@ Token::Value Scanner::scanMultiLineDocComment()
if (isLineTerminator(m_char))
{
skipWhitespace();
- if (!m_source.isPastEndOfInput(1) && m_source.get(0) == '*' && m_source.get(1) != '/')
+ if (!m_source.isPastEndOfInput(1) && m_source.get(0) == '*' && m_source.get(1) == '*')
+ { // it is unknown if this leads to the end of the comment
+ addCommentLiteralChar('*');
+ advance();
+ }
+ else if (!m_source.isPastEndOfInput(1) && m_source.get(0) == '*' && m_source.get(1) != '/')
{ // skip first '*' in subsequent lines
if (charsAdded)
addCommentLiteralChar('\n');
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index c677cf1f..49fac51c 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -327,7 +327,7 @@ void CommandLineInterface::readInputFilesAndConfigureRemappings()
auto infile = boost::filesystem::path(path);
if (!boost::filesystem::exists(infile))
{
- cerr << "Skipping non existant input file \"" << infile << "\"" << endl;
+ cerr << "Skipping non-existent input file \"" << infile << "\"" << endl;
continue;
}
diff --git a/test/liblll/Parser.cpp b/test/liblll/Parser.cpp
index fc91f3c5..0d5d9ea5 100644
--- a/test/liblll/Parser.cpp
+++ b/test/liblll/Parser.cpp
@@ -87,6 +87,8 @@ BOOST_AUTO_TEST_CASE(hexadecimals)
char const* text = "0x1234";
BOOST_CHECK(successParse(text));
BOOST_CHECK_EQUAL(parse(text), R"(4660)");
+
+ BOOST_CHECK(!successParse("0x"));
}
BOOST_AUTO_TEST_CASE(sequence)
@@ -169,7 +171,7 @@ BOOST_AUTO_TEST_CASE(list)
BOOST_CHECK_EQUAL(parse(text), R"(( 1234 ))");
BOOST_CHECK(successParse("( 1234 5467 )"));
- BOOST_CHECK(successParse("()"));
+ BOOST_CHECK(!successParse("()"));
}
BOOST_AUTO_TEST_SUITE_END()
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index c5f79758..47b96dc2 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -8503,6 +8503,18 @@ BOOST_AUTO_TEST_CASE(inline_assembly_invalidjumplabel)
BOOST_CHECK(callContractFunction("f()") == encodeArgs());
}
+BOOST_AUTO_TEST_CASE(contracts_separated_with_comment)
+{
+ char const* sourceCode = R"(
+ contract C1 {}
+ /**
+ **/
+ contract C2 {}
+ )";
+ compileAndRun(sourceCode, 0, "C1");
+ compileAndRun(sourceCode, 0, "C2");
+}
+
BOOST_AUTO_TEST_SUITE_END()
}
diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp
index ef69e85c..85bc2277 100644
--- a/test/libsolidity/SolidityNatspecJSON.cpp
+++ b/test/libsolidity/SolidityNatspecJSON.cpp
@@ -560,7 +560,7 @@ BOOST_AUTO_TEST_CASE(dev_title_at_function_error)
expectNatspecError(sourceCode);
}
-BOOST_AUTO_TEST_CASE(dev_documenting_nonexistant_param)
+BOOST_AUTO_TEST_CASE(dev_documenting_nonexistent_param)
{
char const* sourceCode = "contract test {\n"
" /// @dev Multiplies a number by 7 and adds second parameter\n"
diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp
index d260f4b1..5e3c69d2 100644
--- a/test/libsolidity/SolidityParser.cpp
+++ b/test/libsolidity/SolidityParser.cpp
@@ -1054,6 +1054,19 @@ BOOST_AUTO_TEST_CASE(empty_comment)
BOOST_CHECK(successParse(text));
}
+BOOST_AUTO_TEST_CASE(comment_end_with_double_star)
+{
+ char const* text = R"(
+ contract C1 {
+ /**
+ **/
+ }
+ contract C2 {}
+ )";
+ BOOST_CHECK(successParse(text));
+}
+
+
BOOST_AUTO_TEST_CASE(library_simple)
{
char const* text = R"(