dump: add isUnsigned/isSigned

This commit is contained in:
Daniel Marjamäki 2016-12-09 22:31:47 +01:00
parent 6f2480fb4d
commit 2ca85a1c40
2 changed files with 14 additions and 2 deletions

View File

@ -66,6 +66,8 @@ class Token:
isAssignmentOp Is this token a assignment operator
isComparisonOp Is this token a comparison operator
isLogicalOp Is this token a logical operator: && ||
isUnsigned Is this token a unsigned type
isSigned Is this token a signed type
varId varId for token, each variable has a unique non-zero id
variable Variable information for this token. See the Variable class.
function If this token points at a function call, this attribute has the Function
@ -110,6 +112,8 @@ class Token:
isAssignmentOp = False
isComparisonOp = False
isLogicalOp = False
isUnsigned = False
isSigned = False
varId = None
variableId = None
variable = None
@ -141,6 +145,10 @@ class Token:
type = element.get('type')
if type == 'name':
self.isName = True
if element.get('isUnsigned'):
self.isUnsigned = True
if element.get('isSigned'):
self.isSigned = True
elif type == 'number':
self.isNumber = True
if element.get('isInt'):

View File

@ -3850,9 +3850,13 @@ void Tokenizer::dump(std::ostream &out) const
out << " <token id=\"" << tok << "\" file=\"" << ErrorLogger::toxml(list.file(tok)) << "\" linenr=\"" << tok->linenr() << '\"';
out << " str=\"" << ErrorLogger::toxml(tok->str()) << '\"';
out << " scope=\"" << tok->scope() << '\"';
if (tok->isName())
if (tok->isName()) {
out << " type=\"name\"";
else if (tok->isNumber()) {
if (tok->isUnsigned())
out << " isUnsigned=\"true\"";
else if (tok->isSigned())
out << " isSigned=\"true\"";
} else if (tok->isNumber()) {
out << " type=\"number\"";
if (MathLib::isInt(tok->str()))
out << " isInt=\"True\"";