CCCC - C and C++ Code Counter  9999-git
CCCC Development version (post-3.1.4)
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | Static Private Attributes | Friends | List of all members
ANTLRToken Class Reference

#include <cccc_tok.h>

Inheritance diagram for ANTLRToken:
[legend]
Collaboration diagram for ANTLRToken:
[legend]

Public Member Functions

 ANTLRToken (ANTLRTokenType t, ANTLRChar *s)
 
 ANTLRToken (ANTLRToken &copyTok)
 
 ANTLRToken ()
 
ANTLRTokenoperator= (ANTLRToken &copyTok)
 
virtual ~ANTLRToken ()
 
virtual ANTLRAbstractToken * makeToken (ANTLRTokenType tt, ANTLRChar *txt, int line)
 
int getNestingLevel ()
 
void CountToken ()
 
const char * getTokenTypeName ()
 

Static Public Member Functions

static void IncrementNesting ()
 
static void DecrementNesting ()
 

Static Public Attributes

static int bCodeLine =0
 

Private Attributes

int CurrentNesting
 

Static Private Attributes

static int RunningNesting =0
 
static int numAllocated =0
 

Friends

class DLGLexer
 
ostream & operator<< (ostream &, ANTLRToken &)
 

Detailed Description

Definition at line 49 of file cccc_tok.h.

Constructor & Destructor Documentation

ANTLRToken::ANTLRToken ( ANTLRTokenType  t,
ANTLRChar *  s 
)

Definition at line 77 of file cccc_tok.cc.

77  :
78  ANTLRCommonToken(t,s) {
79  setType(t);
80  setText(s);
81  CountToken();
82 
83  toks_alloc2++;
84 }
void CountToken()
Definition: cccc_tok.cc:153
int toks_alloc2
Definition: cccc_tok.cc:32

Here is the call graph for this function:

ANTLRToken::ANTLRToken ( ANTLRToken copyTok)

Definition at line 87 of file cccc_tok.cc.

87  {
88  setType(copyTok.getType());
89  setText(copyTok.getText());
90  setLine(copyTok.getLine());
92  toks_alloc3++;
93 }
int toks_alloc3
Definition: cccc_tok.cc:32
int CurrentNesting
Definition: cccc_tok.h:61
ANTLRToken::ANTLRToken ( )

Definition at line 69 of file cccc_tok.cc.

69  : ANTLRCommonToken() {
70  toks_alloc1++;
71  CurrentNesting=-99;
72 }
int CurrentNesting
Definition: cccc_tok.h:61
int toks_alloc1
Definition: cccc_tok.cc:32

Here is the caller graph for this function:

ANTLRToken::~ANTLRToken ( )
virtual

Definition at line 128 of file cccc_tok.cc.

128  {
129  toks_freed++;
130  DbgMsg(MEMORY,cerr,"freeing token " << getText()
131  << " on line " << getLine()
132  << " c1:" << toks_alloc1 << " c2:" << toks_alloc2
133  << " c3:" << toks_alloc3 << " freed:" << toks_freed << endl);
134 }
int toks_alloc3
Definition: cccc_tok.cc:32
Definition: cccc.h:47
int toks_alloc2
Definition: cccc_tok.cc:32
int toks_freed
Definition: cccc_tok.cc:32
#define DbgMsg(DF, OS, X)
Definition: cccc.h:51
int toks_alloc1
Definition: cccc_tok.cc:32

Member Function Documentation

void ANTLRToken::CountToken ( )

Definition at line 153 of file cccc_tok.cc.

154 {
155  // we have seen a non-skippable pattern => this line counts toward LOC
156  bCodeLine=1;
158  DbgMsg(COUNTER,cerr,*this);
159 }
Definition: cccc.h:46
static int bCodeLine
Definition: cccc_tok.h:65
int CurrentNesting
Definition: cccc_tok.h:61
static int RunningNesting
Definition: cccc_tok.h:58
#define DbgMsg(DF, OS, X)
Definition: cccc.h:51

Here is the caller graph for this function:

static void ANTLRToken::DecrementNesting ( )
inlinestatic

Definition at line 79 of file cccc_tok.h.

79 { RunningNesting--; }
static int RunningNesting
Definition: cccc_tok.h:58
int ANTLRToken::getNestingLevel ( )
inline

Definition at line 81 of file cccc_tok.h.

81 { return CurrentNesting; }
int CurrentNesting
Definition: cccc_tok.h:61

Here is the caller graph for this function:

const char * ANTLRToken::getTokenTypeName ( )

Definition at line 161 of file cccc_tok.cc.

161 { return ""; }

Here is the caller graph for this function:

static void ANTLRToken::IncrementNesting ( )
inlinestatic

Definition at line 78 of file cccc_tok.h.

78 { RunningNesting++; }
static int RunningNesting
Definition: cccc_tok.h:58
ANTLRAbstractToken * ANTLRToken::makeToken ( ANTLRTokenType  tt,
ANTLRChar *  txt,
int  line 
)
virtual

Definition at line 103 of file cccc_tok.cc.

105  {
106 
107  ANTLRToken *new_t = new ANTLRToken(tt,txt);
108  if(new_t==0) {
109  cerr << "Memory overflow in "
110  "ANTLRToken::makeToken(" << static_cast<int>(tt) << ","
111  << txt << "," << line << ")" << endl;
112  exit(2);
113  }
114  new_t->setLine(line);
115 
116  DbgMsg(
117  LEXER,cerr,
118  "makeToken(tt=>" << static_cast<int>(tt) <<
119  ", txt=>" << txt <<
120  ",line=>" << line <<
121  ")" << endl
122  );
123 
124  return new_t;
125 }
ANTLRToken()
Definition: cccc_tok.cc:69
Definition: cccc.h:44
#define DbgMsg(DF, OS, X)
Definition: cccc.h:51

Here is the call graph for this function:

ANTLRToken & ANTLRToken::operator= ( ANTLRToken copyTok)

Definition at line 137 of file cccc_tok.cc.

137  {
138  setType(copyTok.getType());
139  setText(copyTok.getText());
140  setLine(copyTok.getLine());
142  return *this;
143 }
int CurrentNesting
Definition: cccc_tok.h:61

Friends And Related Function Documentation

friend class DLGLexer
friend

Definition at line 63 of file cccc_tok.h.

ostream& operator<< ( ostream &  ,
ANTLRToken  
)
friend

Definition at line 166 of file cccc_tok.cc.

166  {
167  int i;
168 
169  out << "TOK: " << t.getTokenTypeName()
170  << " " << t.getText()
171  << " " << t.getLine()
172  << " " << t.getNestingLevel();
173 
174  out << endl;
175  return out;
176 }
const char * getTokenTypeName()
Definition: cccc_tok.cc:161
int getNestingLevel()
Definition: cccc_tok.h:81

Member Data Documentation

int ANTLRToken::bCodeLine =0
static

Definition at line 65 of file cccc_tok.h.

int ANTLRToken::CurrentNesting
private

Definition at line 61 of file cccc_tok.h.

int ANTLRToken::numAllocated =0
staticprivate

Definition at line 60 of file cccc_tok.h.

int ANTLRToken::RunningNesting =0
staticprivate

Definition at line 58 of file cccc_tok.h.


The documentation for this class was generated from the following files: