namespace Synopsis
class Parser

C++ Parser

This parser is a LL(k) parser with ad hoc rules such as backtracking.

<name>() is the grammer rule for a non-terminal <name>. opt_<name>() is the grammer rule for an optional non-terminal <name>. is_<name>() looks ahead and returns true if the next symbol is <name>.

Public Classes Summary:
class Error
references
source code

Error is used to cache parse errors encountered during the execution of the parse method.

Public Typedefs Summary:
std::vector<Error*> ErrorList
references
source code
Public Enums Summary:
RuleSet CXX, GCC, MSVC
references
source code

RuleSet defines non-standard optional rules that can be chosen at runtime.

Public Member functions Summary:
 constructor Parser(Lexer& lexer, SymbolFactory& symbols, int ruleset = CXX | GCC)
references
source code
 destructor ~Parser()
references
source code
const ErrorList& errors() const
references
source code
 unsigned long origin(const char*, std::string&) const
source code

Return the origin of the given pointer (filename and line number)

references
source code
Private Classes Summary:
references
source code

A StatusGuard manages a tentative parse.

Private Structs Summary:
struct ScopeGuard
source code
Private Enums Summary:
DeclKind kDeclarator, kArgDeclarator, kCastDeclarator
references
source code
TemplateDeclKind tdk_unknown, tdk_decl, tdk_instantiation, tdk_specialization, num_tdks
references
source code
Private Member function templates Summary:
template <typename T>
 bool declare(T*)
references
source code
Private Member functions Summary:
 bool mark_error()
references
source code
 void show_message_head(const char*)
references
source code
source code
source code
source code
source code
references
source code
source code
source code
source code
source code
source code
source code
source code
source code
source code
source code
source code

template-parameter-list:

source code

template-parameter:

source code

type-parameter:

source code

GNU extension: extern-template-decl:

source code
source code
source code
source code
source code

condition:

references
source code
 bool is_ptr_to_member(int)
references
source code
source code
source code

storage-spec:

source code

cv-qualifier:

source code
source code
source code
 bool init_declarator_list(PTree::Node*&, PTree::Encoding&, bool, bool = false)
source code

[gram.dcl.decl]

source code
 bool declarator(PTree::Node*&, DeclKind, bool, PTree::Encoding&, PTree::Encoding&, bool, bool = false)
source code
source code
source code
source code
source code
source code
source code
source code
source code
source code
source code
source code
source code

parameter-declaration:

source code
source code
source code
source code
source code
source code
source code

base-clause:

source code
source code
source code
source code
source code

expression:

source code

assignment-expression:

source code

conditional-expression:

source code

logical-or-expression:

source code

logical-and-expression:

source code

inclusive-or-expression:

source code

exclusive-or-expression:

source code

and-expression:

source code

equality-expression:

source code

relational-expression:

source code

shift-expression:

source code

additive-expression:

source code

multiplicative-expression:

 bool pm_expr(PTree::Node*&)
source code

pm-expression:

source code

cast-expression:

 bool type_id(PTree::Node*&)
source code

type-id:

source code
source code

unary-expression:

source code

throw-expression:

source code

sizeof-expression:

source code
source code

typeid-expression:

source code
source code
source code
source code
source code
source code
source code
source code
source code
source code
source code
source code
references
source code
source code

function-body:

 bool compound_statement(PTree::Block*&, bool create_scope = false)
source code

compound-statement:

source code
source code

if-statement:

source code

switch-statement:

source code

while-statement:

source code

do-statement:

source code
source code

try-block:

source code
source code
source code
source code
references
source code
 void skip_to(Token::Type token)
source code
 bool more_var_name()
references
source code
Private Data members Summary:
references
source code
references
source code
references
source code
references
source code

Record whether the current scope is valid.

references
source code
references
source code
references
source code

If true, > is interpreted as ther greater-than operator.

references
source code
Enumerators Summary:
Public Classes Details:
class Error
references
source code

Error is used to cache parse errors encountered during the execution of the parse method.

Public Enums Details:
enum RuleSet
CXX = 0x01
GCC = 0x02
MSVC = 0x04

RuleSet defines non-standard optional rules that can be chosen at runtime.

Public Member functions Details:
 unsigned long origin(const char*, std::string&) const
source code

Return the origin of the given pointer (filename and line number)

Private Classes Details:
references
source code

A StatusGuard manages a tentative parse. All actions invoked after its instantiation will be rolled back in the destructor unless 'commit' has been called before.

Private Member functions Details:
source code

template-parameter-list:

  • template-parameter
  • template-parameter-list , template-parameter
source code

template-parameter:

  • type-parameter
  • parameter-declaration
source code

type-parameter:

  • class identifier [opt]
  • class identifier [opt] = type-id
  • typename identifier [opt]
  • typename identifier [opt] = type-id
  • template < template-parameter-list > class identifier [opt]
  • template < template-parameter-list > class identifier [opt] = id-expression
source code

GNU extension: extern-template-decl:

  • extern template declaration
source code

condition:

  • expression
  • type-specifier-seq declarator = assignment-expression
source code

storage-spec:

  • empty
  • static
  • extern
  • auto
  • register
  • mutable
source code

cv-qualifier:

  • empty
  • const
  • volatile
 bool init_declarator_list(PTree::Node*&, PTree::Encoding&, bool, bool = false)
source code

[gram.dcl.decl]

source code

parameter-declaration:

  • decl-specifier-seq declarator
  • decl-specifier-seq declarator = assignment-expression
  • decl-specifier-seq abstract-declarator [opt]
  • decl-specifier-seq abstract-declarator [opt] = assignment-expression
source code

base-clause:

  • : base-specifier-list

base-specifier-list:

  • base-specifier
  • base-specifier-list , base-specifier

base-specifier:

  • virtual access-specifier [opt] :: [opt] nested-name-specifier [opt] class-name
  • access-specifier virtual [opt] :: [opt] nested-name-specifier [opt] class-name
source code

expression:

  • assignment-expression
  • expression , assignment-expression
source code

assignment-expression:

  • conditional-expression
  • logical-or-expression assignment-operator assignment-expression
  • throw-expression
source code

conditional-expression:

  • logical-or-expression
  • logical-or-expression ? expression : assignment-expression
source code

logical-or-expression:

  • logical-and-expression
  • logical-or-expression || logical-and-expression
source code

logical-and-expression:

  • inclusive-or-expression
  • logical-and-expr && inclusive-or-expression
source code

inclusive-or-expression:

  • exclusive-or-expression
  • inclusive-or-expression | exclusive-or-expression
source code

exclusive-or-expression:

  • and-expression
  • exclusive-or-expression ^ and-expression
source code

and-expression:

  • equality-expression
  • and-expression & equality-expression
source code

equality-expression:

  • relational-expression
  • equality-expression == relational-expression
  • equality-expression != relational-expression
source code

relational-expression:

  • shift-expression
  • relational-expression < shift-expression
  • relational-expression > shift-expression
  • relational-expression <= shift-expression
  • relational-expression >= shift-expression
source code

shift-expression:

  • additive-expression
  • shift-expression << additive-expression
  • shift-expression >> additive-expression
source code

additive-expression:

  • multiplicative-expression
  • additive-expression + multiplicative-expression
  • additive-expression - multiplicative-expression
source code

multiplicative-expression:

  • pm-expression
  • multiplicative-expression * pm-expression
  • multiplicative-expression / pm-expression
  • multiplicative-expression % pm-expression
 bool pm_expr(PTree::Node*&)
source code

pm-expression:

  • cast-expression
  • pm-expression .* cast-expression
  • pm-expression ->* cast-expression
source code

cast-expression:

  • unary-expression
  • ( type-id ) cast-expression
 bool type_id(PTree::Node*&)
source code

type-id:

  • type-specifier-seq abstract-declarator [opt]
source code

unary-expression:

  • postfix-expression
  • ++ cast-expression
  • -- cast-expression
  • unary-operator cast-expression
  • sizeof unary-expression
  • sizeof ( unary-expression )
  • new-expression
  • delete-expression

unary-operator:

  • *
  • &
  • +
  • -
  • !
  • ~
source code

throw-expression:

  • throw assignment-expression
source code

sizeof-expression:

  • sizeof unary-expression
  • sizeof ( type-id )
source code

typeid-expression:

  • typeid ( type-id )
  • typeid ( expression )
source code

function-body:

  • compound-statement
 bool compound_statement(PTree::Block*&, bool create_scope = false)
source code

compound-statement:

  • { statement [opt] }
source code

if-statement:

  • if ( condition ) statement
  • if ( condition ) statement else statement
source code

switch-statement:

  • switch ( condition ) statement
source code

while-statement:

  • while ( condition ) statement
source code

do-statement:

  • do statement while ( condition ) ;
source code

try-block:

  • try compound-statement handler-seq

handler-seq:

  • handler handler-seq [opt]

handler:

  • catch ( exception-declaration ) compound-statement

exception-declaration:

  • type-specifier-seq declarator
  • type-specifier-seq abstract-declarator
  • type-specifier-seq
  • ...
Private Data members Details:
references
source code

Record whether the current scope is valid. This allows the parser to continue parsing even after it was unable to enter a scope (such as in a function definition with a qualified name that wasn't declared before).

references
source code

If true, > is interpreted as ther greater-than operator. If false, it marks the end of a template-id or template-parameter-list.