#include <cppPreprocessor.h>
Inheritance diagram for CPPPreprocessor:
Public Types | |
typedef map< string, CPPManifest * > | Manifests |
typedef set< CPPFile > | ParsedFiles |
typedef set< string > | Includes |
Public Member Functions | |
CPPPreprocessor () | |
void | set_verbose (int verbose) |
Sets the verbosity level of the parser. | |
int | get_verbose () const |
Returns the verbosity level of the parser. | |
void | copy_filepos (const CPPPreprocessor &other) |
CPPFile | get_file () const |
int | get_line_number () const |
int | get_col_number () const |
CPPToken | get_next_token () |
void | warning (const string &message, int line=0, int col=0, CPPFile file=CPPFile()) |
void | error (const string &message, int line=0, int col=0, CPPFile file=CPPFile()) |
CPPCommentBlock * | get_comment_before (int line, CPPFile file) |
Returns the CPPCommentBlock immediately preceding the indicated line, if any. | |
int | get_warning_count () const |
int | get_error_count () const |
Public Attributes | |
Manifests | _manifests |
DSearchPath | _include_path |
DSearchPath | _system_include_path |
CPPComments | _comments |
ParsedFiles | _parsed_files |
Includes | _quote_includes |
Includes | _angle_includes |
bool | _resolve_identifiers |
int | _verbose |
Protected Member Functions | |
bool | init_cpp (const CPPFile &file) |
bool | init_const_expr (const string &expr) |
bool | init_type (const string &type) |
bool | push_file (const CPPFile &file) |
bool | push_string (const string &input, bool lock_position) |
string | expand_manifests (const string &input_expr) |
Given a string, expand all manifests within the string and return the new string. | |
CPPExpression * | parse_expr (const string &expr, CPPScope *current_scope, CPPScope *global_scope) |
Given a string, expand all manifests within the string and evaluate it as an expression. | |
Private Types | |
typedef list< InputFile > | Files |
enum | State { S_normal, S_eof, S_nested, S_end_nested } |
Private Member Functions | |
CPPToken | internal_get_next_token () |
int | skip_whitespace (int c) |
int | skip_comment (int c) |
int | skip_c_comment (int c) |
int | skip_cpp_comment (int c) |
int | process_directive (int c) |
int | get_preprocessor_command (int c, string &command) |
int | get_preprocessor_args (int c, string &args) |
void | handle_define_directive (const string &args, int first_line, int first_col, const CPPFile &first_file) |
void | handle_undef_directive (const string &args, int first_line, int first_col, const CPPFile &first_file) |
void | handle_ifdef_directive (const string &args, int first_line, int first_col, const CPPFile &first_file) |
void | handle_ifndef_directive (const string &args, int first_line, int first_col, const CPPFile &first_file) |
void | handle_if_directive (const string &args, int first_line, int first_col, const CPPFile &first_file) |
void | handle_include_directive (const string &args, int first_line, int first_col, const CPPFile &first_file) |
void | handle_error_directive (const string &args, int first_line, int first_col, const CPPFile &first_file) |
void | skip_false_if_block (bool consider_elifs) |
We come here when we fail an #if or an #ifdef test, or when we reach the #else clause to something we didn't fail. | |
CPPToken | get_quoted_char (int c) |
CPPToken | get_quoted_string (int c) |
CPPToken | get_identifier (int c) |
CPPToken | expand_manifest (const CPPManifest *manifest) |
void | extract_manifest_args (const string &name, int num_args, vector_string &args) |
void | expand_defined_function (string &expr, size_t q, size_t &p) |
void | expand_manifest_inline (string &expr, size_t q, size_t &p, const CPPManifest *manifest) |
void | extract_manifest_args_inline (const string &name, int num_args, vector_string &args, const string &expr, size_t &p) |
CPPToken | get_number (int c, int c2=0) |
string | scan_quoted (int c) |
bool | should_ignore_manifest (const CPPManifest *manifest) const |
Returns true if the manifest is one that is being ignored right now (presumably because we are presently expanding it). | |
bool | should_ignore_preprocessor () const |
Returns true if we should ignore any preprocessor directives (e.g. | |
int | get () |
void | unget (int c) |
CPPTemplateParameterList * | nested_parse_template_instantiation (CPPTemplateScope *scope) |
Recursively invokes yacc to parse the stuff within angle brackets that's the template instantiation part of an identifier. | |
void | skip_to_end_nested () |
This is an error-recovery function, called after returning from a nested parse. | |
void | skip_to_angle_bracket () |
This is an error-recovery function, called after returning from a nested parse. | |
Static Private Member Functions | |
int | check_keyword (const string &name) |
Private Attributes | |
Files | _files |
State | _state |
int | _paren_nesting |
bool | _angle_bracket_found |
bool | _start_of_line |
int | _unget |
int | _last_c |
bool | _last_cpp_comment |
bool | _save_comments |
vector< CPPToken > | _saved_tokens |
int | _warning_count |
int | _error_count |
|
Definition at line 196 of file cppPreprocessor.h. |
|
Definition at line 91 of file cppPreprocessor.h. |
|
Definition at line 80 of file cppPreprocessor.h. |
|
Definition at line 88 of file cppPreprocessor.h. |
|
Definition at line 199 of file cppPreprocessor.h. |
|
Definition at line 197 of file cppPreprocessor.cxx. |
|
Definition at line 2001 of file cppPreprocessor.cxx. |
|
Definition at line 255 of file cppPreprocessor.cxx. References _files. |
|
Definition at line 510 of file cppPreprocessor.cxx. References _error_count. Referenced by CPPIdentifier::get_scope(), and CPPIdentifier::is_tbd(). |
|
Definition at line 1783 of file cppPreprocessor.cxx. Referenced by push_string(). |
|
Definition at line 1680 of file cppPreprocessor.cxx. Referenced by skip_false_if_block(). |
|
Definition at line 1812 of file cppPreprocessor.cxx. Referenced by push_string(). |
|
Given a string, expand all manifests within the string and return the new string.
Definition at line 731 of file cppPreprocessor.cxx. References CPPExpressionParser::_expr, _verbose, current_scope, global_scope, NULL, and CPPExpressionParser::parse_expr(). Referenced by handle_undef_directive(). |
|
Definition at line 1713 of file cppPreprocessor.cxx. |
|
Definition at line 1833 of file cppPreprocessor.cxx. |
|
Definition at line 2203 of file cppPreprocessor.cxx. References _files, _saved_tokens, get_next_token(), indent(), S_end_nested, and S_eof. Referenced by get_quoted_string(), handle_error_directive(), handle_include_directive(), internal_get_next_token(), and process_directive(). |
|
Definition at line 300 of file cppPreprocessor.cxx. References _saved_tokens. Referenced by handle_error_directive(), handle_include_directive(), init_const_expr(), and set_verbose(). |
|
Returns the CPPCommentBlock immediately preceding the indicated line, if any. If there is no such comment, returns NULL. Definition at line 571 of file cppPreprocessor.cxx. References _saved_tokens, _state, push_string(), and S_normal. Referenced by CPPScope::set_current_vis(). |
|
Definition at line 554 of file cppPreprocessor.cxx. References _last_c, _saved_tokens, _state, push_file(), and S_normal. Referenced by CPPParser::is_fully_specified(), CPPExpressionParser::~CPPExpressionParser(), and CPPTypeParser::~CPPTypeParser(). |
|
Definition at line 270 of file cppPreprocessor.cxx. References _files. Referenced by handle_error_directive(), handle_include_directive(), init_const_expr(), and set_verbose(). |
|
Definition at line 1628 of file cppPreprocessor.cxx. |
|
Definition at line 285 of file cppPreprocessor.cxx. References _files. Referenced by handle_error_directive(), handle_include_directive(), init_const_expr(), and set_verbose(). |
|
Definition at line 315 of file cppPreprocessor.cxx. Referenced by get(). |
|
Definition at line 1890 of file cppPreprocessor.cxx. References cpp_longlong_keyword. |
|
Definition at line 1261 of file cppPreprocessor.cxx. Referenced by handle_include_directive(). |
|
Definition at line 1233 of file cppPreprocessor.cxx. References _manifests, and warning(). Referenced by handle_include_directive(). |
|
Definition at line 1589 of file cppPreprocessor.cxx. |
|
Definition at line 1612 of file cppPreprocessor.cxx. References get(). |
|
Returns the verbosity level of the parser.
Definition at line 243 of file cppPreprocessor.cxx. References _files. |
|
Definition at line 542 of file cppPreprocessor.cxx. References NULL. |
|
Definition at line 1298 of file cppPreprocessor.cxx. |
|
Definition at line 1513 of file cppPreprocessor.cxx. References _manifests, get(), get_col_number(), get_file(), and get_line_number(). |
|
Definition at line 1384 of file cppPreprocessor.cxx. References CPPFile::S_system. Referenced by handle_include_directive(). |
|
Definition at line 1345 of file cppPreprocessor.cxx. References _files, and _quote_includes. |
|
Definition at line 1364 of file cppPreprocessor.cxx. |
|
Definition at line 1420 of file cppPreprocessor.cxx. References _save_comments, _start_of_line, get(), get_col_number(), get_file(), get_line_number(), get_preprocessor_args(), get_preprocessor_command(), handle_if_directive(), and skip_comment(). |
|
Definition at line 1324 of file cppPreprocessor.cxx. References expand_manifests(). |
|
Definition at line 624 of file cppPreprocessor.cxx. References _files, get_col_number(), get_file(), get_line_number(), and indent(). Referenced by CPPExpressionParser::~CPPExpressionParser(). |
|
Definition at line 608 of file cppPreprocessor.cxx. References _last_c, _parsed_files, and _start_of_line. Referenced by CPPParser::is_fully_specified(). |
|
Definition at line 639 of file cppPreprocessor.cxx. References _files. Referenced by CPPTypeParser::~CPPTypeParser(). |
|
Definition at line 823 of file cppPreprocessor.cxx. References get(). |
|
Recursively invokes yacc to parse the stuff within angle brackets that's the template instantiation part of an identifier. This involves setting and restoring some state flags so we can return EOF when we reach the closing bracket. Definition at line 2271 of file cppPreprocessor.cxx. |
|
Given a string, expand all manifests within the string and evaluate it as an expression. Returns NULL if the string is not a valid expression. This is an internal support function for CPPPreprocessor; however, there is a public variant of this function defined for CPPParser. Definition at line 802 of file cppPreprocessor.cxx. Referenced by CPPParser::parse_file(). |
|
Definition at line 1177 of file cppPreprocessor.cxx. References get(), and skip_comment(). |
|
Definition at line 654 of file cppPreprocessor.cxx. References _files. Referenced by get_error_count(). |
|
Definition at line 685 of file cppPreprocessor.cxx. References _manifests, expand_defined_function(), expand_manifest_inline(), and size_t. Referenced by get_comment_before(). |
|
Definition at line 2070 of file cppPreprocessor.cxx. References _files. |
|
Sets the verbosity level of the parser. At 0, no warnings will be reported; at 1 or higher, expect to get spammed. Definition at line 230 of file cppPreprocessor.cxx. References _files, get_col_number(), get_file(), and get_line_number(). |
|
Returns true if the manifest is one that is being ignored right now (presumably because we are presently expanding it).
Definition at line 2160 of file cppPreprocessor.cxx. References CPPType::new_type(), NULL, skip_to_end_nested(), CPPSimpleType::T_unknown, and warning(). |
|
Returns true if we should ignore any preprocessor directives (e.g. we're presently expanding a manifest). Definition at line 2184 of file cppPreprocessor.cxx. References _angle_bracket_found, and _files. |
|
Definition at line 1060 of file cppPreprocessor.cxx. References _comments. |
|
Definition at line 1032 of file cppPreprocessor.cxx. Referenced by handle_include_directive(), and process_directive(). |
|
Definition at line 1123 of file cppPreprocessor.cxx. |
|
We come here when we fail an #if or an #ifdef test, or when we reach the #else clause to something we didn't fail. This function skips all text up until the matching #endif. Definition at line 1533 of file cppPreprocessor.cxx. References _manifests, and expand_manifest(). |
|
This is an error-recovery function, called after returning from a nested parse. If we haven't yet consumed the closing angle bracket on the template instantiation, keep consuming tokens until we do. Definition at line 2398 of file cppPreprocessor.cxx. |
|
This is an error-recovery function, called after returning from a nested parse. If the state is not S_end_nested, there was an error in parsing the nested tokens, and not all of the nested tokens may have been consumed. This function will consume the rest of the nested tokens. Definition at line 2362 of file cppPreprocessor.cxx. Referenced by should_ignore_manifest(). |
|
Definition at line 1004 of file cppPreprocessor.cxx. |
|
Definition at line 2248 of file cppPreprocessor.cxx. References _saved_tokens. |
|
Definition at line 484 of file cppPreprocessor.cxx. Referenced by extract_manifest_args(), get_preprocessor_command(), CPPDeclaration::get_template_scope(), CPPScope::is_fully_specified(), CPPStructType::is_incomplete(), and should_ignore_manifest(). |
|
Definition at line 204 of file cppPreprocessor.h. Referenced by should_ignore_preprocessor(). |
|
Definition at line 93 of file cppPreprocessor.h. |
|
Definition at line 86 of file cppPreprocessor.h. Referenced by skip_c_comment(). |
|
Definition at line 216 of file cppPreprocessor.h. Referenced by error(). |
|
Definition at line 197 of file cppPreprocessor.h. Referenced by copy_filepos(), get(), get_file(), get_line_number(), get_verbose(), handle_ifdef_directive(), init_const_expr(), init_type(), push_file(), scan_quoted(), set_verbose(), and should_ignore_preprocessor(). |
|
Definition at line 83 of file cppPreprocessor.h. |
|
Definition at line 209 of file cppPreprocessor.h. Referenced by get_error_count(), and init_cpp(). |
|
Definition at line 210 of file cppPreprocessor.h. |
|
Definition at line 81 of file cppPreprocessor.h. Referenced by get_preprocessor_command(), handle_error_directive(), push_string(), and skip_false_if_block(). |
|
Definition at line 203 of file cppPreprocessor.h. |
|
Definition at line 89 of file cppPreprocessor.h. Referenced by init_cpp(). |
|
Definition at line 92 of file cppPreprocessor.h. Referenced by handle_ifdef_directive(). |
|
Definition at line 100 of file cppPreprocessor.h. |
|
Definition at line 211 of file cppPreprocessor.h. Referenced by handle_include_directive(). |
|
Definition at line 213 of file cppPreprocessor.h. Referenced by get(), get_col_number(), get_comment_before(), get_error_count(), and unget(). |
|
Definition at line 206 of file cppPreprocessor.h. Referenced by handle_include_directive(), and init_cpp(). |
|
Definition at line 202 of file cppPreprocessor.h. Referenced by get_comment_before(), and get_error_count(). |
|
Definition at line 84 of file cppPreprocessor.h. |
|
Definition at line 207 of file cppPreprocessor.h. |
|
Definition at line 106 of file cppPreprocessor.h. Referenced by expand_manifests(). |
|
Definition at line 215 of file cppPreprocessor.h. |