Boost C++ 库

...世界上最受尊敬和专业设计的 C++ 库项目之一。 Herb SutterAndrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

结构体模板符号

boost::parser::symbols

概要

// In header: <boost/parser/parser.hpp>

template<typename T> 
struct symbols : public boost::parser::parser_interface< symbol_parser< T > > {

  // public member functions
  symbols();
  symbols(char const *);
  symbols(std::initializer_list< std::pair< std::string_view, T > >);
  symbols(char const *, 
          std::initializer_list< std::pair< std::string_view, T > >);
  void insert_for_next_parse(std::string_view, T);
  void erase_for_next_parse(std::string_view);
  void clear_for_next_parse();
  template<typename Context> 
    void insert_for_next_parse(Context const &, std::string_view, T);
  template<typename Context> 
    void erase_for_next_parse(Context const &, std::string_view);
  template<typename Context> void clear_for_next_parse(Context const &);
  template<typename Context> 
    unspecified find(Context const &, std::string_view) const;
  template<typename Context> 
    void insert(Context const &, std::string_view, T) const;
  template<typename Context> 
    void erase(Context const &, std::string_view) const;
  template<typename Context> void clear(Context const &) const;
};

描述

symbols<T> 表示符号表解析器的初始状态,该解析器生成类型为 T 的属性。符号表中的条目可以在解析期间更改,但这些更改不会影响 symbols<T> 对象本身;所有更改都发生在解析上下文中的符号表副本中。对于在每次解析期间都应使用的表条目,请通过 add()operator() 添加条目。对于解析过程中的更改,请使用 insert()erase()

symbols 公有成员函数

  1. symbols();
  2. symbols(char const * diagnostic_text);
  3. symbols(std::initializer_list< std::pair< std::string_view, T > > il);
  4. symbols(char const * diagnostic_text, 
            std::initializer_list< std::pair< std::string_view, T > > il);
  5. void insert_for_next_parse(std::string_view str, T x);

    插入一个条目,该条目由要匹配的 UTF-8 字符串 str 和关联的属性 x 组成,添加到 *this。添加该条目以供所有后续顶层解析使用。在当前顶层解析期间的后续查找不一定会匹配 str

  6. void erase_for_next_parse(std::string_view str);

    *this 中删除 UTF-8 匹配字符串为 str 的条目。该条目将不再可用于所有后续顶层解析。 str 不会从当前顶层解析中匹配的符号中删除。

  7. void clear_for_next_parse();

    从解析上下文 context 内的符号表副本中删除所有条目。

  8. template<typename Context> 
      void insert_for_next_parse(Context const & context, std::string_view str, 
                                 T x);

    插入一个条目,该条目由要匹配的 UTF-8 字符串 str 和关联的属性 x 组成,添加到 *this。添加该条目以供所有后续顶层解析使用。在当前顶层解析期间的后续查找不一定会匹配 str

  9. template<typename Context> 
      void erase_for_next_parse(Context const & context, std::string_view str);

    *this 中删除 UTF-8 匹配字符串为 str 的条目。该条目将不再可用于所有后续顶层解析。 str 不会从当前顶层解析中匹配的符号中删除。

  10. template<typename Context> void clear_for_next_parse(Context const & context);

    从解析上下文 context 内的符号表副本中删除所有条目。

  11. template<typename Context> 
      unspecified find(Context const & context, std::string_view str) const;

    使用 UTF-8 字符串 str 在解析期间查找表中的属性,并将其作为可选引用返回。查找是在解析上下文 context 内的符号表副本上完成的,而不是在 *this 上完成的。

  12. template<typename Context> 
      void insert(Context const & context, std::string_view str, T x) const;

    插入一个条目,该条目由要匹配的 UTF-8 字符串 str 和关联的属性 x 组成,添加到解析上下文 context 内的符号表副本。

  13. template<typename Context> 
      void erase(Context const & context, std::string_view str) const;

    从解析上下文 context 内的符号表副本中删除 UTF-8 匹配字符串为 str 的条目。

  14. template<typename Context> void clear(Context const & context) const;

    从解析上下文 context 内的符号表副本中删除所有条目。


PrevUpHomeNext