当前位置: 首页>>代码示例>>C++>>正文


C++ token类代码示例

本文整理汇总了C++中token的典型用法代码示例。如果您正苦于以下问题:C++ token类的具体用法?C++ token怎么用?C++ token使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了token类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: expandVariable

void Foam::primitiveEntry::append
(
    const token& currToken,
    const dictionary& dict,
    Istream& is
)
{
    if (currToken.isWord())
    {
        const word& w = currToken.wordToken();

        if
        (
            w.size() == 1
         || (
                !(w[0] == '$' && expandVariable(w, dict))
             && !(w[0] == '#' && expandFunction(w, dict, is))
            )
        )
        {
            newElmt(tokenIndex()++) = currToken;
        }
    }
    else
    {
        newElmt(tokenIndex()++) = currToken;
    }
}
开发者ID:Brzous,项目名称:WindFOAM,代码行数:28,代码来源:primitiveEntryIO.C

示例2: get_token

/*
 * Returns the contents of the lexer as a token
 */
bool lexer::get_token(token &tok) {

	// set appropriate values
	tok.set_text(text);
	tok.set_type(type);
	return true;
}
开发者ID:majestic53,项目名称:Cli-Calc,代码行数:10,代码来源:lexer.cpp

示例3: intersect

    void intersect (basic_charset &rhs_, basic_charset &overlap_)
    {
        _token.intersect (rhs_._token, overlap_._token);

        if (!overlap_._token.empty ())
        {
            typename index_set::const_iterator iter_ = _index_set.begin ();
            typename index_set::const_iterator end_ = _index_set.end ();

            for (; iter_ != end_; ++iter_)
            {
                overlap_._index_set.insert (*iter_);
            }

            iter_ = rhs_._index_set.begin ();
            end_ = rhs_._index_set.end ();

            for (; iter_ != end_; ++iter_)
            {
                overlap_._index_set.insert (*iter_);
            }

            if (_token.empty ())
            {
                _index_set.clear ();
            }

            if (rhs_._token.empty ())
            {
                rhs_._index_set.clear ();
            }
        }
    }
开发者ID:BioinformaticsArchive,项目名称:MulRFRepo,代码行数:33,代码来源:charset.hpp

示例4: opPriority

int
opPriority(token t)
{
    if ( (binOP_Table.end() != binOP_Table.find(t.Tok())) )
	return binOP_Table[t.Tok()];
    else // this will stop OpPrecedence parsing once we hit a
	return -1;  // non-op while evaluating InfixEpxr
}
开发者ID:RalfMBecker,项目名称:decaf,代码行数:8,代码来源:tables.cpp

示例5: to_string

bool token::operator == (const token& rhs) const
{
   if (this == &rhs)
      return true;

   if (valid() && rhs.valid())
      return to_string() == rhs.to_string();
   else
      return false;
}
开发者ID:darkangel-ua,项目名称:hammer,代码行数:10,代码来源:token.cpp

示例6: parse

  virtual parse_result parse( string::const_iterator& i, 
			      string::const_iterator e, 
			      token& tok ) const
  {
    string::const_iterator j = i;
    if ( *j != '&' && *j != '+' ) return failed; ++j;
    while ( j < e && ( *j == '.' || *j == '-' || isalnum(*j) ) ) ++j;
    tok.assign(i, j); tok.type( tok_types::pn_lit ); i = j;
    return done;
  }
开发者ID:brucegentles,项目名称:ringinglib,代码行数:10,代码来源:parser.cpp

示例7: get_root_contents

/*
 * Returns the contents at the root
 */
bool syn_tree::get_root_contents(token &tok) {

	// check that root token exists
	if(!root)
		return false;

	// set the text & type
	tok.set_text(root->get_text());
	tok.set_type(root->get_type());
	return true;
}
开发者ID:majestic53,项目名称:Cli-Calc,代码行数:14,代码来源:syn_tree.cpp

示例8:

zstring::zstring(const token& tok)
    : _buf(0)
    , _pool(0)
{
    if(tok.len() == 0)
        _zptr = _zend = nullstring;
    else {
        _zptr = tok.ptr();
        _zend = tok.ptre() - 1;
    }
}
开发者ID:cyrilgramblicka,项目名称:X264RecorderPlugin,代码行数:11,代码来源:str-win.cpp

示例9: set_contents

/*
 * Set the contents of the current token
 */
bool syn_tree::set_contents(token &tok) {

	// make sure current token exists
	if(!cur)
		return false;

	// set current token contents
	cur->set_text(tok.get_text());
	cur->set_type(tok.get_type());
	return true;
}
开发者ID:majestic53,项目名称:Cli-Calc,代码行数:14,代码来源:syn_tree.cpp

示例10: get_contents

/*
 * Returns contents at current token
 */
bool syn_tree::get_contents(token &tok) {

	// check that current token exists
	if(!cur)
		return false;

	// set the text & type
	tok.set_text(cur->get_text());
	tok.set_type(cur->get_type());
	return true;
}
开发者ID:majestic53,项目名称:Cli-Calc,代码行数:14,代码来源:syn_tree.cpp

示例11: is_greater_precedence

  static bool is_greater_precedence(const token &one, const token &two) {
    size_t one_id = one.first_matching_sym_op_fn_id();
    size_t two_id = two.first_matching_sym_op_fn_id();
    typename Fn_Table::fn_info one_info = Fn_Table::get_info(one_id);
    typename Fn_Table::fn_info two_info = Fn_Table::get_info(two_id);
    bool one_is_left_assoc = one_info.is_left_assoc();
    size_t one_precedence = one_info.precedence();
    size_t two_precedence = two_info.precedence();

    return ((one_is_left_assoc && (one_precedence >= two_precedence))
            || (!one_is_left_assoc && (one_precedence > two_precedence)));
  }
开发者ID:barrbrain,项目名称:r17,代码行数:12,代码来源:shunting_yard.hpp

示例12: fprintf

 void dotfile_visitor::format_node(abstract_node *node, const char *name, const token &tok)
 {
   if (!m_connectTo)
   {
     if (tok.type() == token_types::STRING_LITERAL)
       fprintf(m_file, "\tptr%p [label=\"[%s]\\n[%s]\\n\\\"%.*s\\\"\"];\n", node, name, token_types::names[tok.type()], tok.length() - 2, tok.text() + 1);
     else if (tok.text())
       fprintf(m_file, "\tptr%p [label=\"[%s]\\n[%s]\\n%.*s\"];\n", node, name, token_types::names[tok.type()], tok.length(), tok.text());
     else
       format_node(node, name);
   }
 }
开发者ID:ImOnALampshade,项目名称:brandy,代码行数:12,代码来源:dotfilevisitor.cpp

示例13: new_const

string symbol_table::new_const(token tkconst)
{
    string type = type_of(tkconst);
    auto ent = consts_.find(type+tkconst.text());
    if (ent != consts_.end()) {
        return ent->second.place();
    }
    
    const_desc desc(tkconst);
    consts_[type+tkconst.text()] = desc;
    return desc.place();
}
开发者ID:Aetf,项目名称:ACCompiler,代码行数:12,代码来源:symbol_table.cpp

示例14: hash

static inline token hash(const std::string &pw, token const& salt)
{
	token result;
	if(::libscrypt_scrypt(
		(const uint8_t*)pw.data(), pw.size(),
		salt.data(), salt.size(),
		SCRYPT_N, SCRYPT_r, SCRYPT_p,
		result.data(), result.size()
	) == -1)
		throw std::runtime_error("Incapable of hashing plaintext");

	return result;
}
开发者ID:Supermarx,项目名称:common,代码行数:13,代码来源:session_operations.hpp

示例15: get_size

/*
 * Sets the contents of the specified child token of current token
 */
bool syn_tree::set_child_contents(token &tok, unsigned int index) {

	// check to make sure child token exists
	if(!cur
			|| !get_size()
			|| index >= get_size())
		return false;

	// set contents
	token *child = cur->get_child(index);
	child->set_text(tok.get_text());
	child->set_type(tok.get_type());
	return true;
}
开发者ID:majestic53,项目名称:Cli-Calc,代码行数:17,代码来源:syn_tree.cpp


注:本文中的token类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。