Add Steve Johnson-style parser recovery rules:

SourceUnit = Error $
    Block = '{' Error '}'
    ContractDefinition = '{' Error '}'
    Statement = Error ';'

Co-Authored-By: chriseth <chris@ethereum.org>
This commit is contained in:
rocky
2019-05-28 15:06:34 +02:00
committed by chriseth
co-authored by chriseth
parent 2276b567b1
commit 97f8ee0d1b
27 changed files with 492 additions and 140 deletions
+5
View File
@@ -112,6 +112,7 @@ static string const g_strBinaryRuntime = "bin-runtime";
static string const g_strCombinedJson = "combined-json";
static string const g_strCompactJSON = "compact-format";
static string const g_strContracts = "contracts";
static string const g_strErrorRecovery = "error-recovery";
static string const g_strEVM = "evm";
static string const g_strEVM15 = "evm15";
static string const g_strEVMVersion = "evm-version";
@@ -163,6 +164,7 @@ static string const g_argBinary = g_strBinary;
static string const g_argBinaryRuntime = g_strBinaryRuntime;
static string const g_argCombinedJson = g_strCombinedJson;
static string const g_argCompactJSON = g_strCompactJSON;
static string const g_argErrorRecovery = g_strErrorRecovery;
static string const g_argGas = g_strGas;
static string const g_argHelp = g_strHelp;
static string const g_argInputFile = g_strInputFile;
@@ -689,6 +691,7 @@ Allowed options)",
(g_argColor.c_str(), "Force colored output.")
(g_argNoColor.c_str(), "Explicitly disable colored output, disabling terminal auto-detection.")
(g_argNewReporter.c_str(), "Enables new diagnostics reporter.")
(g_argErrorRecovery.c_str(), "Enables additional parser error recovery.")
(g_argIgnoreMissingFiles.c_str(), "Ignore missing files.");
po::options_description outputComponents("Output Components");
outputComponents.add_options()
@@ -923,6 +926,8 @@ bool CommandLineInterface::processInput()
m_compiler->setSources(m_sourceCodes);
if (m_args.count(g_argLibraries))
m_compiler->setLibraries(m_libraries);
if (m_args.count(g_argErrorRecovery))
m_compiler->setParserErrorRecovery(true);
m_compiler->setEVMVersion(m_evmVersion);
// TODO: Perhaps we should not compile unless requested