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


C++ RefToken类代码示例

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


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

示例1: consume

void TokenStreamHiddenTokenFilter::consumeFirst()
{
	consume();

	// Handle situation where hidden or discarded tokens
	// appear first in input stream
	RefToken p;
	// while hidden or discarded scarf tokens
	while ( hideMask.member(LA(1)->getType()) || discardMask.member(LA(1)->getType()) ) {
		if ( hideMask.member(LA(1)->getType()) ) {
			if ( !p ) {
				p = LA(1);
			}
			else {
				static_cast<CommonHiddenStreamToken*>(p.get())->setHiddenAfter(LA(1));
				static_cast<CommonHiddenStreamToken*>(LA(1).get())->setHiddenBefore(p); // double-link
				p = LA(1);
			}
			lastHiddenToken = p;
			if (!firstHidden)
				firstHidden = p; // record hidden token if first
		}
		consume();
	}
}
开发者ID:0077cc,项目名称:sqlitebrowser,代码行数:25,代码来源:TokenStreamHiddenTokenFilter.cpp

示例2: consumeFirst

/** Return the next monitored token.
*  Test the token following the monitored token.
*  If following is another monitored token, save it
*  for the next invocation of nextToken (like a single
*  lookahead token) and return it then.
*  If following is unmonitored, nondiscarded (hidden)
*  channel token, add it to the monitored token.
*
*  Note: EOF must be a monitored Token.
*/
RefToken TokenStreamHiddenTokenFilter::nextToken()
{
	// handle an initial condition; don't want to get lookahead
	// token of this splitter until first call to nextToken
	if ( !LA(1) ) {
		consumeFirst();
	}

	// we always consume hidden tokens after monitored, thus,
	// upon entry LA(1) is a monitored token.
	RefToken monitored = LA(1);
	// point to hidden tokens found during last invocation
	static_cast<CommonHiddenStreamToken*>(monitored.get())->setHiddenBefore(lastHiddenToken);
	lastHiddenToken = nullToken;

	// Look for hidden tokens, hook them into list emanating
	// from the monitored tokens.
	consume();
	RefToken p = monitored;
	// while hidden or discarded scarf tokens
	while ( hideMask.member(LA(1)->getType()) || discardMask.member(LA(1)->getType()) ) {
		if ( hideMask.member(LA(1)->getType()) ) {
			// attach the hidden token to the monitored in a chain
			// link forwards
			static_cast<CommonHiddenStreamToken*>(p.get())->setHiddenAfter(LA(1));
			// link backwards
			if (p != monitored) { //hidden cannot point to monitored tokens
				static_cast<CommonHiddenStreamToken*>(LA(1).get())->setHiddenBefore(p);
			}
			p = lastHiddenToken = LA(1);
		}
		consume();
	}
	return monitored;
}
开发者ID:0077cc,项目名称:sqlitebrowser,代码行数:45,代码来源:TokenStreamHiddenTokenFilter.cpp

示例3: nextToken

RefToken TokenStreamBasicFilter::nextToken()
{
	RefToken tok = input->nextToken();
	while ( tok && discardMask.member(tok->getType()) ) {
		tok = input->nextToken();
	}
	return tok;
}
开发者ID:blaze3j,项目名称:DocHunt,代码行数:8,代码来源:TokenStreamBasicFilter.cpp

示例4: initialize

void BinaryCompArithOpAST::initialize( RefToken t ) {
	BasicAST::initialize(t);
	switch (t->getType()) {
			 case PTokenTypes::EQ: 
				 _opType = ByteCodeNS::EQ;
				 break;
			 case PTokenTypes::NE: 
				 _opType = ByteCodeNS::NE;
				 break;
			 case PTokenTypes::OP_LT: 
				 _opType = ByteCodeNS::LT;
				 break;
			 case PTokenTypes::LE: 
				 _opType = ByteCodeNS::LE;
				 break;
			 case PTokenTypes::GT: 
				 _opType = ByteCodeNS::GT;
				 break;
			 case PTokenTypes::GE: 
				 _opType = ByteCodeNS::GE;
				 break;

			 case PTokenTypes::PLUS: 
				 _opType = ByteCodeNS::PLUS;
				 break;
			 case PTokenTypes::MINUS: 
				 _opType = ByteCodeNS::MINUS;
				 break;
			 case PTokenTypes::MUL: 
				 _opType = ByteCodeNS::MUL;
				 break;
			 case PTokenTypes::DIV: 
				 _opType = ByteCodeNS::DIV;
				 break;
			 case PTokenTypes::MOD: 
				 _opType = ByteCodeNS::MOD;
				 break;
			 case PTokenTypes::EXP: 
				 _opType = ByteCodeNS::EXP;
				 break;
			 default:
				 assert(false);
	}
}
开发者ID:lwhay,项目名称:ICDMS,代码行数:44,代码来源:BinaryCompArithOpAST.cpp

示例5: getTokenDescription

string BasePortugolParser::getTokenDescription(const RefToken& token) {
    string str;

    if(token->getType() == PortugolParserTokenTypes::T_IDENTIFICADOR) {
        str = "\"";
        str += token->getText();
        str += "\"";
    } else if(isKeyword(token->getType())) {
        str = "a palavra-chave ";
        str += getTokenNames()[token->getType()];
    } else if(token->getType() == PortugolParserTokenTypes::EOF_) {
        str = "fim de arquivo (EOF)";
    } else {
//     str = getTokenNames()[token->getType()];
        str = token->getText();
    }
    return str;
}
开发者ID:BackupTheBerlios,项目名称:gpt-svn,代码行数:18,代码来源:BasePortugolParser.cpp

示例6: ANTLR_USING_NAMESPACE

#include "antlr/String.hpp"

#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
namespace antlr {
#endif

ANTLR_USING_NAMESPACE(std)

NoViableAltException::NoViableAltException(RefAST t)
  : RecognitionException("NoViableAlt","<AST>",-1,-1),
    token(0), node(t)
{
}

NoViableAltException::NoViableAltException(
	RefToken t,
	const ANTLR_USE_NAMESPACE(std)string& fileName_
) : RecognitionException("NoViableAlt",fileName_,t->getLine(),t->getColumn()),
    token(t), node(nullASTptr)
{
}

ANTLR_USE_NAMESPACE(std)string NoViableAltException::getMessage() const
{
	if (token)
	{
		if( token->getType() == Token::EOF_TYPE )
			return string("unexpected end of file");
		else if( token->getType() == Token::NULL_TREE_LOOKAHEAD )
			return string("unexpected end of tree");
		else
			return string("unexpected token: ")+token->getText();
开发者ID:0077cc,项目名称:sqlitebrowser,代码行数:32,代码来源:NoViableAltException.cpp

示例7: initialize

void CommonAST::initialize(RefToken t)
{
    setType(t->getType());
    setText(t->getText());
}
开发者ID:emrekultursay,项目名称:cloud-debug-java,代码行数:5,代码来源:CommonAST.cpp

示例8: BaseAST

CommonAST::CommonAST(RefToken t)
    :  BaseAST(),
       ttype( t->getType() ),
       text( t->getText() )
{
}
开发者ID:emrekultursay,项目名称:cloud-debug-java,代码行数:6,代码来源:CommonAST.cpp

示例9: getHiddenBefore

/** Return a ptr to the hidden token appearing immediately before
 *  token t in the input stream.
 */
RefToken TokenStreamHiddenTokenFilter::getHiddenBefore(RefToken t)
{
	return static_cast<CommonHiddenStreamToken*>(t.get())->getHiddenBefore();
}
开发者ID:0077cc,项目名称:sqlitebrowser,代码行数:7,代码来源:TokenStreamHiddenTokenFilter.cpp

示例10: initialize

void CommonASTWithHiddenTokens::initialize(RefToken t)
{
	CommonAST::initialize(t);
	hiddenBefore = static_cast<CommonHiddenStreamToken*>(t.get())->getHiddenBefore();
	hiddenAfter = static_cast<CommonHiddenStreamToken*>(t.get())->getHiddenAfter();
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:6,代码来源:CommonASTWithHiddenTokens.cpp


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