org.hibernate.id.SequenceGenerator#antlr.collections.AST源码实例Demo

下面列出了org.hibernate.id.SequenceGenerator#antlr.collections.AST 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jFuzzyLogic   文件: CodeGenTreeWalker.java
public final void attrScope(AST _t) throws RecognitionException {
	
	GrammarAST attrScope_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;
	
	try {      // for error handling
		AST __t8 = _t;
		GrammarAST tmp12_AST_in = (GrammarAST)_t;
		match(_t,SCOPE);
		_t = _t.getFirstChild();
		GrammarAST tmp13_AST_in = (GrammarAST)_t;
		match(_t,ID);
		_t = _t.getNextSibling();
		GrammarAST tmp14_AST_in = (GrammarAST)_t;
		match(_t,ACTION);
		_t = _t.getNextSibling();
		_t = __t8;
		_t = _t.getNextSibling();
	}
	catch (RecognitionException ex) {
		reportError(ex);
		if (_t!=null) {_t = _t.getNextSibling();}
	}
	_retTree = _t;
}
 
源代码2 项目: cxf   文件: StructVisitor.java
private XmlSchemaElement createXmlSchemaElement(AST memberNode,
                                                XmlSchemaType schemaType,
                                                Scope fqName) {
    // xmlschema:member
    XmlSchemaElement member = new XmlSchemaElement(schema, false);
    String memberName = memberNode.toString();
    member.setName(memberName);
    member.setSchemaType(schemaType);
    if (schemaType != null) {
        member.setSchemaTypeName(schemaType.getQName());
        if (schemaType.getQName().equals(ReferenceConstants.WSADDRESSING_TYPE)) {
            member.setNillable(true);
        }
    } else {
        wsdlVisitor.getDeferredActions().
            add(fqName, new StructDeferredAction(member));
    }
    return member;
}
 
源代码3 项目: cxf   文件: ConstrTypeSpecVisitor.java
public void visit(AST node) {
    // <constr_type_spec> ::= <struct_type>
    //                      | <union_type>
    //                      | <enum_type>

    Visitor visitor = null;

    if (StructVisitor.accept(node)) {
        visitor = new StructVisitor(getScope(), definition, schema, wsdlVisitor);
    }

    if (UnionVisitor.accept(node)) {
        visitor = new UnionVisitor(getScope(), definition, schema, wsdlVisitor);
    }

    if (EnumVisitor.accept(node)) {
        visitor = new EnumVisitor(getScope(), definition, schema, wsdlVisitor);
    }

    if (visitor != null) {
        visitor.visit(node);

        setSchemaType(visitor.getSchemaType());
        setCorbaType(visitor.getCorbaType());
    }
}
 
源代码4 项目: jFuzzyLogic   文件: AssignTokenTypesWalker.java
public final void attrScope(AST _t) throws RecognitionException {
	
	GrammarAST attrScope_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;
	
	try {      // for error handling
		AST __t17 = _t;
		GrammarAST tmp13_AST_in = (GrammarAST)_t;
		match(_t,SCOPE);
		_t = _t.getFirstChild();
		GrammarAST tmp14_AST_in = (GrammarAST)_t;
		match(_t,ID);
		_t = _t.getNextSibling();
		GrammarAST tmp15_AST_in = (GrammarAST)_t;
		match(_t,ACTION);
		_t = _t.getNextSibling();
		_t = __t17;
		_t = _t.getNextSibling();
	}
	catch (RecognitionException ex) {
		reportError(ex);
		if (_t!=null) {_t = _t.getNextSibling();}
	}
	_retTree = _t;
}
 
源代码5 项目: lams   文件: QueryNode.java
public final OrderByClause getOrderByClause() {
	if ( orderByClause == null ) {
		orderByClause = locateOrderByClause();

		// if there is no order by, make one
		if ( orderByClause == null ) {
			LOG.debug( "getOrderByClause() : Creating a new ORDER BY clause" );
			orderByClause = (OrderByClause) getWalker().getASTFactory().create( SqlTokenTypes.ORDER, "ORDER" );

			// Find the WHERE; if there is no WHERE, find the FROM...
			AST prevSibling = ASTUtil.findTypeInChildren( this, SqlTokenTypes.WHERE );
			if ( prevSibling == null ) {
				prevSibling = ASTUtil.findTypeInChildren( this, SqlTokenTypes.FROM );
			}

			// Now, inject the newly built ORDER BY into the tree
			orderByClause.setNextSibling( prevSibling.getNextSibling() );
			prevSibling.setNextSibling( orderByClause );
		}
	}
	return orderByClause;
}
 
源代码6 项目: lams   文件: HqlSqlWalker.java
@Override
protected void validateMapPropertyExpression(AST node) throws SemanticException {
	try {
		FromReferenceNode fromReferenceNode = (FromReferenceNode) node;
		QueryableCollection collectionPersister = fromReferenceNode.getFromElement().getQueryableCollection();
		if ( !Map.class.isAssignableFrom( collectionPersister.getCollectionType().getReturnedClass() ) ) {
			throw new SemanticException( "node did not reference a map" );
		}
	}
	catch (SemanticException se) {
		throw se;
	}
	catch (Throwable t) {
		throw new SemanticException( "node did not reference a map" );
	}
}
 
源代码7 项目: lams   文件: HqlSqlWalker.java
private EntityJoinFromElement createEntityJoin(
		EntityPersister entityPersister,
		AST aliasNode,
		int joinType,
		AST propertyFetch,
		AST with) throws SemanticException {
	final String alias = aliasNode == null ? null : aliasNode.getText();
	LOG.debugf( "Creating entity-join FromElement [%s -> %s]", alias, entityPersister.getEntityName() );
	EntityJoinFromElement join = new EntityJoinFromElement(
			this,
			getCurrentFromClause(),
			entityPersister,
			JoinProcessor.toHibernateJoinType( joinType ),
			propertyFetch != null,
			alias
	);

	if ( with != null ) {
		handleWithFragment( join, with );
	}

	return join;
}
 
源代码8 项目: lams   文件: QueryTranslatorImpl.java
private void generate(AST sqlAst) throws QueryException, RecognitionException {
	if ( sql == null ) {
		final SqlGenerator gen = new SqlGenerator( factory );
		gen.statement( sqlAst );
		sql = gen.getSQL();
		if ( LOG.isDebugEnabled() ) {
			LOG.debugf( "HQL: %s", hql );
			LOG.debugf( "SQL: %s", sql );
		}
		gen.getParseErrorHandler().throwQueryException();
		if ( collectedParameterSpecifications == null ) {
			collectedParameterSpecifications = gen.getCollectedParameters();
		}
		else {
			collectedParameterSpecifications.addAll( gen.getCollectedParameters() );
		}
	}
}
 
源代码9 项目: lams   文件: QueryTranslatorImpl.java
private HqlParser parse(boolean filter) throws TokenStreamException {
	// Parse the query string into an HQL AST.
	final HqlParser parser = HqlParser.getInstance( hql );
	parser.setFilter( filter );

	LOG.debugf( "parse() - HQL: %s", hql );
	try {
		parser.statement();
	}
	catch (RecognitionException e) {
		throw new HibernateException( "Unexpected error parsing HQL", e );
	}

	final AST hqlAst = parser.getAST();
	parser.getParseErrorHandler().throwQueryException();

	final NodeTraverser walker = new NodeTraverser( new JavaConstantConverter( factory ) );
	walker.traverseDepthFirst( hqlAst );

	showHqlAst( hqlAst );

	return parser;
}
 
源代码10 项目: cacheonix-core   文件: ASTIterator.java
public AST nextNode() {
	current = next;
	if ( next != null ) {
		AST nextSibling = next.getNextSibling();
		if ( nextSibling == null ) {
			next = pop();
		}
		else {
			next = nextSibling;
			down();
		}
	}
	return current;
}
 
源代码11 项目: lams   文件: OrderByFragmentParser.java
@Override
protected AST quotedIdentifier(AST ident) {
	/*
	 * Semantic action used during recognition of quoted identifiers (quoted column names)
	 */
	final String columnName = context.getDialect().quote( '`' + ident.getText() + '`' );
	columnReferences.add( columnName );
	final String marker = '{' + columnName + '}';
	return getASTFactory().create( OrderByTemplateTokenTypes.IDENT, marker );
}
 
源代码12 项目: lams   文件: OrderByFragmentParser.java
@Override
protected AST quotedString(AST ident) {
	/*
	 * Semantic action used during recognition of quoted strings (string literals)
	 */
	return getASTFactory().create( OrderByTemplateTokenTypes.IDENT, context.getDialect().quote( ident.getText() ) );
}
 
源代码13 项目: cxf   文件: TemplateTypeSpecVisitor.java
public void visit(AST node) {
    // <template_type_spec> ::= <sequence_type>
    //                        | <string_type>
    //                        | <wide_string_type>
    //                        | <fixed_pt_type>


    Visitor visitor = null;

    if (SequenceVisitor.accept(node)) {
        // <sequence_type>
        visitor = new SequenceVisitor(getScope(), definition, schema, wsdlVisitor, identifierNode);
    } else if (StringVisitor.accept(node)) {
        // <string_type>
        // <wstring_type>
        visitor = new StringVisitor(getScope(), definition, schema, wsdlVisitor, identifierNode);
    } else if (FixedVisitor.accept(node)) {
        // <fixed_pt_type>
        visitor = new FixedVisitor(getScope(), definition, schema, wsdlVisitor, identifierNode);
    }

    if (visitor != null) {
        visitor.visit(node);

        setSchemaType(visitor.getSchemaType());
        setCorbaType(visitor.getCorbaType());
        setFullyQualifiedName(visitor.getFullyQualifiedName());
    }
}
 
源代码14 项目: jFuzzyLogic   文件: GrammarAST.java
public int getLine() {
int line=0;
      if ( token!=null ) {
          line = token.getLine();
      }
if ( line==0 ) {
	AST child = getFirstChild();
	if ( child!=null ) {
		line = child.getLine();
	}
}
      return line;
  }
 
源代码15 项目: jFuzzyLogic   文件: DefineGrammarItemsWalker.java
public final void attrScope(AST _t) throws RecognitionException {
	
	GrammarAST attrScope_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;
	GrammarAST name = null;
	GrammarAST attrs = null;
	
	try {      // for error handling
		AST __t8 = _t;
		GrammarAST tmp5_AST_in = (GrammarAST)_t;
		match(_t,SCOPE);
		_t = _t.getFirstChild();
		name = (GrammarAST)_t;
		match(_t,ID);
		_t = _t.getNextSibling();
		attrs = (GrammarAST)_t;
		match(_t,ACTION);
		_t = _t.getNextSibling();
		_t = __t8;
		_t = _t.getNextSibling();
		if ( inputState.guessing==0 ) {
			
					AttributeScope scope = grammar.defineGlobalScope(name.getText(),attrs.token);
					scope.isDynamicGlobalScope = true;
					scope.addAttributes(attrs.getText(), ';');
					
		}
	}
	catch (RecognitionException ex) {
		if (inputState.guessing==0) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		} else {
		  throw ex;
		}
	}
	_retTree = _t;
}
 
源代码16 项目: cacheonix-core   文件: LiteralProcessor.java
public void processNumeric(AST literal) {
	if ( literal.getType() == NUM_INT || literal.getType() == NUM_LONG ) {
		literal.setText( determineIntegerRepresentation( literal.getText(), literal.getType() ) );
	}
	else if ( literal.getType() == NUM_FLOAT || literal.getType() == NUM_DOUBLE ) {
		literal.setText( determineDecimalRepresentation( literal.getText(), literal.getType() ) );
	}
	else {
		log.warn( "Unexpected literal token type [" + literal.getType() + "] passed for numeric processing" );
	}
}
 
源代码17 项目: cxf   文件: TypesUtils.java
/** Returns node corresponding to the name of the CORBA primitive type node.
 *
 * @param node
 * @return
 */
public static AST getCorbaTypeNameNode(AST node) {
    AST currentNode = node;
    if (currentNode.getType() == IDLTokenTypes.LITERAL_unsigned) {
        currentNode = currentNode.getNextSibling();
    }
    if (currentNode.getType() == IDLTokenTypes.LITERAL_long
        && (currentNode.getNextSibling() != null)
        && (currentNode.getNextSibling().getType() == IDLTokenTypes.LITERAL_long)) {
        currentNode = currentNode.getNextSibling();
    }
    return currentNode.getNextSibling();
}
 
源代码18 项目: lams   文件: HqlSqlWalker.java
@Override
protected void lookupAlias(AST aliasRef)
		throws SemanticException {
	FromElement alias = currentFromClause.getFromElement( aliasRef.getText() );
	FromReferenceNode aliasRefNode = (FromReferenceNode) aliasRef;
	aliasRefNode.setFromElement( alias );
}
 
源代码19 项目: lams   文件: DotNode.java
private void setPropertyNameAndPath(AST parent) {
	if ( isDotNode( parent ) ) {
		DotNode dotNode = (DotNode) parent;
		AST lhs = dotNode.getFirstChild();
		AST rhs = lhs.getNextSibling();
		propertyName = rhs.getText();
		propertyPath = propertyPath + "." + propertyName; // Append the new property name onto the unresolved path.
		dotNode.propertyPath = propertyPath;
		LOG.debugf( "Unresolved property path is now '%s'", dotNode.propertyPath );
	}
	else {
		LOG.debugf( "Terminal getPropertyPath = [%s]", propertyPath );
	}
}
 
源代码20 项目: lams   文件: FromElementFactory.java
private FromElement createFromElement(EntityPersister entityPersister) {
	Joinable joinable = (Joinable) entityPersister;
	String text = joinable.getTableName();
	AST ast = createFromElement( text );
	FromElement element = (FromElement) ast;
	return element;
}
 
public Visibility visibility(AST modifiers) {
  if (contains(modifiers, "private"))
    return Visibility.PRIVATE;
  if (contains(modifiers, "protected"))
    return Visibility.PROTECTED;
  if (contains(modifiers, "public"))
    return Visibility.PUBLIC;
  return Visibility.PACKAGE;
}
 
源代码22 项目: cxf   文件: StructVisitor.java
private boolean addRecursiveScopedName(AST identifierNode) {
    String structName = identifierNode.toString();
    Scope structScope = new Scope(getScope(), structName);

    ScopeNameCollection scopedNames = wsdlVisitor.getScopedNames();
    if (scopedNames.getScope(structScope) == null) {
        scopedNames.add(structScope);
        return true;
    }
    return false;
}
 
源代码23 项目: cxf   文件: ScopedNameVisitor.java
protected static boolean findSchemaType(Scope scope,
                                        Definition defn,
                                        XmlSchema schemaRef,
                                        AST node,
                                        WSDLASTVisitor wsdlVisitor,
                                        VisitorTypeHolder holder) {
    return findSchemaType(scope, defn, schemaRef, node, wsdlVisitor, holder, false);
}
 
源代码24 项目: cacheonix-core   文件: HqlSqlWalker.java
public void visit(AST node) {
	// todo : currently expects that the individual with expressions apply to the same sql table join.
	//      This may not be the case for joined-subclass where the property values
	//      might be coming from different tables in the joined hierarchy.  At some
	//      point we should expand this to support that capability.  However, that has
	//      some difficulties:
	//          1) the biggest is how to handle ORs when the individual comparisons are
	//              linked to different sql joins.
	//          2) here we would need to track each comparison individually, along with
	//              the join alias to which it applies and then pass that information
	//              back to the FromElement so it can pass it along to the JoinSequence

	if ( node instanceof DotNode ) {
		DotNode dotNode = ( DotNode ) node;
		FromElement fromElement = dotNode.getFromElement();
		if ( referencedFromElement != null ) {
			if ( fromElement != referencedFromElement ) {
				throw new HibernateException( "with-clause referenced two different from-clause elements" );
			}
		}
		else {
			referencedFromElement = fromElement;
			joinAlias = extractAppliedAlias( dotNode );
			// todo : temporary
			//      needed because currently persister is the one that
			//      creates and renders the join fragments for inheritence
			//      hierarchies...
			if ( !joinAlias.equals( referencedFromElement.getTableAlias() ) ) {
				throw new InvalidWithClauseException( "with clause can only reference columns in the driving table" );
			}
		}
	}
}
 
源代码25 项目: lams   文件: ASTParentsFirstIterator.java
private AST pop() {
	if ( parents.size() == 0 ) {
		return null;
	}
	else {
		return parents.removeFirst();
	}
}
 
源代码26 项目: jFuzzyLogic   文件: AssignTokenTypesWalker.java
public final void tokensSpec(AST _t) throws RecognitionException {
	
	GrammarAST tokensSpec_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;
	
	try {      // for error handling
		AST __t36 = _t;
		GrammarAST tmp12_AST_in = (GrammarAST)_t;
		match(_t,TOKENS);
		_t = _t.getFirstChild();
		{
		int _cnt38=0;
		_loop38:
		do {
			if (_t==null) _t=ASTNULL;
			if ((_t.getType()==ASSIGN||_t.getType()==TOKEN_REF)) {
				tokenSpec(_t);
				_t = _retTree;
			}
			else {
				if ( _cnt38>=1 ) { break _loop38; } else {throw new NoViableAltException(_t);}
			}
			
			_cnt38++;
		} while (true);
		}
		_t = __t36;
		_t = _t.getNextSibling();
	}
	catch (RecognitionException ex) {
		reportError(ex);
		if (_t!=null) {_t = _t.getNextSibling();}
	}
	_retTree = _t;
}
 
源代码27 项目: jFuzzyLogic   文件: DefineGrammarItemsWalker.java
public final void finallyClause(AST _t) throws RecognitionException {
	
	GrammarAST finallyClause_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t;
	
	try {      // for error handling
		AST __t93 = _t;
		GrammarAST tmp56_AST_in = (GrammarAST)_t;
		match(_t,LITERAL_finally);
		_t = _t.getFirstChild();
		GrammarAST tmp57_AST_in = (GrammarAST)_t;
		match(_t,ACTION);
		_t = _t.getNextSibling();
		_t = __t93;
		_t = _t.getNextSibling();
		if ( inputState.guessing==0 ) {
			trackInlineAction(tmp57_AST_in);
		}
	}
	catch (RecognitionException ex) {
		if (inputState.guessing==0) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		} else {
		  throw ex;
		}
	}
	_retTree = _t;
}
 
源代码28 项目: lams   文件: ASTUtil.java
/**
 * Returns the last sibling of 'a'.
 *
 * @param a The sibling.
 *
 * @return The last sibling of 'a'.
 */
private static AST getLastSibling(AST a) {
	AST last = null;
	while ( a != null ) {
		last = a;
		a = a.getNextSibling();
	}
	return last;
}
 
源代码29 项目: cacheonix-core   文件: IntoClause.java
private void initializeColumns() {
	AST propertySpec = getFirstChild();
	List types = new ArrayList();
	visitPropertySpecNodes( propertySpec.getFirstChild(), types );
	this.types = ArrayHelper.toTypeArray( types );
	columnSpec = columnSpec.substring( 0, columnSpec.length() - 2 );
}
 
源代码30 项目: proparse   文件: NodeFactory.java
/** Used for synthetic node creation by the Antlr generated parser. */
@Override
public AST create(int type) {
	ProToken token = new ProToken(filenameList, type, "");
	switch(type) {
		case NodeTypes.Field_ref:
			return new FieldRefNode(token);
		case NodeTypes.Program_root:
			return new ProgramRootNode(token);
		default:
			return new JPNode(token);
	}
}