• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ANTLR_USE_NAMESPACE函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ANTLR_USE_NAMESPACE

ANTLR_USE_NAMESPACE(antlr)RefToken LexTokenStream::nextToken()
{
	ANTLR_USE_NAMESPACE(antlr)RefToken ret;
	if (!reachedEOF)
	{
		int type;

		currentLexer = this;
		while ((type = yylex()) == -1) // Token::SKIP
			;

		if (type != 0)
		{
			if( type != JavaTokenTypes::STRING_LITERAL )
				ret = ANTLR_USE_NAMESPACE(antlr)RefToken(new ANTLR_USE_NAMESPACE(antlr)CommonToken(type,yytext));
			else
				ret = ANTLR_USE_NAMESPACE(antlr)RefToken(new ANTLR_USE_NAMESPACE(antlr)CommonToken(type,string_buf));

//			ANTLR_USE_NAMESPACE(std)cout << "Read token " << type << " [" << ret->getText() << "]" << ANTLR_USE_NAMESPACE(std)endl;
		}
		else
			reachedEOF = true;
	}
	if (reachedEOF)
	{
		ret = ANTLR_USE_NAMESPACE(antlr)RefToken(new ANTLR_USE_NAMESPACE(antlr)CommonToken(1,"EOF"));
		//		cout << "EOF reached" << endl;
	}
	ret->setLine(line);
	return ret;
}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:31,代码来源:LexTokenStream.cpp


示例2: ANTLR_USE_NAMESPACE

void IOSCfgParser::access_group_by_number() {
	ANTLR_USE_NAMESPACE(antlr)RefToken  acln = ANTLR_USE_NAMESPACE(antlr)nullToken;
	ANTLR_USE_NAMESPACE(antlr)RefToken  dir = ANTLR_USE_NAMESPACE(antlr)nullToken;
	
	try {      // for error handling
		match(ACCESS_GROUP);
		acln = LT(1);
		match(INT_CONST);
		dir = LT(1);
		match(WORD);
		if ( inputState->guessing==0 ) {
#line 625 "iosacl.g"
			
			importer->setCurrentLineNumber(LT(0)->getLine());
			importer->setInterfaceAndDirectionForRuleSet(
			std::string("acl_") + acln->getText(),
			"",
			dir->getText() );
			*dbg << LT(1)->getLine() << ":"
			<< " INTRFACE: ACL '" << acln->getText() << "'"
			<< " " << dir->getText() << std::endl;
			
#line 2116 "IOSCfgParser.cpp"
		}
	}
	catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
		if( inputState->guessing == 0 ) {
			reportError(ex);
			recover(ex,_tokenSet_14);
		} else {
			throw;
		}
	}
}
开发者ID:BrendanThompson,项目名称:fwbuilder,代码行数:34,代码来源:IOSCfgParser.cpp


示例3: ANTLR_USE_NAMESPACE

void MDParser::inttuple() {
	returnAST = ANTLR_USE_NAMESPACE(antlr)nullAST;
	ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST;
	ANTLR_USE_NAMESPACE(antlr)RefAST inttuple_AST = ANTLR_USE_NAMESPACE(antlr)nullAST;
	
	try {      // for error handling
		intConst();
		astFactory->addASTChild( currentAST, returnAST );
		{ // ( ... )*
		for (;;) {
			if ((LA(1) == COMMA)) {
				match(COMMA);
				intConst();
				astFactory->addASTChild( currentAST, returnAST );
			}
			else {
				goto _loop71;
			}
			
		}
		_loop71:;
		} // ( ... )*
		inttuple_AST = currentAST.root;
	}
	catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
		reportError(ex);
		recover(ex,_tokenSet_12);
	}
	returnAST = inttuple_AST;
}
开发者ID:Patrick-Louden,项目名称:2.2,代码行数:30,代码来源:MDParser.cpp


示例4: ANTLR_USE_NAMESPACE

/** Parser error-reporting function can be overridden in subclass */
void Parser::reportError(const RecognitionException& ex)
{
	// DW 060204 Amended to indicate error in DOS window
	ANTLR_USE_NAMESPACE(std)cerr << "cerr " << ex.toString().c_str() << ANTLR_USE_NAMESPACE(std)endl;
	// DW 060204 Inserted to show position of condition in trace output
	ANTLR_USE_NAMESPACE(std)cout << "cout " << ex.toString().c_str() << ANTLR_USE_NAMESPACE(std)endl;
}
开发者ID:guojerry,项目名称:cppxml,代码行数:8,代码来源:Parser.cpp


示例5: ANTLR_USE_NAMESPACE

ANTLR_USE_NAMESPACE(std)string MismatchedTokenException::getMessage() const
{
	ANTLR_USE_NAMESPACE(std)string s;
	switch (mismatchType) {
	case TOKEN:
		s += "expecting " + tokenName(expecting) + ", found '" + tokenText + "'";
		break;
	case NOT_TOKEN:
		s += "expecting anything but " + tokenName(expecting) + "; got it anyway";
		break;
	case RANGE:
		s += "expecting token in range: " + tokenName(expecting) + ".." + tokenName(upper) + ", found '" + tokenText + "'";
		break;
	case NOT_RANGE:
		s += "expecting token NOT in range: " + tokenName(expecting) + ".." + tokenName(upper) + ", found '" + tokenText + "'";
		break;
	case SET:
	case NOT_SET:
		{
			s += ANTLR_USE_NAMESPACE(std)string("expecting ") + (mismatchType == NOT_SET ? "NOT " : "") + "one of (";
			ANTLR_USE_NAMESPACE(std)vector<unsigned int> elems = set.toArray();
			for ( unsigned int i = 0; i < elems.size(); i++ )
			{
				s += " ";
				s += tokenName(elems[i]);
			}
			s += "), found '" + tokenText + "'";
		}
		break;
	default:
		s = RecognitionException::getMessage();
		break;
	}
	return s;
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:35,代码来源:MismatchedTokenException.cpp


示例6: ANTLR_USE_NAMESPACE

void ConversionParser::conversion() {
	ANTLR_USE_NAMESPACE(antlr)RefToken  v_from = ANTLR_USE_NAMESPACE(antlr)nullToken;
	ANTLR_USE_NAMESPACE(antlr)RefToken  v_to = ANTLR_USE_NAMESPACE(antlr)nullToken;
	
	unsigned int from;
	unsigned int to;
	bool add = false;
	
	
	try {      // for error handling
		v_from = LT(1);
		match(NUMBER);
		{
		switch ( LA(1)) {
		case C_TYPE:
		{
			match(C_TYPE);
			add = true;
			break;
		}
		case S_TYPE:
		{
			match(S_TYPE);
			add = true;
			break;
		}
		case T_TYPE:
		{
			match(T_TYPE);
			break;
		}
		case F_TYPE:
		{
			match(F_TYPE);
			break;
		}
		default:
		{
			throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());
		}
		}
		}
		v_to = LT(1);
		match(NUMBER);
		
		if(add)
		{
		from = toHexInt(v_from->getText());
		to = toHexInt(v_to->getText());
		changer->SetConversion(from,to);
		}
		
	}
	catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
		reportError(ex);
		recover(ex,_tokenSet_1);
	}
}
开发者ID:Oksert,项目名称:genus,代码行数:58,代码来源:ConversionParser.cpp


示例7: RefBasicAST

void P::factor() {
	returnAST = RefBasicAST(ANTLR_USE_NAMESPACE(antlr)nullAST);
	ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST;
	RefBasicAST factor_AST = RefBasicAST(ANTLR_USE_NAMESPACE(antlr)nullAST);
	
	try {      // for error handling
		factor2();
		astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST));
		{ // ( ... )*
		for (;;) {
			if ((LA(1) == MOD || LA(1) == EXP)) {
				{
				switch ( LA(1)) {
				case EXP:
				{
					RefBinaryCompArithOpAST tmp11_AST = RefBinaryCompArithOpAST(RefBasicAST(ANTLR_USE_NAMESPACE(antlr)nullAST));
					tmp11_AST = astFactory->create(LT(1));
					astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp11_AST));
					match(EXP);
					break;
				}
				case MOD:
				{
					RefBinaryCompArithOpAST tmp12_AST = RefBinaryCompArithOpAST(RefBasicAST(ANTLR_USE_NAMESPACE(antlr)nullAST));
					tmp12_AST = astFactory->create(LT(1));
					astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp12_AST));
					match(MOD);
					break;
				}
				default:
				{
					throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());
				}
				}
				}
				factor2();
				astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST));
			}
			else {
				goto _loop14;
			}
			
		}
		_loop14:;
		} // ( ... )*
		factor_AST = RefBasicAST(currentAST.root);
	}
	catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
		reportError(ex);
		recover(ex,_tokenSet_3);
	}
	returnAST = factor_AST;
}
开发者ID:lwhay,项目名称:ICDMS,代码行数:53,代码来源:P.cpp


示例8: switch

void IOSCfgParser::xoperator() {
	
	try {      // for error handling
		switch ( LA(1)) {
		case P_EQ:
		case P_GT:
		case P_LT:
		case P_NEQ:
		{
			single_port_op();
			break;
		}
		case P_RANGE:
		{
			port_range();
			break;
		}
		default:
		{
			throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());
		}
		}
	}
	catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
		if( inputState->guessing == 0 ) {
			reportError(ex);
			recover(ex,_tokenSet_11);
		} else {
			throw;
		}
	}
}
开发者ID:BrendanThompson,项目名称:fwbuilder,代码行数:32,代码来源:IOSCfgParser.cpp


示例9: match

void IOSCfgParser::description() {
	
	try {      // for error handling
		match(DESCRIPTION);
		if ( inputState->guessing==0 ) {
#line 547 "iosacl.g"
			
			importer->setCurrentLineNumber(LT(0)->getLine());
			*dbg << LT(1)->getLine() << ":";
			std::string descr;
			while (LA(1) != ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE && LA(1) != NEWLINE)
			{
			descr += LT(1)->getText() + " ";
			consume();
			}
			importer->setInterfaceComment( descr );
			*dbg << " DESCRIPTION " << descr << std::endl;
			//consumeUntil(NEWLINE);
			
#line 489 "IOSCfgParser.cpp"
		}
	}
	catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
		if( inputState->guessing == 0 ) {
			reportError(ex);
			recover(ex,_tokenSet_2);
		} else {
			throw;
		}
	}
}
开发者ID:BrendanThompson,项目名称:fwbuilder,代码行数:31,代码来源:IOSCfgParser.cpp


示例10: access_group_by_name

void IOSCfgParser::interface_known_ip_commands() {
	
	try {      // for error handling
		{
		if ((LA(1) == ACCESS_GROUP) && (LA(2) == WORD)) {
			access_group_by_name();
		}
		else if ((LA(1) == ACCESS_GROUP) && (LA(2) == INT_CONST)) {
			access_group_by_number();
		}
		else if ((LA(1) == ADDRESS)) {
			intf_address();
		}
		else {
			throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());
		}
		
		}
		match(NEWLINE);
	}
	catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
		if( inputState->guessing == 0 ) {
			reportError(ex);
			recover(ex,_tokenSet_2);
		} else {
			throw;
		}
	}
}
开发者ID:BrendanThompson,项目名称:fwbuilder,代码行数:29,代码来源:IOSCfgParser.cpp


示例11: ANTLR_USE_NAMESPACE

/** get the current marked characters as a string
 * @warning it may treat 0 and EOF values wrong
 */
ANTLR_USE_NAMESPACE(std)string InputBuffer::getMarkedChars( void ) const
{
	ANTLR_USE_NAMESPACE(std)string ret;

	for(unsigned int i = 0; i < markerOffset; i++)
		ret += queue.elementAt(i);

	return ret;
}
开发者ID:blaze3j,项目名称:DocHunt,代码行数:12,代码来源:InputBuffer.cpp


示例12: ANTLR_USE_NAMESPACE

/** get the current lookahead characters as a string
 * @warning it may treat 0 and EOF values wrong
 */
ANTLR_USE_NAMESPACE(std)string InputBuffer::getLAChars( void ) const
{
	ANTLR_USE_NAMESPACE(std)string ret;

	for(int i = markerOffset; i < queue.entries(); i++)
		ret += queue.elementAt(i);

	return ret;
}
开发者ID:MikeJeffrey,项目名称:cloud-debug-java,代码行数:12,代码来源:InputBuffer.cpp


示例13: ANTLR_USE_NAMESPACE

ANTLR_USE_NAMESPACE(std)vector<unsigned int> BitSet::toArray() const {
  ANTLR_USE_NAMESPACE(std)vector<unsigned int> elems;

  for (unsigned int i = 0; i < storage.size(); i++) {
    if (storage[i])
      elems.push_back(i);
  }

  return elems;
}
开发者ID:tulip5,项目名称:tulip,代码行数:10,代码来源:BitSet.cpp


示例14: traceIndent

/**Make sure current lookahead symbol matches token type <tt>t</tt>.
 * Throw an exception upon mismatch, which is catch by either the
 * error handler or by the syntactic predicate.
 */
void Parser::match(int t)
{	
	if ( DEBUG_PARSER )
	{
		traceIndent();
		ANTLR_USE_NAMESPACE(std)cout << "enter match(" << t << ") with LA(1)=" << LA(1) << ANTLR_USE_NAMESPACE(std)endl;
	}
	if ( LA(1)!=t ) {
		if ( DEBUG_PARSER )
		{
			traceIndent();
			ANTLR_USE_NAMESPACE(std)cout << "token mismatch: " << LA(1) << "!=" << t << ANTLR_USE_NAMESPACE(std)endl;
		}
		throw MismatchedTokenException(getTokenNames(), getNumTokens(), LT(1), t, false, getFilename());
	} else {
		// mark token as consumed -- fetch next token deferred until LA/LT
		consume();
	}
}
开发者ID:guojerry,项目名称:cppxml,代码行数:23,代码来源:Parser.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ANativeWindow_fromSurface函数代码示例发布时间:2022-05-30
下一篇:
C++ ANSI_TO_TCHAR函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap