File parse-yacc.c

RCS Header: /home/amb/cxref/RCS/parse.y 1.42 2001/04/28 15:33:03 amb Exp

C Cross Referencing & Documentation tool. Version 1.5c.
C parser.

References Variables: firstparse-yacc.c


Included Files


Preprocessor definitions

#define YYBISON 1

#define IDENTIFIER 257

#define TYPE_NAME 258

#define LITERAL 259

#define STRING_LITERAL 260

#define ELLIPSES 261

#define MUL_ASSIGN 262

#define DIV_ASSIGN 263

#define MOD_ASSIGN 264

#define ADD_ASSIGN 265

#define SUB_ASSIGN 266

#define LEFT_ASSIGN 267

#define RIGHT_ASSIGN 268

#define AND_ASSIGN 269

#define XOR_ASSIGN 270

#define OR_ASSIGN 271

#define EQ_OP 272

#define NE_OP 273

#define PTR_OP 274

#define AND_OP 275

#define OR_OP 276

#define DEC_OP 277

#define INC_OP 278

#define LE_OP 279

#define GE_OP 280

#define LEFT_SHIFT 281

#define RIGHT_SHIFT 282

#define SIZEOF 283

#define TYPEDEF 284

#define EXTERN 285

#define STATIC 286

#define AUTO 287

#define REGISTER 288

#define CONST 289

#define VOLATILE 290

#define VOID 291

#define INLINE 292

#define CHAR 293

#define SHORT 294

#define INT 295

#define LONG 296

#define SIGNED 297

#define UNSIGNED 298

#define FLOAT 299

#define DOUBLE 300

#define STRUCT 301

#define UNION 302

#define ENUM 303

#define CASE 304

#define DEFAULT 305

#define IF 306

#define ELSE 307

#define SWITCH 308

#define WHILE 309

#define DO 310

#define FOR 311

#define GOTO 312

#define CONTINUE 313

#define BREAK 314

#define RETURN 315

#define ASM 316

#define yylex cxref_yylex

The variable must be LOCAL or EXTERNAL or GLOBAL, so this checks and sets that.

#define SCOPE

#define YYFINAL 579

#define YYFLAG 32768

#define YYNTBASE 87

#define YYTRANSLATE( x )

#define YYLAST 1694

#define YYSTACK_USE_ALLOCA

#define YYSTACK_ALLOC alloca

#define yyerrok

#define yyclearin

#define YYEMPTY 2

#define YYEOF 0

#define YYACCEPT

#define YYABORT

#define YYERROR

#define YYFAIL

#define YYRECOVERING

#define YYBACKUP( token, value )

#define YYTERROR 1

#define YYERRCODE 256

#define YYLEX yylex

#define YYINITDEPTH 200

#define YYMAXDEPTH 10000

#define __yy_memcpy( TO, FROM, COUNT )

#define YYPARSE_PARAM_ARG

#define YYPARSE_PARAM_DECL

#define YYPOPSTACK


Typedef stack

A structure to hold the information about an object.

typedef struct _stack stack
struct _stack 
   { 
     char* name; The name of the object.
     char* type; The type of the object.
     char* qual; The type qualifier of the object.
   } 


Global Variable yydebug

Turn the debugging output on and off.

int yydebug
Visible in:  cxref.c
   func.c
   parse-lex.c
   parse-yacc.c
   parse-yy.h
   preproc.c
   type.c
   var.c
Used in: DocumentTheFile()cxref.c
  yyparse()parse-yacc.c


Global Variable yylval

For communication between the lex and yacc code.

char* yylval
Visible in:  cxref.c
   func.c
   parse-lex.c
   parse-yacc.c
   parse-yacc.h
   parse-yy.h
   preproc.c
   type.c
   var.c
Used in: cxref_yylex()parse-yacc.c
  yyerror()parse-yacc.c
  yylex()parse-lex.c
  yyparse()parse-yacc.c


Global Variable in_typedef

A flag that is set to true when typedef is seen in a statement.

int in_typedef
Visible in:  parse-yacc.c
   type.c
Used in: ResetParser()parse-yacc.c
  SeenStructUnionEnd()type.c
  SeenStructUnionStart()type.c
  yyparse()parse-yacc.c


Global Variable yychar

int yychar
Visible in:  parse-yacc.c
Used in: yyerror()parse-yacc.c
  yyparse()parse-yacc.c

Global Variable yynerrs

int yynerrs
Visible in:  parse-yacc.c
Used in: yyparse()parse-yacc.c

External Variables

in_header
When in a header file, some stuff can be skipped over quickly.

extern int in_header
Defined in: preproc.c


Local Variables

scope
The scope of the function / variable that is being examined.

static int scope
Used in: ResetParser()
  yyparse()

in_function
When in a function or a function definition, the behaviour is different.

static int in_function
Used in: ResetParser()
  yyparse()

in_funcdef
When in a function or a function definition, the behaviour is different.

static int in_funcdef
Used in: ResetParser()
  yyparse()

in_funcbody
When in a function or a function definition, the behaviour is different.

static int in_funcbody
Used in: ResetParser()
  yyparse()

first
The parsing stack first value.

static stack first
Used in:  parse-yacc.c
  ResetParser()
  push()

list
The parsing stack list of all values.

static stack* list
Used in: ResetParser()
  pop()
  push()

current
The parsing stack current values.

static stack* current
Used in: ResetParser()
  pop()
  push()
  reset()
  yyparse()

depth
The depth of the stack currently in use.

static int depth
Used in: ResetParser()
  pop()
  push()

maxdepth
The depth of the stack total malloced.

static int maxdepth
Used in: ResetParser()
  push()

common_comment
Declarations that are in the same statement share this comment.

static char* common_comment
Used in: ResetParser()
  yyparse()

in_structunion
When inside a struct / union / enum definition, this is the depth.

static int in_structunion
Used in: ResetParser()
  cxref_yylex()
  yyparse()

comp_type
When inside a struct / union definition, this is the component type.

static char* comp_type
Used in: ResetParser()
  yyparse()

in_type_spec
To solve the problem where a type name is used as an identifier.

static int in_type_spec
Used in: ResetParser()
  cxref_yylex()
  yyparse()

yytranslate
static const char yytranslate[]
Used in: yyparse()

yyprhs
static const short yyprhs[]
Used in: yyparse()

yyrhs
static const short yyrhs[]
Used in: yyparse()

yyrline
static const short yyrline[]
Used in: yyparse()

yytname
static const char* const yytname[]
Used in: yyerror()
  yyparse()

yyr1
static const short yyr1[]
Used in: yyparse()

yyr2
static const short yyr2[]
Used in: yyparse()

yydefact
static const short yydefact[]
Used in: yyparse()

yydefgoto
static const short yydefgoto[]
Used in: yyparse()

yypact
static const short yypact[]
Used in: yyparse()

yypgoto
static const short yypgoto[]
Used in: yyparse()

yytable
static const short yytable[]
Used in: yyparse()

yycheck
static const short yycheck[]
Used in: yyparse()

last_yylex
static int last_yylex[11]
Used in: cxref_yylex()
  yyerror()

last_yylval
static char* last_yylval[11]
Used in: cxref_yylex()
  yyerror()

count
static int count
Used in: cxref_yylex()
  yyerror()

modcount
static int modcount
Used in: cxref_yylex()
  yyerror()


Global Function ResetParser()

Reset the Parser, ready for the next file.

void ResetParser ( void )
Prototyped in: cxref.h
Calls: SafeFree()memory.c
  reset()parse-yacc.c
Called by: main()cxref.c
References Variables: common_commentparse-yacc.c
  comp_typeparse-yacc.c
  currentparse-yacc.c
  depthparse-yacc.c
  firstparse-yacc.c
  in_funcbodyparse-yacc.c
  in_funcdefparse-yacc.c
  in_functionparse-yacc.c
  in_structunionparse-yacc.c
  in_type_specparse-yacc.c
  in_typedefparse-yacc.c
  listparse-yacc.c
  maxdepthparse-yacc.c
  scopeparse-yacc.c


Global Function yyparse()

int yyparse ( void )
Prototyped in: parse-yy.h
Calls: CheckFunctionVariableRef()func.c
  ConcatStrings()memory.c
  CopyString()memory.c
  DownScope()var.c
  GetCurrentComment()comment.c
  IsAScopeVariable()var.c
  IsATypeName()type.c
  SeenFunctionArg()func.c
  SeenFunctionCall()func.c
  SeenFunctionDeclaration()func.c
  SeenFunctionDefinition()func.c
  SeenFunctionProto()func.c
  SeenScopeVariable()var.c
  SeenStructUnionComp()type.c
  SeenStructUnionEnd()type.c
  SeenStructUnionStart()type.c
  SeenTypedef()type.c
  SeenTypedefName()type.c
  SeenVariableDefinition()var.c
  SetCurrentComment()comment.c
  UpScope()var.c
  cxref_yylex()parse-yacc.c
  pop()parse-yacc.c
  push()parse-yacc.c
  reset()parse-yacc.c
  yyerror()parse-yacc.c
  __builtin_alloca(), __builtin_memcpy(), fprintf(), free(), malloc(), printf(), strcat(), strcmp(), strcpy(), strlen(), strstr()
Called by: DocumentTheFile()cxref.c
References Variables: common_commentparse-yacc.c
  comp_typeparse-yacc.c
  currentparse-yacc.c
  in_funcbodyparse-yacc.c
  in_funcdefparse-yacc.c
  in_functionparse-yacc.c
  in_headerpreproc.c
  in_structunionparse-yacc.c
  in_type_specparse-yacc.c
  in_typedefparse-yacc.c
  scopeparse-yacc.c
  yycharparse-yacc.c
  yycheckparse-yacc.c
  yydebugparse-yacc.c
  yydefactparse-yacc.c
  yydefgotoparse-yacc.c
  yylvalparse-yacc.c
  yynerrsparse-yacc.c
  yypactparse-yacc.c
  yypgotoparse-yacc.c
  yyprhsparse-yacc.c
  yyr1parse-yacc.c
  yyr2parse-yacc.c
  yyrhsparse-yacc.c
  yyrlineparse-yacc.c
  yytableparse-yacc.c
  yytnameparse-yacc.c
  yytranslateparse-yacc.c

Local Function cxref_yylex()

Call the lexer, the feedback from the parser to the lexer is applied here.

static int cxref_yylex ( void )

int cxref_yylex
Returns the value from the lexer, modified due to parser feedback.
Prototyped in: parse-yacc.c
Calls: yylex()parse-lex.c
Called by: yyerror()parse-yacc.c
  yyparse()parse-yacc.c
References Variables: countparse-yacc.c
  in_structunionparse-yacc.c
  in_type_specparse-yacc.c
  last_yylexparse-yacc.c
  last_yylvalparse-yacc.c
  modcountparse-yacc.c
  yylvalparse-yacc.c

Local Function pop()

Pop a level from the stack.

static void pop ( void )
Calls: reset()parse-yacc.c
Called by: yyparse()parse-yacc.c
References Variables: currentparse-yacc.c
  depthparse-yacc.c
  listparse-yacc.c


Local Function push()

Push a level onto the stack.

static void push ( void )
Calls: SafeMalloc()memory.c
  SafeRealloc()memory.c
  reset()parse-yacc.c
Called by: yyparse()parse-yacc.c
References Variables: currentparse-yacc.c
  depthparse-yacc.c
  firstparse-yacc.c
  listparse-yacc.c
  maxdepthparse-yacc.c


Local Function reset()

Reset the current level on the stack.

static void reset ( void )
Called by: ResetParser()parse-yacc.c
  pop()parse-yacc.c
  push()parse-yacc.c
  yyparse()parse-yacc.c
References Variables: currentparse-yacc.c


Local Function yyerror()

Stop parsing the current file, due to an error.

static void yyerror ( char* s )

char* s
The error message to print out.
Prototyped in: parse-yacc.c
Calls: cxref_yylex()parse-yacc.c
  yylex()parse-lex.c
  fflush(), fprintf()
Called by: yyparse()parse-yacc.c
References Variables: countparse-yacc.c
  last_yylexparse-yacc.c
  last_yylvalparse-yacc.c
  modcountparse-yacc.c
  parse_fileparse-lex.c
  parse_lineparse-lex.c
  yycharparse-yacc.c
  yylvalparse-yacc.c
  yytnameparse-yacc.c