parser.h now including parser.tab.hh (should only ever have to include parser/parser.h now); added PrimitiveTypeNode.cc with translation from primitive type to C type string
git-svn-id: svn://anubis/jtlc/trunk@18 f5bc74b8-7b62-4e90-9214-7121d538519f
This commit is contained in:
parent
d44b77d240
commit
bf1baf16e6
@ -78,6 +78,7 @@ class PrimitiveTypeNode : public Node
|
||||
{
|
||||
public:
|
||||
PrimitiveTypeNode(uint64_t type) { m_integer = type; }
|
||||
virtual std::string getString();
|
||||
};
|
||||
|
||||
class ProgramNode : public Node
|
||||
|
35
nodes/PrimitiveTypeNode.cc
Normal file
35
nodes/PrimitiveTypeNode.cc
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
#include <iostream>
|
||||
#include "Node.h"
|
||||
#include "parser/parser.h"
|
||||
using namespace std;
|
||||
|
||||
string PrimitiveTypeNode::getString()
|
||||
{
|
||||
switch (m_integer)
|
||||
{
|
||||
case BYTE:
|
||||
return "int8_t";
|
||||
case UBYTE:
|
||||
return "uint8_t";
|
||||
case CHAR:
|
||||
return "char";
|
||||
case WCHAR:
|
||||
return "wchar_t";
|
||||
case SHORT:
|
||||
return "int16_t";
|
||||
case USHORT:
|
||||
return "uint16_t";
|
||||
case INT:
|
||||
return "int32_t";
|
||||
case UINT:
|
||||
return "uint32_t";
|
||||
case LONG:
|
||||
return "int64_t";
|
||||
case ULONG:
|
||||
return "uint64_t";
|
||||
default:
|
||||
cerr << "Error: Unknown primitive type " << m_integer << endl;
|
||||
return "<UNKNOWN-TYPE>";
|
||||
}
|
||||
}
|
@ -7,6 +7,9 @@
|
||||
|
||||
#define YYSTYPE refptr<Node>
|
||||
|
||||
/* include this AFTER defining YYSTYPE */
|
||||
#include "parser/parser.tab.hh"
|
||||
|
||||
YYSTYPE parse(const char * fileName);
|
||||
|
||||
#endif
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include "parser.h"
|
||||
#include "parser.tab.hh"
|
||||
using namespace std;
|
||||
static string build_string;
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include "parser.h"
|
||||
#include "parser.tab.hh" /* bison-generated header with YY[SL]TYPE */
|
||||
using namespace std;
|
||||
|
||||
#define yyerror(msg) errFunc(msg, &yylloc)
|
||||
|
Loading…
x
Reference in New Issue
Block a user