aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/inlineasm/AsmParser.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2017-02-02 04:40:50 +0800
committerchriseth <c@ethdev.com>2017-03-03 22:41:01 +0800
commit98e343b3fc11f3e94297b016c3f625e3b319b09b (patch)
treec5ff0283866f2aed81ffafb2cdfc0c58fd9dc828 /libsolidity/inlineasm/AsmParser.cpp
parentfd62adebf3e594298c171e43e78153dbefc42759 (diff)
downloaddexon-solidity-98e343b3fc11f3e94297b016c3f625e3b319b09b.tar
dexon-solidity-98e343b3fc11f3e94297b016c3f625e3b319b09b.tar.gz
dexon-solidity-98e343b3fc11f3e94297b016c3f625e3b319b09b.tar.bz2
dexon-solidity-98e343b3fc11f3e94297b016c3f625e3b319b09b.tar.lz
dexon-solidity-98e343b3fc11f3e94297b016c3f625e3b319b09b.tar.xz
dexon-solidity-98e343b3fc11f3e94297b016c3f625e3b319b09b.tar.zst
dexon-solidity-98e343b3fc11f3e94297b016c3f625e3b319b09b.zip
Parsing of labels with stack info.
Diffstat (limited to 'libsolidity/inlineasm/AsmParser.cpp')
-rw-r--r--libsolidity/inlineasm/AsmParser.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/libsolidity/inlineasm/AsmParser.cpp b/libsolidity/inlineasm/AsmParser.cpp
index 0fc0a34f..5d439b2f 100644
--- a/libsolidity/inlineasm/AsmParser.cpp
+++ b/libsolidity/inlineasm/AsmParser.cpp
@@ -121,6 +121,38 @@ assembly::Statement Parser::parseStatement()
return label;
}
}
+ case Token::LBrack:
+ {
+ if (statement.type() != typeid(assembly::Identifier))
+ fatalParserError("Label name must precede \"[\".");
+ assembly::Identifier const& identifier = boost::get<assembly::Identifier>(statement);
+ Label label = createWithLocation<Label>(identifier.location);
+ label.name = identifier.name;
+ m_scanner->next();
+ if (m_scanner->currentToken() == Token::Number)
+ {
+ label.stackInfo.push_back(m_scanner->currentLiteral());
+ m_scanner->next();
+ }
+ else if (m_scanner->currentToken() == Token::Sub)
+ {
+ m_scanner->next();
+ label.stackInfo.push_back("-" + m_scanner->currentLiteral());
+ expectToken(Token::Number);
+ }
+ else
+ while (true)
+ {
+ label.stackInfo.push_back(expectAsmIdentifier());
+ if (m_scanner->currentToken() == Token::RBrack)
+ break;
+ expectToken(Token::Comma);
+ }
+ expectToken(Token::RBrack);
+ label.location.end = endPosition();
+ expectToken(Token::Colon);
+ return label;
+ }
default:
break;
}