summaryrefslogtreecommitdiff
path: root/src/parsers
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-06-13 22:49:13 +0300
committerAndrei Karas <akaras@inbox.ru>2015-06-13 22:49:13 +0300
commit49a697cb7d536f09bc3c8791eb6f1808e6e0a8d6 (patch)
treed1e3886dfb1ebeeb0aa19e1f8055c7da5883b866 /src/parsers
parent0f84327ef128f4990651d8385117a05e887ce29f (diff)
downloadparanucker-49a697cb7d536f09bc3c8791eb6f1808e6e0a8d6.tar.gz
paranucker-49a697cb7d536f09bc3c8791eb6f1808e6e0a8d6.tar.bz2
paranucker-49a697cb7d536f09bc3c8791eb6f1808e6e0a8d6.tar.xz
paranucker-49a697cb7d536f09bc3c8791eb6f1808e6e0a8d6.zip
Add parsing ENUMERAL_TYPE.
Diffstat (limited to 'src/parsers')
-rw-r--r--src/parsers/type/enumeral_type.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/parsers/type/enumeral_type.cpp b/src/parsers/type/enumeral_type.cpp
new file mode 100644
index 0000000..b609fa9
--- /dev/null
+++ b/src/parsers/type/enumeral_type.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2015 Andrei Karas
+ *
+ * This file is part of AstDumper.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "includes/parserincludes.h"
+
+parserDefine(EnumeralType);
+
+#include "parsers/base/type.h"
+
+#include "nodes/type/enumeral_type.h"
+
+namespace Generic
+{
+
+void parseEnumeralTypeNode(EnumeralTypeNode *node)
+{
+ fillType(node);
+ Log::dump(node);
+
+ setPrintField(node, TYPE_PRECISION, precisionBits);
+ node->isUnsigned = TYPE_UNSIGNED(node->gccNode);
+ if (node->isUnsigned)
+ Log::dumpRaw(node, "- unsigned");
+ else
+ Log::dumpRaw(node, "- signed");
+
+ fillTypeName(node);
+ fillTypeAttributes(node);
+
+ node->minValue = static_cast<IntegerCstNode*>(createParseNode(
+ node,
+ TYPE_MIN_VALUE(node->gccNode),
+ INTEGER_CST,
+ "min value"));
+ node->maxValue = static_cast<IntegerCstNode*>(createParseNode(
+ node,
+ TYPE_MAX_VALUE(node->gccNode),
+ INTEGER_CST,
+ "max value"));
+ node->values = static_cast<TreeListNode*>(createParseNode(
+ node,
+ TYPE_VALUES(node->gccNode),
+ TREE_LIST,
+ "values"));
+}
+
+}