PUMA Library Reference Manual
Loading...
Searching...
No Matches
Puma::InstantiationSyntax Class Reference

#include <InstantiationSyntax.h>

Inheritance diagram for Puma::InstantiationSyntax:

Public Member Functions

 InstantiationSyntax (InstantiationBuilder &, InstantiationSemantic &)
virtual void configure (Config &)
 Configure the syntactic analysis object.
InstantiationTokenSource & source () const
InstantiationTokenProvider & provider () const
virtual bool class_name ()
virtual bool enum_name ()
virtual bool template_name ()
virtual bool class_template_name ()
virtual bool namespace_name ()
virtual bool typedef_name ()
virtual bool template_id ()
virtual bool class_template_id ()
bool type_param_without_init ()
CTree * rule_type_param_without_init ()
bool non_type_param_without_init ()
CTree * rule_non_type_param_without_init ()
Public Member Functions inherited from Puma::CCSyntax
 CCSyntax (CCBuilder &, CCSemantic &)
virtual Grammar grammar () const
void config_skip_fct_body (bool s)
virtual bool original_ns_name ()
virtual bool namespace_alias ()
virtual bool literal ()
virtual bool prim_expr ()
virtual bool id_expr ()
virtual bool qual_id ()
virtual bool unqual_id ()
virtual bool colon_colon ()
virtual bool nested_name_spec ()
virtual bool nested_name_spec1 ()
virtual bool class_or_ns_name ()
virtual bool postfix_expr ()
virtual bool postfix_expr1 ()
virtual bool postfix_expr2 ()
virtual bool construct_expr ()
virtual bool pseudo_dtor_name ()
virtual bool unary_expr ()
virtual bool type_trait_expr ()
virtual bool new_expr ()
virtual bool new_placement ()
virtual bool new_type_id ()
virtual bool new_declarator ()
virtual bool direct_new_declarator ()
virtual bool direct_new_declarator1 ()
virtual bool new_init ()
virtual bool delete_expr ()
virtual bool pm_expr ()
virtual bool mul_expr ()
virtual bool rel_expr ()
virtual bool cond_expr ()
virtual bool ass_expr ()
virtual bool ass_expr1 ()
virtual bool const_expr ()
virtual bool stmt ()
virtual bool stmt_seq ()
virtual bool sub_stmt ()
virtual bool condition ()
virtual bool condition1 ()
virtual bool condition2 ()
virtual bool decl_stmt ()
virtual bool decl ()
virtual bool decl_check ()
virtual bool block_decl ()
virtual bool simple_decl ()
virtual bool decl_spec_seq1 ()
virtual bool misc_spec ()
virtual bool storage_class_spec ()
virtual bool fct_spec ()
virtual bool simple_type_spec ()
virtual bool type_name ()
virtual bool elaborated_type_spec ()
virtual bool enumerator_list ()
virtual bool enumerator_def ()
virtual bool linkage_spec ()
virtual bool namespace_def ()
virtual bool named_ns_def ()
virtual bool original_ns_def ()
virtual bool original_ns_def1 ()
virtual bool extension_ns_def ()
virtual bool extension_ns_def1 ()
virtual bool unnamed_ns_def ()
virtual bool unnamed_ns_def1 ()
virtual bool namespace_body ()
virtual bool ns_alias_def ()
virtual bool qual_ns_spec ()
virtual bool using_decl ()
virtual bool using_directive ()
virtual bool init_declarator ()
virtual bool direct_declarator1 ()
virtual bool array_delim ()
virtual bool ptr_operator ()
virtual bool declarator_id ()
virtual bool direct_abst_declarator ()
virtual bool param_decl_clause ()
CTree * rule_param_decl ()
virtual bool param_decl ()
CTree * rule_param_init ()
virtual bool param_init ()
CTree * rule_fct_def ()
virtual bool fct_def ()
CTree * rule_skipped_fct_body ()
virtual bool skipped_fct_body ()
CTree * rule_fct_body ()
virtual bool fct_body ()
CTree * rule_init ()
virtual bool init ()
CTree * rule_init_clause ()
virtual bool init_clause ()
CTree * rule_class_spec ()
virtual bool class_spec ()
virtual bool class_head ()
virtual bool class_head1 ()
CTree * rule_member_decl ()
virtual bool member_decl ()
CTree * rule_member_decl1 ()
virtual bool member_decl1 ()
CTree * rule_access_decl ()
virtual bool access_decl ()
CTree * rule_member_declarator ()
virtual bool member_declarator ()
CTree * rule_pure_spec ()
virtual bool pure_spec ()
CTree * rule_const_init ()
virtual bool const_init ()
CTree * rule_base_clause ()
virtual bool base_clause ()
CTree * rule_base_spec_list ()
virtual bool base_spec_list ()
CTree * rule_base_spec ()
virtual bool base_spec ()
CTree * rule_access_spec ()
virtual bool access_spec ()
virtual bool conv_fct_id ()
virtual bool conv_type_id ()
CTree * rule_conv_declarator ()
virtual bool conv_declarator ()
CTree * rule_ctor_init ()
virtual bool ctor_init ()
CTree * rule_mem_init_list ()
virtual bool mem_init_list ()
CTree * rule_mem_init ()
virtual bool mem_init ()
CTree * rule_mem_init_id ()
virtual bool mem_init_id ()
CTree * rule_oper_fct_id ()
virtual bool oper_fct_id ()
CTree * rule_template_key ()
virtual bool template_key ()
CTree * rule_template_decl ()
virtual bool template_decl ()
CTree * rule_member_template_decl ()
virtual bool member_template_decl ()
CTree * rule_template_param_list ()
virtual bool template_param_list ()
CTree * rule_template_param ()
virtual bool template_param ()
CTree * rule_type_param ()
virtual bool type_param ()
CTree * rule_non_type_param ()
virtual bool non_type_param ()
CTree * rule_template_id ()
CTree * rule_class_template_id ()
CTree * rule_template_arg_list ()
virtual bool template_arg_list ()
CTree * rule_template_arg ()
virtual bool template_arg ()
CTree * rule_template_type_arg ()
virtual bool template_type_arg ()
CTree * rule_template_non_type_arg ()
virtual bool template_non_type_arg ()
CTree * rule_template_template_arg ()
virtual bool template_template_arg ()
CTree * rule_explicit_instantiation ()
virtual bool explicit_instantiation ()
CTree * rule_explicit_specialization ()
virtual bool explicit_specialization ()
CTree * rule_try_block ()
virtual bool try_block ()
CTree * rule_fct_try_block ()
virtual bool fct_try_block ()
CTree * rule_handler_seq ()
virtual bool handler_seq ()
CTree * rule_handler ()
virtual bool handler ()
CTree * rule_exception_decl ()
virtual bool exception_decl ()
CTree * rule_throw_expr ()
virtual bool throw_expr ()
CTree * rule_exception_spec ()
virtual bool exception_spec ()
CTree * rule_type_id_list ()
virtual bool type_id_list ()
Public Member Functions inherited from Puma::CSyntax
 CSyntax (CBuilder &, CSemantic &)
virtual bool private_name ()
virtual bool identifier ()
virtual bool cmpd_str ()
virtual bool str_literal ()
virtual bool trans_unit ()
 Top parse rule to be reimplemented for a specific grammar.
virtual bool cmpd_literal ()
virtual bool expr_list ()
virtual bool unary_expr1 ()
virtual bool cast_expr ()
virtual bool cast_expr1 ()
virtual bool cast_expr2 ()
virtual bool offsetof_expr ()
virtual bool memb_designator ()
virtual bool add_expr ()
virtual bool shift_expr ()
virtual bool equ_expr ()
virtual bool and_expr ()
virtual bool excl_or_expr ()
virtual bool incl_or_expr ()
virtual bool log_and_expr ()
virtual bool log_or_expr ()
virtual bool expr ()
virtual bool label_stmt ()
virtual bool expr_stmt ()
virtual bool cmpd_stmt ()
virtual bool select_stmt ()
virtual bool iter_stmt ()
virtual bool for_init_stmt ()
virtual bool jump_stmt ()
virtual bool decl_seq ()
virtual bool decl_spec ()
virtual bool decl_spec_seq ()
virtual bool type_spec ()
virtual bool enum_key ()
virtual bool enum_spec ()
virtual bool enum_spec1 ()
virtual bool enumerator ()
virtual bool asm_def ()
virtual bool init_declarator_list ()
virtual bool init_declarator1 ()
virtual bool declarator ()
virtual bool direct_declarator ()
virtual bool identifier_list ()
virtual bool cv_qual_seq ()
virtual bool cv_qual ()
virtual bool type_id ()
virtual bool type_spec_seq ()
virtual bool type_spec_seq1 ()
virtual bool abst_declarator ()
virtual bool direct_abst_declarator1 ()
virtual bool param_decl_list ()
CTree * rule_param_decl ()
virtual bool param_decl1 ()
CTree * rule_fct_def ()
CTree * rule_arg_decl_seq ()
virtual bool arg_decl_seq ()
CTree * rule_fct_body ()
CTree * rule_init ()
CTree * rule_init_clause ()
CTree * rule_init_list ()
virtual bool init_list ()
CTree * rule_init_list_item ()
virtual bool init_list_item ()
CTree * rule_designation ()
virtual bool designation ()
CTree * rule_designator ()
virtual bool designator ()
CTree * rule_class_spec ()
virtual bool class_key ()
CTree * rule_member_spec ()
virtual bool member_spec ()
CTree * rule_member_decl ()
CTree * rule_member_declarator_list ()
virtual bool member_declarator_list ()
CTree * rule_member_declarator ()
Public Member Functions inherited from Puma::Syntax
pointcut parse_fct ()
 Interface for aspects that affect the syntax and parsing process.
pointcut check_fct ()
pointcut in_syntax ()
pointcut rule_exec ()
pointcut rule_call ()
pointcut rule_check ()
CTree * run (TokenProvider &tp)
 Start the parse process.
template<class T>
CTree * run (TokenProvider &tp, bool(T::*rule)())
 Start the parse process at a specific grammar rule.
TokenProvider * provider () const
 Get the token provider from which the parsed tokens are read.
Token * problem () const
 Get the last token that could not be parsed.
bool error () const
 Check if errors occured during the parse process.
bool look_ahead (int token_type, unsigned n=1)
 Look-ahead n core language tokens and check if the n-th token has the given type.
bool look_ahead (int *token_types, unsigned n=1)
 Look-ahead n core language tokens and check if the n-th token has one of the given types.
int look_ahead (unsigned n=1)
 Look-ahead one core language token.
bool consume ()
 Consume all tokens until the next core language token.
bool predict_1 (const tokenset &ts)
template<class T>
bool parse (CTree *(T::*rule)())
 Parse the given grammar rule.
template<class T>
bool seq (CTree *(T::*rule)())
 Parse a sequence of the given grammar rule.
template<class T>
bool seq (bool(T::*rule)())
 Parse a sequence of the given grammar rule.
template<class T>
bool list (CTree *(T::*rule)(), int separator, bool trailing_separator=false)
 Parse a sequence of rule-separator pairs.
template<class T>
bool list (CTree *(T::*rule)(), int *separators, bool trailing_separator=false)
 Parse a sequence of rule-separator pairs.
template<class T>
bool list (bool(T::*rule)(), int separator, bool trailing_separator=false)
 Parse a sequence of rule-separator pairs.
template<class T>
bool list (bool(T::*rule)(), int *separators, bool trailing_separator=false)
 Parse a sequence of rule-separator pairs.
template<class T>
bool catch_error (bool(T::*rule)(), const char *msg, int *finish_tokens, int *skip_tokens)
 Parse a grammar rule automatically catching parse errors.
bool parse (int token_type)
 Parse a token with the given type.
bool parse (int *token_types)
 Parse a token with one of the given types.
bool parse_token (int token_type)
 Parse a token with the given type.
bool opt (bool dummy) const
 Optional rule parsing.
Builder & builder () const
 Get the syntax tree builder.
Semantic & semantic () const
 Get the semantic analysis object.
State save_state ()
 Save the current parser state.
void forget_state ()
 Forget the saved parser state.
void restore_state ()
 Restore the saved parser state.
void restore_state (State state)
 Restore the saved parser state to the given state.
void set_state (State state)
 Overwrite the parser state with the given state.
bool accept (CTree *tree, State state)
 Accept the given syntax tree node.
CTree * accept (CTree *tree)
 Accept the given syntax tree node.
Token * locate_token ()
 Skip all non-core language tokens until the next core-language token is read.
void skip ()
 Skip the current token.
void skip_block (int start, int end, bool inclusive=true)
 Skip all tokens between start and end, including start and end token.
void skip_curly_block ()
 Skip all tokens between '{' and '}', including '{' and '}'.
void skip_round_block ()
 Skip all tokens between '(' and ')', including '(' and ')'.
bool parse_block (int start, int end)
 Parse all tokens between start and end, including start and end token.
bool parse_curly_block ()
 Parse all tokens between '{' and '}', including '{' and '}'.
bool parse_round_block ()
 Parse all tokens between '(' and ')', including '(' and ')'.
bool skip (int stop_token, bool inclusive=true)
 Skip all tokens until a token with the given type is read.
bool skip (int *stop_tokens, bool inclusive=true)
 Skip all tokens until a token with one of the given types is read.
bool is_in (int token_type, int *token_types) const
 Check if the given token type is in the set of given token types.

Protected Member Functions

InstantiationBuilder & builder () const
InstantiationSemantic & semantic () const
bool isRoot (int up) const
template<class NODE>
bool is (int up) const
Protected Member Functions inherited from Puma::CCSyntax
CCBuilder & builder () const
CCSemantic & semantic () const
virtual bool is_fct_def ()
virtual bool is_nested_name ()
virtual bool is_class_def ()
virtual bool is_tpl_id ()
virtual bool is_tpl_declarator_id ()
virtual bool is_ptr_to_fct ()
virtual bool is_nested (State)
virtual bool is_ass_expr ()
virtual void init_prim_types ()
virtual void init_cv_quals ()
virtual void init_explicit_instantiation ()
virtual void init_explicit_specialization ()
virtual void init_access_spec ()
virtual void init_oper_fct_id ()
virtual void init_template_key ()
virtual void init_template_id ()
virtual void init_class_template_id ()
void skip_param_init ()
void skip_ctor_init ()
void skip_fct_body ()
void skip_fct_try_block ()
void skip_const_expr ()
void skip_const_init ()
void get_search_scope (SearchScope &)
void set_search_scope (SearchScope &)
Protected Member Functions inherited from Puma::CSyntax
bool is_prim_type ()
bool is_cv_qual ()
virtual void init_class_spec ()
virtual void handle_directive ()
 Handle a compiler directive token.
Protected Member Functions inherited from Puma::Syntax
 Syntax (Builder &b, Semantic &s)
 Constructor.
virtual ~Syntax ()
 Destructor.

Additional Inherited Members

Public Types inherited from Puma::CSyntax
enum  Grammar {
  GRAMMAR_C ,
  GRAMMAR_CPLUSPLUS
}
Public Types inherited from Puma::Syntax
typedef std::bitset< TOK_NO > tokenset
Static Public Member Functions inherited from Puma::Syntax
template<typename SYNTAX, typename RULE>
static bool seq (SYNTAX &s)
 Parse a sequence of the given grammar rule by calling RULE::check() in a loop.
template<typename SYNTAX, typename RULE>
static bool list (SYNTAX &s, int sep, bool trailing_sep=false)
 Parse a sequence of rule-separator pairs by calling RULE::check() in a loop.
template<typename SYNTAX, typename RULE>
static bool list (SYNTAX &s, int *separators, bool trailing_sep=false)
 Parse a sequence of rule-separator pairs by calling RULE::check() in a loop.
template<class SYNTAX, class RULE>
static bool catch_error (SYNTAX &s, const char *msg, int *finish_tokens, int *skip_tokens)
 Parse a grammar rule automatically catching parse errors.
template<class RULE1, class RULE2, class SYNTAX>
static bool ambiguous (SYNTAX &s)
 First parse rule1 and if that rule fails discard all errors and parse the rule2.
Public Attributes inherited from Puma::Syntax
TokenProvider * token_provider
 Token provider for getting the tokens to parse.
Protected Attributes inherited from Puma::CSyntax
tokenset _prim_types
tokenset _cv_quals
tokenset _class_spec_1
Token * last_look_ahead_token
bool last_look_ahead_result

Constructor & Destructor Documentation

◆ InstantiationSyntax()

Puma::InstantiationSyntax::InstantiationSyntax ( InstantiationBuilder & ,
InstantiationSemantic &  )

Member Function Documentation

◆ builder()

InstantiationBuilder & Puma::InstantiationSyntax::builder ( ) const
protected

◆ class_name()

virtual bool Puma::InstantiationSyntax::class_name ( )
virtual

Reimplemented from Puma::CCSyntax.

◆ class_template_id()

virtual bool Puma::InstantiationSyntax::class_template_id ( )
virtual

Reimplemented from Puma::CCSyntax.

◆ class_template_name()

virtual bool Puma::InstantiationSyntax::class_template_name ( )
virtual

Reimplemented from Puma::CCSyntax.

◆ configure()

virtual void Puma::InstantiationSyntax::configure ( Config & c)
virtual

Configure the syntactic analysis object.

Parameters
cThe configuration object.

Reimplemented from Puma::CCSyntax.

◆ enum_name()

virtual bool Puma::InstantiationSyntax::enum_name ( )
virtual

Reimplemented from Puma::CCSyntax.

◆ is()

template<class NODE>
bool Puma::InstantiationSyntax::is ( int up) const
inlineprotected

◆ isRoot()

bool Puma::InstantiationSyntax::isRoot ( int up) const
protected

◆ namespace_name()

virtual bool Puma::InstantiationSyntax::namespace_name ( )
virtual

Reimplemented from Puma::CCSyntax.

◆ non_type_param_without_init()

bool Puma::InstantiationSyntax::non_type_param_without_init ( )

◆ provider()

InstantiationTokenProvider & Puma::InstantiationSyntax::provider ( ) const

◆ rule_non_type_param_without_init()

CTree * Puma::InstantiationSyntax::rule_non_type_param_without_init ( )

◆ rule_type_param_without_init()

CTree * Puma::InstantiationSyntax::rule_type_param_without_init ( )

◆ semantic()

InstantiationSemantic & Puma::InstantiationSyntax::semantic ( ) const
protected

◆ source()

InstantiationTokenSource & Puma::InstantiationSyntax::source ( ) const

◆ template_id()

virtual bool Puma::InstantiationSyntax::template_id ( )
virtual

Reimplemented from Puma::CCSyntax.

◆ template_name()

virtual bool Puma::InstantiationSyntax::template_name ( )
virtual

Reimplemented from Puma::CCSyntax.

◆ type_param_without_init()

bool Puma::InstantiationSyntax::type_param_without_init ( )

◆ typedef_name()

virtual bool Puma::InstantiationSyntax::typedef_name ( )
virtual

Reimplemented from Puma::CSyntax.