# File parse-lex.c

RCS Header: /home/amb/cxref/RCS/parse.l 1.28 1998/10/23 10:41:57 amb Exp

C Cross Referencing & Documentation tool. Version 1.4c.
C lexical analyser CPP processing, including GNU extensions, using yylval as a string.

## Included Files

- `#include <stdio.h>`

- `#include "parse-yy.h"`
  - `#include <stdio.h>`
  - `#include <stdlib.h>`

- `#include "parse-yacc.h"`

- `#include "cxref.h"`
  - `#include "datatype.h"`

- `#include "memory.h"`

- `#include <stdlib.h>`

## Preprocessor definitions

`#define FLEX_SCANNER`

`#define YY_FLEX_MAJOR_VERSION 2`

`#define YY_FLEX_MINOR_VERSION 5`

`#define YY_USE_PROTOS`

`#define YY_USE_CONST`

`#define yyconst const`

`#define YY_PROTO( proto )`

`#define YY_NULL 0`

`#define YY_SC_TO_UI( c )`

`#define BEGIN`

`#define YY_START`

`#define YYSTATE YY_START`

`#define YY_STATE_EOF( state )`

`#define YY_NEW_FILE`

`#define YY_END_OF_BUFFER_CHAR 0`

`#define YY_BUF_SIZE 16384`

`#define EOB_ACT_CONTINUE_SCAN 0`

`#define EOB_ACT_END_OF_FILE 1`

`#define EOB_ACT_LAST_MATCH 2`

`#define yyless( n )`

`#define unput( c )`

`#define YY_BUFFER_NEW 0`

`#define YY_BUFFER_NORMAL 1`

`#define YY_BUFFER_EOF_PENDING 2`

`#define YY_CURRENT_BUFFER yy_current_buffer`

`#define YY_FLUSH_BUFFER`

`#define yy_new_buffer yy_create_buffer`

`#define yy_set_interactive( is_interactive )`

`#define yy_set_bol( at_bol )`

`#define YY_AT_BOL`

`#define YY_USES_REJECT`

`#define yytext_ptr yytext`

`#define YY_DO_BEFORE_ACTION`

`#define YY_NUM_RULES 194`

`#define YY_END_OF_BUFFER 195`

`#define YY_TRAILING_MASK 0x2000`

`#define YY_TRAILING_HEAD_MASK 0x4000`

`#define REJECT`

`#define yymore`

`#define YY_MORE_ADJ 0`

`#define YY_RESTORE_YY_MORE_OFFSET`

`#define INITIAL 0`

`#define START_COMMENT 1`

`#define COMMENT 2`

`#define SPECIAL_COMMENT 3`

`#define START_COMMENT_CPP 4`

`#define COMMENT_CPP 5`

`#define SPECIAL_COMMENT_CPP 6`

`#define CPP 7`

`#define CPP_START 8`

`#define CPP_INCLUDE 9`

`#define CPP_INC_FILE 10`

`#define CPP_INC_FLAGS 11`

`#define CPP_DEFINE 12`

`#define CPP_DEFINE_ARGP 13`

`#define CPP_DEFINE_BODY 14`

`#define CPP_DEFINE_ARGS 15`

`#define GNU_LABEL 16`

`#define GNU_ATTRIBUTE 17`

`#define GNU_EXTENSION 18`

`#define GNU_TYPEOF 19`

`#define CHAR_VARYING 20`

`#define YY_NO_PUSH_STATE 1`

`#define YY_NO_POP_STATE 1`

`#define YY_NO_TOP_STATE 1`

`#define YY_READ_BUF_SIZE 8192`

`#define ECHO`

`#define YY_INPUT( buf, result, max_size )`

`#define yyterminate`

`#define YY_START_STACK_INCR 25`

`#define YY_FATAL_ERROR( msg )`

`#define YY_DECL`

`#define YY_USER_ACTION`

`#define YY_BREAK break`

`#define YY_RULE_SETUP YY_USER_ACTION`

`#define YY_EXIT_FAILURE 2`

`#define yyless( n )`

## Typedef YY_BUFFER_STATE

`typedef struct yy_buffer_state* YY_BUFFER_STATE`

See:
  - Type struct yy_buffer_state

## Typedef yy_size_t

`typedef unsigned int yy_size_t`

## Type struct yy_buffer_state

`struct yy_buffer_state`

`struct yy_buffer_state` |
`{` |
`FILE* yy_input_file;` |
`char* yy_ch_buf;` |
`char* yy_buf_pos;` |
`yy_size_t yy_buf_size;` |
`int yy_n_chars;` |
`int yy_is_our_buffer;` |
`int yy_is_interactive;` |
`int yy_at_bol;` |
`int yy_fill_buffer;` |
`int yy_buffer_status;` |
`}` |

## Typedef YY_CHAR

`typedef unsigned char YY_CHAR`

## Typedef yy_state_type

`typedef int yy_state_type`

## Global Variable yyleng

`int yyleng`

Visible in: |  | parse-lex.c
Used in: | yylex() | parse-lex.c

## Global Variable yyin

`FILE* yyin`

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
| input() | parse-lex.c
| yy_get_next_buffer() | parse-lex.c
| yy_load_buffer_state() | parse-lex.c
| yylex() | parse-lex.c
| yyrestart() | parse-lex.c

## Global Variable yyout

`FILE* yyout`

Visible in: |  | parse-lex.c
Used in: | yylex() | parse-lex.c

## Global Variable yytext

`char* yytext`

Visible in: |  | parse-lex.c
Used in: | input() | parse-lex.c
| yy_get_next_buffer() | parse-lex.c
| yy_get_previous_state() | parse-lex.c
| yy_load_buffer_state() | parse-lex.c
| yylex() | parse-lex.c
| yyunput() | parse-lex.c

## Global Variable parse_file

The name of the current file.

`char* parse_file`

Visible in: |  | comment.c
|  | cxref.c
|  | func.c
|  | parse-lex.c
|  | parse-yacc.c
|  | parse-yy.h
|  | preproc.c
|  | type.c
|  | var.c
Used in: | ResetLexer() | parse-lex.c
| SeenComment() | comment.c
| SeenFunctionDeclaration() | func.c
| SeenFunctionProto() | func.c
| SeenVariableDefinition() | var.c
| yyerror() | parse-yacc.c
| yylex() | parse-lex.c

## Global Variable parse_line

The current line number in the file.

`int parse_line`

Visible in: |  | cxref.c
|  | func.c
|  | parse-lex.c
|  | parse-yacc.c
|  | parse-yy.h
|  | preproc.c
|  | type.c
|  | var.c
Used in: | ResetLexer() | parse-lex.c
| SeenDefine() | preproc.c
| SeenFunctionDeclaration() | func.c
| SeenStructUnionStart() | type.c
| SeenTypedef() | type.c
| SeenVariableDefinition() | var.c
| yyerror() | parse-yacc.c
| yylex() | parse-lex.c

## External Variables

in_header
If we are in a header file then ignore the comments.

`extern int in_header`

Defined in: | preproc.c

option_all_comments
One of the options controlling how comments are processed, use all comments not just the specially formattted ones.

`extern int option_all_comments`

Defined in: | cxref.c

option_block_comments
One of the options controlling how comments are processed, remove the leading block comment marker.

`extern int option_block_comments`

Defined in: | cxref.c

option_no_comments
One of the options controlling how comments are processed, ignore all comments.

`extern int option_no_comments`

Defined in: | cxref.c

option_warn
Flag that indicates if the comment warnings are to be issued.

`extern int option_warn`

Defined in: | cxref.c

## Local Variables

yy_current_buffer
`static YY_BUFFER_STATE yy_current_buffer`

Used in: | input()
| yy_delete_buffer()
| yy_flush_buffer()
| yy_get_next_buffer()
| yy_load_buffer_state()
| yy_switch_to_buffer()
| yylex()
| yyrestart()
| yyunput()

yy_hold_char
`static char yy_hold_char`

Used in: | input()
| yy_load_buffer_state()
| yy_switch_to_buffer()
| yylex()
| yyunput()

yy_n_chars
`static int yy_n_chars`

Used in: | input()
| yy_get_next_buffer()
| yy_load_buffer_state()
| yy_switch_to_buffer()
| yylex()
| yyunput()

yy_c_buf_p
`static char* yy_c_buf_p`

Used in: | input()
| yy_get_next_buffer()
| yy_get_previous_state()
| yy_load_buffer_state()
| yy_switch_to_buffer()
| yylex()
| yyunput()

yy_init
`static int yy_init`

Used in: | yylex()

yy_start
`static int yy_start`

Used in: | yy_get_previous_state()
| yylex()

yy_did_buffer_switch_on_eof
`static int yy_did_buffer_switch_on_eof`

Used in: | input()
| yy_switch_to_buffer()
| yylex()

yy_acclist
`static const short int yy_acclist[766]`

Used in: | yylex()

yy_accept
`static const short int yy_accept[659]`

Used in: | yylex()

yy_ec
`static const int yy_ec[256]`

Used in: | yy_get_previous_state()
| yylex()

yy_meta
`static const int yy_meta[73]`

Used in: | yy_get_previous_state()
| yy_try_NUL_trans()
| yylex()

yy_base
`static const short int yy_base[695]`

Used in: | yy_get_previous_state()
| yy_try_NUL_trans()
| yylex()

yy_def
`static const short int yy_def[695]`

Used in: | yy_get_previous_state()
| yy_try_NUL_trans()
| yylex()

yy_nxt
`static const short int yy_nxt[1786]`

Used in: | yy_get_previous_state()
| yy_try_NUL_trans()
| yylex()

yy_chk
`static const short int yy_chk[1786]`

Used in: | yy_get_previous_state()
| yy_try_NUL_trans()
| yylex()

yy_state_buf
`static yy_state_type yy_state_buf[16384+2]`

Used in: | yy_get_previous_state()
| yylex()

yy_state_ptr
`static yy_state_type* yy_state_ptr`

Used in: | yy_get_previous_state()
| yy_try_NUL_trans()
| yylex()

yy_full_match
`static char* yy_full_match`

Used in: | yylex()

yy_lp
`static int yy_lp`

Used in: | yylex()

yy_looking_for_trail_begin
`static int yy_looking_for_trail_begin`

Used in: | yylex()

yy_full_lp
`static int yy_full_lp`

Used in: | yylex()

yy_full_state
`static int* yy_full_state`

Used in: | yylex()

inc_file_flags
The flags that come out of GCC when a file is included.

`static int inc_file_flags`

Used in: | ResetLexer()
| yylex()

define_value
The value of the thing that is defined (but only if it is simple).

`static char* define_value`

Used in: | ResetLexer()
| yylex()

comment_init_state
The lex state at the time that a comment is seen.

`static int comment_init_state`

Used in: | ResetLexer()
| yylex()

gnu_att_depth
To get around the GCC __attribute__ keyword, skip over matched () counted by this.

`static int gnu_att_depth`

Used in: | ResetLexer()
| yylex()

gnu_typ_depth
To get around the GCC __typeof__ keyword, skip over matched () counted by this.

`static int gnu_typ_depth`

Used in: | ResetLexer()
| yylex()

push_past
If we see a comment immediately after a ',', ';', '};', '},' or ')' then push it before.

`static int push_past`

Used in: | ResetLexer()
| yylex()

## Global Function ResetLexer()

Reset the Lexer, ready for the next file.

`void ResetLexer ( void )`

Prototyped in: | cxref.h
Called by: | main() | cxref.c
References Variables: | comment_init_state | parse-lex.c
| define_value | parse-lex.c
| gnu_att_depth | parse-lex.c
| gnu_typ_depth | parse-lex.c
| inc_file_flags | parse-lex.c
| parse_file | parse-lex.c
| parse_line | parse-lex.c
| push_past | parse-lex.c

## Global Function yy_create_buffer()

`YY_BUFFER_STATE yy_create_buffer ( FILE* file, int size )`

Prototyped in: | parse-lex.c
Calls: | yy_fatal_error() | parse-lex.c
| yy_flex_alloc() | parse-lex.c
| yy_init_buffer() | parse-lex.c
Called by: | yylex() | parse-lex.c
| yyrestart() | parse-lex.c

## Global Function yy_delete_buffer()

`void yy_delete_buffer ( YY_BUFFER_STATE b )`

Prototyped in: | parse-lex.c
Calls: | yy_flex_free() | parse-lex.c
References Variables: | yy_current_buffer | parse-lex.c

## Global Function yy_flush_buffer()

`void yy_flush_buffer ( YY_BUFFER_STATE b )`

Prototyped in: | parse-lex.c
Calls: | yy_load_buffer_state() | parse-lex.c
Called by: | yy_init_buffer() | parse-lex.c
References Variables: | yy_current_buffer | parse-lex.c

## Global Function yy_init_buffer()

`void yy_init_buffer ( YY_BUFFER_STATE b, FILE* file )`

Prototyped in: | parse-lex.c
Calls: | yy_flush_buffer() | parse-lex.c
| fileno(), isatty()
Called by: | yy_create_buffer() | parse-lex.c
| yyrestart() | parse-lex.c

## Global Function yy_load_buffer_state()

`void yy_load_buffer_state ( void )`

Prototyped in: | parse-lex.c
Called by: | yy_flush_buffer() | parse-lex.c
| yy_switch_to_buffer() | parse-lex.c
| yylex() | parse-lex.c
| yyrestart() | parse-lex.c
References Variables: | yy_c_buf_p | parse-lex.c
| yy_current_buffer | parse-lex.c
| yy_hold_char | parse-lex.c
| yy_n_chars | parse-lex.c
| yyin | parse-lex.c
| yytext | parse-lex.c

## Global Function yy_scan_buffer()

`YY_BUFFER_STATE yy_scan_buffer ( char* base, yy_size_t size )`

Prototyped in: | parse-lex.c
Calls: | yy_fatal_error() | parse-lex.c
| yy_flex_alloc() | parse-lex.c
| yy_switch_to_buffer() | parse-lex.c
Called by: | yy_scan_bytes() | parse-lex.c

## Global Function yy_scan_bytes()

`YY_BUFFER_STATE yy_scan_bytes ( const char* bytes, int len )`

Prototyped in: | parse-lex.c
Calls: | yy_fatal_error() | parse-lex.c
| yy_flex_alloc() | parse-lex.c
| yy_scan_buffer() | parse-lex.c
Called by: | yy_scan_string() | parse-lex.c

## Global Function yy_scan_string()

`YY_BUFFER_STATE yy_scan_string ( const char* yy_str )`

Prototyped in: | parse-lex.c
Calls: | yy_scan_bytes() | parse-lex.c

## Global Function yy_switch_to_buffer()

`void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer )`

Prototyped in: | parse-lex.c
Calls: | yy_load_buffer_state() | parse-lex.c
Called by: | yy_scan_buffer() | parse-lex.c
References Variables: | yy_c_buf_p | parse-lex.c
| yy_current_buffer | parse-lex.c
| yy_did_buffer_switch_on_eof | parse-lex.c
| yy_hold_char | parse-lex.c
| yy_n_chars | parse-lex.c

## Global Function yylex()

`int yylex ( void )`

Prototyped in: | parse-yy.h
Calls: | CopyString() | memory.c
| GetCurrentComment() | comment.c
| IsAScopeVariable() | var.c
| IsATypeName() | type.c
| SeenComment() | comment.c
| SeenDefine() | preproc.c
| SeenDefineComment() | preproc.c
| SeenDefineFuncArgComment() | preproc.c
| SeenDefineFunctionArg() | preproc.c
| SeenDefineValue() | preproc.c
| SeenFileChange() | preproc.c
| SeenInclude() | preproc.c
| SeenIncludeComment() | preproc.c
| yy_create_buffer() | parse-lex.c
| yy_fatal_error() | parse-lex.c
| yy_get_next_buffer() | parse-lex.c
| yy_get_previous_state() | parse-lex.c
| yy_load_buffer_state() | parse-lex.c
| yy_try_NUL_trans() | parse-lex.c
| yyrestart() | parse-lex.c
| yyunput() | parse-lex.c
| atoi(), fprintf(), fwrite(), strlen()
Called by: | cxref_yylex() | parse-yacc.c
| yyerror() | parse-yacc.c
References Variables: | comment_init_state | parse-lex.c
| define_value | parse-lex.c
| gnu_att_depth | parse-lex.c
| gnu_typ_depth | parse-lex.c
| in_header | preproc.c
| inc_file_flags | parse-lex.c
| option_all_comments | cxref.c
| option_block_comments | cxref.c
| option_no_comments | cxref.c
| option_warn | cxref.c
| parse_file | parse-lex.c
| parse_line | parse-lex.c
| push_past | parse-lex.c
| yy_accept | parse-lex.c
| yy_acclist | parse-lex.c
| yy_base | parse-lex.c
| yy_c_buf_p | parse-lex.c
| yy_chk | parse-lex.c
| yy_current_buffer | parse-lex.c
| yy_def | parse-lex.c
| yy_did_buffer_switch_on_eof | parse-lex.c
| yy_ec | parse-lex.c
| yy_full_lp | parse-lex.c
| yy_full_match | parse-lex.c
| yy_full_state | parse-lex.c
| yy_hold_char | parse-lex.c
| yy_init | parse-lex.c
| yy_looking_for_trail_begin | parse-lex.c
| yy_lp | parse-lex.c
| yy_meta | parse-lex.c
| yy_n_chars | parse-lex.c
| yy_nxt | parse-lex.c
| yy_start | parse-lex.c
| yy_state_buf | parse-lex.c
| yy_state_ptr | parse-lex.c
| yyin | parse-lex.c
| yyleng | parse-lex.c
| yylval | parse-yacc.c
| yyout | parse-lex.c
| yytext | parse-lex.c

## Global Function yyrestart()

`void yyrestart ( FILE* input_file )`

Prototyped in: | parse-lex.c
Calls: | yy_create_buffer() | parse-lex.c
| yy_init_buffer() | parse-lex.c
| yy_load_buffer_state() | parse-lex.c
Called by: | DocumentTheFile() | cxref.c
| input() | parse-lex.c
| yy_get_next_buffer() | parse-lex.c
| yylex() | parse-lex.c
References Variables: | yy_current_buffer | parse-lex.c
| yyin | parse-lex.c

## Local Function input()

`static int input ( void )`

Prototyped in: | parse-lex.c
Calls: | input() | parse-lex.c
| yy_get_next_buffer() | parse-lex.c
| yyrestart() | parse-lex.c
Called by: | input() | parse-lex.c
References Variables: | yy_c_buf_p | parse-lex.c
| yy_current_buffer | parse-lex.c
| yy_did_buffer_switch_on_eof | parse-lex.c
| yy_hold_char | parse-lex.c
| yy_n_chars | parse-lex.c
| yyin | parse-lex.c
| yytext | parse-lex.c

## Local Function yy_fatal_error()

`static void yy_fatal_error ( const char msg[] )`

Prototyped in: | parse-lex.c
Calls: | exit(), fprintf()
Called by: | yy_create_buffer() | parse-lex.c
| yy_get_next_buffer() | parse-lex.c
| yy_scan_buffer() | parse-lex.c
| yy_scan_bytes() | parse-lex.c
| yylex() | parse-lex.c
| yyunput() | parse-lex.c

## Local Function yy_flex_alloc()

`static void* yy_flex_alloc ( yy_size_t size )`

Prototyped in: | parse-lex.c
Calls: | malloc()
Called by: | yy_create_buffer() | parse-lex.c
| yy_scan_buffer() | parse-lex.c
| yy_scan_bytes() | parse-lex.c

## Local Function yy_flex_free()

`static void yy_flex_free ( void* ptr )`

Prototyped in: | parse-lex.c
Calls: | free()
Called by: | yy_delete_buffer() | parse-lex.c

## Local Function yy_flex_realloc()

`static void* yy_flex_realloc ( void* ptr, yy_size_t size )`

Prototyped in: | parse-lex.c
Calls: | realloc()

## Local Function yy_get_next_buffer()

`static int yy_get_next_buffer ( void )`

Prototyped in: | parse-lex.c
Calls: | yy_fatal_error() | parse-lex.c
| yyrestart() | parse-lex.c
| _getc_inline(), ferror(), fread()
Called by: | input() | parse-lex.c
| yylex() | parse-lex.c
References Variables: | yy_c_buf_p | parse-lex.c
| yy_current_buffer | parse-lex.c
| yy_n_chars | parse-lex.c
| yyin | parse-lex.c
| yytext | parse-lex.c

## Local Function yy_get_previous_state()

`static yy_state_type yy_get_previous_state ( void )`

Prototyped in: | parse-lex.c
Called by: | yylex() | parse-lex.c
References Variables: | yy_base | parse-lex.c
| yy_c_buf_p | parse-lex.c
| yy_chk | parse-lex.c
| yy_def | parse-lex.c
| yy_ec | parse-lex.c
| yy_meta | parse-lex.c
| yy_nxt | parse-lex.c
| yy_start | parse-lex.c
| yy_state_buf | parse-lex.c
| yy_state_ptr | parse-lex.c
| yytext | parse-lex.c

## Local Function yy_try_NUL_trans()

`static yy_state_type yy_try_NUL_trans ( yy_state_type yy_current_state )`

Prototyped in: | parse-lex.c
Called by: | yylex() | parse-lex.c
References Variables: | yy_base | parse-lex.c
| yy_chk | parse-lex.c
| yy_def | parse-lex.c
| yy_meta | parse-lex.c
| yy_nxt | parse-lex.c
| yy_state_ptr | parse-lex.c

## Local Function yyunput()

`static void yyunput ( int c, char* yy_bp )`

Prototyped in: | parse-lex.c
Calls: | yy_fatal_error() | parse-lex.c
Called by: | yylex() | parse-lex.c
References Variables: | yy_c_buf_p | parse-lex.c
| yy_current_buffer | parse-lex.c
| yy_hold_char | parse-lex.c
| yy_n_chars | parse-lex.c
| yytext | parse-lex.c