16 #ifndef __PCODE_SNIPPET__
17 #define __PCODE_SNIPPET__
19 #include "pcodecompile.hh"
47 char curchar,lookahead1,lookahead2;
55 void starttoken(
void) { curtoken[0] = curchar; tokpos = 1; }
56 void advancetoken(
void) { curtoken[tokpos++] = curchar; }
57 bool isIdent(
char c)
const {
return (isalnum(c)||(c==
'_')||(c==
'.')); }
58 bool isHex(
char c)
const {
return isxdigit(c); }
59 bool isDec(
char c)
const {
return isdigit(c); }
60 int4 findIdentifier(
const string &str)
const;
64 void initialize(istream *t);
65 int4 getNextToken(
void);
66 const string &getIdentifier(
void)
const {
return curidentifier; }
67 uintb getNumber(
void)
const {
return curnum; }
78 virtual uintb allocateTemp(
void);
86 virtual void reportError(
const Location *loc,
const string &msg);
87 virtual void reportWarning(
const Location *loc,
const string &msg) {}
88 bool hasErrors(
void)
const {
return (errorcount != 0); }
89 const string getErrorMessage(
void)
const {
return firsterror; }
90 void setUniqueBase(uintb val) { tempbase = val; }
91 uintb getUniqueBase(
void)
const {
return tempbase; }
94 bool parseStream(istream& s);
95 void addOperand(
const string &name,int4 index);