diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-04-28 21:33:52 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-06-16 17:56:21 +0800 |
commit | 47925bc14e80d0c33c491dabc3c3dd3ea787b63c (patch) | |
tree | 10f0dc08bf0a78a02a921d7fa69449c94d6676a3 /libsolidity/inlineasm/AsmParser.cpp | |
parent | 54e97d1c34d7c291673e695a991db8df627c503e (diff) | |
download | dexon-solidity-47925bc14e80d0c33c491dabc3c3dd3ea787b63c.tar.gz dexon-solidity-47925bc14e80d0c33c491dabc3c3dd3ea787b63c.tar.zst dexon-solidity-47925bc14e80d0c33c491dabc3c3dd3ea787b63c.zip |
Parse for statement in assembly parser / printer
Diffstat (limited to 'libsolidity/inlineasm/AsmParser.cpp')
-rw-r--r-- | libsolidity/inlineasm/AsmParser.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libsolidity/inlineasm/AsmParser.cpp b/libsolidity/inlineasm/AsmParser.cpp index f9b073ba..d282a30d 100644 --- a/libsolidity/inlineasm/AsmParser.cpp +++ b/libsolidity/inlineasm/AsmParser.cpp @@ -87,6 +87,8 @@ assembly::Statement Parser::parseStatement() _switch.location.end = _switch.cases.back().body.location.end; return _switch; } + case Token::For: + return parseForLoop(); case Token::Assign: { if (m_julia) @@ -171,6 +173,20 @@ assembly::Case Parser::parseCase() return _case; } +assembly::ForLoop Parser::parseForLoop() +{ + ForLoop forLoop = createWithLocation<ForLoop>(); + expectToken(Token::For); + forLoop.pre = parseBlock(); + forLoop.condition = make_shared<Statement>(parseExpression()); + if (forLoop.condition->type() == typeid(assembly::Instruction)) + fatalParserError("Instructions are not supported as conditions for the for statement."); + forLoop.post = parseBlock(); + forLoop.body = parseBlock(); + forLoop.location.end = forLoop.body.location.end; + return forLoop; +} + assembly::Statement Parser::parseExpression() { Statement operation = parseElementaryOperation(true); |