osprey/kg++fe/gnu/cpplex.c File Reference

#include "config.h"
#include "system.h"
#include "cpplib.h"
#include "cpphash.h"

Include dependency graph for cpplex.c:

Go to the source code of this file.

Data Types

type  token_spelling

Defines

#define OP(e, s)   { SPELL_OPERATOR, U s },
#define TK(e, s)   { s, U STRINGX (e) },
#define TOKEN_SPELL(token)   (token_spellings[(token)->type].category)
#define TOKEN_NAME(token)   (token_spellings[(token)->type].name)
#define BACKUP()   do {buffer->cur = buffer->backup_to;} while (0)
#define IF_NEXT_IS(CHAR, THEN_TYPE, ELSE_TYPE)
#define MIN_BUFF_SIZE   8000
#define BUFF_SIZE_UPPER_BOUND(MIN_SIZE)   (MIN_BUFF_SIZE + (MIN_SIZE) * 3 / 2)
#define EXTENDED_BUFF_SIZE(BUFF, MIN_EXTRA)   (MIN_EXTRA + ((BUFF)->limit - (BUFF)->cur) * 2)

Enumerations

enum  spell_type {
  SPELL_OPERATOR = 0, SPELL_CHAR, SPELL_IDENT, SPELL_NUMBER,
  SPELL_STRING, SPELL_NONE, SPELL_OPERATOR = 0, SPELL_CHAR,
  SPELL_IDENT, SPELL_NUMBER, SPELL_STRING, SPELL_NONE,
  SPELL_OPERATOR = 0, SPELL_IDENT, SPELL_LITERAL, SPELL_NONE,
  SPELL_OPERATOR = 0, SPELL_IDENT, SPELL_LITERAL, SPELL_NONE
}

Functions/Subroutines

static void handle_newline PARAMS ((cpp_reader *))
static int skip_whitespace PARAMS ((cpp_reader *, cppchar_t))
static uchar *parse_slow PARAMS ((cpp_reader *, const uchar *, int, unsigned int *))
static void parse_number PARAMS ((cpp_reader *, cpp_string *, int))
static int unescaped_terminator_p PARAMS ((cpp_reader *, const uchar *))
static void parse_string PARAMS ((cpp_reader *, cpp_token *, cppchar_t))
static void save_comment PARAMS ((cpp_reader *, cpp_token *, const uchar *, cppchar_t))
static int name_p PARAMS ((cpp_reader *, const cpp_string *))
static int maybe_read_ucs PARAMS ((cpp_reader *, const unsigned char **, const unsigned char *, cppchar_t *))
static tokenrun *next_tokenrun PARAMS ((tokenrun *))
static unsigned int hex_digit_value PARAMS ((unsigned int))
static _cpp_buff *new_buff PARAMS ((size_t))
int cpp_ideq (cpp_token *token, const char *string) const
static void handle_newline (cpp_reader *pfile)
static bool trigraph_p (cpp_reader *pfile)
static cppchar_t skip_escaped_newlines (cpp_reader *pfile)
static cppchar_t get_effective_char (cpp_reader *pfile)
static int skip_block_comment (cpp_reader *pfile)
static int skip_line_comment (cpp_reader *pfile)
static void adjust_column (cpp_reader *pfile)
static int skip_whitespace (cpp_reader *pfile, cppchar_t c)
static int name_p (cpp_reader *pfile, const cpp_string *string)
static cpp_hashnodeparse_identifier (cpp_reader *pfile)
static ucharparse_slow (cpp_reader *pfile, const uchar *cur, int number_p, unsigned int *plen)
static void parse_number (cpp_reader *pfile, cpp_string *number, int leading_period)
static int unescaped_terminator_p (cpp_reader *pfile, const unsigned char *dest)
static void parse_string (cpp_reader *pfile, cpp_token *token, cppchar_t terminator)
static void save_comment (cpp_reader *pfile, cpp_token *token, const unsigned char *from, cppchar_t type)
void _cpp_init_tokenrun (tokenrun *run, unsigned int count)
static tokenrunnext_tokenrun (tokenrun *run)
cpp_token_cpp_temp_token (cpp_reader *pfile)
const cpp_token_cpp_lex_token (cpp_reader *pfile)
static bool continue_after_nul (cpp_reader *pfile)
cpp_token_cpp_lex_direct (cpp_reader *pfile)
unsigned int cpp_token_len (cpp_token *token) const
unsigned char * cpp_spell_token (cpp_reader *pfile, const cpp_token *token, unsigned char *buffer)
unsigned char * cpp_token_as_text (cpp_reader *pfile, const cpp_token *token)
const char * cpp_type2name (enum cpp_ttype type)
void cpp_output_token (cpp_token *token, FILE *fp) const
int _cpp_equiv_tokens (cpp_token *a, cpp_token *b) const
int cpp_avoid_paste (cpp_reader *pfile, const cpp_token *token1, const cpp_token *token2)
void cpp_output_line (cpp_reader *pfile, FILE *fp)
static unsigned int hex_digit_value (unsigned int c)
static int maybe_read_ucs (cpp_reader *pfile, const unsigned char **pstr, const unsigned char *limit, cppchar_t *pc)
cppchar_t cpp_parse_escape (cpp_reader *pfile, const unsigned char **pstr, const unsigned char *limit, int wide)
cppchar_t cpp_interpret_charconst (cpp_reader *pfile, const cpp_token *token, unsigned int *pchars_seen, int *unsignedp)
static _cpp_buffnew_buff (size_t len)
void _cpp_release_buff (cpp_reader *pfile, _cpp_buff *buff)
_cpp_buff_cpp_get_buff (cpp_reader *pfile, size_t min_size)
_cpp_buff_cpp_append_extend_buff (cpp_reader *pfile, _cpp_buff *buff, size_t min_extra)
void _cpp_extend_buff (cpp_reader *pfile, _cpp_buff **pbuff, size_t min_extra)
void _cpp_free_buff (_cpp_buff *buff)
unsigned char * _cpp_unaligned_alloc (cpp_reader *pfile, size_t len)
unsigned char * _cpp_aligned_alloc (cpp_reader *pfile, size_t len)

Variables

static const unsigned char *const digraph_spellings []
static struct token_spelling token_spellings [N_TTYPES] = { TTYPE_TABLE }


Define Documentation

 
#define BACKUP (  )     do {buffer->cur = buffer->backup_to;} while (0)

Definition at line 71 of file cpplex.c.

Referenced by _cpp_lex_direct(), and parse_slow().

#define BUFF_SIZE_UPPER_BOUND ( MIN_SIZE   )     (MIN_BUFF_SIZE + (MIN_SIZE) * 3 / 2)

Definition at line 2176 of file cpplex.c.

Referenced by _cpp_get_buff().

#define EXTENDED_BUFF_SIZE ( BUFF,
MIN_EXTRA   )     (MIN_EXTRA + ((BUFF)->limit - (BUFF)->cur) * 2)

Definition at line 2177 of file cpplex.c.

Referenced by _cpp_append_extend_buff(), and _cpp_extend_buff().

#define IF_NEXT_IS ( CHAR,
THEN_TYPE,
ELSE_TYPE   ) 

Value:

do {            \
    if (get_effective_char (pfile) == CHAR) \
      result->type = THEN_TYPE;     \
    else          \
      {           \
        BACKUP ();        \
        result->type = ELSE_TYPE;   \
      }           \
  } while (0)

Definition at line 1075 of file cpplex.c.

Referenced by _cpp_lex_direct().

#define MIN_BUFF_SIZE   8000

Definition at line 2175 of file cpplex.c.

Referenced by new_buff().

#define OP ( e,
 )     { SPELL_OPERATOR, U s },

Definition at line 63 of file cpplex.c.

#define TK ( e,
 )     { s, U STRINGX (e) },

Definition at line 64 of file cpplex.c.

#define TOKEN_NAME ( token   )     (token_spellings[(token)->type].name)

Definition at line 70 of file cpplex.c.

Referenced by cpp_output_token(), and cpp_spell_token().

#define TOKEN_SPELL ( token   )     (token_spellings[(token)->type].category)


Enumeration Type Documentation

enum spell_type

Enumerator:
SPELL_OPERATOR 
SPELL_CHAR 
SPELL_IDENT 
SPELL_NUMBER 
SPELL_STRING 
SPELL_NONE 
SPELL_OPERATOR 
SPELL_CHAR 
SPELL_IDENT 
SPELL_NUMBER 
SPELL_STRING 
SPELL_NONE 
SPELL_OPERATOR 
SPELL_IDENT 
SPELL_LITERAL 
SPELL_NONE 
SPELL_OPERATOR 
SPELL_IDENT 
SPELL_LITERAL 
SPELL_NONE 

Definition at line 44 of file cpplex.c.


Function Documentation

unsigned char* _cpp_aligned_alloc ( cpp_reader pfile,
size_t  len 
)

Definition at line 2332 of file cpplex.c.

Referenced by _cpp_create_definition(), insert_pragma_entry(), and new_pragma_entry().

_cpp_buff* _cpp_append_extend_buff ( cpp_reader pfile,
_cpp_buff buff,
size_t  min_extra 
)

Definition at line 2253 of file cpplex.c.

Referenced by collect_args().

int _cpp_equiv_tokens ( cpp_token a,
cpp_token b 
) const

void _cpp_extend_buff ( cpp_reader pfile,
_cpp_buff **  pbuff,
size_t  min_extra 
)

void _cpp_free_buff ( _cpp_buff buff  ) 

Definition at line 2288 of file cpplex.c.

_cpp_buff* _cpp_get_buff ( cpp_reader pfile,
size_t  min_size 
)

void _cpp_init_tokenrun ( tokenrun run,
unsigned int  count 
)

Definition at line 791 of file cpplex.c.

Referenced by next_tokenrun().

cpp_token* _cpp_lex_direct ( cpp_reader pfile  ) 

Definition at line 1098 of file cpplex.c.

Referenced by _cpp_lex_token(), builtin_macro(), lex_expansion_token(), and paste_tokens().

const cpp_token* _cpp_lex_token ( cpp_reader pfile  ) 

void _cpp_release_buff ( cpp_reader pfile,
_cpp_buff buff 
)

cpp_token* _cpp_temp_token ( cpp_reader pfile  ) 

unsigned char* _cpp_unaligned_alloc ( cpp_reader pfile,
size_t  len 
)

static void adjust_column ( cpp_reader pfile  )  [static]

Definition at line 371 of file cpplex.c.

References col, cpp_buffer::col_adjust, CPP_BUF_COL, and CPP_OPTION.

Referenced by skip_block_comment(), and skip_whitespace().

static bool continue_after_nul ( cpp_reader pfile  )  [static]

int cpp_avoid_paste ( cpp_reader pfile,
const cpp_token token1,
const cpp_token token2 
)

Definition at line 1733 of file cpplex.c.

Referenced by scan_translation_unit().

int cpp_ideq ( cpp_token token,
const char *  string 
) const

Definition at line 104 of file cpplex.c.

References NODE_NAME, uchar, and ustrcmp().

Referenced by read_scan_file(), recognized_extern(), and scan_decls().

cppchar_t cpp_interpret_charconst ( cpp_reader pfile,
const cpp_token token,
unsigned int *  pchars_seen,
int *  unsignedp 
)

Definition at line 2057 of file cpplex.c.

Referenced by eval_token(), and lex_charconst().

void cpp_output_line ( cpp_reader pfile,
FILE fp 
)

Definition at line 1788 of file cpplex.c.

Referenced by cb_def_pragma(), and do_diagnostic().

void cpp_output_token ( cpp_token token,
FILE fp 
) const

cppchar_t cpp_parse_escape ( cpp_reader pfile,
const unsigned char **  pstr,
const unsigned char *  limit,
int  wide 
)

Definition at line 1912 of file cpplex.c.

Referenced by cpp_interpret_charconst(), dequote_string(), and lex_string().

unsigned char* cpp_spell_token ( cpp_reader pfile,
const cpp_token token,
unsigned char *  buffer 
)

unsigned char* cpp_token_as_text ( cpp_reader pfile,
const cpp_token token 
)

unsigned int cpp_token_len ( cpp_token token  )  const

const char* cpp_type2name ( enum cpp_ttype  type  ) 

Definition at line 1625 of file cpplex.c.

Referenced by c_parse_error().

static cppchar_t get_effective_char ( cpp_reader pfile  )  [static]

Definition at line 252 of file cpplex.c.

References __builtin_expect, cpp_buffer::backup_to, cpp_buffer::cur, next, and skip_escaped_newlines().

Referenced by _cpp_lex_direct().

static void handle_newline ( cpp_reader pfile  )  [static]

static unsigned int hex_digit_value ( unsigned int  c  )  [static]

Definition at line 1808 of file cpplex.c.

References abort, hex_p, and hex_value.

Referenced by cpp_parse_escape(), and maybe_read_ucs().

static int maybe_read_ucs ( cpp_reader pfile,
const unsigned char **  pstr,
const unsigned char *  limit,
cppchar_t pc 
) [static]

Definition at line 1840 of file cpplex.c.

References cpp_error(), CPP_OPTION, CPP_WTRADITIONAL, DL_ERROR, DL_WARNING, hex_digit_value(), ISXDIGIT, length, and p.

Referenced by cpp_parse_escape().

static int name_p ( cpp_reader pfile,
const cpp_string string 
) [static]

Definition at line 430 of file cpplex.c.

References i, is_idchar, and cpp_string::text.

static _cpp_buff* new_buff ( size_t  len  )  [static]

static tokenrun* next_tokenrun ( tokenrun run  )  [static]

Definition at line 802 of file cpplex.c.

References _cpp_init_tokenrun(), tokenrun::next, NULL, and xnew.

Referenced by _cpp_lex_token(), and _cpp_temp_token().

static _cpp_buff* new_buff PARAMS ( (size_t  )  [static]

static unsigned int hex_digit_value PARAMS ( (unsigned int)   )  [static]

static tokenrun* next_tokenrun PARAMS ( (tokenrun *)   )  [static]

static int maybe_read_ucs PARAMS ( (cpp_reader *, const unsigned char **, const unsigned char *, cppchar_t *)   )  [static]

static int name_p PARAMS ( (cpp_reader *, const cpp_string *)   )  [static]

static void save_comment PARAMS ( (cpp_reader *, cpp_token *, const uchar *, cppchar_t  )  [static]

static void parse_string PARAMS ( (cpp_reader *, cpp_token *, cppchar_t  )  [static]

static int unescaped_terminator_p PARAMS ( (cpp_reader *, const uchar *)   )  [static]

static void parse_number PARAMS ( (cpp_reader *, cpp_string *, int)   )  [static]

static uchar* parse_slow PARAMS ( (cpp_reader *, const uchar *, int, unsigned int *)   )  [static]

static int skip_whitespace PARAMS ( (cpp_reader *, cppchar_t  )  [static]

static void handle_newline PARAMS ( (cpp_reader *)   )  [static]

static cpp_hashnode* parse_identifier ( cpp_reader pfile  )  [static]

static void parse_number ( cpp_reader pfile,
cpp_string number,
int  leading_period 
) [static]

static uchar* parse_slow ( cpp_reader pfile,
const uchar cur,
int  number_p,
unsigned int *  plen 
) [static]

static void parse_string ( cpp_reader pfile,
cpp_token token,
cppchar_t  terminator 
) [static]

static void save_comment ( cpp_reader pfile,
cpp_token token,
const unsigned char *  from,
cppchar_t  type 
) [static]

static int skip_block_comment ( cpp_reader pfile  )  [static]

static cppchar_t skip_escaped_newlines ( cpp_reader pfile  )  [static]

static int skip_line_comment ( cpp_reader pfile  )  [static]

static int skip_whitespace ( cpp_reader pfile,
cppchar_t  c 
) [static]

static bool trigraph_p ( cpp_reader pfile  )  [static]

static int unescaped_terminator_p ( cpp_reader pfile,
const unsigned char *  dest 
) [static]

Definition at line 615 of file cpplex.c.

References BUFF_FRONT, start, and obstack::temp.

Referenced by parse_string().


Variable Documentation

const unsigned char* const digraph_spellings[] [static]

Initial value:

{ U"%:", U"%:%:", U"<:", U":>", U"<%", U"%>" }

Definition at line 60 of file cpplex.c.

Referenced by cpp_avoid_paste(), cpp_output_token(), and cpp_spell_token().

struct token_spelling token_spellings[N_TTYPES] = { TTYPE_TABLE } [static]

Definition at line 65 of file cpplex.c.


Generated on Wed Apr 8 15:30:17 2009 for Open64 by  doxygen 1.5.6