aboutsummaryrefslogtreecommitdiffstats
path: root/Parser.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2015-02-06 20:38:10 +0800
committerChristian <c@ethdev.com>2015-02-06 20:38:29 +0800
commit82edc1ca6d694ad022c6b0e251da70393dfeb38a (patch)
tree862dc4a01f217ae4a71feb90f64cd901bda2b32a /Parser.cpp
parent16fc2d651e1a96e3f86d98a8b3fb1fa43c9b20c1 (diff)
downloaddexon-solidity-82edc1ca6d694ad022c6b0e251da70393dfeb38a.tar
dexon-solidity-82edc1ca6d694ad022c6b0e251da70393dfeb38a.tar.gz
dexon-solidity-82edc1ca6d694ad022c6b0e251da70393dfeb38a.tar.bz2
dexon-solidity-82edc1ca6d694ad022c6b0e251da70393dfeb38a.tar.lz
dexon-solidity-82edc1ca6d694ad022c6b0e251da70393dfeb38a.tar.xz
dexon-solidity-82edc1ca6d694ad022c6b0e251da70393dfeb38a.tar.zst
dexon-solidity-82edc1ca6d694ad022c6b0e251da70393dfeb38a.zip
Some fixes for the ether units parser.
Diffstat (limited to 'Parser.cpp')
-rw-r--r--Parser.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/Parser.cpp b/Parser.cpp
index 741b9aba..d8c15c36 100644
--- a/Parser.cpp
+++ b/Parser.cpp
@@ -684,7 +684,6 @@ ASTPointer<Expression> Parser::parsePrimaryExpression()
ASTNodeFactory nodeFactory(*this);
Token::Value token = m_scanner->getCurrentToken();
ASTPointer<Expression> expression;
- Token::Value nextToken = Token::ILLEGAL;
switch (token)
{
case Token::TRUE_LITERAL:
@@ -692,12 +691,19 @@ ASTPointer<Expression> Parser::parsePrimaryExpression()
expression = nodeFactory.createNode<Literal>(token, getLiteralAndAdvance());
break;
case Token::NUMBER:
- nextToken = m_scanner->peekNextToken();
+ if (Token::isEtherSubdenomination(m_scanner->peekNextToken()))
+ {
+ ASTPointer<ASTString> literal = getLiteralAndAdvance();
+ nodeFactory.markEndPosition();
+ Literal::SubDenomination subdenomination = static_cast<Literal::SubDenomination>(m_scanner->getCurrentToken());
+ m_scanner->next();
+ expression = nodeFactory.createNode<Literal>(token, literal, subdenomination);
+ break;
+ }
+ // fall-through
case Token::STRING_LITERAL:
nodeFactory.markEndPosition();
- expression = nodeFactory.createNode<Literal>(token, getLiteralAndAdvance(), nextToken);
- if (Token::isEtherSubdenomination(nextToken))
- m_scanner->next();
+ expression = nodeFactory.createNode<Literal>(token, getLiteralAndAdvance());
break;
case Token::IDENTIFIER:
nodeFactory.markEndPosition();