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


C++ RefAST类代码示例

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


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

示例1: getFirstChild

void BinaryCompArithOpAST::renameAttrRef(const SchemaMapString* schemaMap) {
	RefAST childAST = getFirstChild();
	assert (childAST);
	(RefBasicAST(childAST))->renameAttrRef(schemaMap);

	if (childAST->getNextSibling()) {
		(RefBasicAST(childAST->getNextSibling()))->renameAttrRef(schemaMap);
	}
}
开发者ID:lwhay,项目名称:ICDMS,代码行数:9,代码来源:BinaryCompArithOpAST.cpp

示例2: main

int main(int argc, char *argv[])
{
    if (argc < 1)
        return 0;

    ANTLR_USING_NAMESPACE(std);
    ANTLR_USING_NAMESPACE(antlr);
    ANTLR_USING_NAMESPACE(Asm);

    char *filename = argv[1];

    if (!filename)
        exit(1);

    try {
        ifstream input(filename);
        AsmLexer lexer(input);
        TokenBuffer buffer(lexer);
        AsmParser parser(buffer);

        ASTFactory ast_factory;
        parser.initializeASTFactory(ast_factory);
        parser.setASTFactory(&ast_factory);

        parser.asmFile();
        RefAST a = parser.getAST();

        AsmTreeParser tree_parser;
        tree_parser.init(false, false, false);
        tree_parser.initializeASTFactory(ast_factory);
        tree_parser.setASTFactory(&ast_factory);

        tree_parser.asmFile(a);
#if 0
        cout << "List:" << endl;
        cout << a->toStringList() << endl;
        cout << "Tree:" << endl;
        cout << a->toStringTree() << endl;
#endif
    } catch (ANTLRException& e) {
        cerr << "exception: " << e.getMessage() << endl;
        return 2;
    } catch (exception& e) {
        cerr << "exception: " << e.what() << endl;
        return 3;
    }
    return 0;
}
开发者ID:manyoso,项目名称:sformsv1,代码行数:48,代码来源:main.cpp

示例3: matchNot

void TreeParser::matchNot(RefAST t, int ttype)
{
	//ANTLR_USE_NAMESPACE(std)cout << "match(" << ttype << "); cursor is " << t.toString() << ANTLR_USE_NAMESPACE(std)endl;
	if ( !t || t==ASTNULL || t->getType()==ttype ) {
		throw MismatchedTokenException();
	}
}
开发者ID:cooljeanius,项目名称:cec,代码行数:7,代码来源:TreeParser.cpp

示例4: RecognitionException

// Expected BitSet / not BitSet
MismatchedTokenException::MismatchedTokenException(
	const char* const* tokenNames_,
	const int numTokens_,
	RefAST node_,
	BitSet set_,
	bool matchNot
) : RecognitionException("Mismatched Token","<AST>",-1,-1)
  , token(0)
  , node(node_)
  , tokenText( (node_ ? node_->toString(): ANTLR_USE_NAMESPACE(std)string("<empty tree>")) )
  , mismatchType(matchNot ? NOT_SET : SET)
  , set(set_)
  , tokenNames(tokenNames_)
  , numTokens(numTokens_)
{
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:17,代码来源:MismatchedTokenException.cpp

示例5: create

/** Create a new empty AST node; if the user did not specify
 *  an AST node type, then create a default one: CommonAST.
 */
RefAST ASTFactory::create()
{
	RefAST node = nodeFactories[0]->second();
	node->setType(Token::INVALID_TYPE);
	return node;
}
开发者ID:jariba,项目名称:europa-pso,代码行数:9,代码来源:ASTFactory.cpp

示例6: match

/**Make sure current lookahead symbol matches the given set
 * Throw an exception upon mismatch, which is caught by either the
 * error handler or by the syntactic predicate.
 */
void TreeParser::match(RefAST t, const BitSet& b)
{
	if ( !t || t==ASTNULL || !b.member(t->getType()) ) {
		throw MismatchedTokenException();
	}
}
开发者ID:cooljeanius,项目名称:cec,代码行数:10,代码来源:TreeParser.cpp

示例7: create

RefAST ASTFactory::create(int type)
{
    RefAST t = create();
    t->initialize(type,"");
    return t;
}
开发者ID:dbenn,项目名称:cgp,代码行数:6,代码来源:ASTFactory.cpp

示例8: nodeFactory

/** Create a new empty AST node; if the user did not specify
 *  an AST node type, then create a default one: CommonAST.
 */
RefAST ASTFactory::create()
{
    RefAST node = nodeFactory(); //new CommonASTNode();
    node->setType(Token::INVALID_TYPE);
    return node;
}
开发者ID:dbenn,项目名称:cgp,代码行数:9,代码来源:ASTFactory.cpp

示例9: matchNot

void TreeParser::matchNot(RefAST t, int ttype)
{
	if ( !t || t == ASTNULL || t->getType() == ttype )
		throw MismatchedTokenException( getTokenNames(), getNumTokens(),
												  t, ttype, true );
}
开发者ID:caiosba,项目名称:master-project,代码行数:6,代码来源:TreeParser.cpp

示例10: match

/** Make sure current lookahead symbol matches the given set
 * Throw an exception upon mismatch, which is caught by either the
 * error handler or by the syntactic predicate.
 */
void TreeParser::match(RefAST t, const BitSet& b)
{
	if ( !t || t==ASTNULL || !b.member(t->getType()) )
		throw MismatchedTokenException( getTokenNames(), getNumTokens(),
												  t, b, false );
}
开发者ID:caiosba,项目名称:master-project,代码行数:10,代码来源:TreeParser.cpp

示例11: match

	virtual void match(RefAST t, int ttype)
	{
		if (!t || t == ASTNULL || t->getType() != ttype )
			throw MismatchedTokenException( getTokenNames(), getNumTokens(),
													  t, ttype, false );
	}
开发者ID:jariba,项目名称:europa-pso,代码行数:6,代码来源:TreeParser.hpp

示例12: while

		while( t->right )
		{
			t = t->right;
			n++;
		}
		return n;
	}
	return n;
}

void BaseAST::doWorkForFindAll(
		ANTLR_USE_NAMESPACE(std)vector<RefAST>& v,
		RefAST target,bool partialMatch)
{
	// Start walking sibling lists, looking for matches.
	for (RefAST sibling=this;
			sibling;
			sibling=sibling->getNextSibling())
	{
		if ( (partialMatch && sibling->equalsTreePartial(target)) ||
				(!partialMatch && sibling->equalsTree(target)) ) {
			v.push_back(sibling);
		}
		// regardless of match or not, check any children for matches
		if ( sibling->getFirstChild() ) {
			RefBaseAST(sibling->getFirstChild())->doWorkForFindAll(v, target, partialMatch);
		}
	}
}

/** Is t an exact structural and equals() match of this tree.  The
开发者ID:ezhangle,项目名称:GNU-Data-Language-0.9.6,代码行数:31,代码来源:BaseAST.cpp

示例13: initialize

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


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