BisonListener Class Reference

Collaboration diagram for BisonListener:

Collaboration graph
[legend]

List of all members.


Detailed Description

bison callback implementation

Definition at line 35 of file parser.cc.


Public Member Functions

 BisonListener (IBuilder *, string fileName)
virtual ~BisonListener ()
virtual void setType (EToken type)
 token type detected
virtual void glVar (Token token)
 global variable
virtual void fncInit (Token token)
 fnc decl/def detected
virtual void fncDecl ()
 fnc declaration complete
virtual void fncDefEnter ()
 fnc definition body enter
virtual void fncDefLeave ()
 fnc definition body leave
virtual void argDecl ()
 arg in fnc declaration
virtual void argDef (Token token)
 arg in fnc definition
virtual void lcVar (Token token)
 local variable in fnc def
virtual void assign (Token token)
virtual void ifEnter (Token token)
virtual void ifElse ()
virtual void ifLeave ()
virtual void whileInit (Token token)
virtual void whileEnter ()
virtual void whileLeave ()
virtual void pushToken (Token token)
virtual void evalUnOp (Token token)
virtual void evalBinOp (Token token)
virtual void fncCallInit (Token token)
 fnc call detected
virtual void fncCallArg ()
 fnc call arg
virtual void fncCallPrintArg ()
 fnc call arg of print()
virtual void fncCallAsCmd ()
 fnc call as command
virtual void fncCallAsExpr ()
 fnc call as expression

Private Types

typedef TFncCallTStack

Private Member Functions

bool initDeclIfNeeded ()
 init function declaration in higher layer (if not already initiated)
bool initDefIfNeeded ()
 init function definition in higher layer (if not already initiated)
void errMixedDeclDef ()
 handle error caused by mixed syntax of function declaration/definition
bool chkStack ()
 check stack if not empty; if so handle such error; return true on success

Private Attributes

IBuilderbuilder_
 entry point to higher layer (IBuilder object)
string fileName_
 name (or alias) of input file (used in messages)
EToken type_
 last type detected by bison (will be never T_VOID)
EToken fncType_
 return type of function currently being read
Token fncId_
 name (as defining token) of function currently being read
bool fncInitDeclSent_
 true if higher layer is now reading function declaration
bool fncInitDefSent_
 true if higher layer is now reading function definition
EToken fncPrint_
 type of print function currently being read (if any)
TStack stack_
 function call stack

Classes

struct  TFncCall

Member Typedef Documentation

typedef TFncCall* TStack [private]

Definition at line 74 of file parser.cc.


Constructor & Destructor Documentation

BisonListener ( IBuilder builder,
string  fileName 
)

Definition at line 83 of file parser.cc.

virtual ~BisonListener (  )  [inline, virtual]

Definition at line 38 of file parser.cc.


Member Function Documentation

void setType ( EToken  type  )  [virtual]

token type detected

Definition at line 94 of file parser.cc.

References type_.

void glVar ( Token  token  )  [virtual]

global variable

Definition at line 98 of file parser.cc.

References builder_, and type_.

void fncInit ( Token  token  )  [virtual]

fnc decl/def detected

Definition at line 102 of file parser.cc.

References fncId_, fncInitDeclSent_, fncInitDefSent_, fncType_, and type_.

void fncDecl (  )  [virtual]

fnc declaration complete

Definition at line 109 of file parser.cc.

References builder_, and initDeclIfNeeded().

Here is the call graph for this function:

void fncDefEnter (  )  [virtual]

fnc definition body enter

Definition at line 114 of file parser.cc.

References builder_, and initDefIfNeeded().

Here is the call graph for this function:

void fncDefLeave (  )  [virtual]

fnc definition body leave

Definition at line 119 of file parser.cc.

References builder_, and initDefIfNeeded().

Here is the call graph for this function:

void argDecl (  )  [virtual]

arg in fnc declaration

Definition at line 124 of file parser.cc.

References builder_, initDeclIfNeeded(), and type_.

Here is the call graph for this function:

void argDef ( Token  token  )  [virtual]

arg in fnc definition

Definition at line 129 of file parser.cc.

References builder_, initDefIfNeeded(), and type_.

Here is the call graph for this function:

void lcVar ( Token  token  )  [virtual]

local variable in fnc def

Definition at line 134 of file parser.cc.

References builder_, initDefIfNeeded(), and type_.

Here is the call graph for this function:

virtual void assign ( Token  token  )  [inline, virtual]

Definition at line 48 of file parser.cc.

References builder_.

virtual void ifEnter ( Token  token  )  [inline, virtual]

Definition at line 49 of file parser.cc.

References builder_.

virtual void ifElse (  )  [inline, virtual]

Definition at line 50 of file parser.cc.

References builder_.

virtual void ifLeave (  )  [inline, virtual]

Definition at line 51 of file parser.cc.

References builder_.

virtual void whileInit ( Token  token  )  [inline, virtual]

Definition at line 52 of file parser.cc.

References builder_.

virtual void whileEnter (  )  [inline, virtual]

Definition at line 53 of file parser.cc.

References builder_.

virtual void whileLeave (  )  [inline, virtual]

Definition at line 54 of file parser.cc.

References builder_.

virtual void pushToken ( Token  token  )  [inline, virtual]

Definition at line 55 of file parser.cc.

References builder_.

virtual void evalUnOp ( Token  token  )  [inline, virtual]

Definition at line 56 of file parser.cc.

References builder_.

virtual void evalBinOp ( Token  token  )  [inline, virtual]

Definition at line 57 of file parser.cc.

References builder_.

void fncCallInit ( Token  token  )  [virtual]

fnc call detected

Definition at line 139 of file parser.cc.

References StreamDecorator::C_LIGHT_PURPLE, StreamDecorator::C_NO_COLOR, ETOKEN_NULL, fncPrint_, and stack_.

void fncCallArg (  )  [virtual]

fnc call arg

Definition at line 150 of file parser.cc.

References StreamDecorator::C_LIGHT_PURPLE, StreamDecorator::C_NO_COLOR, BisonListener::TFncCall::first, BisonListener::TFncCall::second, and stack_.

void fncCallPrintArg (  )  [virtual]

fnc call arg of print()

Definition at line 162 of file parser.cc.

References builder_, chkStack(), StreamDecorator::E_ERROR, IBuilder::errorDetected(), fileName_, BisonListener::TFncCall::first, fncPrint_, stack_, Token::text, and type_.

Here is the call graph for this function:

void fncCallAsCmd (  )  [virtual]

fnc call as command

Definition at line 174 of file parser.cc.

References builder_, StreamDecorator::C_LIGHT_PURPLE, StreamDecorator::C_NO_COLOR, chkStack(), ETOKEN_NULL, BisonListener::TFncCall::first, fncPrint_, BisonListener::TFncCall::second, and stack_.

Here is the call graph for this function:

void fncCallAsExpr (  )  [virtual]

fnc call as expression

Definition at line 192 of file parser.cc.

References builder_, StreamDecorator::C_LIGHT_PURPLE, StreamDecorator::C_NO_COLOR, chkStack(), BisonListener::TFncCall::first, BisonListener::TFncCall::second, and stack_.

Here is the call graph for this function:

bool initDeclIfNeeded (  )  [private]

init function declaration in higher layer (if not already initiated)

Definition at line 207 of file parser.cc.

References builder_, errMixedDeclDef(), fncId_, fncInitDeclSent_, fncInitDefSent_, and fncType_.

Referenced by argDecl(), and fncDecl().

Here is the call graph for this function:

Here is the caller graph for this function:

bool initDefIfNeeded (  )  [private]

init function definition in higher layer (if not already initiated)

Definition at line 220 of file parser.cc.

References builder_, errMixedDeclDef(), fncId_, fncInitDeclSent_, fncInitDefSent_, and fncType_.

Referenced by argDef(), fncDefEnter(), fncDefLeave(), and lcVar().

Here is the call graph for this function:

Here is the caller graph for this function:

void errMixedDeclDef (  )  [private]

handle error caused by mixed syntax of function declaration/definition

Definition at line 242 of file parser.cc.

References builder_, StreamDecorator::E_ERROR, fileName_, and fncId_.

Referenced by initDeclIfNeeded(), and initDefIfNeeded().

Here is the caller graph for this function:

bool chkStack (  )  [private]

check stack if not empty; if so handle such error; return true on success

Definition at line 233 of file parser.cc.

References builder_, StreamDecorator::E_ERROR, fileName_, and stack_.

Referenced by fncCallAsCmd(), fncCallAsExpr(), and fncCallPrintArg().

Here is the caller graph for this function:


Member Data Documentation

IBuilder* builder_ [private]

entry point to higher layer (IBuilder object)

Definition at line 64 of file parser.cc.

Referenced by argDecl(), argDef(), assign(), chkStack(), errMixedDeclDef(), evalBinOp(), evalUnOp(), fncCallAsCmd(), fncCallAsExpr(), fncCallPrintArg(), fncDecl(), fncDefEnter(), fncDefLeave(), glVar(), ifElse(), ifEnter(), ifLeave(), initDeclIfNeeded(), initDefIfNeeded(), lcVar(), pushToken(), whileEnter(), whileInit(), and whileLeave().

string fileName_ [private]

name (or alias) of input file (used in messages)

Definition at line 65 of file parser.cc.

Referenced by chkStack(), errMixedDeclDef(), and fncCallPrintArg().

EToken type_ [private]

last type detected by bison (will be never T_VOID)

Definition at line 66 of file parser.cc.

Referenced by argDecl(), argDef(), fncCallPrintArg(), fncInit(), glVar(), lcVar(), and setType().

EToken fncType_ [private]

return type of function currently being read

Definition at line 67 of file parser.cc.

Referenced by fncInit(), initDeclIfNeeded(), and initDefIfNeeded().

Token fncId_ [private]

name (as defining token) of function currently being read

Definition at line 68 of file parser.cc.

Referenced by errMixedDeclDef(), fncInit(), initDeclIfNeeded(), and initDefIfNeeded().

bool fncInitDeclSent_ [private]

true if higher layer is now reading function declaration

Definition at line 69 of file parser.cc.

Referenced by fncInit(), initDeclIfNeeded(), and initDefIfNeeded().

bool fncInitDefSent_ [private]

true if higher layer is now reading function definition

Definition at line 70 of file parser.cc.

Referenced by fncInit(), initDeclIfNeeded(), and initDefIfNeeded().

EToken fncPrint_ [private]

type of print function currently being read (if any)

Definition at line 71 of file parser.cc.

Referenced by fncCallAsCmd(), fncCallInit(), and fncCallPrintArg().

TStack stack_ [private]

function call stack

Definition at line 75 of file parser.cc.

Referenced by chkStack(), fncCallArg(), fncCallAsCmd(), fncCallAsExpr(), fncCallInit(), and fncCallPrintArg().


The documentation for this class was generated from the following file:
Generated on Sat Jul 4 18:33:05 2009 for vyp08 (compiler and interpreter of VYP08 language) by  doxygen 1.5.4