Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

grammar_to_parser::basic_non_terminal< E, A > Class Template Reference

#include <non_terminal.h>

Inheritance diagram for grammar_to_parser::basic_non_terminal< E, A >:

grammar_to_parser::basic_object_parser< E, A > grammar_to_parser::basic_parser< E > grammar_to_parser::basic_choice< E, A > grammar_to_parser::basic_choice< char, A > grammar_to_parser::basic_choice< wchar_t, A > grammar_to_parser::basic_set< E, A > grammar_to_parser::basic_subset< E, A > xml_parser::basic_xml_element_parser< E, A > xml_parser::basic_xml_element_parser< char, A > xml_parser::basic_xml_element_parser< wchar_t, A > xml_parser::basic_xml_element_parser< wchar_t, address > List of all members.

Public Types

typedef basic_parser< E
>::parser_list 
parser_list
typedef basic_parser< E
>::parser_list_iterator 
parser_list_iterator

Public Member Functions

 basic_non_terminal ()
 Default constructor.
 basic_non_terminal (const A &obj)
 Constructor taking compound object.
 basic_non_terminal (const basic_non_terminal &rhs)
 Copy constructor.
 ~basic_non_terminal ()
 The destructor.
virtual unsigned long parse (const E *buf, const unsigned long buf_length)
virtual unsigned long parse (const E *buf, const unsigned long buf_length, basic_parser_strategy< E > &strategy)
virtual std::basic_istream<
E > & 
parse (std::basic_istream< E > &is)
virtual std::basic_ostream<
E > & 
format (std::basic_ostream< E > &os)
void invalidate ()

Protected Member Functions

virtual void prepare_symbols ()
 Obtains the list of symbols embedded in parsed object.
void prepare_for_parsing ()
 Obtains symbols from parsed object.
void prepare_for_formatting ()
 Obtains symbols from formatted object.

Protected Attributes

parser_list m_symbols
bool m_symbols_valid

Detailed Description

template<typename E, typename A>
class grammar_to_parser::basic_non_terminal< E, A >

The non_terminal - always defined as set of symbols in defined order. The parsing succeedes only if all of symbols are parsed. The parse method uses simple parsing algorithm for parsing language defined by non-left-recursive grammar. To use another strategies, like for parsing language defined by left-recursive context-free grammar, use the parse method and specify the third parameter - the strategy - which must be implemented by someone.


Member Function Documentation

template<typename E, typename A>
std::basic_ostream< E > & grammar_to_parser::basic_non_terminal< E, A >::format std::basic_ostream< E > &  os  )  [virtual]
 

Method formats all previously parsed or assigned data back into output stream. This is common format method for any composed parsers - is_formatted returns true if all valid composed objects were formatted succesfully

Implements grammar_to_parser::basic_parser< E >.

template<typename E, typename A>
void grammar_to_parser::basic_non_terminal< E, A >::invalidate  )  [inline, virtual]
 

Method removes all referenced symbols, as after deleting the parsed object all symbols become invalid

Reimplemented from grammar_to_parser::basic_object_parser< E, A >.

template<typename E, typename A>
std::basic_istream< E > & grammar_to_parser::basic_non_terminal< E, A >::parse std::basic_istream< E > &  is  )  [virtual]
 

This parse method is taking symbols from the begin of istream to the end, doesn't require that the whole input is parsed The input will be copied into parsed objects manipulated by

See also:
basic_object_parser.

Implements grammar_to_parser::basic_parser< E >.

Reimplemented in grammar_to_parser::basic_choice< E, A >, grammar_to_parser::basic_set< E, A >, grammar_to_parser::basic_subset< E, A >, grammar_to_parser::basic_choice< E, meta_char_choice< E > >, grammar_to_parser::basic_choice< E, follow_list< E > >, grammar_to_parser::basic_choice< E, bracket_expr_type >, grammar_to_parser::basic_choice< E, one_char_or_coll_elem_ere< E > >, grammar_to_parser::basic_choice< E, collating_choice< E > >, grammar_to_parser::basic_choice< E, ere_branch< E > >, grammar_to_parser::basic_choice< E, equivalence_class< E > >, grammar_to_parser::basic_choice< E, ere_dups< E > >, grammar_to_parser::basic_choice< E, ere_expression_no_dup >, grammar_to_parser::basic_choice< E, class_name< E > >, grammar_to_parser::basic_choice< E, special_chars< E > >, grammar_to_parser::basic_choice< E, ere_expression< E > >, grammar_to_parser::basic_choice< E, bracket_list< E > >, grammar_to_parser::basic_choice< E, collating_symbol< E > >, grammar_to_parser::basic_choice< E, extended_reg_exp< E > >, grammar_to_parser::basic_choice< E, single_expression< E > >, grammar_to_parser::basic_choice< E, ere_dupl_symbol< E > >, grammar_to_parser::basic_choice< E, range_expression< E > >, grammar_to_parser::basic_choice< E, expression_term< E > >, grammar_to_parser::basic_set< wchar_t, A >, grammar_to_parser::basic_set< char, A >, grammar_to_parser::basic_subset< wchar_t, A >, and grammar_to_parser::basic_subset< char, A >.

template<typename E, typename A>
unsigned long grammar_to_parser::basic_non_terminal< E, A >::parse const E *  buf,
const unsigned long  buf_length,
basic_parser_strategy< E > &  strategy
[virtual]
 

The method calls the proper strategy method - parse_all.

Reimplemented from grammar_to_parser::basic_parser< E >.

Reimplemented in grammar_to_parser::basic_choice< E, A >, grammar_to_parser::basic_choice< E, meta_char_choice< E > >, grammar_to_parser::basic_choice< E, follow_list< E > >, grammar_to_parser::basic_choice< E, bracket_expr_type >, grammar_to_parser::basic_choice< E, one_char_or_coll_elem_ere< E > >, grammar_to_parser::basic_choice< E, collating_choice< E > >, grammar_to_parser::basic_choice< E, ere_branch< E > >, grammar_to_parser::basic_choice< E, equivalence_class< E > >, grammar_to_parser::basic_choice< E, ere_dups< E > >, grammar_to_parser::basic_choice< E, ere_expression_no_dup >, grammar_to_parser::basic_choice< E, class_name< E > >, grammar_to_parser::basic_choice< E, special_chars< E > >, grammar_to_parser::basic_choice< E, ere_expression< E > >, grammar_to_parser::basic_choice< E, bracket_list< E > >, grammar_to_parser::basic_choice< E, collating_symbol< E > >, grammar_to_parser::basic_choice< E, extended_reg_exp< E > >, grammar_to_parser::basic_choice< E, single_expression< E > >, grammar_to_parser::basic_choice< E, ere_dupl_symbol< E > >, grammar_to_parser::basic_choice< E, range_expression< E > >, and grammar_to_parser::basic_choice< E, expression_term< E > >.

template<typename E, typename A>
unsigned long grammar_to_parser::basic_non_terminal< E, A >::parse const E *  buf,
const unsigned long  buf_length
[virtual]
 

This parse method is taking symbols from the begin of buffer to the end, doesn't require that the whole input is parsed. The input will be copied into parsed objects manipulated by

See also:
basic_object_parser, which inherits from auto_ptr.

Implements grammar_to_parser::basic_parser< E >.

Reimplemented in grammar_to_parser::basic_choice< E, A >, grammar_to_parser::basic_set< E, A >, grammar_to_parser::basic_subset< E, A >, grammar_to_parser::basic_choice< E, meta_char_choice< E > >, grammar_to_parser::basic_choice< E, follow_list< E > >, grammar_to_parser::basic_choice< E, bracket_expr_type >, grammar_to_parser::basic_choice< E, one_char_or_coll_elem_ere< E > >, grammar_to_parser::basic_choice< E, collating_choice< E > >, grammar_to_parser::basic_choice< E, ere_branch< E > >, grammar_to_parser::basic_choice< E, equivalence_class< E > >, grammar_to_parser::basic_choice< E, ere_dups< E > >, grammar_to_parser::basic_choice< E, ere_expression_no_dup >, grammar_to_parser::basic_choice< E, class_name< E > >, grammar_to_parser::basic_choice< E, special_chars< E > >, grammar_to_parser::basic_choice< E, ere_expression< E > >, grammar_to_parser::basic_choice< E, bracket_list< E > >, grammar_to_parser::basic_choice< E, collating_symbol< E > >, grammar_to_parser::basic_choice< E, extended_reg_exp< E > >, grammar_to_parser::basic_choice< E, single_expression< E > >, grammar_to_parser::basic_choice< E, ere_dupl_symbol< E > >, grammar_to_parser::basic_choice< E, range_expression< E > >, grammar_to_parser::basic_choice< E, expression_term< E > >, grammar_to_parser::basic_set< wchar_t, A >, grammar_to_parser::basic_set< char, A >, grammar_to_parser::basic_subset< wchar_t, A >, and grammar_to_parser::basic_subset< char, A >.


Member Data Documentation

template<typename E, typename A>
parser_list grammar_to_parser::basic_non_terminal< E, A >::m_symbols [protected]
 

The list of symbols defining the non terminal - symbols and their order is defined by parsed object manipulated by

See also:
object_parser

template<typename E, typename A>
bool grammar_to_parser::basic_non_terminal< E, A >::m_symbols_valid [protected]
 

Flag identifying whether embedded symbols were read from parsed object


The documentation for this class was generated from the following file:
Generated on Sun Jul 2 18:39:46 2006 for grammar2parser.kdevelop by  doxygen 1.4.1