Examples of ParserException


Examples of com.alibaba.druid.sql.parser.ParserException

    stmt.setTableName(tableName);
    if (identifierEquals(CHARACTER)) {
      lexer.nextToken();
      accept(Token.SET);
      if (lexer.token() != Token.LITERAL_CHARS) {
        throw new ParserException("syntax error, illegal charset");
      }
      String charset = lexer.stringVal();
      lexer.nextToken();
      stmt.setCharset(charset);
    }
    if (identifierEquals("ROWS")) {
      lexer.nextToken();
      accept(Token.IDENTIFIED);
      accept(Token.BY);
      SQLExpr rowsIdentifiedBy = exprParser.expr();
      stmt.setRowsIdentifiedBy(rowsIdentifiedBy);
    }
    if (identifierEquals(IGNORE)) {
      throw new ParserException("TODO");
    }
    if (lexer.token() == Token.SET) {
      throw new ParserException("TODO");
    }
    return stmt;
  }
View Full Code Here

Examples of com.alibaba.druid.sql.parser.ParserException

    stmt.setTableName(tableName);
    if (identifierEquals(CHARACTER)) {
      lexer.nextToken();
      accept(Token.SET);
      if (lexer.token() != Token.LITERAL_CHARS) {
        throw new ParserException("syntax error, illegal charset");
      }
      String charset = lexer.stringVal();
      lexer.nextToken();
      stmt.setCharset(charset);
    }
    if (identifierEquals("FIELDS") || identifierEquals("COLUMNS")) {
      throw new ParserException("TODO");
    }
    if (identifierEquals("LINES")) {
      throw new ParserException("TODO");
    }
    if (identifierEquals(IGNORE)) {
      throw new ParserException("TODO");
    }
    if (lexer.token() == Token.SET) {
      throw new ParserException("TODO");
    }
    return stmt;
  }
View Full Code Here

Examples of com.alibaba.druid.sql.parser.ParserException

                .parsePrimaryKey();
            SQLAlterTableAddPrimaryKey item = new SQLAlterTableAddPrimaryKey();
            item.setPrimaryKey(primaryKey);
            stmt.getItems().add(item);
          } else if (lexer.token() == Token.KEY) {
            throw new ParserException("TODO " + lexer.token() + " "
                + lexer.stringVal());
          } else if (lexer.token() == Token.CONSTRAINT) {
            throw new ParserException("TODO " + lexer.token() + " "
                + lexer.stringVal());
          } else if (identifierEquals(FULLTEXT)) {
            throw new ParserException("TODO " + lexer.token() + " "
                + lexer.stringVal());
          } else if (identifierEquals(SPATIAL)) {
            throw new ParserException("TODO " + lexer.token() + " "
                + lexer.stringVal());
          } else {
            WaspSqlAlterTableAddColumn item = new WaspSqlAlterTableAddColumn();
            SQLColumnDefinition columnDef = this.exprParser.parseColumn();
            item.getColumns().add(columnDef);
            if (identifierEquals("AFTER")) {
              lexer.nextToken();
              item.setAfterColumn(this.exprParser.name());
            }
            stmt.getItems().add(item);
          }
        } else if (identifierEquals("ALTER")) {
          throw new ParserException("TODO " + lexer.token() + " "
              + lexer.stringVal());
        } else if (identifierEquals("CHANGE")) {
          lexer.nextToken();
          if (identifierEquals("COLUMN")) {
            lexer.nextToken();
          }
          WaspSqlAlterTableChangeColumn item = new WaspSqlAlterTableChangeColumn();
          item.setColumnName(this.exprParser.name());
          item.setNewColumnDefinition(this.exprParser.parseColumn());
          if (identifierEquals("AFTER")) {
            lexer.nextToken();
            item.setAfterColumn(this.exprParser.name());
          } else if (identifierEquals("FIRST")) {
            lexer.nextToken();
            if (lexer.token() == Token.IDENTIFIER) {
              item.setFirstColumn(this.exprParser.name());
            } else {
              item.setFirst(true);
            }
          }
          stmt.getItems().add(item);
        } else if (identifierEquals("MODIFY")) {
          throw new ParserException("TODO " + lexer.token() + " "
              + lexer.stringVal());
        } else if (lexer.token() == Token.DROP) {
          lexer.nextToken();
          if (lexer.token() == Token.INDEX) {
            lexer.nextToken();
            SQLName indexName = this.exprParser.name();
            SQLAlterTableDropIndex item = new SQLAlterTableDropIndex();
            item.setIndexName(indexName);
            stmt.getItems().add(item);
          } else {
            if (identifierEquals("COLUMN")) {
              lexer.nextToken();
            }
            SQLAlterTableDropColumnItem item = new SQLAlterTableDropColumnItem();
            item.setColumnName(this.exprParser.name());
            stmt.getItems().add(item);
          }
        } else if (identifierEquals("DISABLE")) {
          throw new ParserException("TODO " + lexer.token() + " "
              + lexer.stringVal());
        } else if (identifierEquals("ENABLE")) {
          throw new ParserException("TODO " + lexer.token() + " "
              + lexer.stringVal());
        } else if (identifierEquals("RENAME")) {
          lexer.nextToken();
          WaspSqlRenameTableStatement renameStmt = new WaspSqlRenameTableStatement();
          WaspSqlRenameTableStatement.Item item = new WaspSqlRenameTableStatement.Item();
          item.setName(stmt.getTableSource().getExpr());
          item.setTo(this.exprParser.name());
          renameStmt.getItems().add(item);

          return renameStmt;
        } else if (lexer.token() == Token.ORDER) {
          throw new ParserException("TODO " + lexer.token() + " "
              + lexer.stringVal());
        } else if (identifierEquals("CONVERT")) {
          throw new ParserException("TODO " + lexer.token() + " "
              + lexer.stringVal());
        } else if (lexer.token() == Token.DEFAULT) {
          throw new ParserException("TODO " + lexer.token() + " "
              + lexer.stringVal());
        } else if (identifierEquals("DISCARD")) {
          throw new ParserException("TODO " + lexer.token() + " "
              + lexer.stringVal());
        } else if (identifierEquals("IMPORT")) {
          throw new ParserException("TODO " + lexer.token() + " "
              + lexer.stringVal());
        } else if (identifierEquals("FORCE")) {
          throw new ParserException("TODO " + lexer.token() + " "
              + lexer.stringVal());
        } else if (identifierEquals("TRUNCATE")) {
          throw new ParserException("TODO " + lexer.token() + " "
              + lexer.stringVal());
        } else if (identifierEquals("COALESCE")) {
          throw new ParserException("TODO " + lexer.token() + " "
              + lexer.stringVal());

        } else if (identifierEquals("REORGANIZE")) {
          throw new ParserException("TODO " + lexer.token() + " "
              + lexer.stringVal());
        } else if (identifierEquals("EXCHANGE")) {
          throw new ParserException("TODO " + lexer.token() + " "
              + lexer.stringVal());
        } else if (identifierEquals("ANALYZE")) {
          throw new ParserException("TODO " + lexer.token() + " "
              + lexer.stringVal());
        } else if (identifierEquals("CHECK")) {
          throw new ParserException("TODO " + lexer.token() + " "
              + lexer.stringVal());
        } else if (identifierEquals("OPTIMIZE")) {
          throw new ParserException("TODO " + lexer.token() + " "
              + lexer.stringVal());
        } else if (identifierEquals("REBUILD")) {
          throw new ParserException("TODO " + lexer.token() + " "
              + lexer.stringVal());
        } else if (identifierEquals("REPAIR")) {
          throw new ParserException("TODO " + lexer.token() + " "
              + lexer.stringVal());
        } else if (identifierEquals("REMOVE")) {
          throw new ParserException("TODO " + lexer.token() + " "
              + lexer.stringVal());
        } else if (identifierEquals(CHARACTER)) {
          lexer.nextToken();
          accept(Token.SET);
          accept(Token.EQ);
          WaspSqlAlterTableCharacter item = new WaspSqlAlterTableCharacter();
          item.setCharacterSet(this.exprParser.primary());
          if (lexer.token() == Token.COMMA) {
            lexer.nextToken();
            acceptIdentifier(COLLATE2);
            accept(Token.EQ);
            item.setCollate(this.exprParser.primary());
          }
          stmt.getItems().add(item);
        } else {
          break;
        }

        if (lexer.token() == Token.COMMA) {
          lexer.nextToken();
          continue;
        } else {
          break;
        }
      }

      return stmt;
    }
    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
  }
View Full Code Here

Examples of com.creativewidgetworks.goldparser.engine.ParserException

     * @param msg to add to the errors list
     * @throws ParserException
     */
    public void raiseParserException(String msg) throws ParserException {
        addErrorMessage(msg);
        throw new ParserException(msg);
    }
View Full Code Here

Examples of com.gatehill.apib.parser.exception.ParserException

                }
            }

            if (null != parserHome) {
                if (!parserHome.isDirectory()) {
                    throw new ParserException("Execution directory does not exist: " + parserHome);

                } else if (!parserHome.canRead()) {
                    throw new ParserException("Execution directory is not readable: " + parserHome);
                }

            } else {
                LOGGER.warn("No parser home directory specified");
            }

            final ParsingResult<File> result = executeParser(parserHome, blueprintFile, outputFormat);
            LOGGER.debug("AST file: {}", result.getAst().getAbsolutePath());
            return result;

        } catch (Exception e) {
            throw new ParserException("Error parsing blueprint file to AST file: " + blueprintFile, e);
        }
    }
View Full Code Here

Examples of com.meapsoft.ParserException

    if (!trainFile.haveReadFile)
      trainFile.readFile();

    if (trainFile.chunks.size() == 0)
      throw new ParserException(trainFile.filename, "No chunks found");

    trainFile = (FeatFile) trainFile.clone();
    trainFile.normalizeFeatures();
    trainFile.applyFeatureWeights();

    // To change the number of beats per state all we have to do
    // is modify the chunks in trainFile by joining every
    // beatsPerCodeword chunk into one a superchunk.
    Vector newChunks = new Vector();
    for (int x = 0; x < trainFile.chunks.size() - beatsPerCodeword + 1; x += beatsPerCodeword)
    {
      FeatChunk newChunk = (FeatChunk) ((FeatChunk) trainFile.chunks
          .get(x)).clone();

      // double length = 0;
      for (int y = 1; y < beatsPerCodeword; y++)
      {
        FeatChunk f = (FeatChunk) trainFile.chunks.get(x + y);

        newChunk.addFeature(f.getFeatures());
        newChunk.length += f.length;
      }

      newChunks.add(newChunk);
    }

    trainFile.chunks = newChunks;

    progress.setMaximum(trainFile.chunks.size());

    if (featsToQuantize != null)
    {
      if (!featsToQuantize.haveReadFile)
        featsToQuantize.readFile();

      // What if features don't match
      if (!featsToQuantize.isCompatibleWith(trainFile))
        throw new ParserException(trainFile.filename,
            "Features do not match those in "
                + featsToQuantize.filename);

      featsToQuantize = (FeatFile) featsToQuantize.clone();
      featsToQuantize.normalizeFeatures();
View Full Code Here

Examples of com.meapsoft.ParserException

    if (!featFile.haveReadFile)
      featFile.readFile();

    if (featFile.chunks.size() == 0)
      throw new ParserException(featFile.filename, "No chunks found");

    progress.setMaximum(featFile.chunks.size());
  }
View Full Code Here

Examples of com.meapsoft.ParserException

    if (!featFile.haveReadFile)
      featFile.readFile();

    if (featFile.chunks.size() == 0)
      throw new ParserException(featFile.filename, "No chunks found");

        if (normalizeFeatures)
    {
      featFile = (FeatFile) featFile.clone();
            featFile.normalizeFeatures();
View Full Code Here

Examples of com.meapsoft.ParserException

    if (!featFile.haveReadFile)
      featFile.readFile();

    if (featFile.chunks.size() == 0)
      throw new ParserException(featFile.filename, "No chunks found");

    progress.setMaximum(featFile.chunks.size());

    // System.out.println("blip chunks in: " + featFile.chunks.size());
  }
View Full Code Here

Examples of com.meapsoft.ParserException

    if (!inEDLFile.haveReadFile)
      inEDLFile.readFile();

    if (inEDLFile.chunks.size() == 0)
      throw new ParserException(inEDLFile.filename, "No chunks found");

    if (normalizeFeatures)
    {
      // inEDLFile = (EDLFile) inEDLFile.clone();
      inEDLFile.normalizeFeatures();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.