Skip to content

Commit

Permalink
prefixed 's_' to static token class members
Browse files Browse the repository at this point in the history
  • Loading branch information
thunder422 committed Dec 8, 2012
1 parent 5c5da1f commit e0474f5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion enums.awk
Expand Up @@ -127,7 +127,7 @@ BEGIN {
{
if (msg_array == 0)
{
if (line ~ /const QString Token::messageArray/)
if (line ~ /const QString Token::s_messageArray/)
{
# found start of token message array
msg_array = 1
Expand Down
38 changes: 19 additions & 19 deletions token.cpp
Expand Up @@ -27,16 +27,16 @@


// static token variables
bool Token::paren[sizeof_TokenType];
bool Token::op[sizeof_TokenType];
int Token::prec[sizeof_TokenType];
bool Token::table[sizeof_TokenType];
bool Token::s_paren[sizeof_TokenType];
bool Token::s_op[sizeof_TokenType];
int Token::s_prec[sizeof_TokenType];
bool Token::s_table[sizeof_TokenType];

// token status message array
// (TokenStatus enumeration generated from names
// in comments at the end each line by enums.awk,
// lines starting with comments are ignored)
const QString Token::messageArray[sizeof_TokenStatus] = {
const QString Token::s_messageArray[sizeof_TokenStatus] = {
tr("Null_TokenStatus (BUG)"), // Null
tr("Good_TokenStatus (BUG)"), // Good
tr("Done_TokenStatus (BUG)"), // Done
Expand Down Expand Up @@ -105,26 +105,26 @@ const QString Token::messageArray[sizeof_TokenStatus] = {
void Token::initialize(void)
{
// set true for types that contain an opening parentheses
paren[IntFuncP_TokenType] = true;
paren[DefFuncP_TokenType] = true;
paren[Paren_TokenType] = true;
s_paren[IntFuncP_TokenType] = true;
s_paren[DefFuncP_TokenType] = true;
s_paren[Paren_TokenType] = true;

// set true for types that are considered an operator
op[Command_TokenType] = true;
op[Operator_TokenType] = true;
s_op[Command_TokenType] = true;
s_op[Operator_TokenType] = true;

// set precedence for non-table token types
prec[Command_TokenType] = -1; // use table precedence if -1
prec[Operator_TokenType] = -1;
prec[IntFuncP_TokenType] = -1;
prec[DefFuncP_TokenType] = 2; // same as open parentheses (Paren_TokenType)
prec[Paren_TokenType] = 2;
s_prec[Command_TokenType] = -1; // use table precedence if -1
s_prec[Operator_TokenType] = -1;
s_prec[IntFuncP_TokenType] = -1;
s_prec[DefFuncP_TokenType] = 2; // same as open parentheses (Paren_TokenType)
s_prec[Paren_TokenType] = 2;

// set token type has a table entry flags
table[Command_TokenType] = true;
table[Operator_TokenType] = true;
table[IntFuncN_TokenType] = true;
table[IntFuncP_TokenType] = true;
s_table[Command_TokenType] = true;
s_table[Operator_TokenType] = true;
s_table[IntFuncN_TokenType] = true;
s_table[IntFuncP_TokenType] = true;
// FIXME should Remark_TokenType also have table entry flag set?
}

Expand Down
20 changes: 10 additions & 10 deletions token.h
Expand Up @@ -240,19 +240,19 @@ class Token
// token information functions
bool isOperator(void) const
{
return op[m_type];
return s_op[m_type];
}
bool hasParen(void) const
{
return paren[m_type];
return s_paren[m_type];
}
int precedence(void) const
{
return prec[m_type];
return s_prec[m_type];
}
int hasTableEntry(void) const
{
return table[m_type];
return s_table[m_type];
}
bool isNull(void) const
{
Expand All @@ -268,18 +268,18 @@ class Token

private:
// static members
static bool paren[sizeof_TokenType];
static bool op[sizeof_TokenType];
static int prec[sizeof_TokenType];
static bool table[sizeof_TokenType];
static const QString messageArray[sizeof_TokenStatus];
static bool s_paren[sizeof_TokenType];
static bool s_op[sizeof_TokenType];
static int s_prec[sizeof_TokenType];
static bool s_table[sizeof_TokenType];
static const QString s_messageArray[sizeof_TokenStatus];

public:
// static member functions
static void initialize(void);
static const QString message(TokenStatus status)
{
return messageArray[status];
return s_messageArray[status];
}
};

Expand Down

0 comments on commit e0474f5

Please sign in to comment.