Package antlr

Examples of antlr.SemanticException


    TNode typedefName_AST = null;
    Token  i = null;
    TNode i_AST = null;
   
    if (!( isTypedefName ( LT(1).getText() ) ))
      throw new SemanticException(" isTypedefName ( LT(1).getText() ) ");
    i = LT(1);
    i_AST = (TNode)astFactory.create(i);
    astFactory.addASTChild(currentAST, i_AST);
    match(ID);
    if ( inputState.guessing==0 ) {
View Full Code Here


    Token  i = null;
    TNode i_AST = null;
   
    try {      // for error handling
      if (!( isTypedefName ( LT(1).getText() ) ))
        throw new SemanticException(" isTypedefName ( LT(1).getText() ) ");
      i = LT(1);
      i_AST = (TNode)astFactory.create(i);
      astFactory.addASTChild(currentAST, i_AST);
      match(ID);
      if ( inputState.guessing==0 ) {
View Full Code Here

    String text = queryableCollection.getTableName();
    AST ast = createFromElement( text );
    FromElement destination = ( FromElement ) ast;
    Type elementType = queryableCollection.getElementType();
    if ( elementType.isCollectionType() ) {
      throw new SemanticException( "Collections of collections are not supported!" );
    }
    destination.initializeCollection( fromClause, classAlias, tableAlias );
    destination.setType( JOIN_FRAGMENT );    // Tag this node as a JOIN.
    destination.setIncludeSubclasses( false )// Don't include subclasses in the join.
    destination.setCollectionJoin( true );    // This is a clollection join.
View Full Code Here

    }
  }

  private void checkForDuplicateClassAlias(String classAlias) throws SemanticException {
    if ( classAlias != null && fromElementByClassAlias.containsKey( classAlias ) ) {
      throw new SemanticException( "Duplicate definition of alias '" + classAlias + "'" );
    }
  }
View Full Code Here

    if ( fetch && isSubQuery() ) {
      throw new QueryException( "fetch not allowed in subquery from-elements" );
    }
    // The path AST should be a DotNode, and it should have been evaluated already.
    if ( path.getType() != SqlTokenTypes.DOT ) {
      throw new SemanticException( "Path expected for join!" );
    }
    DotNode dot = ( DotNode ) path;
    int hibernateJoinType = JoinProcessor.toHibernateJoinType( joinType );
    dot.setJoinType( hibernateJoinType )// Tell the dot node about the join type.
    dot.setFetch( fetch );
    // Generate an explicit join for the root dot node.   The implied joins will be collected and passed up
    // to the root dot node.
    dot.resolve( true, false, alias == null ? null : alias.getText() );
    FromElement fromElement = dot.getImpliedJoin();
    fromElement.setAllPropertyFetch(propertyFetch!=null);

    if ( with != null ) {
      if ( fetch ) {
        throw new SemanticException( "with-clause not allowed on fetched associations; use filters" );
      }
      handleWithFragment( fromElement, with );
    }

    if ( log.isDebugEnabled() ) {
View Full Code Here

    }
    catch( InvalidWithClauseException e ) {
      throw e;
    }
    catch ( Exception e) {
      throw new SemanticException( e.getMessage() );
    }
  }
View Full Code Here

    }
  }

  protected AST generatePositionalParameter(AST inputNode) throws SemanticException {
    if ( namedParameters.size() > 0 ) {
      throw new SemanticException( "cannot define positional parameter after any named parameters have been defined" );
    }
    ParameterNode parameter = ( ParameterNode ) astFactory.create( PARAM, "?" );
    PositionalParameterSpecification paramSpec = new PositionalParameterSpecification(
        ( ( Node ) inputNode ).getLine(),
            ( ( Node ) inputNode ).getColumn(),
View Full Code Here

    FromClause fromClause = updateStatement.getFromClause();
    if ( versioned != null ) {
      // Make sure that the persister is versioned
      Queryable persister = fromClause.getFromElement().getQueryable();
      if ( !persister.isVersioned() ) {
        throw new SemanticException( "increment option specified for update of non-versioned entity" );
      }

      VersionType versionType = persister.getVersionType();
      if ( versionType instanceof UserVersionType ) {
        throw new SemanticException( "user-defined version types not supported for increment option" );
      }

      AST eq = getASTFactory().create( HqlSqlTokenTypes.EQ, "=" );
      AST versionPropertyNode = generateVersionPropertyNode( persister );
View Full Code Here

    return methodName;
  }

  private void collectionProperty(AST path, AST name) throws SemanticException {
    if ( path == null ) {
      throw new SemanticException( "Collection function " + name.getText() + " has no path!" );
    }

    SqlNode expr = ( SqlNode ) path;
    Type type = expr.getDataType();
    if ( log.isDebugEnabled() ) {
View Full Code Here

      prepareSelectColumns( selectColumns );
      setText( selectColumns[0] );
      setType( SqlTokenTypes.SQL_TOKEN );
    }
    else {
      throw new SemanticException(
          "Unexpected expression " + expr +
          " found for collection function " + propertyName
        );
    }
  }
View Full Code Here

TOP

Related Classes of antlr.SemanticException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.