Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/Shell.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/Shell.java (revision 574112) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/Shell.java (working copy) @@ -34,7 +34,7 @@ /** * An hbase shell. * - * @see HBaseShell + * @see HbaseShell */ public class Shell { /** audible keyboard bells */ @@ -92,7 +92,7 @@ /** Return the string of prompt start string */ private static String getPrompt(final StringBuilder queryStr) { - return (queryStr.toString().equals("")) ? "HBase > " : " --> "; + return (queryStr.toString().equals("")) ? "Hbase > " : " --> "; } /** Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DeleteCommand.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DeleteCommand.java (revision 574112) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DeleteCommand.java (working copy) @@ -20,64 +20,83 @@ package org.apache.hadoop.hbase.shell; import java.io.IOException; +import java.util.ArrayList; import java.util.List; -import java.util.Map; -import java.util.Set; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.HBaseAdmin; import org.apache.hadoop.hbase.HTable; import org.apache.hadoop.io.Text; +/** + * Deletes values from tables. + */ public class DeleteCommand extends BasicCommand { - - private Text table; - private Map> condition; + private String tableName; + + private String rowKey; + + private List columnList; + public ReturnMsg execute(Configuration conf) { - if (this.table == null || condition == null) - return new ReturnMsg(0, "Syntax error : Please check 'Delete' syntax."); + if (columnList == null) { + throw new IllegalArgumentException("Column list is null"); + } try { - HTable table = new HTable(conf, this.table); - long lockId = table.startUpdate(getRow()); + HBaseAdmin admin = new HBaseAdmin(conf); + HTable hTable = new HTable(conf, new Text(tableName)); + long lockID = hTable.startUpdate(new Text(rowKey)); - if (getColumn() != null) { - table.delete(lockId, getColumn()); - } else { - Set keySet = table.getRow(getRow()).keySet(); - Text[] columnKey = keySet.toArray(new Text[keySet.size()]); - - for (int i = 0; i < columnKey.length; i++) { - table.delete(lockId, columnKey[i]); - } + for (Text column : getColumnList(admin, hTable)) { + hTable.delete(lockID, new Text(column)); } - table.commit(lockId); + hTable.commit(lockID); - return new ReturnMsg(1, "1 deleted successfully. "); + return new ReturnMsg(1, "Column(s) deleted successfully."); } catch (IOException e) { - return new ReturnMsg(0, "error msg : " + e.toString()); + String[] msg = e.getMessage().split("[\n]"); + return new ReturnMsg(0, msg[0]); } } public void setTable(String table) { - this.table = new Text(table); + this.tableName = table; } - public void setCondition(Map> cond) { - this.condition = cond; + public void setRow(String row) { + this.rowKey = row; } - public Text getRow() { - return new Text(this.condition.get("row").get(1)); + public void setColumnList(List columnList) { + this.columnList = columnList; } - public Text getColumn() { - if (this.condition.containsKey("column")) { - return new Text(this.condition.get("column").get(1)); - } else { - return null; + public Text[] getColumnList(HBaseAdmin admin, HTable hTable) { + Text[] cols = null; + + try { + if (this.columnList.contains("*")) { + cols = hTable.getRow(new Text(this.rowKey)).keySet().toArray(new Text[] {}); + } else { + List tmpList = new ArrayList(); + for (int i = 0; i < this.columnList.size(); i++) { + Text column = null; + if (this.columnList.get(i).contains(":")) + column = new Text(this.columnList.get(i)); + else + column = new Text(this.columnList.get(i) + ":"); + + tmpList.add(column); + } + cols = tmpList.toArray(new Text[] {}); + } + } catch (IOException e) { + e.printStackTrace(); } + return cols; } - + } Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/CreateCommand.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/CreateCommand.java (revision 574112) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/CreateCommand.java (working copy) @@ -19,60 +19,59 @@ */ package org.apache.hadoop.hbase.shell; -import java.io.IOException; -import java.util.List; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseAdmin; import org.apache.hadoop.hbase.HColumnDescriptor; -import org.apache.hadoop.hbase.HConnection; -import org.apache.hadoop.hbase.HConnectionManager; import org.apache.hadoop.hbase.HTableDescriptor; -import org.apache.hadoop.io.Text; -public class CreateCommand extends BasicCommand { +/** + * Creates tables. + */ +public class CreateCommand extends SchemaModificationCommand { - private Text table; - private List columnfamilies; - @SuppressWarnings("unused") - private int limit; - + private String table; + private Map> columnSpecMap = + new HashMap>(); public ReturnMsg execute(Configuration conf) { - if (this.table == null || this.columnfamilies == null) - return new ReturnMsg(0, "Syntax error : Please check 'Create' syntax."); - try { - HConnection conn = HConnectionManager.getConnection(conf); HBaseAdmin admin = new HBaseAdmin(conf); + HTableDescriptor tableDesc = new HTableDescriptor(table); - if (conn.tableExists(this.table)) { - return new ReturnMsg(0, "Table was already exsits."); + HColumnDescriptor columnDesc = null; + Set columns = columnSpecMap.keySet(); + for (String column : columns) { + columnDesc = getColumnDescriptor(column, columnSpecMap.get(column)); + tableDesc.addFamily(columnDesc); } - HTableDescriptor desc = new HTableDescriptor(this.table.toString()); - for (int i = 0; i < this.columnfamilies.size(); i++) { - String columnFamily = columnfamilies.get(i); - if (columnFamily.lastIndexOf(':') == (columnFamily.length() - 1)) { - columnFamily = columnFamily.substring(0, columnFamily.length() - 1); - } - desc.addFamily(new HColumnDescriptor(columnFamily + FAMILY_INDICATOR)); - } - admin.createTable(desc); - return new ReturnMsg(1, "Table created successfully."); - } catch (IOException e) { - return new ReturnMsg(0, "error msg : " + e.toString()); + + System.out.println("Creating table... Please wait."); + + admin.createTable(tableDesc); + return new ReturnMsg(0, "Table created successfully."); } + catch (Exception e) { + return new ReturnMsg(0, extractErrMsg(e)); + } } - + + /** + * Sets the table to be created. + * @param table Table to be created + */ public void setTable(String table) { - this.table = new Text(table); + this.table = table; } - public void setColumnfamilies(List columnfamilies) { - this.columnfamilies = columnfamilies; + /** + * Adds a column specification. + * @param columnSpec Column specification + */ + public void addColumnSpec(String column, Map columnSpec) { + columnSpecMap.put(column, columnSpec); } - - public void setLimit(int limit) { - this.limit = limit; - } } Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/HelpManager.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/HelpManager.java (revision 574115) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/HelpManager.java (working copy) @@ -41,7 +41,6 @@ /** Print out the program version. */ public void printVersion() { - ClearCommand.clear(); System.out.println(APP_NAME + ", " + APP_VERSION + " version.\n" + "Copyright (c) 2007 by udanax, " + "licensed to Apache Software Foundation.\n" @@ -55,12 +54,13 @@ for (Map.Entry helpMap : help.entrySet()) { wrapping(helpMap.getKey(), helpMap.getValue(), false); } + System.out.println(); } else { if (help.containsKey(cmd.toUpperCase())) { String[] msg = help.get(cmd.toUpperCase()); wrapping(cmd.toUpperCase(), msg, true); } else { - System.out.println("Unknown Command : Type 'help' for usage."); + System.out.println("Unknown Command: Type 'help;' for usage."); } } } @@ -76,6 +76,6 @@ } if (example) - System.out.println("\n>>> " + cmdType[1]); + System.out.println("\nSyntax:\n" + cmdType[1] + "\n"); } } Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DisableCommand.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DisableCommand.java (revision 0) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DisableCommand.java (revision 0) @@ -0,0 +1,53 @@ +/** + * Copyright 2007 The Apache Software Foundation + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hbase.shell; + +import java.io.IOException; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.HBaseAdmin; +import org.apache.hadoop.io.Text; + +/** + * Disables tables. + */ +public class DisableCommand extends BasicCommand { + + private String table; + + public ReturnMsg execute(Configuration conf) { + assert table != null; + + try { + HBaseAdmin admin = new HBaseAdmin(conf); + admin.disableTable(new Text(table)); + + return new ReturnMsg(1, "Table disabled successfully."); + } catch (IOException e) { + String[] msg = e.getMessage().split("[\n]"); + return new ReturnMsg(0, msg[0]); + } + } + + public void setTable(String table) { + this.table = table; + } + +} Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/InsertCommand.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/InsertCommand.java (revision 574112) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/InsertCommand.java (working copy) @@ -21,22 +21,32 @@ import java.io.IOException; import java.util.List; -import java.util.Map; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HTable; import org.apache.hadoop.io.Text; +/** + * Inserts values into tables. + */ public class InsertCommand extends BasicCommand { private Text table; private List columnfamilies; private List values; - private Map> condition; + private String row; public ReturnMsg execute(Configuration conf) { - if (this.table == null || this.values == null || this.condition == null) + if (this.table == null || this.values == null) { return new ReturnMsg(0, "Syntax error : Please check 'Insert' syntax."); + } else if(this.row == null) { + return new ReturnMsg(0, "The string must be enclosed in " + + "single quotation marks, as in '...'.\n"); + } else if (this.columnfamilies.size() == 0) { + return new ReturnMsg(0, "The quoted identifier for table name " + + "and column name must \nbe enclosed " + + "in double quotation marks, as in \"...\".\n"); + } if (this.columnfamilies.size() != this.values.size()) return new ReturnMsg(0, @@ -47,8 +57,12 @@ long lockId = table.startUpdate(getRow()); for (int i = 0; i < this.values.size(); i++) { - table.put(lockId, getColumn(i), getValue(i)); - + Text column = null; + if(getColumn(i).toString().contains(":")) + column = getColumn(i); + else + column = new Text(getColumn(i) + ":"); + table.put(lockId, column, getValue(i)); } table.commit(lockId); @@ -71,12 +85,12 @@ this.values = values; } - public void setCondition(Map> cond) { - this.condition = cond; + public void setRow(String row) { + this.row = row; } public Text getRow() { - return new Text(this.condition.get("row").get(1)); + return new Text(this.row); } public Text getColumn(int i) { Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DropCommand.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DropCommand.java (revision 574112) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DropCommand.java (working copy) @@ -20,31 +20,40 @@ package org.apache.hadoop.hbase.shell; import java.io.IOException; +import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseAdmin; import org.apache.hadoop.io.Text; +/** + * Drops tables. + */ public class DropCommand extends BasicCommand { - private Text table; + private List tableList; public ReturnMsg execute(Configuration conf) { - if (this.table == null) - return new ReturnMsg(0, "Syntax error : Please check 'Drop' syntax."); - + if (tableList == null) { + throw new IllegalArgumentException("List of tables is null"); + } + try { HBaseAdmin admin = new HBaseAdmin(conf); - admin.deleteTable(this.table); - return new ReturnMsg(1, "Table droped successfully."); + for (String table : tableList) { + System.out.println("Dropping " + table + "... Please wait."); + admin.deleteTable(new Text(table)); + } + + return new ReturnMsg(1, "Table(s) dropped successfully."); } catch (IOException e) { - return new ReturnMsg(0, "error msg : " + e.toString()); + return new ReturnMsg(0, extractErrMsg(e)); } } - public void setArgument(String table) { - this.table = new Text(table); + public void setTableList(List tableList) { + this.tableList = tableList; } } Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/HelpContents.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/HelpContents.java (revision 574112) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/HelpContents.java (working copy) @@ -29,37 +29,77 @@ */ public static Map Load() { Map load = new HashMap(); + String columnName = "column_name: " + + "\n\t column_family_name" + + "\n\t| column_family_name:column_label_name"; + String columnList = "{ column_name, [, column_name] ... | *}"; - load.put("SHOW", new String[] { "List all tables.", "SHOW TABLES;" }); + load.put("SHOW", new String[] { "List all available tables", "SHOW TABLES;" }); + load.put("FS", new String[] { "Hadoop FsShell operations.", "FS -copyFromLocal /home/user/backup.dat fs/user/backup;" }); - load.put("CLEAR", new String[] {"Clear the screen.", "CLEAR;"} ); - load.put("DESCRIBE", new String[] { "Describe a table's columnfamilies.", - "DESCRIBE ;" }); + + load.put("CLEAR", new String[] {"Clear the screen", "CLEAR;"} ); + + load.put("DESCRIBE", new String[] { "Print information about tables", + "[DESCRIBE|DESC] table_name;" }); + load.put("CREATE", new String[] { - "Create a table", - "CREATE " - + "\n\t COLUMNFAMILIES('cf_name1'[, 'cf_name2', ...]);" - + "\n [LIMIT=versions_limit];" }); + "Create tables", + "CREATE TABLE table_name" + + "\n\t(column_family_spec [, column_family_spec] ...);" + + "\n\n" + + "column_family_spec:" + + "\n\tcolumn_family_name" + + "\n\t[MAX_VERSIONS=n]" + + "\n\t[MAX_LENGTH=n]" + + "\n\t[COMPRESSION=NONE|RECORD|BLOCK]" + + "\n\t[IN_MEMORY]" + + "\n\t[BLOOMFILTER=NONE|BLOOM|COUNTING|RETOUCHED VECTOR_SIZE=n NUM_HASH=n]" + }); + load.put("DROP", new String[] { - "Drop columnfamilie(s) from a table or drop table(s)", - "DROP table_name1[, table_name2, ...] | cf_name1[, cf_name2, ...];" }); + "Drop tables", + "DROP table_name [, table_name] ...;" }); + load.put("INSERT", new String[] { - "Insert row into table", - "INSERT " + "\n\t('column_name1'[, 'column_name2', ...])" - + "\n\t VALUES('entry1'[, 'entry2', ...])" - + "\n WHERE row='row_key';" }); + "Insert values into tables", + "INSERT INTO table_name" + + "\n\t(colmn_name, ...) VALUES ('value', ...)" + + "\n\tWHERE row='row_key';" + + "\n\n" + columnName + }); + load.put("DELETE", new String[] { - "Delete cell or row in table.", - "DELETE " + "\n\t WHERE row='row_key;" - + "\n [AND column='column_name'];" }); + "Delete a subset of the data in a table", + "DELETE " + columnList + + "\n\tFROM table_name" + + "\n\tWHERE row='row-key';" + + "\n\n" + + columnName + }); + load.put("SELECT", new String[] { - "Select values from a table", - "SELECT " + "\n\t [WHERE row='row_key']" - + "\n [AND column='column_name'];" - + "\n [AND time='timestamp'];" - + "\n [LIMIT=versions_limit];" }); + "Select values from tables", + "SELECT " + columnList + " FROM table_name" + + "\n\t[WHERE row='row_key' | STARTING FROM 'row-key']" + + "\n\t[NUM_VERSIONS = version_count]" + + "\n\t[TIMESTAMP 'timestamp']" + + "\n\t[LIMIT = row_count]" + + "\n\t[INTO FILE 'file_name'];" + }); + + load.put("ALTER", + new String[] { + "Alter the structure of a table", + "ALTER TABLE table_name" + + "\n\t ADD column_spec" + + "\n\t| ADD (column_spec, column_spec, ...)" + + "\n\t| DROP column_family_name" + + "\n\t| CHANGE column_spec;" + }); + load.put("EXIT", new String[] { "Exit shell", "EXIT;" }); return load; Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/AlterCommand.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/AlterCommand.java (revision 0) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/AlterCommand.java (revision 0) @@ -0,0 +1,137 @@ +/** + * Copyright 2007 The Apache Software Foundation + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hbase.shell; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.HBaseAdmin; +import org.apache.hadoop.hbase.HColumnDescriptor; +import org.apache.hadoop.io.Text; + +/** + * Alters tables. + */ +public class AlterCommand extends SchemaModificationCommand { + + public enum OperationType { ADD, DROP, CHANGE, NOOP }; + private OperationType operationType = OperationType.NOOP; + private Map> columnSpecMap = + new HashMap>(); + private String table; + private String column; // column to be dropped + + public ReturnMsg execute(Configuration conf) { + try { + HBaseAdmin admin = new HBaseAdmin(conf); + Set columns = null; + HColumnDescriptor columnDesc = null; + + switch (operationType) { + case ADD: + disableTable(admin, table); + + columns = columnSpecMap.keySet(); + for (String column : columns) { + columnDesc = getColumnDescriptor(column, columnSpecMap.get(column)); + System.out.println("Adding " + column + + " to " + table + "... Please wait."); + admin.addColumn(new Text(table), columnDesc); + } + + enableTable(admin, table); + break; + case DROP: + disableTable(admin, table); + + System.out.println("Dropping " + column + + " from " + table + "... Please wait."); + column = appendDelimiter(column); + admin.deleteColumn(new Text(table), new Text(column)); + + enableTable(admin, table); + break; + case CHANGE: + // Not yet supported + return new ReturnMsg(0, "" + operationType + + " is not yet supported."); + case NOOP: + return new ReturnMsg(0, "Invalid operation type."); + } + + return new ReturnMsg(0, "Table altered successfully."); + + } + catch (Exception e) { + return new ReturnMsg(0, extractErrMsg(e)); + } + } + + private void disableTable(HBaseAdmin admin, String table) + throws IOException { + System.out.println("Disabling " + table + "... Please wait."); + admin.disableTable(new Text(table)); + } + + private void enableTable(HBaseAdmin admin, String table) + throws IOException { + System.out.println("Enabling " + table + "... Please wait."); + admin.enableTable(new Text(table)); + } + + /** + * Sets the table to be altered. + * @param table Table to be altered. + */ + public void setTable(String table) { + this.table = table; + + } + + /** + * Adds a column specification. + * @param columnSpec Column specification + */ + public void addColumnSpec(String column, Map columnSpec) { + columnSpecMap.put(column, columnSpec); + } + + /** + * Sets the column to be dropped. Only applicable to the DROP + * operation. + * @param column Column to be dropped. + */ + public void setColumn(String column) { + this.column = column; + } + + /** + * Sets the opearation type of this alteration. + * @param operationType Operation type + * @see OperationType + */ + public void setOperationType(OperationType operationType) { + this.operationType = operationType; + } + +} Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/FsCommand.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/FsCommand.java (revision 574112) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/FsCommand.java (working copy) @@ -25,6 +25,9 @@ import org.apache.hadoop.fs.FsShell; import org.apache.hadoop.util.ToolRunner; +/** + * Run hadoop filesystem commands. + */ public class FsCommand extends BasicCommand { private List query; Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ConsoleTable.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ConsoleTable.java (revision 574112) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ConsoleTable.java (working copy) @@ -26,7 +26,11 @@ * Manufactures console table, but stupid. */ public class ConsoleTable { + private static PrintStream out; + private static final String sBar = "+------+----------------------+"; + private static final String lBar = "----------------------+----------------------+"; + static { try { out = new PrintStream(System.out, true, "UTF-8"); @@ -34,21 +38,20 @@ e.printStackTrace(); } } - + public static void printHead(String name) { - out.println("+------+----------------------+"); + out.println(sBar); out.print("| No. | "); - out.printf("%-20s", name); - out.println(" |"); + printCell(name, " |", true); } public static void printFoot() { - out.println("+------+----------------------+"); + out.println(sBar); out.println(); } public static void printTable(int count, String name) { - out.println("+------+----------------------+"); + out.println(sBar); if (name.length() > 20) { int interval = 20; @@ -56,8 +59,7 @@ out.print("| "); out.printf("%-4s", count + 1); out.print(" | "); - out.printf("%-20s", name.substring(0, interval)); - out.println(" |"); + printCell(name.substring(0, interval), " |", true); for (int i = 0; i < name.length() / interval; i++) { out.print("| "); @@ -66,64 +68,44 @@ int end = ((interval * i) + interval + interval); if (end > name.length()) { - out.printf("%-20s", name.substring(end - interval, - name.length())); + printCell(name.substring(end - interval, name.length()), " |", true); } else { - out.printf("%-20s", name.substring(end - interval, end)); + printCell(name.substring(end - interval, end), " |", true); } - out.println(" |"); } } else { out.print("| "); out.printf("%-4s", count + 1); out.print(" | "); - out.printf("%-20s", name); - out.println(" |"); + printCell(name, " |", true); } } public static void selectHead() { - out.println("+------+----------------------+" + - "----------------------+----------------------+"); + out.println(sBar + lBar); out.print("| No. | "); - out.printf("%-20s", "Row"); - out.printf(" | "); - out.printf("%-20s", "Column"); - out.printf(" | "); - out.printf("%-20s", "Cell"); - out.println(" | "); + printCell("Row", " | ", false); + printCell("Column", " | ", false); + printCell("Cell", " | ", true); } public static void printLine(int count, String key, String column, String cellData) { - out.println("+------+----------------------+" + - "----------------------+----------------------+"); + out.println(sBar + lBar); if (key.length() > 20 || column.length() > 20 || cellData.length() > 20) { int interval = 20; out.print("| "); out.printf("%-4s", count + 1); out.print(" | "); - if (key.length() > 20) - out.printf("%-20s", key.substring(0, interval)); - else - out.printf("%-20s", key); - out.print(" | "); - if (column.length() > 20) - out.printf("%-20s", column.substring(0, interval)); - else - out.printf("%-20s", column); - out.print(" | "); - if (cellData.length() > 20) - out.printf("%-20s", cellData.substring(0, interval)); - else - out.printf("%-20s", cellData); - out.println(" |"); - // out.println(getBiggerInt(new int[]{ 3, 1, 9})); + printLongCell(key, interval); + printLongCell(column, interval); + printLongCell(cellData, interval); + int biggerStrLength = getBiggerInt(new int[] { key.length(), - column.length(), cellData.length() }); + column.length(), cellData.length() }); for (int i = 0; i < (biggerStrLength / interval); i++) { out.print("| "); @@ -132,58 +114,51 @@ int end = ((interval * i) + interval + interval); - if (end > key.length()) { - if (key.length() > interval && end - interval < key.length()) { - out.printf("%-20s", key.substring(end - interval, - key.length())); - } else { - out.printf("%-20s", ""); - } - } else { - out.printf("%-20s", key.substring(end - interval, end)); - } - - out.print(" | "); - - if (end > column.length()) { - if (column.length() > interval && end - interval < column.length()) { - out.printf("%-20s", column.substring(end - interval, - column.length())); - } else { - out.printf("%-20s", ""); - } - } else { - out.printf("%-20s", column.substring(end - interval, end)); - } - - out.print(" | "); - if (end > cellData.length()) { - if (cellData.length() > interval && - end - interval < cellData.length()) { - out.printf("%-20s", - cellData.substring(end - interval, cellData.length())); - } else { - out.printf("%-20s", ""); - } - } else { - out.printf("%-20s", cellData.substring(end - interval, end)); - } - out.println(" |"); + printLongCellData(key, end, interval, false); + printLongCellData(column, end, interval, false); + printLongCellData(cellData, end, interval, false); } - } else { out.print("| "); out.printf("%-4s", count + 1); out.print(" | "); - out.printf("%-20s", key); - out.print(" | "); - out.printf("%-20s", column); - out.print(" | "); - out.printf("%-20s", cellData); - out.println(" |"); + printCell(key, " | ", false); + printCell(column, " | ", false); + printCell(cellData, " |", true); } } + private static void printLongCellData(String key, int end, int interval, + boolean newLine) { + if (end > key.length()) { + if (key.length() > interval && end - interval < key.length()) { + out.printf("%-20s", key.substring(end - interval, key.length())); + } else { + out.printf("%-20s", ""); + } + } else { + out.printf("%-20s", key.substring(end - interval, end)); + } + out.print(" | "); + if (newLine) + out.println(); + } + + private static void printLongCell(String iKey, int interval) { + if (iKey.length() > 20) + printCell(iKey.substring(0, interval), " | ", true); + else + printCell(iKey, " | ", true); + } + + private static void printCell(String data, String end, boolean newLine) { + out.printf("%-20s", data); + out.printf(end); + + if (newLine) + out.println(); + } + public static int getBiggerInt(int[] integers) { int result = -1; for (int i = 0; i < integers.length; i++) { @@ -195,8 +170,7 @@ } public static void selectFoot() { - out.println("+------+----------------------+" + - "----------------------+----------------------+"); + out.println(sBar + lBar); out.println(); } Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DescCommand.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DescCommand.java (revision 574112) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DescCommand.java (working copy) @@ -27,6 +27,9 @@ import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.io.Text; +/** + * Prints information about tables. + */ public class DescCommand extends BasicCommand { private Text table; Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/ParserTokenManager.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/ParserTokenManager.java (revision 574112) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/ParserTokenManager.java (working copy) @@ -1,4 +1,4 @@ -/* Generated By:JavaCC: Do not edit this line. ParserTokenManager.java */ +/* Generated By:JavaCC: Do not edit this line. ParserTokenManager.java */ /** * Copyright 2007 The Apache Software Foundation * @@ -17,1016 +17,1612 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ -package org.apache.hadoop.hbase.shell.generated; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.HashMap; -import java.io.StringReader; -import java.io.Reader; -import org.apache.hadoop.hbase.shell.*; - -public class ParserTokenManager implements ParserConstants -{ - public java.io.PrintStream debugStream = System.out; - public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } -private final int jjStopStringLiteralDfa_0(int pos, long active0) -{ + */ +package org.apache.hadoop.hbase.shell.generated; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.HashMap; +import java.io.StringReader; +import java.io.Reader; +import org.apache.hadoop.hbase.shell.*; + +public class ParserTokenManager implements ParserConstants +{ + public java.io.PrintStream debugStream = System.out; + public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } +private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1) +{ switch (pos) - { - case 0: - if ((active0 & 0x1ffffe0L) != 0L) - { - jjmatchedKind = 32; - return 13; - } - if ((active0 & 0x84000000L) != 0L) - return 1; - return -1; - case 1: - if ((active0 & 0x1000800L) != 0L) - return 13; - if ((active0 & 0xfff7e0L) != 0L) - { - jjmatchedKind = 32; - jjmatchedPos = 1; - return 13; - } - return -1; - case 2: - if ((active0 & 0x810000L) != 0L) - return 13; - if ((active0 & 0x7ef7e0L) != 0L) - { - jjmatchedKind = 32; - jjmatchedPos = 2; - return 13; - } - return -1; - case 3: - if ((active0 & 0x7ae340L) != 0L) - { - jjmatchedKind = 32; - jjmatchedPos = 3; - return 13; - } - if ((active0 & 0x414a0L) != 0L) - return 13; - return -1; - case 4: - if ((active0 & 0x600040L) != 0L) - return 13; - if ((active0 & 0x1ae300L) != 0L) - { - jjmatchedKind = 32; - jjmatchedPos = 4; - return 13; - } - return -1; - case 5: - if ((active0 & 0x1ae200L) != 0L) - return 13; - if ((active0 & 0x100L) != 0L) - { - if (jjmatchedPos != 5) - { - jjmatchedKind = 32; - jjmatchedPos = 5; - } - return 13; - } - return -1; - case 6: - if ((active0 & 0x100100L) != 0L) - { - jjmatchedKind = 32; - jjmatchedPos = 6; - return 13; - } - return -1; - case 7: - if ((active0 & 0x100L) != 0L) - return 13; - if ((active0 & 0x100000L) != 0L) - { - jjmatchedKind = 32; - jjmatchedPos = 7; - return 13; - } - return -1; - case 8: - if ((active0 & 0x100000L) != 0L) - { - jjmatchedKind = 32; - jjmatchedPos = 8; - return 13; - } - return -1; - case 9: - if ((active0 & 0x100000L) != 0L) - { - jjmatchedKind = 32; - jjmatchedPos = 9; - return 13; - } - return -1; - case 10: - if ((active0 & 0x100000L) != 0L) - { - jjmatchedKind = 32; - jjmatchedPos = 10; - return 13; - } - return -1; - case 11: - if ((active0 & 0x100000L) != 0L) - { - jjmatchedKind = 32; - jjmatchedPos = 11; - return 13; - } - return -1; - case 12: - if ((active0 & 0x100000L) != 0L) - { - jjmatchedKind = 32; - jjmatchedPos = 12; - return 13; - } - return -1; - default : - return -1; - } -} -private final int jjStartNfa_0(int pos, long active0) -{ - return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); -} -private final int jjStopAtPos(int pos, int kind) -{ - jjmatchedKind = kind; - jjmatchedPos = pos; - return pos + 1; -} -private final int jjStartNfaWithStates_0(int pos, int kind, int state) -{ - jjmatchedKind = kind; - jjmatchedPos = pos; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { return pos + 1; } - return jjMoveNfa_0(state, pos + 1); -} -private final int jjMoveStringLiteralDfa0_0() -{ - switch(curChar) - { - case 40: - return jjStopAtPos(0, 27); - case 41: - return jjStopAtPos(0, 28); - case 44: - return jjStopAtPos(0, 25); - case 45: - return jjStartNfaWithStates_0(0, 31, 1); - case 46: - return jjStartNfaWithStates_0(0, 26, 1); - case 59: - return jjStopAtPos(0, 37); - case 60: - return jjMoveStringLiteralDfa1_0(0x40000000L); - case 61: - return jjStopAtPos(0, 29); - case 65: - case 97: - return jjMoveStringLiteralDfa1_0(0x800000L); - case 67: - case 99: - return jjMoveStringLiteralDfa1_0(0x120240L); - case 68: - case 100: - return jjMoveStringLiteralDfa1_0(0x4500L); - case 69: - case 101: - return jjMoveStringLiteralDfa1_0(0x1000L); - case 70: - case 102: - return jjMoveStringLiteralDfa1_0(0x800L); - case 72: - case 104: - return jjMoveStringLiteralDfa1_0(0x20L); - case 73: - case 105: - return jjMoveStringLiteralDfa1_0(0x2000L); - case 76: - case 108: - return jjMoveStringLiteralDfa1_0(0x400000L); - case 79: - case 111: - return jjMoveStringLiteralDfa1_0(0x1000000L); - case 82: - case 114: - return jjMoveStringLiteralDfa1_0(0x10000L); - case 83: - case 115: - return jjMoveStringLiteralDfa1_0(0x8080L); - case 84: - case 116: - return jjMoveStringLiteralDfa1_0(0x40000L); - case 86: - case 118: - return jjMoveStringLiteralDfa1_0(0x80000L); - case 87: - case 119: - return jjMoveStringLiteralDfa1_0(0x200000L); - default : - return jjMoveNfa_0(0, 0); - } -} -private final int jjMoveStringLiteralDfa1_0(long active0) -{ - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(0, active0); - return 1; - } - switch(curChar) - { - case 62: - if ((active0 & 0x40000000L) != 0L) - return jjStopAtPos(1, 30); - break; - case 65: - case 97: - return jjMoveStringLiteralDfa2_0(active0, 0x80000L); - case 69: - case 101: - return jjMoveStringLiteralDfa2_0(active0, 0xc120L); - case 72: - case 104: - return jjMoveStringLiteralDfa2_0(active0, 0x200080L); - case 73: - case 105: - return jjMoveStringLiteralDfa2_0(active0, 0x440000L); - case 76: - case 108: - return jjMoveStringLiteralDfa2_0(active0, 0x40L); - case 78: - case 110: - return jjMoveStringLiteralDfa2_0(active0, 0x802000L); - case 79: - case 111: - return jjMoveStringLiteralDfa2_0(active0, 0x130000L); - case 82: - case 114: - if ((active0 & 0x1000000L) != 0L) - return jjStartNfaWithStates_0(1, 24, 13); - return jjMoveStringLiteralDfa2_0(active0, 0x600L); - case 83: - case 115: - if ((active0 & 0x800L) != 0L) - return jjStartNfaWithStates_0(1, 11, 13); - break; - case 88: - case 120: - return jjMoveStringLiteralDfa2_0(active0, 0x1000L); - default : - break; - } - return jjStartNfa_0(0, active0); -} -private final int jjMoveStringLiteralDfa2_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(0, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(1, active0); - return 2; - } - switch(curChar) - { - case 68: - case 100: - if ((active0 & 0x800000L) != 0L) - return jjStartNfaWithStates_0(2, 23, 13); - break; - case 69: - case 101: - return jjMoveStringLiteralDfa3_0(active0, 0x200240L); - case 73: - case 105: - return jjMoveStringLiteralDfa3_0(active0, 0x1000L); - case 76: - case 108: - return jjMoveStringLiteralDfa3_0(active0, 0x1ac020L); - case 77: - case 109: - return jjMoveStringLiteralDfa3_0(active0, 0x440000L); - case 79: - case 111: - return jjMoveStringLiteralDfa3_0(active0, 0x480L); - case 83: - case 115: - return jjMoveStringLiteralDfa3_0(active0, 0x2100L); - case 87: - case 119: - if ((active0 & 0x10000L) != 0L) - return jjStartNfaWithStates_0(2, 16, 13); - break; - default : - break; - } - return jjStartNfa_0(1, active0); -} -private final int jjMoveStringLiteralDfa3_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(1, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(2, active0); - return 3; - } - switch(curChar) - { - case 65: - case 97: - return jjMoveStringLiteralDfa4_0(active0, 0x240L); - case 67: - case 99: - return jjMoveStringLiteralDfa4_0(active0, 0x100L); - case 69: - case 101: - if ((active0 & 0x40000L) != 0L) - return jjStartNfaWithStates_0(3, 18, 13); - return jjMoveStringLiteralDfa4_0(active0, 0xe000L); - case 73: - case 105: - return jjMoveStringLiteralDfa4_0(active0, 0x400000L); - case 80: - case 112: - if ((active0 & 0x20L) != 0L) - return jjStartNfaWithStates_0(3, 5, 13); - else if ((active0 & 0x400L) != 0L) - return jjStartNfaWithStates_0(3, 10, 13); - break; - case 82: - case 114: - return jjMoveStringLiteralDfa4_0(active0, 0x200000L); - case 84: - case 116: - if ((active0 & 0x1000L) != 0L) - return jjStartNfaWithStates_0(3, 12, 13); - break; - case 85: - case 117: - return jjMoveStringLiteralDfa4_0(active0, 0x1a0000L); - case 87: - case 119: - if ((active0 & 0x80L) != 0L) - return jjStartNfaWithStates_0(3, 7, 13); - break; - default : - break; - } - return jjStartNfa_0(2, active0); -} -private final int jjMoveStringLiteralDfa4_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(2, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(3, active0); - return 4; - } - switch(curChar) - { - case 67: - case 99: - return jjMoveStringLiteralDfa5_0(active0, 0x8000L); - case 69: - case 101: - if ((active0 & 0x200000L) != 0L) - return jjStartNfaWithStates_0(4, 21, 13); - return jjMoveStringLiteralDfa5_0(active0, 0x80000L); - case 77: - case 109: - return jjMoveStringLiteralDfa5_0(active0, 0x120000L); - case 82: - case 114: - if ((active0 & 0x40L) != 0L) - return jjStartNfaWithStates_0(4, 6, 13); - return jjMoveStringLiteralDfa5_0(active0, 0x2100L); - case 84: - case 116: - if ((active0 & 0x400000L) != 0L) - return jjStartNfaWithStates_0(4, 22, 13); - return jjMoveStringLiteralDfa5_0(active0, 0x4200L); - default : - break; - } - return jjStartNfa_0(3, active0); -} -private final int jjMoveStringLiteralDfa5_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(3, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(4, active0); - return 5; - } - switch(curChar) - { - case 69: - case 101: - if ((active0 & 0x200L) != 0L) - return jjStartNfaWithStates_0(5, 9, 13); - else if ((active0 & 0x4000L) != 0L) - return jjStartNfaWithStates_0(5, 14, 13); - break; - case 73: - case 105: - return jjMoveStringLiteralDfa6_0(active0, 0x100L); - case 78: - case 110: - if ((active0 & 0x20000L) != 0L) - { - jjmatchedKind = 17; - jjmatchedPos = 5; - } - return jjMoveStringLiteralDfa6_0(active0, 0x100000L); - case 83: - case 115: - if ((active0 & 0x80000L) != 0L) - return jjStartNfaWithStates_0(5, 19, 13); - break; - case 84: - case 116: - if ((active0 & 0x2000L) != 0L) - return jjStartNfaWithStates_0(5, 13, 13); - else if ((active0 & 0x8000L) != 0L) - return jjStartNfaWithStates_0(5, 15, 13); - break; - default : - break; - } - return jjStartNfa_0(4, active0); -} -private final int jjMoveStringLiteralDfa6_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(4, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(5, active0); - return 6; - } - switch(curChar) - { - case 66: - case 98: - return jjMoveStringLiteralDfa7_0(active0, 0x100L); - case 70: - case 102: - return jjMoveStringLiteralDfa7_0(active0, 0x100000L); - default : - break; - } - return jjStartNfa_0(5, active0); -} -private final int jjMoveStringLiteralDfa7_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(5, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(6, active0); - return 7; - } - switch(curChar) - { - case 65: - case 97: - return jjMoveStringLiteralDfa8_0(active0, 0x100000L); - case 69: - case 101: - if ((active0 & 0x100L) != 0L) - return jjStartNfaWithStates_0(7, 8, 13); - break; - default : - break; - } - return jjStartNfa_0(6, active0); -} -private final int jjMoveStringLiteralDfa8_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(6, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(7, active0); - return 8; - } - switch(curChar) - { - case 77: - case 109: - return jjMoveStringLiteralDfa9_0(active0, 0x100000L); - default : - break; - } - return jjStartNfa_0(7, active0); -} -private final int jjMoveStringLiteralDfa9_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(7, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(8, active0); - return 9; - } - switch(curChar) - { - case 73: - case 105: - return jjMoveStringLiteralDfa10_0(active0, 0x100000L); - default : - break; - } - return jjStartNfa_0(8, active0); -} -private final int jjMoveStringLiteralDfa10_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(8, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(9, active0); - return 10; - } - switch(curChar) - { - case 76: - case 108: - return jjMoveStringLiteralDfa11_0(active0, 0x100000L); - default : - break; - } - return jjStartNfa_0(9, active0); -} -private final int jjMoveStringLiteralDfa11_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(9, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(10, active0); - return 11; - } - switch(curChar) - { - case 73: - case 105: - return jjMoveStringLiteralDfa12_0(active0, 0x100000L); - default : - break; - } - return jjStartNfa_0(10, active0); -} -private final int jjMoveStringLiteralDfa12_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(10, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(11, active0); - return 12; - } - switch(curChar) - { - case 69: - case 101: - return jjMoveStringLiteralDfa13_0(active0, 0x100000L); - default : - break; - } - return jjStartNfa_0(11, active0); -} -private final int jjMoveStringLiteralDfa13_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(11, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(12, active0); - return 13; - } - switch(curChar) - { - case 83: - case 115: - if ((active0 & 0x100000L) != 0L) - return jjStartNfaWithStates_0(13, 20, 13); - break; - default : - break; - } - return jjStartNfa_0(12, active0); -} -private final void jjCheckNAdd(int state) -{ - if (jjrounds[state] != jjround) - { - jjstateSet[jjnewStateCnt++] = state; - jjrounds[state] = jjround; - } -} -private final void jjAddStates(int start, int end) -{ - do { - jjstateSet[jjnewStateCnt++] = jjnextStates[start]; - } while (start++ != end); -} -private final void jjCheckNAddTwoStates(int state1, int state2) -{ - jjCheckNAdd(state1); - jjCheckNAdd(state2); -} -private final void jjCheckNAddStates(int start, int end) -{ - do { - jjCheckNAdd(jjnextStates[start]); - } while (start++ != end); -} -private final void jjCheckNAddStates(int start) -{ - jjCheckNAdd(jjnextStates[start]); - jjCheckNAdd(jjnextStates[start + 1]); -} + { + case 0: + if ((active0 & 0x400000000L) != 0L) + return 31; + if ((active0 & 0x7ffff01ffffffe0L) != 0L) + { + jjmatchedKind = 59; + return 0; + } + return -1; + case 1: + if ((active0 & 0x100002000L) != 0L) + return 0; + if ((active0 & 0x7ffff00ffffdfe0L) != 0L) + { + jjmatchedKind = 59; + jjmatchedPos = 1; + return 0; + } + return -1; + case 2: + if ((active0 & 0x20000082000000L) != 0L) + return 0; + if ((active0 & 0x7dfff007dffdfe0L) != 0L) + { + jjmatchedKind = 59; + jjmatchedPos = 2; + return 0; + } + return -1; + case 3: + if ((active0 & 0x400080001015720L) != 0L) + return 0; + if ((active0 & 0x3dff7007cfe88c0L) != 0L) + { + if (jjmatchedPos != 3) + { + jjmatchedKind = 59; + jjmatchedPos = 3; + } + return 0; + } + return -1; + case 4: + if ((active0 & 0x2001000408200c0L) != 0L) + return 0; + if ((active0 & 0x1dfe7003c7c8a00L) != 0L) + { + jjmatchedKind = 59; + jjmatchedPos = 4; + return 0; + } + return -1; + case 5: + if ((active0 & 0x1402000041c8800L) != 0L) + return 0; + if ((active0 & 0x9fc70038600200L) != 0L) + { + if (jjmatchedPos != 5) + { + jjmatchedKind = 59; + jjmatchedPos = 5; + } + return 0; + } + return -1; + case 6: + if ((active0 & 0x200000L) != 0L) + return 0; + if ((active0 & 0x19fc70038400200L) != 0L) + { + jjmatchedKind = 59; + jjmatchedPos = 6; + return 0; + } + return -1; + case 7: + if ((active0 & 0x8000000400200L) != 0L) + return 0; + if ((active0 & 0x197c70038000000L) != 0L) + { + jjmatchedKind = 59; + jjmatchedPos = 7; + return 0; + } + return -1; + case 8: + if ((active0 & 0x100400010000000L) != 0L) + return 0; + if ((active0 & 0x97870028000000L) != 0L) + { + jjmatchedKind = 59; + jjmatchedPos = 8; + return 0; + } + return -1; + case 9: + if ((active0 & 0x80020000000000L) != 0L) + return 0; + if ((active0 & 0x17850028000000L) != 0L) + { + jjmatchedKind = 59; + jjmatchedPos = 9; + return 0; + } + return -1; + case 10: + if ((active0 & 0x14840000000000L) != 0L) + return 0; + if ((active0 & 0x3010028000000L) != 0L) + { + jjmatchedKind = 59; + jjmatchedPos = 10; + return 0; + } + return -1; + case 11: + if ((active0 & 0x10020000000L) != 0L) + return 0; + if ((active0 & 0x3000008000000L) != 0L) + { + jjmatchedKind = 59; + jjmatchedPos = 11; + return 0; + } + return -1; + case 12: + if ((active0 & 0x3000008000000L) != 0L) + { + jjmatchedKind = 59; + jjmatchedPos = 12; + return 0; + } + return -1; + case 13: + if ((active0 & 0x8000000L) != 0L) + return 0; + if ((active0 & 0x3000000000000L) != 0L) + { + jjmatchedKind = 59; + jjmatchedPos = 13; + return 0; + } + return -1; + case 14: + if ((active0 & 0x3000000000000L) != 0L) + { + jjmatchedKind = 59; + jjmatchedPos = 14; + return 0; + } + return -1; + case 15: + if ((active0 & 0x3000000000000L) != 0L) + { + jjmatchedKind = 59; + jjmatchedPos = 15; + return 0; + } + return -1; + case 16: + if ((active0 & 0x3000000000000L) != 0L) + { + jjmatchedKind = 59; + jjmatchedPos = 16; + return 0; + } + return -1; + case 17: + if ((active0 & 0x3000000000000L) != 0L) + { + jjmatchedKind = 59; + jjmatchedPos = 17; + return 0; + } + return -1; + case 18: + if ((active0 & 0x3000000000000L) != 0L) + { + jjmatchedKind = 59; + jjmatchedPos = 18; + return 0; + } + return -1; + case 19: + if ((active0 & 0x1000000000000L) != 0L) + return 0; + if ((active0 & 0x2000000000000L) != 0L) + { + jjmatchedKind = 59; + jjmatchedPos = 19; + return 0; + } + return -1; + default : + return -1; + } +} +private final int jjStartNfa_0(int pos, long active0, long active1) +{ + return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0, active1), pos + 1); +} +private final int jjStopAtPos(int pos, int kind) +{ + jjmatchedKind = kind; + jjmatchedPos = pos; + return pos + 1; +} +private final int jjStartNfaWithStates_0(int pos, int kind, int state) +{ + jjmatchedKind = kind; + jjmatchedPos = pos; + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { return pos + 1; } + return jjMoveNfa_0(state, pos + 1); +} +private final int jjMoveStringLiteralDfa0_0() +{ + switch(curChar) + { + case 40: + return jjStopAtPos(0, 35); + case 41: + return jjStopAtPos(0, 36); + case 42: + return jjStopAtPos(0, 39); + case 44: + return jjStopAtPos(0, 33); + case 46: + return jjStartNfaWithStates_0(0, 34, 31); + case 59: + return jjStopAtPos(0, 65); + case 60: + return jjMoveStringLiteralDfa1_0(0x4000000000L); + case 61: + return jjStopAtPos(0, 37); + case 65: + case 97: + return jjMoveStringLiteralDfa1_0(0x20000080000040L); + case 66: + case 98: + return jjMoveStringLiteralDfa1_0(0x900000000000L); + case 67: + case 99: + return jjMoveStringLiteralDfa1_0(0x41040008000880L); + case 68: + case 100: + return jjMoveStringLiteralDfa1_0(0x241600L); + case 69: + case 101: + return jjMoveStringLiteralDfa1_0(0x104000L); + case 70: + case 102: + return jjMoveStringLiteralDfa1_0(0x1002000L); + case 71: + case 103: + return jjMoveStringLiteralDfa1_0(0x200000000000000L); + case 72: + case 104: + return jjMoveStringLiteralDfa1_0(0x20L); + case 73: + case 105: + return jjMoveStringLiteralDfa1_0(0x400000018000L); + case 76: + case 108: + return jjMoveStringLiteralDfa1_0(0x40000000L); + case 77: + case 109: + return jjMoveStringLiteralDfa1_0(0x30000000000L); + case 78: + case 110: + return jjMoveStringLiteralDfa1_0(0x18080020000000L); + case 79: + case 111: + return jjMoveStringLiteralDfa1_0(0x100000000L); + case 80: + case 112: + return jjMoveStringLiteralDfa1_0(0x80000000000000L); + case 82: + case 114: + return jjMoveStringLiteralDfa1_0(0x2200002000000L); + case 83: + case 115: + return jjMoveStringLiteralDfa1_0(0x500000000480100L); + case 84: + case 116: + return jjMoveStringLiteralDfa1_0(0x10020000L); + case 86: + case 118: + return jjMoveStringLiteralDfa1_0(0x4000004000000L); + case 87: + case 119: + return jjMoveStringLiteralDfa1_0(0x800000L); + default : + return jjMoveNfa_0(1, 0); + } +} +private final int jjMoveStringLiteralDfa1_0(long active0) +{ + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(0, active0, 0L); + return 1; + } + switch(curChar) + { + case 62: + if ((active0 & 0x4000000000L) != 0L) + return jjStopAtPos(1, 38); + break; + case 65: + case 97: + return jjMoveStringLiteralDfa2_0(active0, 0x30004020000L); + case 68: + case 100: + return jjMoveStringLiteralDfa2_0(active0, 0x20000000000000L); + case 69: + case 101: + return jjMoveStringLiteralDfa2_0(active0, 0x1062000000c0620L); + case 72: + case 104: + return jjMoveStringLiteralDfa2_0(active0, 0x40000000800100L); + case 73: + case 105: + return jjMoveStringLiteralDfa2_0(active0, 0x50200000L); + case 76: + case 108: + return jjMoveStringLiteralDfa2_0(active0, 0x9000000000c0L); + case 78: + case 110: + return jjMoveStringLiteralDfa2_0(active0, 0x400080118000L); + case 79: + case 111: + return jjMoveStringLiteralDfa2_0(active0, 0x4010c000a000000L); + case 82: + case 114: + if ((active0 & 0x100000000L) != 0L) + return jjStartNfaWithStates_0(1, 32, 0); + return jjMoveStringLiteralDfa2_0(active0, 0x280000001001800L); + case 83: + case 115: + if ((active0 & 0x2000L) != 0L) + return jjStartNfaWithStates_0(1, 13, 0); + break; + case 84: + case 116: + return jjMoveStringLiteralDfa2_0(active0, 0x400000L); + case 85: + case 117: + return jjMoveStringLiteralDfa2_0(active0, 0x18000020000000L); + case 88: + case 120: + return jjMoveStringLiteralDfa2_0(active0, 0x4000L); + default : + break; + } + return jjStartNfa_0(0, active0, 0L); +} +private final int jjMoveStringLiteralDfa2_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(0, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(1, active0, 0L); + return 2; + } + switch(curChar) + { + case 95: + return jjMoveStringLiteralDfa3_0(active0, 0x400000000000L); + case 65: + case 97: + return jjMoveStringLiteralDfa3_0(active0, 0x40000000500000L); + case 66: + case 98: + return jjMoveStringLiteralDfa3_0(active0, 0x20000L); + case 67: + case 99: + return jjMoveStringLiteralDfa3_0(active0, 0x4200000000000L); + case 68: + case 100: + if ((active0 & 0x80000000L) != 0L) + return jjStartNfaWithStates_0(2, 31, 0); + else if ((active0 & 0x20000000000000L) != 0L) + return jjStartNfaWithStates_0(2, 53, 0); + break; + case 69: + case 101: + return jjMoveStringLiteralDfa3_0(active0, 0x800880L); + case 73: + case 105: + return jjMoveStringLiteralDfa3_0(active0, 0x4000L); + case 76: + case 108: + return jjMoveStringLiteralDfa3_0(active0, 0x10000000c0c0020L); + case 77: + case 109: + return jjMoveStringLiteralDfa3_0(active0, 0x18040070000000L); + case 78: + case 110: + return jjMoveStringLiteralDfa3_0(active0, 0x80000000000L); + case 79: + case 111: + return jjMoveStringLiteralDfa3_0(active0, 0x280900001001100L); + case 82: + case 114: + return jjMoveStringLiteralDfa3_0(active0, 0x400000000000000L); + case 83: + case 115: + return jjMoveStringLiteralDfa3_0(active0, 0x208600L); + case 84: + case 116: + return jjMoveStringLiteralDfa3_0(active0, 0x2000000010040L); + case 85: + case 117: + return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000L); + case 87: + case 119: + if ((active0 & 0x2000000L) != 0L) + return jjStartNfaWithStates_0(2, 25, 0); + break; + case 88: + case 120: + return jjMoveStringLiteralDfa3_0(active0, 0x30000000000L); + default : + break; + } + return jjStartNfa_0(1, active0, 0L); +} +private final int jjMoveStringLiteralDfa3_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(1, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(2, active0, 0L); + return 3; + } + switch(curChar) + { + case 95: + return jjMoveStringLiteralDfa4_0(active0, 0x18030020000000L); + case 65: + case 97: + return jjMoveStringLiteralDfa4_0(active0, 0x200880L); + case 66: + case 98: + return jjMoveStringLiteralDfa4_0(active0, 0x100000L); + case 67: + case 99: + if ((active0 & 0x400L) != 0L) + { + jjmatchedKind = 10; + jjmatchedPos = 3; + } + return jjMoveStringLiteralDfa4_0(active0, 0x100000000200L); + case 69: + case 101: + if ((active0 & 0x80000000000L) != 0L) + return jjStartNfaWithStates_0(3, 43, 0); + return jjMoveStringLiteralDfa4_0(active0, 0x1000000100c8040L); + case 73: + case 105: + return jjMoveStringLiteralDfa4_0(active0, 0x40000000L); + case 74: + case 106: + return jjMoveStringLiteralDfa4_0(active0, 0x80000000000000L); + case 76: + case 108: + return jjMoveStringLiteralDfa4_0(active0, 0x20000L); + case 77: + case 109: + if ((active0 & 0x1000000L) != 0L) + return jjStartNfaWithStates_0(3, 24, 0); + return jjMoveStringLiteralDfa4_0(active0, 0x400000000000L); + case 78: + case 110: + return jjMoveStringLiteralDfa4_0(active0, 0x41000000000000L); + case 79: + case 111: + if ((active0 & 0x10000L) != 0L) + return jjStartNfaWithStates_0(3, 16, 0); + return jjMoveStringLiteralDfa4_0(active0, 0x2a00000000000L); + case 80: + case 112: + if ((active0 & 0x20L) != 0L) + return jjStartNfaWithStates_0(3, 5, 0); + else if ((active0 & 0x1000L) != 0L) + return jjStartNfaWithStates_0(3, 12, 0); + return jjMoveStringLiteralDfa4_0(active0, 0x40000000000L); + case 82: + case 114: + return jjMoveStringLiteralDfa4_0(active0, 0xc00000L); + case 84: + case 116: + if ((active0 & 0x4000L) != 0L) + return jjStartNfaWithStates_0(3, 14, 0); + else if ((active0 & 0x400000000000000L) != 0L) + return jjStartNfaWithStates_0(3, 58, 0); + return jjMoveStringLiteralDfa4_0(active0, 0x4000000000000L); + case 85: + case 117: + return jjMoveStringLiteralDfa4_0(active0, 0x20000000c000000L); + case 87: + case 119: + if ((active0 & 0x100L) != 0L) + return jjStartNfaWithStates_0(3, 8, 0); + break; + default : + break; + } + return jjStartNfa_0(2, active0, 0L); +} +private final int jjMoveStringLiteralDfa4_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(2, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(3, active0, 0L); + return 4; + } + switch(curChar) + { + case 66: + case 98: + return jjMoveStringLiteralDfa5_0(active0, 0x200000L); + case 67: + case 99: + return jjMoveStringLiteralDfa5_0(active0, 0x100000000080000L); + case 69: + case 101: + if ((active0 & 0x20000L) != 0L) + return jjStartNfaWithStates_0(4, 17, 0); + else if ((active0 & 0x800000L) != 0L) + return jjStartNfaWithStates_0(4, 23, 0); + return jjMoveStringLiteralDfa5_0(active0, 0x90400004000000L); + case 71: + case 103: + return jjMoveStringLiteralDfa5_0(active0, 0x40000000000000L); + case 72: + case 104: + return jjMoveStringLiteralDfa5_0(active0, 0x8000000000000L); + case 75: + case 107: + if ((active0 & 0x100000000000L) != 0L) + return jjStartNfaWithStates_0(4, 44, 0); + break; + case 76: + case 108: + return jjMoveStringLiteralDfa5_0(active0, 0x20000100000L); + case 77: + case 109: + return jjMoveStringLiteralDfa5_0(active0, 0x800008000000L); + case 79: + case 111: + return jjMoveStringLiteralDfa5_0(active0, 0x4000000000000L); + case 80: + case 112: + if ((active0 & 0x200000000000000L) != 0L) + return jjStartNfaWithStates_0(4, 57, 0); + break; + case 82: + case 114: + if ((active0 & 0x40L) != 0L) + return jjStartNfaWithStates_0(4, 6, 0); + else if ((active0 & 0x80L) != 0L) + return jjStartNfaWithStates_0(4, 7, 0); + return jjMoveStringLiteralDfa5_0(active0, 0x240000008200L); + case 83: + case 115: + return jjMoveStringLiteralDfa5_0(active0, 0x10000000L); + case 84: + case 116: + if ((active0 & 0x40000000L) != 0L) + return jjStartNfaWithStates_0(4, 30, 0); + return jjMoveStringLiteralDfa5_0(active0, 0x1000000440800L); + case 85: + case 117: + return jjMoveStringLiteralDfa5_0(active0, 0x2000000000000L); + case 86: + case 118: + return jjMoveStringLiteralDfa5_0(active0, 0x10020000000L); + default : + break; + } + return jjStartNfa_0(3, active0, 0L); +} +private final int jjMoveStringLiteralDfa5_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(3, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(4, active0, 0L); + return 5; + } + switch(curChar) + { + case 65: + case 97: + return jjMoveStringLiteralDfa6_0(active0, 0x8000000000000L); + case 67: + case 99: + return jjMoveStringLiteralDfa6_0(active0, 0x82000000000000L); + case 68: + case 100: + if ((active0 & 0x200000000000L) != 0L) + return jjStartNfaWithStates_0(5, 45, 0); + break; + case 69: + case 101: + if ((active0 & 0x800L) != 0L) + return jjStartNfaWithStates_0(5, 11, 0); + else if ((active0 & 0x40000L) != 0L) + return jjStartNfaWithStates_0(5, 18, 0); + else if ((active0 & 0x100000L) != 0L) + return jjStartNfaWithStates_0(5, 20, 0); + else if ((active0 & 0x40000000000000L) != 0L) + return jjStartNfaWithStates_0(5, 54, 0); + return jjMoveStringLiteralDfa6_0(active0, 0x70020000000L); + case 70: + case 102: + return jjMoveStringLiteralDfa6_0(active0, 0x800000000000L); + case 73: + case 105: + return jjMoveStringLiteralDfa6_0(active0, 0x1000000400200L); + case 76: + case 108: + return jjMoveStringLiteralDfa6_0(active0, 0x200000L); + case 77: + case 109: + return jjMoveStringLiteralDfa6_0(active0, 0x400000000000L); + case 78: + case 110: + return jjMoveStringLiteralDfa6_0(active0, 0x10000008000000L); + case 82: + case 114: + return jjMoveStringLiteralDfa6_0(active0, 0x4000000000000L); + case 83: + case 115: + if ((active0 & 0x4000000L) != 0L) + return jjStartNfaWithStates_0(5, 26, 0); + break; + case 84: + case 116: + if ((active0 & 0x8000L) != 0L) + return jjStartNfaWithStates_0(5, 15, 0); + else if ((active0 & 0x80000L) != 0L) + { + jjmatchedKind = 19; + jjmatchedPos = 5; + } + return jjMoveStringLiteralDfa6_0(active0, 0x100000010000000L); + default : + break; + } + return jjStartNfa_0(4, active0, 0L); +} +private final int jjMoveStringLiteralDfa6_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(4, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(5, active0, 0L); + return 6; + } + switch(curChar) + { + case 95: + return jjMoveStringLiteralDfa7_0(active0, 0x4000000000000L); + case 65: + case 97: + return jjMoveStringLiteralDfa7_0(active0, 0x10000000L); + case 66: + case 98: + return jjMoveStringLiteralDfa7_0(active0, 0x200L); + case 69: + case 101: + if ((active0 & 0x200000L) != 0L) + return jjStartNfaWithStates_0(6, 21, 0); + break; + case 70: + case 102: + return jjMoveStringLiteralDfa7_0(active0, 0x8000000L); + case 72: + case 104: + return jjMoveStringLiteralDfa7_0(active0, 0x2000000000000L); + case 73: + case 105: + return jjMoveStringLiteralDfa7_0(active0, 0x100800000000000L); + case 78: + case 110: + return jjMoveStringLiteralDfa7_0(active0, 0x1020000400000L); + case 79: + case 111: + return jjMoveStringLiteralDfa7_0(active0, 0x400000000000L); + case 82: + case 114: + return jjMoveStringLiteralDfa7_0(active0, 0x10020000000L); + case 83: + case 115: + return jjMoveStringLiteralDfa7_0(active0, 0x8040000000000L); + case 84: + case 116: + return jjMoveStringLiteralDfa7_0(active0, 0x90000000000000L); + default : + break; + } + return jjStartNfa_0(5, active0, 0L); +} +private final int jjMoveStringLiteralDfa7_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(5, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(6, active0, 0L); + return 7; + } + switch(curChar) + { + case 65: + case 97: + return jjMoveStringLiteralDfa8_0(active0, 0x8000000L); + case 69: + case 101: + if ((active0 & 0x200L) != 0L) + return jjStartNfaWithStates_0(7, 9, 0); + return jjMoveStringLiteralDfa8_0(active0, 0x2000000000000L); + case 71: + case 103: + if ((active0 & 0x400000L) != 0L) + return jjStartNfaWithStates_0(7, 22, 0); + return jjMoveStringLiteralDfa8_0(active0, 0x1020000000000L); + case 72: + case 104: + if ((active0 & 0x8000000000000L) != 0L) + return jjStartNfaWithStates_0(7, 51, 0); + break; + case 73: + case 105: + return jjMoveStringLiteralDfa8_0(active0, 0x80000000000000L); + case 76: + case 108: + return jjMoveStringLiteralDfa8_0(active0, 0x800000000000L); + case 77: + case 109: + return jjMoveStringLiteralDfa8_0(active0, 0x10000000L); + case 79: + case 111: + return jjMoveStringLiteralDfa8_0(active0, 0x100000000000000L); + case 82: + case 114: + return jjMoveStringLiteralDfa8_0(active0, 0x10400000000000L); + case 83: + case 115: + return jjMoveStringLiteralDfa8_0(active0, 0x4050020000000L); + default : + break; + } + return jjStartNfa_0(6, active0, 0L); +} +private final int jjMoveStringLiteralDfa8_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(6, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(7, active0, 0L); + return 8; + } + switch(curChar) + { + case 95: + return jjMoveStringLiteralDfa9_0(active0, 0x1000000000000L); + case 68: + case 100: + return jjMoveStringLiteralDfa9_0(active0, 0x2000000000000L); + case 73: + case 105: + return jjMoveStringLiteralDfa9_0(active0, 0x14050020000000L); + case 77: + case 109: + return jjMoveStringLiteralDfa9_0(active0, 0x8000000L); + case 78: + case 110: + if ((active0 & 0x100000000000000L) != 0L) + return jjStartNfaWithStates_0(8, 56, 0); + break; + case 79: + case 111: + return jjMoveStringLiteralDfa9_0(active0, 0x80000000000000L); + case 80: + case 112: + if ((active0 & 0x10000000L) != 0L) + return jjStartNfaWithStates_0(8, 28, 0); + break; + case 84: + case 116: + return jjMoveStringLiteralDfa9_0(active0, 0x820000000000L); + case 89: + case 121: + if ((active0 & 0x400000000000L) != 0L) + return jjStartNfaWithStates_0(8, 46, 0); + break; + default : + break; + } + return jjStartNfa_0(7, active0, 0L); +} +private final int jjMoveStringLiteralDfa9_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(7, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(8, active0, 0L); + return 9; + } + switch(curChar) + { + case 95: + return jjMoveStringLiteralDfa10_0(active0, 0x2000000000000L); + case 66: + case 98: + return jjMoveStringLiteralDfa10_0(active0, 0x1000000000000L); + case 69: + case 101: + return jjMoveStringLiteralDfa10_0(active0, 0x10800000000000L); + case 72: + case 104: + if ((active0 & 0x20000000000L) != 0L) + return jjStartNfaWithStates_0(9, 41, 0); + break; + case 73: + case 105: + return jjMoveStringLiteralDfa10_0(active0, 0x8000000L); + case 78: + case 110: + if ((active0 & 0x80000000000000L) != 0L) + return jjStartNfaWithStates_0(9, 55, 0); + break; + case 79: + case 111: + return jjMoveStringLiteralDfa10_0(active0, 0x50020000000L); + case 90: + case 122: + return jjMoveStringLiteralDfa10_0(active0, 0x4000000000000L); + default : + break; + } + return jjStartNfa_0(8, active0, 0L); +} +private final int jjMoveStringLiteralDfa10_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(8, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(9, active0, 0L); + return 10; + } + switch(curChar) + { + case 66: + case 98: + return jjMoveStringLiteralDfa11_0(active0, 0x2000000000000L); + case 69: + case 101: + if ((active0 & 0x4000000000000L) != 0L) + return jjStartNfaWithStates_0(10, 50, 0); + break; + case 76: + case 108: + return jjMoveStringLiteralDfa11_0(active0, 0x1000008000000L); + case 78: + case 110: + if ((active0 & 0x40000000000L) != 0L) + return jjStartNfaWithStates_0(10, 42, 0); + return jjMoveStringLiteralDfa11_0(active0, 0x10020000000L); + case 82: + case 114: + if ((active0 & 0x800000000000L) != 0L) + return jjStartNfaWithStates_0(10, 47, 0); + break; + case 83: + case 115: + if ((active0 & 0x10000000000000L) != 0L) + return jjStartNfaWithStates_0(10, 52, 0); + break; + default : + break; + } + return jjStartNfa_0(9, active0, 0L); +} +private final int jjMoveStringLiteralDfa11_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(9, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(10, active0, 0L); + return 11; + } + switch(curChar) + { + case 73: + case 105: + return jjMoveStringLiteralDfa12_0(active0, 0x8000000L); + case 76: + case 108: + return jjMoveStringLiteralDfa12_0(active0, 0x2000000000000L); + case 79: + case 111: + return jjMoveStringLiteralDfa12_0(active0, 0x1000000000000L); + case 83: + case 115: + if ((active0 & 0x20000000L) != 0L) + return jjStartNfaWithStates_0(11, 29, 0); + else if ((active0 & 0x10000000000L) != 0L) + return jjStartNfaWithStates_0(11, 40, 0); + break; + default : + break; + } + return jjStartNfa_0(10, active0, 0L); +} +private final int jjMoveStringLiteralDfa12_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(10, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(11, active0, 0L); + return 12; + } + switch(curChar) + { + case 69: + case 101: + return jjMoveStringLiteralDfa13_0(active0, 0x8000000L); + case 79: + case 111: + return jjMoveStringLiteralDfa13_0(active0, 0x3000000000000L); + default : + break; + } + return jjStartNfa_0(11, active0, 0L); +} +private final int jjMoveStringLiteralDfa13_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(11, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(12, active0, 0L); + return 13; + } + switch(curChar) + { + case 77: + case 109: + return jjMoveStringLiteralDfa14_0(active0, 0x1000000000000L); + case 79: + case 111: + return jjMoveStringLiteralDfa14_0(active0, 0x2000000000000L); + case 83: + case 115: + if ((active0 & 0x8000000L) != 0L) + return jjStartNfaWithStates_0(13, 27, 0); + break; + default : + break; + } + return jjStartNfa_0(12, active0, 0L); +} +private final int jjMoveStringLiteralDfa14_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(12, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(13, active0, 0L); + return 14; + } + switch(curChar) + { + case 70: + case 102: + return jjMoveStringLiteralDfa15_0(active0, 0x1000000000000L); + case 77: + case 109: + return jjMoveStringLiteralDfa15_0(active0, 0x2000000000000L); + default : + break; + } + return jjStartNfa_0(13, active0, 0L); +} +private final int jjMoveStringLiteralDfa15_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(13, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(14, active0, 0L); + return 15; + } + switch(curChar) + { + case 70: + case 102: + return jjMoveStringLiteralDfa16_0(active0, 0x2000000000000L); + case 73: + case 105: + return jjMoveStringLiteralDfa16_0(active0, 0x1000000000000L); + default : + break; + } + return jjStartNfa_0(14, active0, 0L); +} +private final int jjMoveStringLiteralDfa16_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(14, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(15, active0, 0L); + return 16; + } + switch(curChar) + { + case 73: + case 105: + return jjMoveStringLiteralDfa17_0(active0, 0x2000000000000L); + case 76: + case 108: + return jjMoveStringLiteralDfa17_0(active0, 0x1000000000000L); + default : + break; + } + return jjStartNfa_0(15, active0, 0L); +} +private final int jjMoveStringLiteralDfa17_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(15, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(16, active0, 0L); + return 17; + } + switch(curChar) + { + case 76: + case 108: + return jjMoveStringLiteralDfa18_0(active0, 0x2000000000000L); + case 84: + case 116: + return jjMoveStringLiteralDfa18_0(active0, 0x1000000000000L); + default : + break; + } + return jjStartNfa_0(16, active0, 0L); +} +private final int jjMoveStringLiteralDfa18_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(16, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(17, active0, 0L); + return 18; + } + switch(curChar) + { + case 69: + case 101: + return jjMoveStringLiteralDfa19_0(active0, 0x1000000000000L); + case 84: + case 116: + return jjMoveStringLiteralDfa19_0(active0, 0x2000000000000L); + default : + break; + } + return jjStartNfa_0(17, active0, 0L); +} +private final int jjMoveStringLiteralDfa19_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(17, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(18, active0, 0L); + return 19; + } + switch(curChar) + { + case 69: + case 101: + return jjMoveStringLiteralDfa20_0(active0, 0x2000000000000L); + case 82: + case 114: + if ((active0 & 0x1000000000000L) != 0L) + return jjStartNfaWithStates_0(19, 48, 0); + break; + default : + break; + } + return jjStartNfa_0(18, active0, 0L); +} +private final int jjMoveStringLiteralDfa20_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(18, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(19, active0, 0L); + return 20; + } + switch(curChar) + { + case 82: + case 114: + if ((active0 & 0x2000000000000L) != 0L) + return jjStartNfaWithStates_0(20, 49, 0); + break; + default : + break; + } + return jjStartNfa_0(19, active0, 0L); +} +private final void jjCheckNAdd(int state) +{ + if (jjrounds[state] != jjround) + { + jjstateSet[jjnewStateCnt++] = state; + jjrounds[state] = jjround; + } +} +private final void jjAddStates(int start, int end) +{ + do { + jjstateSet[jjnewStateCnt++] = jjnextStates[start]; + } while (start++ != end); +} +private final void jjCheckNAddTwoStates(int state1, int state2) +{ + jjCheckNAdd(state1); + jjCheckNAdd(state2); +} +private final void jjCheckNAddStates(int start, int end) +{ + do { + jjCheckNAdd(jjnextStates[start]); + } while (start++ != end); +} +private final void jjCheckNAddStates(int start) +{ + jjCheckNAdd(jjnextStates[start]); + jjCheckNAdd(jjnextStates[start + 1]); +} static final long[] jjbitVec0 = { 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL -}; -private final int jjMoveNfa_0(int startState, int curPos) -{ - int[] nextStates; - int startsAt = 0; - jjnewStateCnt = 13; - int i = 1; - jjstateSet[0] = startState; - int j, kind = 0x7fffffff; - for (;;) - { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) - { - long l = 1L << curChar; - MatchLoop: do - { - switch(jjstateSet[--i]) - { - case 0: - if ((0x3ff000000000000L & l) != 0L) - { - if (kind > 34) - kind = 34; - jjCheckNAdd(3); - } - else if ((0xe00000000000L & l) != 0L) - { - if (kind > 32) - kind = 32; - jjCheckNAdd(1); - } - else if (curChar == 39) - jjCheckNAddStates(0, 2); - else if (curChar == 34) - jjCheckNAdd(5); - if ((0x3ff000000000000L & l) != 0L) - { - if (kind > 33) - kind = 33; - jjCheckNAdd(2); - } - break; - case 13: - if ((0x3ffe00000000000L & l) != 0L) - { - if (kind > 32) - kind = 32; - jjCheckNAdd(1); - } - if ((0x3ff000000000000L & l) != 0L) - { - if (kind > 34) - kind = 34; - jjCheckNAdd(3); - } - break; - case 1: - if ((0x3ffe00000000000L & l) == 0L) - break; - if (kind > 32) - kind = 32; - jjCheckNAdd(1); - break; - case 2: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 33) - kind = 33; - jjCheckNAdd(2); - break; - case 3: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 34) - kind = 34; - jjCheckNAdd(3); - break; - case 4: - if (curChar == 34) - jjCheckNAdd(5); - break; - case 5: - if ((0xfffffffbffffffffL & l) != 0L) - jjCheckNAddTwoStates(5, 6); - break; - case 6: - if (curChar == 34 && kind > 35) - kind = 35; - break; - case 7: - if (curChar == 39) - jjCheckNAddStates(0, 2); - break; - case 8: - if ((0xffffff7fffffffffL & l) != 0L) - jjCheckNAddStates(0, 2); - break; - case 9: - if (curChar == 39) - jjCheckNAddStates(3, 5); - break; - case 10: - if (curChar == 39) - jjstateSet[jjnewStateCnt++] = 9; - break; - case 11: - if ((0xffffff7fffffffffL & l) != 0L) - jjCheckNAddStates(3, 5); - break; - case 12: - if (curChar == 39 && kind > 36) - kind = 36; - break; - default : break; - } - } while(i != startsAt); - } - else if (curChar < 128) - { - long l = 1L << (curChar & 077); - MatchLoop: do - { - switch(jjstateSet[--i]) - { - case 0: - if ((0x7fffffe87fffffeL & l) != 0L) - { - if (kind > 32) - kind = 32; - jjCheckNAdd(1); - } - if ((0x7fffffe07fffffeL & l) != 0L) - { - if (kind > 34) - kind = 34; - jjCheckNAdd(3); - } - break; - case 13: - if ((0x7fffffe87fffffeL & l) != 0L) - { - if (kind > 32) - kind = 32; - jjCheckNAdd(1); - } - if ((0x7fffffe07fffffeL & l) != 0L) - { - if (kind > 34) - kind = 34; - jjCheckNAdd(3); - } - break; - case 1: - if ((0x7fffffe87fffffeL & l) == 0L) - break; - if (kind > 32) - kind = 32; - jjCheckNAdd(1); - break; - case 3: - if ((0x7fffffe07fffffeL & l) == 0L) - break; - if (kind > 34) - kind = 34; - jjCheckNAdd(3); - break; - case 5: - jjAddStates(6, 7); - break; - case 8: - jjCheckNAddStates(0, 2); - break; - case 11: - jjCheckNAddStates(3, 5); - break; - default : break; - } - } while(i != startsAt); - } - else - { - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - MatchLoop: do - { - switch(jjstateSet[--i]) - { - case 5: - if ((jjbitVec0[i2] & l2) != 0L) - jjAddStates(6, 7); - break; - case 8: - if ((jjbitVec0[i2] & l2) != 0L) - jjCheckNAddStates(0, 2); - break; - case 11: - if ((jjbitVec0[i2] & l2) != 0L) - jjCheckNAddStates(3, 5); - break; - default : break; - } - } while(i != startsAt); - } - if (kind != 0x7fffffff) - { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 13 - (jjnewStateCnt = startsAt))) - return curPos; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { return curPos; } - } -} +}; +private final int jjMoveNfa_0(int startState, int curPos) +{ + int[] nextStates; + int startsAt = 0; + jjnewStateCnt = 31; + int i = 1; + jjstateSet[0] = startState; + int j, kind = 0x7fffffff; + for (;;) + { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) + { + long l = 1L << curChar; + MatchLoop: do + { + switch(jjstateSet[--i]) + { + case 31: + if ((0x3ff000000000000L & l) != 0L) + { + if (kind > 61) + kind = 61; + jjCheckNAddTwoStates(2, 3); + } + else if ((0x400e00000000000L & l) != 0L) + { + if (kind > 59) + kind = 59; + jjCheckNAdd(0); + } + break; + case 1: + if ((0x3ff000000000000L & l) != 0L) + { + if (kind > 60) + kind = 60; + jjCheckNAddStates(0, 6); + } + else if ((0x400e00000000000L & l) != 0L) + { + if (kind > 59) + kind = 59; + jjCheckNAdd(0); + } + else if (curChar == 39) + jjCheckNAddStates(7, 9); + else if (curChar == 34) + jjCheckNAdd(7); + if (curChar == 46) + jjCheckNAdd(2); + break; + case 0: + if ((0x400e00000000000L & l) == 0L) + break; + if (kind > 59) + kind = 59; + jjCheckNAdd(0); + break; + case 2: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 61) + kind = 61; + jjCheckNAddTwoStates(2, 3); + break; + case 4: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(5); + break; + case 5: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 61) + kind = 61; + jjCheckNAdd(5); + break; + case 6: + if (curChar == 34) + jjCheckNAdd(7); + break; + case 7: + if ((0xfffffffbffffffffL & l) != 0L) + jjCheckNAddTwoStates(7, 8); + break; + case 8: + if (curChar == 34 && kind > 63) + kind = 63; + break; + case 9: + if (curChar == 39) + jjCheckNAddStates(7, 9); + break; + case 10: + if ((0xffffff7fffffffffL & l) != 0L) + jjCheckNAddStates(7, 9); + break; + case 11: + if (curChar == 39) + jjCheckNAddStates(10, 12); + break; + case 12: + if (curChar == 39) + jjstateSet[jjnewStateCnt++] = 11; + break; + case 13: + if ((0xffffff7fffffffffL & l) != 0L) + jjCheckNAddStates(10, 12); + break; + case 14: + if (curChar == 39 && kind > 64) + kind = 64; + break; + case 15: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 60) + kind = 60; + jjCheckNAddStates(0, 6); + break; + case 16: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 60) + kind = 60; + jjCheckNAdd(16); + break; + case 17: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(17, 18); + break; + case 18: + if (curChar == 46) + jjCheckNAdd(19); + break; + case 19: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 61) + kind = 61; + jjCheckNAddTwoStates(19, 20); + break; + case 21: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(22); + break; + case 22: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 61) + kind = 61; + jjCheckNAdd(22); + break; + case 23: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(23, 24); + break; + case 25: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(26); + break; + case 26: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 61) + kind = 61; + jjCheckNAdd(26); + break; + case 27: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 61) + kind = 61; + jjCheckNAddTwoStates(27, 28); + break; + case 29: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(30); + break; + case 30: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 61) + kind = 61; + jjCheckNAdd(30); + break; + default : break; + } + } while(i != startsAt); + } + else if (curChar < 128) + { + long l = 1L << (curChar & 077); + MatchLoop: do + { + switch(jjstateSet[--i]) + { + case 31: + case 0: + if ((0x7fffffe87fffffeL & l) == 0L) + break; + if (kind > 59) + kind = 59; + jjCheckNAdd(0); + break; + case 1: + if ((0x7fffffe87fffffeL & l) == 0L) + break; + if (kind > 59) + kind = 59; + jjCheckNAdd(0); + break; + case 3: + if ((0x2000000020L & l) != 0L) + jjAddStates(13, 14); + break; + case 7: + jjAddStates(15, 16); + break; + case 10: + jjCheckNAddStates(7, 9); + break; + case 13: + jjCheckNAddStates(10, 12); + break; + case 20: + if ((0x2000000020L & l) != 0L) + jjAddStates(17, 18); + break; + case 24: + if ((0x2000000020L & l) != 0L) + jjAddStates(19, 20); + break; + case 28: + if ((0x2000000020L & l) != 0L) + jjAddStates(21, 22); + break; + default : break; + } + } while(i != startsAt); + } + else + { + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + MatchLoop: do + { + switch(jjstateSet[--i]) + { + case 7: + if ((jjbitVec0[i2] & l2) != 0L) + jjAddStates(15, 16); + break; + case 10: + if ((jjbitVec0[i2] & l2) != 0L) + jjCheckNAddStates(7, 9); + break; + case 13: + if ((jjbitVec0[i2] & l2) != 0L) + jjCheckNAddStates(10, 12); + break; + default : break; + } + } while(i != startsAt); + } + if (kind != 0x7fffffff) + { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 31 - (jjnewStateCnt = startsAt))) + return curPos; + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { return curPos; } + } +} static final int[] jjnextStates = { - 8, 10, 12, 10, 11, 12, 5, 6, -}; -public static final String[] jjstrLiteralImages = { -"", null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, null, null, null, null, null, null, null, "\54", -"\56", "\50", "\51", "\75", "\74\76", "\55", null, null, null, null, null, "\73", }; -public static final String[] lexStateNames = { - "DEFAULT", -}; + 16, 17, 18, 23, 24, 27, 28, 10, 12, 14, 12, 13, 14, 4, 5, 7, + 8, 21, 22, 25, 26, 29, 30, +}; +public static final String[] jjstrLiteralImages = { +"", null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, "\54", "\56", "\50", "\51", "\75", "\74\76", +"\52", null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, "\73", }; +public static final String[] lexStateNames = { + "DEFAULT", +}; static final long[] jjtoToken = { - 0x3fffffffe1L, -}; + 0xbfffffffffffffe1L, 0x3L, +}; static final long[] jjtoSkip = { - 0x1eL, -}; -protected SimpleCharStream input_stream; -private final int[] jjrounds = new int[13]; -private final int[] jjstateSet = new int[26]; -protected char curChar; -public ParserTokenManager(SimpleCharStream stream){ - if (SimpleCharStream.staticFlag) - throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); - input_stream = stream; -} -public ParserTokenManager(SimpleCharStream stream, int lexState){ - this(stream); - SwitchTo(lexState); -} -public void ReInit(SimpleCharStream stream) -{ - jjmatchedPos = jjnewStateCnt = 0; - curLexState = defaultLexState; - input_stream = stream; - ReInitRounds(); -} -private final void ReInitRounds() -{ - int i; - jjround = 0x80000001; - for (i = 13; i-- > 0;) - jjrounds[i] = 0x80000000; -} -public void ReInit(SimpleCharStream stream, int lexState) -{ - ReInit(stream); - SwitchTo(lexState); -} -public void SwitchTo(int lexState) -{ - if (lexState >= 1 || lexState < 0) - throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); - else - curLexState = lexState; -} - -protected Token jjFillToken() -{ - Token t = Token.newToken(jjmatchedKind); - t.kind = jjmatchedKind; - String im = jjstrLiteralImages[jjmatchedKind]; - t.image = (im == null) ? input_stream.GetImage() : im; - t.beginLine = input_stream.getBeginLine(); - t.beginColumn = input_stream.getBeginColumn(); - t.endLine = input_stream.getEndLine(); - t.endColumn = input_stream.getEndColumn(); - return t; -} - -int curLexState = 0; -int defaultLexState = 0; -int jjnewStateCnt; -int jjround; -int jjmatchedPos; -int jjmatchedKind; - -public Token getNextToken() -{ - int kind; - Token specialToken = null; - Token matchedToken; - int curPos = 0; - + 0x1eL, 0x0L, +}; +protected SimpleCharStream input_stream; +private final int[] jjrounds = new int[31]; +private final int[] jjstateSet = new int[62]; +protected char curChar; +public ParserTokenManager(SimpleCharStream stream){ + if (SimpleCharStream.staticFlag) + throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); + input_stream = stream; +} +public ParserTokenManager(SimpleCharStream stream, int lexState){ + this(stream); + SwitchTo(lexState); +} +public void ReInit(SimpleCharStream stream) +{ + jjmatchedPos = jjnewStateCnt = 0; + curLexState = defaultLexState; + input_stream = stream; + ReInitRounds(); +} +private final void ReInitRounds() +{ + int i; + jjround = 0x80000001; + for (i = 31; i-- > 0;) + jjrounds[i] = 0x80000000; +} +public void ReInit(SimpleCharStream stream, int lexState) +{ + ReInit(stream); + SwitchTo(lexState); +} +public void SwitchTo(int lexState) +{ + if (lexState >= 1 || lexState < 0) + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); + else + curLexState = lexState; +} + +protected Token jjFillToken() +{ + Token t = Token.newToken(jjmatchedKind); + t.kind = jjmatchedKind; + String im = jjstrLiteralImages[jjmatchedKind]; + t.image = (im == null) ? input_stream.GetImage() : im; + t.beginLine = input_stream.getBeginLine(); + t.beginColumn = input_stream.getBeginColumn(); + t.endLine = input_stream.getEndLine(); + t.endColumn = input_stream.getEndColumn(); + return t; +} + +int curLexState = 0; +int defaultLexState = 0; +int jjnewStateCnt; +int jjround; +int jjmatchedPos; +int jjmatchedKind; + +public Token getNextToken() +{ + int kind; + Token specialToken = null; + Token matchedToken; + int curPos = 0; + EOFLoop : - for (;;) - { - try - { - curChar = input_stream.BeginToken(); - } - catch(java.io.IOException e) - { - jjmatchedKind = 0; - matchedToken = jjFillToken(); - return matchedToken; - } - - try { input_stream.backup(0); - while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L) - curChar = input_stream.BeginToken(); - } - catch (java.io.IOException e1) { continue EOFLoop; } - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_0(); - if (jjmatchedKind != 0x7fffffff) - { - if (jjmatchedPos + 1 < curPos) - input_stream.backup(curPos - jjmatchedPos - 1); - if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) - { - matchedToken = jjFillToken(); - return matchedToken; - } - else - { - continue EOFLoop; - } - } - int error_line = input_stream.getEndLine(); - int error_column = input_stream.getEndColumn(); - String error_after = null; - boolean EOFSeen = false; - try { input_stream.readChar(); input_stream.backup(1); } - catch (java.io.IOException e1) { - EOFSeen = true; - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - if (curChar == '\n' || curChar == '\r') { - error_line++; - error_column = 0; - } - else - error_column++; - } - if (!EOFSeen) { - input_stream.backup(1); - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - } - throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); - } -} - -} + for (;;) + { + try + { + curChar = input_stream.BeginToken(); + } + catch(java.io.IOException e) + { + jjmatchedKind = 0; + matchedToken = jjFillToken(); + return matchedToken; + } + + try { input_stream.backup(0); + while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L) + curChar = input_stream.BeginToken(); + } + catch (java.io.IOException e1) { continue EOFLoop; } + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_0(); + if (jjmatchedKind != 0x7fffffff) + { + if (jjmatchedPos + 1 < curPos) + input_stream.backup(curPos - jjmatchedPos - 1); + if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) + { + matchedToken = jjFillToken(); + return matchedToken; + } + else + { + continue EOFLoop; + } + } + int error_line = input_stream.getEndLine(); + int error_column = input_stream.getEndColumn(); + String error_after = null; + boolean EOFSeen = false; + try { input_stream.readChar(); input_stream.backup(1); } + catch (java.io.IOException e1) { + EOFSeen = true; + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + if (curChar == '\n' || curChar == '\r') { + error_line++; + error_column = 0; + } + else + error_column++; + } + if (!EOFSeen) { + input_stream.backup(1); + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + } + throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); + } +} + +} Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/ParserConstants.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/ParserConstants.java (revision 574112) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/ParserConstants.java (working copy) @@ -1,4 +1,4 @@ -/* Generated By:JavaCC: Do not edit this line. ParserConstants.java */ +/* Generated By:JavaCC: Do not edit this line. ParserConstants.java */ /** * Copyright 2007 The Apache Software Foundation * @@ -17,86 +17,142 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ -package org.apache.hadoop.hbase.shell.generated; - -public interface ParserConstants { - - int EOF = 0; - int HELP = 5; - int CLEAR = 6; - int SHOW = 7; - int DESCRIBE = 8; - int CREATE = 9; - int DROP = 10; - int FS = 11; - int EXIT = 12; - int INSERT = 13; - int DELETE = 14; - int SELECT = 15; - int ROW = 16; - int COLUMN = 17; - int TIME = 18; - int VALUES = 19; - int COLUMNFAMILIES = 20; - int WHERE = 21; - int LIMIT = 22; - int AND = 23; - int OR = 24; - int COMMA = 25; - int DOT = 26; - int LPAREN = 27; - int RPAREN = 28; - int EQUALS = 29; - int NOTEQUAL = 30; - int OPTIONS = 31; - int ID = 32; - int NUM = 33; - int STRING = 34; - int QUOTED_STRING = 35; - int STRING_LITERAL = 36; - - int DEFAULT = 0; - - String[] tokenImage = { - "", - "\" \"", - "\"\\t\"", - "\"\\r\"", - "\"\\n\"", - "\"help\"", - "\"clear\"", - "\"show\"", - "\"describe\"", - "\"create\"", - "\"drop\"", - "\"fs\"", - "\"exit\"", - "\"insert\"", - "\"delete\"", - "\"select\"", - "\"row\"", - "\"column\"", - "\"time\"", - "\"values\"", - "\"columnfamilies\"", - "\"where\"", - "\"limit\"", - "\"and\"", - "\"or\"", - "\",\"", - "\".\"", - "\"(\"", - "\")\"", - "\"=\"", - "\"<>\"", - "\"-\"", - "", - "", - "", - "", - "", - "\";\"", - }; - -} + */ +package org.apache.hadoop.hbase.shell.generated; + +public interface ParserConstants { + + int EOF = 0; + int HELP = 5; + int ALTER = 6; + int CLEAR = 7; + int SHOW = 8; + int DESCRIBE = 9; + int DESC = 10; + int CREATE = 11; + int DROP = 12; + int FS = 13; + int EXIT = 14; + int INSERT = 15; + int INTO = 16; + int TABLE = 17; + int DELETE = 18; + int SELECT = 19; + int ENABLE = 20; + int DISABLE = 21; + int STARTING = 22; + int WHERE = 23; + int FROM = 24; + int ROW = 25; + int VALUES = 26; + int COLUMNFAMILIES = 27; + int TIMESTAMP = 28; + int NUM_VERSIONS = 29; + int LIMIT = 30; + int AND = 31; + int OR = 32; + int COMMA = 33; + int DOT = 34; + int LPAREN = 35; + int RPAREN = 36; + int EQUALS = 37; + int NOTEQUAL = 38; + int ASTERISK = 39; + int MAX_VERSIONS = 40; + int MAX_LENGTH = 41; + int COMPRESSION = 42; + int NONE = 43; + int BLOCK = 44; + int RECORD = 45; + int IN_MEMORY = 46; + int BLOOMFILTER = 47; + int COUNTING_BLOOMFILTER = 48; + int RETOUCHED_BLOOMFILTER = 49; + int VECTOR_SIZE = 50; + int NUM_HASH = 51; + int NUM_ENTRIES = 52; + int ADD = 53; + int CHANGE = 54; + int PROJECTION = 55; + int SELECTION = 56; + int GROUP = 57; + int SORT = 58; + int ID = 59; + int INTEGER_LITERAL = 60; + int FLOATING_POINT_LITERAL = 61; + int EXPONENT = 62; + int QUOTED_IDENTIFIER = 63; + int STRING_LITERAL = 64; + + int DEFAULT = 0; + + String[] tokenImage = { + "", + "\" \"", + "\"\\t\"", + "\"\\r\"", + "\"\\n\"", + "\"help\"", + "\"alter\"", + "\"clear\"", + "\"show\"", + "\"describe\"", + "\"desc\"", + "\"create\"", + "\"drop\"", + "\"fs\"", + "\"exit\"", + "\"insert\"", + "\"into\"", + "\"table\"", + "\"delete\"", + "\"select\"", + "\"enable\"", + "\"disable\"", + "\"starting\"", + "\"where\"", + "\"from\"", + "\"row\"", + "\"values\"", + "\"columnfamilies\"", + "\"timestamp\"", + "\"num_versions\"", + "\"limit\"", + "\"and\"", + "\"or\"", + "\",\"", + "\".\"", + "\"(\"", + "\")\"", + "\"=\"", + "\"<>\"", + "\"*\"", + "\"max_versions\"", + "\"max_length\"", + "\"compression\"", + "\"none\"", + "\"block\"", + "\"record\"", + "\"in_memory\"", + "\"bloomfilter\"", + "\"counting_bloomfilter\"", + "\"retouched_bloomfilter\"", + "\"vector_size\"", + "\"num_hash\"", + "\"num_entries\"", + "\"add\"", + "\"change\"", + "\"projection\"", + "\"selection\"", + "\"group\"", + "\"sort\"", + "", + "", + "", + "", + "", + "", + "\";\"", + }; + +} Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/Parser.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/Parser.java (revision 574112) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/Parser.java (working copy) @@ -1,4 +1,4 @@ -/* Generated By:JavaCC: Do not edit this line. Parser.java */ +/* Generated By:JavaCC: Do not edit this line. Parser.java */ /** * Copyright 2007 The Apache Software Foundation * @@ -17,774 +17,1208 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ -package org.apache.hadoop.hbase.shell.generated; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.HashMap; -import java.io.StringReader; -import java.io.Reader; - -import org.apache.hadoop.hbase.shell.*; - + */ +package org.apache.hadoop.hbase.shell.generated; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.HashMap; +import java.io.StringReader; +import java.io.Reader; + +import org.apache.hadoop.hbase.shell.*; + /** * Parsing command line. - */ -public class Parser implements ParserConstants { - private String QueryString; - - public Parser(String query) { - this((Reader)(new StringReader(query))); - this.QueryString = query; - } - - public String getQueryStr() { - return this.QueryString; - } - + * + */ +public class Parser implements ParserConstants { + private String QueryString; + + public Parser(String query) { + this((Reader)(new StringReader(query))); + this.QueryString = query; + } + + public String getQueryStr() { + return this.QueryString; + } + /** * Parses the given array of command line arguments. - */ - final public Command terminatedCommand() throws ParseException { - Command statement = null; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case HELP: - case CLEAR: - case SHOW: - case DESCRIBE: - case CREATE: - case DROP: - case FS: - case EXIT: - case INSERT: - case DELETE: - case SELECT: - case 37: - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case HELP: - case CLEAR: - case SHOW: - case DESCRIBE: - case CREATE: - case DROP: - case FS: - case EXIT: - case INSERT: - case DELETE: - case SELECT: - statement = cmdStatement(); - break; - default: - jj_la1[0] = jj_gen; - ; - } - jj_consume_token(37); - break; - case 0: - jj_consume_token(0); - break; - default: - jj_la1[1] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - {if (true) return statement;} - throw new Error("Missing return statement in function"); - } - - final public Command cmdStatement() throws ParseException { - Command cmd = null; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case EXIT: - cmd = exitCommand(); - break; - case HELP: - cmd = helpCommand(); - break; - case SHOW: - cmd = showCommand(); - break; - case DESCRIBE: - cmd = descCommand(); - break; - case CREATE: - cmd = createCommand(); - break; - case DROP: - cmd = dropCommand(); - break; - case INSERT: - cmd = insertCommand(); - break; - case DELETE: - cmd = deleteCommand(); - break; - case SELECT: - cmd = selectCommand(); - break; - case CLEAR: - cmd = clearCommand(); - break; - case FS: - cmd = fsCommand(); - break; - default: - jj_la1[2] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - {if (true) return cmd;} - throw new Error("Missing return statement in function"); - } - - final public ExitCommand exitCommand() throws ParseException { - ExitCommand exit = new ExitCommand(); - jj_consume_token(EXIT); - {if (true) return exit;} - throw new Error("Missing return statement in function"); - } - - final public FsCommand fsCommand() throws ParseException { - Token t = null; - FsCommand fs = new FsCommand(); - List query = new ArrayList(); - jj_consume_token(FS); - label_1: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case ID: - ; - break; - default: - jj_la1[3] = jj_gen; - break label_1; - } - t = jj_consume_token(ID); - query.add(t.image.toString()); - } - fs.setQuery(query); - {if (true) return fs;} - throw new Error("Missing return statement in function"); - } - - final public HelpCommand helpCommand() throws ParseException { - Token t = null; - HelpCommand help = new HelpCommand(); - String argument = ""; - jj_consume_token(HELP); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case CLEAR: - case SHOW: - case DESCRIBE: - case CREATE: - case DROP: - case FS: - case EXIT: - case INSERT: - case DELETE: - case SELECT: - case ID: - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SHOW: - t = jj_consume_token(SHOW); - break; - case DESCRIBE: - t = jj_consume_token(DESCRIBE); - break; - case CREATE: - t = jj_consume_token(CREATE); - break; - case DROP: - t = jj_consume_token(DROP); - break; - case EXIT: - t = jj_consume_token(EXIT); - break; - case INSERT: - t = jj_consume_token(INSERT); - break; - case DELETE: - t = jj_consume_token(DELETE); - break; - case SELECT: - t = jj_consume_token(SELECT); - break; - case CLEAR: - t = jj_consume_token(CLEAR); - break; - case FS: - t = jj_consume_token(FS); - break; - case ID: - t = jj_consume_token(ID); - break; - default: - jj_la1[4] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - argument = t.image.toString(); - break; - default: - jj_la1[5] = jj_gen; - ; - } - help.setArgument(argument); - {if (true) return help;} - throw new Error("Missing return statement in function"); - } - - final public ShowCommand showCommand() throws ParseException { - ShowCommand show = new ShowCommand(); - String argument = null; - jj_consume_token(SHOW); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case ID: - case QUOTED_STRING: - argument = getString(); - break; - default: - jj_la1[6] = jj_gen; - ; - } - show.setArgument(argument); - {if (true) return show;} - throw new Error("Missing return statement in function"); - } - - final public DescCommand descCommand() throws ParseException { - DescCommand desc = new DescCommand(); - String argument = null; - jj_consume_token(DESCRIBE); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case ID: - case QUOTED_STRING: - argument = getString(); - break; - default: - jj_la1[7] = jj_gen; - ; - } - desc.setArgument(argument); - {if (true) return desc;} - throw new Error("Missing return statement in function"); - } - - final public CreateCommand createCommand() throws ParseException { - CreateCommand create = new CreateCommand(); - String argument = null; - List columnfamilies = null; - int limit = 1; - jj_consume_token(CREATE); - argument = getString(); - create.setTable(argument); - jj_consume_token(COLUMNFAMILIES); - columnfamilies = getLiteralValues(); - create.setColumnfamilies(columnfamilies); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LIMIT: - jj_consume_token(LIMIT); - jj_consume_token(EQUALS); - limit = getInt(); - try{ - create.setLimit(limit); - }catch(ClassCastException ce) { - {if (true) throw generateParseException();} - } - break; - default: - jj_la1[8] = jj_gen; - ; - } - {if (true) return create;} - throw new Error("Missing return statement in function"); - } - - final public DropCommand dropCommand() throws ParseException { - DropCommand drop = new DropCommand(); - String argument = null; - jj_consume_token(DROP); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case ID: - case QUOTED_STRING: - argument = getString(); - break; - default: - jj_la1[9] = jj_gen; - ; - } - drop.setArgument(argument); - {if (true) return drop;} - throw new Error("Missing return statement in function"); - } - - final public InsertCommand insertCommand() throws ParseException { - InsertCommand in = new InsertCommand(); - Map> cond = null; - List columnfamilies = null; - List values = null; - String table = null; - jj_consume_token(INSERT); - table = getString(); - in.setTable(table); - columnfamilies = getLiteralValues(); - in.setColumnfamilies(columnfamilies); - jj_consume_token(VALUES); - values = getLiteralValues(); - in.setValues(values); - jj_consume_token(WHERE); - cond = WhereClause(); - try{ - in.setCondition(cond); - }catch(ClassCastException ce) { - {if (true) throw generateParseException();} - } - {if (true) return in;} - throw new Error("Missing return statement in function"); - } - - final public DeleteCommand deleteCommand() throws ParseException { - DeleteCommand del = new DeleteCommand(); - Map> cond = null; - String argument = null; - jj_consume_token(DELETE); - argument = getString(); - del.setTable(argument); - jj_consume_token(WHERE); - cond = WhereClause(); - try{ - del.setCondition(cond); - }catch(ClassCastException ce) { - {if (true) throw generateParseException();} - } - {if (true) return del;} - throw new Error("Missing return statement in function"); - } - - final public SelectCommand selectCommand() throws ParseException { - SelectCommand select = new SelectCommand(); - Map> cond = null; - String argument = null; - int limit; - jj_consume_token(SELECT); - argument = getString(); - select.setTable(argument); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case WHERE: - jj_consume_token(WHERE); - cond = WhereClause(); - try{ - select.setCondition(cond); - }catch(ClassCastException ce) { - {if (true) throw generateParseException();} - } - break; - default: - jj_la1[10] = jj_gen; - ; - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LIMIT: - jj_consume_token(LIMIT); - jj_consume_token(EQUALS); - limit = getInt(); - try{ - select.setLimit(limit); - }catch(ClassCastException ce) { - {if (true) throw generateParseException();} - } - break; - default: - jj_la1[11] = jj_gen; - ; - } - {if (true) return select;} - throw new Error("Missing return statement in function"); - } - - final public ClearCommand clearCommand() throws ParseException { - ClearCommand clear = new ClearCommand(); - jj_consume_token(CLEAR); - {if (true) return clear;} - throw new Error("Missing return statement in function"); - } - -/** -* TODO : expressions codes need more love. -*/ - final public String getString() throws ParseException { - Token t = null; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case ID: - t = jj_consume_token(ID); - break; - case QUOTED_STRING: - t = jj_consume_token(QUOTED_STRING); - break; - default: - jj_la1[12] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - {if (true) return t.image.toString();} - throw new Error("Missing return statement in function"); - } - - final public int getInt() throws ParseException { - Token t = null; - t = jj_consume_token(NUM); - {if (true) return Integer.parseInt(t.image.toString());} - throw new Error("Missing return statement in function"); - } - - final public Map> WhereClause() throws ParseException { - Map> result = - new HashMap>(); - List exception = - new ArrayList(); - try{ - result.putAll(ConditionExpression()); - }catch(ParseException pe) { - exception.add(pe.toString()); - result.put("error", exception); - } - label_2: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case AND: - ; - break; - default: - jj_la1[13] = jj_gen; - break label_2; - } - jj_consume_token(AND); - try{ - result.putAll(ConditionExpression()); - }catch(ParseException pe) { - exception.add(pe.toString()); - result.put("error", exception); - } - } - {if (true) return result;} - throw new Error("Missing return statement in function"); - } - - final public Map> ConditionExpression() throws ParseException { - Token tSearchName, tComparator, tComparand; - Map> tmp = - new HashMap>(); - List values = - new ArrayList(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case ROW: - tSearchName = jj_consume_token(ROW); - break; - case COLUMN: - tSearchName = jj_consume_token(COLUMN); - break; - case TIME: - tSearchName = jj_consume_token(TIME); - break; - case ID: - tSearchName = jj_consume_token(ID); - break; - case VALUES: - tSearchName = jj_consume_token(VALUES); - break; - case COLUMNFAMILIES: - tSearchName = jj_consume_token(COLUMNFAMILIES); - break; - default: - jj_la1[14] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case EQUALS: - tComparator = jj_consume_token(EQUALS); - break; - case NOTEQUAL: - tComparator = jj_consume_token(NOTEQUAL); - break; - default: - jj_la1[15] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case QUOTED_STRING: - tComparand = jj_consume_token(QUOTED_STRING); - values.add("quoted string"); - tmp.put("error", values); - {if (true) return tmp;} - break; - case STRING_LITERAL: - tComparand = jj_consume_token(STRING_LITERAL); - values.add(tComparator.image); - values.add(tComparand.image.substring(1,tComparand.image.length() - 1)); - - if(tSearchName.image.toString().equals("row") || - tSearchName.image.toString().equals("column") || - tSearchName.image.toString().equals("time")) - { tmp.put(tSearchName.image, values); } - else - { - values.add(tSearchName.image.toString()); - tmp.put("error", values); - } - - {if (true) return tmp;} - break; - default: - jj_la1[16] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - throw new Error("Missing return statement in function"); - } - - final public List getLiteralValues() throws ParseException { - List values = new ArrayList(); - String literal = null; - jj_consume_token(LPAREN); - literal = getStringLiteral(); - if(literal != null) values.add(literal); - label_3: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case COMMA: - case ID: - case STRING: - case QUOTED_STRING: - case STRING_LITERAL: - ; - break; - default: - jj_la1[17] = jj_gen; - break label_3; - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case COMMA: - jj_consume_token(COMMA); - literal = getStringLiteral(); - if(literal != null) values.add(literal); - break; - case ID: - case STRING: - case QUOTED_STRING: - case STRING_LITERAL: - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case ID: - jj_consume_token(ID); - break; - case STRING_LITERAL: - jj_consume_token(STRING_LITERAL); - break; - case QUOTED_STRING: - jj_consume_token(QUOTED_STRING); - break; - case STRING: - jj_consume_token(STRING); - break; - default: - jj_la1[18] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - values.removeAll(values); - break; - default: - jj_la1[19] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - jj_consume_token(RPAREN); - {if (true) return values;} - throw new Error("Missing return statement in function"); - } - - final public String getStringLiteral() throws ParseException { - Token stringLiteral; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case STRING_LITERAL: - stringLiteral = jj_consume_token(STRING_LITERAL); - {if (true) return stringLiteral.image.substring(1,stringLiteral.image.length() - 1);} - break; - case QUOTED_STRING: - jj_consume_token(QUOTED_STRING); - {if (true) return null;} - break; - default: - jj_la1[20] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - throw new Error("Missing return statement in function"); - } - - public ParserTokenManager token_source; - SimpleCharStream jj_input_stream; - public Token token, jj_nt; - private int jj_ntk; - private int jj_gen; - final private int[] jj_la1 = new int[21]; - static private int[] jj_la1_0; - static private int[] jj_la1_1; - static { - jj_la1_0(); - jj_la1_1(); - } - private static void jj_la1_0() { - jj_la1_0 = new int[] {0xffe0,0xffe1,0xffe0,0x0,0xffc0,0xffc0,0x0,0x0,0x400000,0x0,0x200000,0x400000,0x0,0x800000,0x1f0000,0x60000000,0x0,0x2000000,0x0,0x2000000,0x0,}; - } - private static void jj_la1_1() { - jj_la1_1 = new int[] {0x0,0x20,0x0,0x1,0x1,0x1,0x9,0x9,0x0,0x9,0x0,0x0,0x9,0x0,0x1,0x0,0x18,0x1d,0x1d,0x1d,0x18,}; - } - - public Parser(java.io.InputStream stream) { - this(stream, null); - } - public Parser(java.io.InputStream stream, String encoding) { - try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source = new ParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 21; i++) jj_la1[i] = -1; - } - - public void ReInit(java.io.InputStream stream) { - ReInit(stream, null); - } - public void ReInit(java.io.InputStream stream, String encoding) { - try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 21; i++) jj_la1[i] = -1; - } - - public Parser(java.io.Reader stream) { - jj_input_stream = new SimpleCharStream(stream, 1, 1); - token_source = new ParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 21; i++) jj_la1[i] = -1; - } - - public void ReInit(java.io.Reader stream) { - jj_input_stream.ReInit(stream, 1, 1); - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 21; i++) jj_la1[i] = -1; - } - - public Parser(ParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 21; i++) jj_la1[i] = -1; - } - - public void ReInit(ParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 21; i++) jj_la1[i] = -1; - } - - final private Token jj_consume_token(int kind) throws ParseException { - Token oldToken; - if ((oldToken = token).next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - if (token.kind == kind) { - jj_gen++; - return token; - } - token = oldToken; - jj_kind = kind; - throw generateParseException(); - } - - final public Token getNextToken() { - if (token.next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - jj_gen++; - return token; - } - - final public Token getToken(int index) { - Token t = token; - for (int i = 0; i < index; i++) { - if (t.next != null) t = t.next; - else t = t.next = token_source.getNextToken(); - } - return t; - } - - final private int jj_ntk() { - if ((jj_nt=token.next) == null) - return (jj_ntk = (token.next=token_source.getNextToken()).kind); - else - return (jj_ntk = jj_nt.kind); - } - - private java.util.Vector jj_expentries = new java.util.Vector(); - private int[] jj_expentry; - private int jj_kind = -1; - - public ParseException generateParseException() { - jj_expentries.removeAllElements(); - boolean[] la1tokens = new boolean[38]; - for (int i = 0; i < 38; i++) { - la1tokens[i] = false; - } - if (jj_kind >= 0) { - la1tokens[jj_kind] = true; - jj_kind = -1; - } - for (int i = 0; i < 21; i++) { - if (jj_la1[i] == jj_gen) { - for (int j = 0; j < 32; j++) { - if ((jj_la1_0[i] & (1< query = new ArrayList(); + jj_consume_token(FS); + label_1: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ID: + ; + break; + default: + jj_la1[3] = jj_gen; + break label_1; + } + t = jj_consume_token(ID); + query.add(t.image.toString()); + } + fs.setQuery(query); + {if (true) return fs;} + throw new Error("Missing return statement in function"); + } + + final public HelpCommand helpCommand() throws ParseException { + Token t = null; + HelpCommand help = new HelpCommand(); + String argument = ""; + jj_consume_token(HELP); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ALTER: + case CLEAR: + case SHOW: + case DESCRIBE: + case CREATE: + case DROP: + case FS: + case EXIT: + case INSERT: + case DELETE: + case SELECT: + case ID: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SHOW: + t = jj_consume_token(SHOW); + break; + case DESCRIBE: + t = jj_consume_token(DESCRIBE); + break; + case CREATE: + t = jj_consume_token(CREATE); + break; + case DROP: + t = jj_consume_token(DROP); + break; + case EXIT: + t = jj_consume_token(EXIT); + break; + case INSERT: + t = jj_consume_token(INSERT); + break; + case DELETE: + t = jj_consume_token(DELETE); + break; + case SELECT: + t = jj_consume_token(SELECT); + break; + case ALTER: + t = jj_consume_token(ALTER); + break; + case CLEAR: + t = jj_consume_token(CLEAR); + break; + case FS: + t = jj_consume_token(FS); + break; + case ID: + t = jj_consume_token(ID); + break; + default: + jj_la1[4] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + argument = t.image.toString(); + break; + default: + jj_la1[5] = jj_gen; + ; + } + help.setArgument(argument); + {if (true) return help;} + throw new Error("Missing return statement in function"); + } + + final public ShowCommand showCommand() throws ParseException { + ShowCommand show = new ShowCommand(); + String arg = null; + jj_consume_token(SHOW); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ID: + case QUOTED_IDENTIFIER: + case STRING_LITERAL: + arg = Identifier(); + break; + default: + jj_la1[6] = jj_gen; + ; + } + show.setArgument(arg); + {if (true) return show;} + throw new Error("Missing return statement in function"); + } + + final public DescCommand descCommand() throws ParseException { + DescCommand desc = new DescCommand(); + String argument = null; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DESCRIBE: + jj_consume_token(DESCRIBE); + break; + case DESC: + jj_consume_token(DESC); + break; + default: + jj_la1[7] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + argument = Identifier(); + desc.setArgument(argument); + {if (true) return desc;} + throw new Error("Missing return statement in function"); + } + + final public Map ColumnSpec() throws ParseException { + Map columnSpec = new HashMap(); + int n = -1; + Token t = null; + label_2: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case MAX_VERSIONS: + case MAX_LENGTH: + case COMPRESSION: + case IN_MEMORY: + case BLOOMFILTER: + case VECTOR_SIZE: + case NUM_HASH: + case NUM_ENTRIES: + ; + break; + default: + jj_la1[8] = jj_gen; + break label_2; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case MAX_VERSIONS: + jj_consume_token(MAX_VERSIONS); + jj_consume_token(EQUALS); + n = Number(); + columnSpec.put("MAX_VERSIONS", n); + break; + case MAX_LENGTH: + jj_consume_token(MAX_LENGTH); + jj_consume_token(EQUALS); + n = Number(); + columnSpec.put("MAX_LENGTH", n); + break; + case COMPRESSION: + jj_consume_token(COMPRESSION); + jj_consume_token(EQUALS); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NONE: + t = jj_consume_token(NONE); + break; + case BLOCK: + t = jj_consume_token(BLOCK); + break; + case RECORD: + t = jj_consume_token(RECORD); + break; + default: + jj_la1[9] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + columnSpec.put("COMPRESSION", t.image.toString()); + break; + case IN_MEMORY: + jj_consume_token(IN_MEMORY); + columnSpec.put("IN_MEMORY", true); + break; + case BLOOMFILTER: + jj_consume_token(BLOOMFILTER); + jj_consume_token(EQUALS); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BLOOMFILTER: + t = jj_consume_token(BLOOMFILTER); + break; + case COUNTING_BLOOMFILTER: + t = jj_consume_token(COUNTING_BLOOMFILTER); + break; + case RETOUCHED_BLOOMFILTER: + t = jj_consume_token(RETOUCHED_BLOOMFILTER); + break; + default: + jj_la1[10] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + columnSpec.put("BLOOMFILTER", t.image.toString()); + break; + case VECTOR_SIZE: + jj_consume_token(VECTOR_SIZE); + jj_consume_token(EQUALS); + n = Number(); + columnSpec.put("VECTOR_SIZE", n); + break; + case NUM_HASH: + jj_consume_token(NUM_HASH); + jj_consume_token(EQUALS); + n = Number(); + columnSpec.put("NUM_HASH", n); + break; + case NUM_ENTRIES: + jj_consume_token(NUM_ENTRIES); + jj_consume_token(EQUALS); + n = Number(); + columnSpec.put("NUM_ENTRIES", n); + break; + default: + jj_la1[11] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + {if (true) return columnSpec;} + throw new Error("Missing return statement in function"); + } + + final public CreateCommand createCommand() throws ParseException { + CreateCommand createCommand = new CreateCommand(); + String table = null; + Map columnSpec = null; + Token t = null; + String column = null; + jj_consume_token(CREATE); + jj_consume_token(TABLE); + table = Identifier(); + createCommand.setTable(table); + jj_consume_token(LPAREN); + column = Identifier(); + columnSpec = ColumnSpec(); + createCommand.addColumnSpec(column, columnSpec); + label_3: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[12] = jj_gen; + break label_3; + } + jj_consume_token(COMMA); + column = Identifier(); + columnSpec = ColumnSpec(); + createCommand.addColumnSpec(column, columnSpec); + } + jj_consume_token(RPAREN); + {if (true) return createCommand;} + throw new Error("Missing return statement in function"); + } + + final public AlterCommand alterCommand() throws ParseException { + AlterCommand alterCommand = new AlterCommand(); + String table = null; + String column = null; + Map columnSpec = null; + jj_consume_token(ALTER); + jj_consume_token(TABLE); + table = Identifier(); + alterCommand.setTable(table); + if (jj_2_1(2)) { + jj_consume_token(ADD); + column = Identifier(); + columnSpec = ColumnSpec(); + alterCommand.setOperationType(AlterCommand.OperationType.ADD); + alterCommand.addColumnSpec(column, columnSpec); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ADD: + jj_consume_token(ADD); + jj_consume_token(LPAREN); + alterCommand.setOperationType(AlterCommand.OperationType.ADD); + column = Identifier(); + columnSpec = ColumnSpec(); + alterCommand.addColumnSpec(column, columnSpec); + label_4: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[13] = jj_gen; + break label_4; + } + jj_consume_token(COMMA); + column = Identifier(); + columnSpec = ColumnSpec(); + alterCommand.addColumnSpec(column, columnSpec); + } + jj_consume_token(RPAREN); + break; + case DROP: + jj_consume_token(DROP); + column = Identifier(); + alterCommand.setOperationType(AlterCommand.OperationType.DROP); + alterCommand.setColumn(column); + break; + case CHANGE: + jj_consume_token(CHANGE); + column = Identifier(); + columnSpec = ColumnSpec(); + alterCommand.setOperationType(AlterCommand.OperationType.CHANGE); + alterCommand.addColumnSpec(column, columnSpec); + break; + default: + jj_la1[14] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + {if (true) return alterCommand;} + throw new Error("Missing return statement in function"); + } + + final public DropCommand dropCommand() throws ParseException { + DropCommand drop = new DropCommand(); + String argument = null; + List tableList = null; + jj_consume_token(DROP); + jj_consume_token(TABLE); + tableList = TableList(); + drop.setTableList(tableList); + {if (true) return drop;} + throw new Error("Missing return statement in function"); + } + + final public InsertCommand insertCommand() throws ParseException { + InsertCommand in = new InsertCommand(); + List columnfamilies = null; + List values = null; + String table = null; + Token t = null; + jj_consume_token(INSERT); + jj_consume_token(INTO); + table = Identifier(); + in.setTable(table); + columnfamilies = getColumns(); + in.setColumnfamilies(columnfamilies); + jj_consume_token(VALUES); + values = getLiteralValues(); + in.setValues(values); + jj_consume_token(WHERE); + jj_consume_token(ROW); + jj_consume_token(EQUALS); + t = jj_consume_token(STRING_LITERAL); + in.setRow(t.image.substring(1, t.image.length()-1)); + {if (true) return in;} + throw new Error("Missing return statement in function"); + } + + final public DeleteCommand deleteCommand() throws ParseException { + DeleteCommand deleteCommand = new DeleteCommand(); + List columnList = null; + Token t = null; + String table = null; + jj_consume_token(DELETE); + columnList = ColumnList(); + deleteCommand.setColumnList(columnList); + jj_consume_token(FROM); + table = Identifier(); + deleteCommand.setTable(table); + jj_consume_token(WHERE); + jj_consume_token(ROW); + jj_consume_token(EQUALS); + t = jj_consume_token(STRING_LITERAL); + deleteCommand.setRow(t.image.substring(1, t.image.length()-1)); + {if (true) return deleteCommand;} + throw new Error("Missing return statement in function"); + } + + final public SelectCommand selectCommand() throws ParseException { + SelectCommand select = new SelectCommand(); + List columns = null; + String rowKey = ""; + String timestamp = null; + int numVersion = 0; + String tableName = null; + int limit; + jj_consume_token(SELECT); + columns = ColumnList(); + jj_consume_token(FROM); + tableName = Identifier(); + select.setColumns(columns); + select.setTable(tableName); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STARTING: + case WHERE: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case WHERE: + jj_consume_token(WHERE); + jj_consume_token(ROW); + jj_consume_token(EQUALS); + select.setWhere(true); + break; + case STARTING: + jj_consume_token(STARTING); + jj_consume_token(FROM); + break; + default: + jj_la1[15] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + rowKey = getStringLiteral(); + select.setRowKey(rowKey); + break; + default: + jj_la1[16] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TIMESTAMP: + jj_consume_token(TIMESTAMP); + timestamp = getStringLiteral(); + select.setTimestamp(timestamp); + break; + default: + jj_la1[17] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NUM_VERSIONS: + jj_consume_token(NUM_VERSIONS); + numVersion = Number(); + select.setVersion(numVersion); + break; + default: + jj_la1[18] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LIMIT: + jj_consume_token(LIMIT); + jj_consume_token(EQUALS); + limit = Number(); + try{ + select.setLimit(limit); + }catch(ClassCastException ce) { + {if (true) throw generateParseException();} + } + break; + default: + jj_la1[19] = jj_gen; + ; + } + {if (true) return select;} + throw new Error("Missing return statement in function"); + } + + final public EnableCommand enableCommand() throws ParseException { + EnableCommand enableCommand = new EnableCommand(); + String table = null; + jj_consume_token(ENABLE); + table = Identifier(); + enableCommand.setTable(table); + {if (true) return enableCommand;} + throw new Error("Missing return statement in function"); + } + + final public DisableCommand disableCommand() throws ParseException { + DisableCommand disableCommand = new DisableCommand(); + String table = null; + jj_consume_token(DISABLE); + table = Identifier(); + disableCommand.setTable(table); + {if (true) return disableCommand;} + throw new Error("Missing return statement in function"); + } + + final public ClearCommand clearCommand() throws ParseException { + ClearCommand clear = new ClearCommand(); + jj_consume_token(CLEAR); + {if (true) return clear;} + throw new Error("Missing return statement in function"); + } + +//////////////////////////////////////////////// +// Utility expansion units... + final public List getLiteralValues() throws ParseException { + List values = new ArrayList(); + String literal = null; + jj_consume_token(LPAREN); + literal = getStringLiteral(); + if(literal != null) values.add(literal); + label_5: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + case ID: + case QUOTED_IDENTIFIER: + case STRING_LITERAL: + ; + break; + default: + jj_la1[20] = jj_gen; + break label_5; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + jj_consume_token(COMMA); + literal = getStringLiteral(); + if(literal != null) values.add(literal); + break; + case ID: + case QUOTED_IDENTIFIER: + case STRING_LITERAL: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ID: + jj_consume_token(ID); + break; + case STRING_LITERAL: + jj_consume_token(STRING_LITERAL); + break; + case QUOTED_IDENTIFIER: + jj_consume_token(QUOTED_IDENTIFIER); + break; + default: + jj_la1[21] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + values.removeAll(values); + break; + default: + jj_la1[22] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + jj_consume_token(RPAREN); + {if (true) return values;} + throw new Error("Missing return statement in function"); + } + + final public String getStringLiteral() throws ParseException { + Token stringLiteral; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STRING_LITERAL: + stringLiteral = jj_consume_token(STRING_LITERAL); + String value = stringLiteral.image.toString(); + {if (true) return value.substring(1,value.length() - 1);} + break; + case QUOTED_IDENTIFIER: + jj_consume_token(QUOTED_IDENTIFIER); + {if (true) return null;} + break; + default: + jj_la1[23] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + + final public List getColumns() throws ParseException { + List values = new ArrayList(); + String literal = null; + jj_consume_token(LPAREN); + literal = getColumn(); + if(literal != null) values.add(literal); + label_6: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[24] = jj_gen; + break label_6; + } + jj_consume_token(COMMA); + literal = getColumn(); + if(literal != null) values.add(literal); + } + jj_consume_token(RPAREN); + {if (true) return values;} + throw new Error("Missing return statement in function"); + } + + final public String getColumn() throws ParseException { + Token col; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ASTERISK: + case ID: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ID: + col = jj_consume_token(ID); + break; + case ASTERISK: + col = jj_consume_token(ASTERISK); + break; + default: + jj_la1[25] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + {if (true) return col.image.toString();} + break; + case QUOTED_IDENTIFIER: + case STRING_LITERAL: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case QUOTED_IDENTIFIER: + col = jj_consume_token(QUOTED_IDENTIFIER); + break; + case STRING_LITERAL: + col = jj_consume_token(STRING_LITERAL); + break; + default: + jj_la1[26] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + {if (true) return col.image.substring(1,col.image.toString().length() - 1);} + break; + default: + jj_la1[27] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + + final public List TableList() throws ParseException { + List tableList = new ArrayList(); + String table = null; + table = Identifier(); + tableList.add(table); + label_7: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[28] = jj_gen; + break label_7; + } + jj_consume_token(COMMA); + table = Identifier(); + tableList.add(table); + } + {if (true) return tableList;} + throw new Error("Missing return statement in function"); + } + + final public List ColumnList() throws ParseException { + List columnList = new ArrayList(); + String column = null; + column = getColumn(); + if(column != null) { + columnList.add(column); + } else { + {if (true) return columnList;} + } + label_8: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[29] = jj_gen; + break label_8; + } + jj_consume_token(COMMA); + column = getColumn(); + columnList.add(column); + } + {if (true) return columnList;} + throw new Error("Missing return statement in function"); + } + + final public int Number() throws ParseException { + Token t = null; + t = jj_consume_token(INTEGER_LITERAL); + {if (true) return Integer.parseInt(t.image.toString());} + throw new Error("Missing return statement in function"); + } + + final public String Identifier() throws ParseException { + Token t = null; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ID: + t = jj_consume_token(ID); + {if (true) return t.image.toString();} + break; + case QUOTED_IDENTIFIER: + case STRING_LITERAL: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case QUOTED_IDENTIFIER: + t = jj_consume_token(QUOTED_IDENTIFIER); + break; + case STRING_LITERAL: + t = jj_consume_token(STRING_LITERAL); + break; + default: + jj_la1[30] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + {if (true) return t.image.substring(1,t.image.toString().length() - 1);} + break; + default: + jj_la1[31] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + + final private boolean jj_2_1(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_1(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(0, xla); } + } + + final private boolean jj_3R_9() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_10()) { + jj_scanpos = xsp; + if (jj_3R_11()) return true; + } + return false; + } + + final private boolean jj_3_1() { + if (jj_scan_token(ADD)) return true; + if (jj_3R_9()) return true; + return false; + } + + final private boolean jj_3R_11() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(63)) { + jj_scanpos = xsp; + if (jj_scan_token(64)) return true; + } + return false; + } + + final private boolean jj_3R_10() { + if (jj_scan_token(ID)) return true; + return false; + } + + public ParserTokenManager token_source; + SimpleCharStream jj_input_stream; + public Token token, jj_nt; + private int jj_ntk; + private Token jj_scanpos, jj_lastpos; + private int jj_la; + public boolean lookingAhead = false; + private boolean jj_semLA; + private int jj_gen; + final private int[] jj_la1 = new int[32]; + static private int[] jj_la1_0; + static private int[] jj_la1_1; + static private int[] jj_la1_2; + static { + jj_la1_0(); + jj_la1_1(); + jj_la1_2(); + } + private static void jj_la1_0() { + jj_la1_0 = new int[] {0x3cffe0,0x3cffe1,0x3cffe0,0x0,0xcfbc0,0xcfbc0,0x0,0x600,0x0,0x0,0x0,0x0,0x0,0x0,0x1000,0xc00000,0xc00000,0x10000000,0x20000000,0x40000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_1() { + jj_la1_1 = new int[] {0x0,0x0,0x0,0x8000000,0x8000000,0x8000000,0x88000000,0x0,0x1cc700,0x3800,0x38000,0x1cc700,0x2,0x2,0x600000,0x0,0x0,0x0,0x0,0x0,0x88000002,0x88000000,0x88000002,0x80000000,0x2,0x8000080,0x80000000,0x88000080,0x2,0x2,0x80000000,0x88000000,}; + } + private static void jj_la1_2() { + jj_la1_2 = new int[] {0x0,0x2,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x1,0x1,0x1,0x0,0x0,0x1,0x1,0x0,0x0,0x1,0x1,}; + } + final private JJCalls[] jj_2_rtns = new JJCalls[1]; + private boolean jj_rescan = false; + private int jj_gc = 0; + + public Parser(java.io.InputStream stream) { + this(stream, null); + } + public Parser(java.io.InputStream stream, String encoding) { + try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source = new ParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 32; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + public void ReInit(java.io.InputStream stream) { + ReInit(stream, null); + } + public void ReInit(java.io.InputStream stream, String encoding) { + try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 32; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + public Parser(java.io.Reader stream) { + jj_input_stream = new SimpleCharStream(stream, 1, 1); + token_source = new ParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 32; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + public void ReInit(java.io.Reader stream) { + jj_input_stream.ReInit(stream, 1, 1); + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 32; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + public Parser(ParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 32; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + public void ReInit(ParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 32; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + final private Token jj_consume_token(int kind) throws ParseException { + Token oldToken; + if ((oldToken = token).next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + if (token.kind == kind) { + jj_gen++; + if (++jj_gc > 100) { + jj_gc = 0; + for (int i = 0; i < jj_2_rtns.length; i++) { + JJCalls c = jj_2_rtns[i]; + while (c != null) { + if (c.gen < jj_gen) c.first = null; + c = c.next; + } + } + } + return token; + } + token = oldToken; + jj_kind = kind; + throw generateParseException(); + } + + static private final class LookaheadSuccess extends java.lang.Error { } + final private LookaheadSuccess jj_ls = new LookaheadSuccess(); + final private boolean jj_scan_token(int kind) { + if (jj_scanpos == jj_lastpos) { + jj_la--; + if (jj_scanpos.next == null) { + jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); + } else { + jj_lastpos = jj_scanpos = jj_scanpos.next; + } + } else { + jj_scanpos = jj_scanpos.next; + } + if (jj_rescan) { + int i = 0; Token tok = token; + while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } + if (tok != null) jj_add_error_token(kind, i); + } + if (jj_scanpos.kind != kind) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; + return false; + } + + final public Token getNextToken() { + if (token.next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + jj_gen++; + return token; + } + + final public Token getToken(int index) { + Token t = lookingAhead ? jj_scanpos : token; + for (int i = 0; i < index; i++) { + if (t.next != null) t = t.next; + else t = t.next = token_source.getNextToken(); + } + return t; + } + + final private int jj_ntk() { + if ((jj_nt=token.next) == null) + return (jj_ntk = (token.next=token_source.getNextToken()).kind); + else + return (jj_ntk = jj_nt.kind); + } + + private java.util.Vector jj_expentries = new java.util.Vector(); + private int[] jj_expentry; + private int jj_kind = -1; + private int[] jj_lasttokens = new int[100]; + private int jj_endpos; + + private void jj_add_error_token(int kind, int pos) { + if (pos >= 100) return; + if (pos == jj_endpos + 1) { + jj_lasttokens[jj_endpos++] = kind; + } else if (jj_endpos != 0) { + jj_expentry = new int[jj_endpos]; + for (int i = 0; i < jj_endpos; i++) { + jj_expentry[i] = jj_lasttokens[i]; + } + boolean exists = false; + for (java.util.Enumeration e = jj_expentries.elements(); e.hasMoreElements();) { + int[] oldentry = (int[])(e.nextElement()); + if (oldentry.length == jj_expentry.length) { + exists = true; + for (int i = 0; i < jj_expentry.length; i++) { + if (oldentry[i] != jj_expentry[i]) { + exists = false; + break; + } + } + if (exists) break; + } + } + if (!exists) jj_expentries.addElement(jj_expentry); + if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; + } + } + + public ParseException generateParseException() { + jj_expentries.removeAllElements(); + boolean[] la1tokens = new boolean[66]; + for (int i = 0; i < 66; i++) { + la1tokens[i] = false; + } + if (jj_kind >= 0) { + la1tokens[jj_kind] = true; + jj_kind = -1; + } + for (int i = 0; i < 32; i++) { + if (jj_la1[i] == jj_gen) { + for (int j = 0; j < 32; j++) { + if ((jj_la1_0[i] & (1< jj_gen) { + jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; + switch (i) { + case 0: jj_3_1(); break; + } + } + p = p.next; + } while (p != null); + } catch(LookaheadSuccess ls) { } + } + jj_rescan = false; + } + + final private void jj_save(int index, int xla) { + JJCalls p = jj_2_rtns[index]; + while (p.gen > jj_gen) { + if (p.next == null) { p = p.next = new JJCalls(); break; } + p = p.next; + } + p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; + } + + static final class JJCalls { + int gen; + Token first; + int arg; + JJCalls next; + } + +} Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/SelectCommand.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/SelectCommand.java (revision 574112) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/SelectCommand.java (working copy) @@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.shell; import java.io.IOException; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -35,75 +36,74 @@ import org.apache.hadoop.io.DataInputBuffer; import org.apache.hadoop.io.Text; +/** + * Selects values from tables. + * + * INTO FILE is not yet implemented. + */ public class SelectCommand extends BasicCommand { - private Text table; + private Text tableName; + private Text rowKey = new Text(""); + private List columns; + private long timestamp; private int limit; - private Map> condition; + private int version; + private boolean where = false; public ReturnMsg execute(Configuration conf) { - if (this.condition != null && this.condition.containsKey("error")) + if (this.tableName.equals("")) { return new ReturnMsg(0, "Syntax error : Please check 'Select' syntax."); - + } else if(this.rowKey == null) { + return new ReturnMsg(0, "The string must be enclosed " + + "in single quotation marks, as in '...'.\n"); + } else if(this.columns.size() == 0) { + return new ReturnMsg(0, "The quoted identifier for table name " + + "and column name must \nbe enclosed " + + "in double quotation marks, as in \"...\".\n"); + } + try { - HTable table = new HTable(conf, this.table); + HTable table = new HTable(conf, this.tableName); HBaseAdmin admin = new HBaseAdmin(conf); - - switch (getCondition()) { - case 0: - HTableDescriptor[] tables = admin.listTables(); - Text[] columns = null; + if (this.where) { + compoundWherePrint(table, admin); + } else { + scanPrint(table, admin); + } + return new ReturnMsg(1, "Successfully print out the selected data."); + } catch (IOException e) { + String[] msg = e.getMessage().split("[,]"); + return new ReturnMsg(0, msg[0]); + } + } - if (this.table.equals(HConstants.ROOT_TABLE_NAME) - || this.table.equals(HConstants.META_TABLE_NAME)) { - columns = HConstants.COLUMN_FAMILY_ARRAY; - } else { - for (int i = 0; i < tables.length; i++) { - if (tables[i].getName().equals(this.table)) { - columns = tables[i].families().keySet().toArray(new Text[] {}); - } + private void compoundWherePrint(HTable table, HBaseAdmin admin) { + try { + if (this.version != 0) { + byte[][] result = null; + Text[] cols = getColumns(admin); + for (int i = 0; i < cols.length; i++) { + + if (this.timestamp == 0) { + result = table.get(this.rowKey, cols[i], this.timestamp, this.version); + } else { + result = table.get(this.rowKey, cols[i], this.version); } - } - HScannerInterface scan = table.obtainScanner(columns, new Text("")); - HStoreKey key = new HStoreKey(); - TreeMap results = new TreeMap(); - - ConsoleTable.selectHead(); - int count = 0; - while (scan.next(key, results)) { - Text rowKey = key.getRow(); - - for (Text columnKey : results.keySet()) { - byte[] value = results.get(columnKey); - String cellData = new String(value, HConstants.UTF8_ENCODING); - - if (columnKey.equals(HConstants.COL_REGIONINFO)) { - DataInputBuffer inbuf = new DataInputBuffer(); - HRegionInfo info = new HRegionInfo(); - inbuf.reset(value, value.length); - info.readFields(inbuf); - - cellData = "ID : " + String.valueOf(info.getRegionId()); - } - ConsoleTable.printLine(count, rowKey.toString(), columnKey.toString(), - cellData); - count++; + ConsoleTable.selectHead(); + for (int ii = 0; ii < result.length; ii++) { + ConsoleTable.printLine(i, this.rowKey.toString(), cols[i].toString(), + new String(result[ii], HConstants.UTF8_ENCODING)); } - results = new TreeMap(); + ConsoleTable.selectFoot(); } - ConsoleTable.selectFoot(); - scan.close(); - - break; - - case 1: - - count = 0; + } else { + int count = 0; ConsoleTable.selectHead(); - for (Map.Entry entry : table.getRow(new Text(getRow())).entrySet()) { - + + for (Map.Entry entry : table.getRow(this.rowKey).entrySet()) { byte[] value = entry.getValue(); String cellData = new String(value, HConstants.UTF8_ENCODING); @@ -112,138 +112,126 @@ HRegionInfo info = new HRegionInfo(); inbuf.reset(value, value.length); info.readFields(inbuf); - - cellData = "ID : " + String.valueOf(info.getRegionId()); + cellData = String.valueOf(info.getRegionId()); } - ConsoleTable.printLine(count, getRow().toString(), entry.getKey().toString(), - cellData); - count++; - } - ConsoleTable.selectFoot(); - break; - - case 2: - - Text[] column = new Text[] { new Text(getColumn()) }; - - HScannerInterface scanner = table.obtainScanner(column, new Text("")); - HStoreKey k = new HStoreKey(); - TreeMap r = new TreeMap(); - - ConsoleTable.selectHead(); - count = 0; - while (scanner.next(k, r)) { - Text rowKey = k.getRow(); - - for (Text columnKey : r.keySet()) { - byte[] value = r.get(columnKey); - String cellData = new String(value, HConstants.UTF8_ENCODING); - ConsoleTable.printLine(count, rowKey.toString(), columnKey.toString(), - cellData); + if (columns.contains(entry.getKey().toString()) || columns.contains("*")) { + ConsoleTable.printLine(count, this.rowKey.toString(), entry.getKey() + .toString(), cellData); count++; } - results = new TreeMap(); } ConsoleTable.selectFoot(); - scanner.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } - break; + private void scanPrint(HTable table, HBaseAdmin admin) { + HScannerInterface scan = null; + try { + if (this.timestamp == 0) { + scan = table.obtainScanner(getColumns(admin), this.rowKey); + } else { + scan = table.obtainScanner(getColumns(admin), this.rowKey, this.timestamp); + } - case 3: + HStoreKey key = new HStoreKey(); + TreeMap results = new TreeMap(); - byte[] rs1 = table.get(new Text(getRow()), new Text(getColumn())); + ConsoleTable.selectHead(); + int count = 0; - ConsoleTable.selectHead(); - ConsoleTable.printLine(0, getRow(), getColumn(), - new String(rs1, HConstants.UTF8_ENCODING)); - ConsoleTable.selectFoot(); + while (scan.next(key, results) && checkLimit(count)) { + Text rowKey = key.getRow(); - break; - - case 4: - - byte[][] rs2 = table.get(new Text(getRow()), new Text(getColumn()), this.limit); - - ConsoleTable.selectHead(); - for (int i = 0; i < rs2.length; i++) { - ConsoleTable.printLine(i, getRow(), getColumn(), - new String(rs2[i], HConstants.UTF8_ENCODING)); + for (Text columnKey : results.keySet()) { + String cellData = new String(results.get(columnKey), HConstants.UTF8_ENCODING); + ConsoleTable.printLine(count, rowKey.toString(), columnKey.toString(), cellData); } - ConsoleTable.selectFoot(); + count++; + } + ConsoleTable.selectFoot(); + scan.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } - break; + public Text[] getColumns(HBaseAdmin admin) { + Text[] cols = null; - case 5: - - byte[][] rs3 = table.get(new Text(getRow()), new Text(getColumn()), getTime(), this.limit); - - ConsoleTable.selectHead(); - for (int i = 0; i < rs3.length; i++) { - ConsoleTable.printLine(i, getRow(), getColumn(), new String(rs3[i], HConstants.UTF8_ENCODING)); + try { + if (this.columns.contains("*")) { + HTableDescriptor[] tables = admin.listTables(); + if (this.tableName.equals(HConstants.ROOT_TABLE_NAME) + || this.tableName.equals(HConstants.META_TABLE_NAME)) { + cols = HConstants.COLUMN_FAMILY_ARRAY; + } else { + for (int i = 0; i < tables.length; i++) { + if (tables[i].getName().equals(this.tableName)) { + cols = tables[i].families().keySet().toArray(new Text[] {}); + } + } } - ConsoleTable.selectFoot(); - - break; - + } else { + List tmpList = new ArrayList(); + for (int i = 0; i < this.columns.size(); i++) { + Text column = null; + if(this.columns.get(i).contains(":")) + column = new Text(this.columns.get(i)); + else + column = new Text(this.columns.get(i) + ":"); + + tmpList.add(column); + } + cols = tmpList.toArray(new Text[] {}); } - - return new ReturnMsg(1, "Successfully print out the selected data."); } catch (IOException e) { - String[] msg = e.getMessage().split("[,]"); - return new ReturnMsg(0, msg[0]); + e.printStackTrace(); } + return cols; } + private boolean checkLimit(int count) { + if (this.limit == 0) { + return true; + } else { + return (this.limit > count) ? true : false; + } + } + public void setTable(String table) { - this.table = new Text(table); + this.tableName = new Text(table); } public void setLimit(int limit) { this.limit = limit; } - public void setCondition(Map> cond) { - this.condition = cond; + public void setWhere(boolean isWhereClause) { + if (isWhereClause) + this.where = true; } - public String getRow() { - return this.condition.get("row").get(1); + public void setTimestamp(String timestamp) { + this.timestamp = Long.parseLong(timestamp); } - public String getColumn() { - return this.condition.get("column").get(1); + public void setColumns(List columns) { + this.columns = columns; } - public long getTime() { - return Long.parseLong(this.condition.get("time").get(1)); + public void setRowKey(String rowKey) { + if(rowKey == null) + this.rowKey = null; + else + this.rowKey = new Text(rowKey); } - public int getConditionSize() { - return this.condition.size(); + public void setVersion(int version) { + this.version = version; } - - public int getCondition() { - int type = 0; - if (this.condition == null) { - type = 0; - } else if (this.condition.containsKey("row")) { - if (getConditionSize() == 1) { - type = 1; - } else if (this.condition.containsKey("column")) { - if (getConditionSize() == 2) { - if (this.limit == 0) { - type = 3; - } else { - type = 4; - } - } else { - type = 5; - } - } - } else if (this.condition.containsKey("column")) { - type = 2; - } - return type; - } + } Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ShowCommand.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ShowCommand.java (revision 574112) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ShowCommand.java (working copy) @@ -25,6 +25,9 @@ import org.apache.hadoop.hbase.HBaseAdmin; import org.apache.hadoop.hbase.HTableDescriptor; +/** + * Shows all available tables. + */ public class ShowCommand extends BasicCommand { private String command; @@ -55,7 +58,8 @@ } return new ReturnMsg(0, "Missing parameters. Please check 'Show' syntax."); } catch (IOException e) { - return new ReturnMsg(0, "error msg : " + e.toString()); + String[] msg = e.getMessage().split("[\n]"); + return new ReturnMsg(0, msg[0]); } } Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/BasicCommand.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/BasicCommand.java (revision 574112) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/BasicCommand.java (working copy) @@ -20,10 +20,12 @@ package org.apache.hadoop.hbase.shell; /** - * @see HBaseShell + * @see HbaseShell */ public abstract class BasicCommand implements Command, CommandFactory { + private static final String DELIMITER = ":"; + public BasicCommand getBasicCommand() { return this; } @@ -33,4 +35,22 @@ return this; } + protected String extractErrMsg(String msg) { + int index = msg.indexOf(":"); + int eofIndex = msg.indexOf("\n"); + return msg.substring(index + 1, eofIndex); + } + + protected String extractErrMsg(Exception e) { + return extractErrMsg(e.getMessage()); + } + + /** + * Appends, if it does not exist, a delimiter (colon) + * at the end of the column name. + */ + protected String appendDelimiter(String column) { + return (!column.endsWith(DELIMITER))? column + DELIMITER: column; + } + } Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ClearCommand.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ClearCommand.java (revision 574112) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ClearCommand.java (working copy) @@ -23,6 +23,9 @@ import org.apache.hadoop.conf.Configuration; +/** + * Clears the console screen. + */ public class ClearCommand extends BasicCommand { public ReturnMsg execute(Configuration conf) { Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/EnableCommand.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/EnableCommand.java (revision 0) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/EnableCommand.java (revision 0) @@ -0,0 +1,53 @@ +/** + * Copyright 2007 The Apache Software Foundation + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hbase.shell; + +import java.io.IOException; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.HBaseAdmin; +import org.apache.hadoop.io.Text; + +/** + * Enables tables. + */ +public class EnableCommand extends BasicCommand { + + private String table; + + public ReturnMsg execute(Configuration conf) { + assert table != null; + + try { + HBaseAdmin admin = new HBaseAdmin(conf); + admin.enableTable(new Text(table)); + + return new ReturnMsg(1, "Table enabled successfully."); + } catch (IOException e) { + String[] msg = e.getMessage().split("[\n]"); + return new ReturnMsg(0, msg[0]); + } + } + + public void setTable(String table) { + this.table = table; + } + +} Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/SchemaModificationCommand.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/SchemaModificationCommand.java (revision 0) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/SchemaModificationCommand.java (revision 0) @@ -0,0 +1,107 @@ +/** + * Copyright 2007 The Apache Software Foundation + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hbase.shell; + +import java.util.Map; +import java.util.Set; + +import org.apache.hadoop.hbase.BloomFilterDescriptor; +import org.apache.hadoop.hbase.BloomFilterDescriptor.BloomFilterType; +import org.apache.hadoop.hbase.HColumnDescriptor; +import org.apache.hadoop.io.Text; + +/** + * The base class of schema modification commands, CreateCommand and Alter + * Command. Provides utility methods for alteration operations. + */ +public abstract class SchemaModificationCommand extends BasicCommand { + + private int maxVersions; + private int maxLength; + private HColumnDescriptor.CompressionType compression; + private boolean inMemory; + private BloomFilterDescriptor bloomFilterDesc; + private BloomFilterType bloomFilterType; + private int vectorSize; + private int numHash; + private int numEntries; + + private void initOptions() { + maxVersions = HColumnDescriptor.DEFAULT_N_VERSIONS; + maxLength = HColumnDescriptor.DEFAULT_MAX_VALUE_LENGTH; + compression = HColumnDescriptor.DEFAULT_COMPRESSION_TYPE; + inMemory = HColumnDescriptor.DEFAULT_IN_MEMORY; + bloomFilterDesc = HColumnDescriptor.DEFAULT_BLOOM_FILTER_DESCRIPTOR; + } + + /** + * Given a column name and column spec, returns an instance of + * HColumnDescriptor representing the column spec. + */ + protected HColumnDescriptor getColumnDescriptor(String column, + Map columnSpec) throws IllegalArgumentException { + initOptions(); + + Set specs = columnSpec.keySet(); + for (String spec : specs) { + spec = spec.toUpperCase(); + + if (spec.equals("MAX_VERSIONS")) { + maxVersions = (Integer) columnSpec.get(spec); + } else if (spec.equals("MAX_LENGTH")) { + maxLength = (Integer) columnSpec.get(spec); + } else if (spec.equals("COMPRESSION")) { + compression = HColumnDescriptor.CompressionType + .valueOf(((String) columnSpec.get(spec)).toUpperCase()); + } else if (spec.equals("IN_MEMORY")) { + inMemory = (Boolean) columnSpec.get(spec); + } else if (spec.equals("BLOOMFILTER")) { + bloomFilterType = BloomFilterType.valueOf(((String) columnSpec + .get(spec)).toUpperCase()); + } else if (spec.equals("VECTOR_SIZE")) { + vectorSize = (Integer) columnSpec.get(spec); + } else if (spec.equals("NUM_HASH")) { + numHash = (Integer) columnSpec.get(spec); + } else if (spec.equals("NUM_ENTRIES")) { + numEntries = (Integer) columnSpec.get(spec); + } else { + throw new IllegalArgumentException("Invalid option: " + spec); + } + } + + // Now we gather all the specified options for this column. + if (bloomFilterType != null) { + if (specs.contains("NUM_ENTRIES")) { + bloomFilterDesc = new BloomFilterDescriptor(bloomFilterType, numEntries); + } else { + bloomFilterDesc = new BloomFilterDescriptor(bloomFilterType, + vectorSize, numHash); + } + } + + column = appendDelimiter(column); + + HColumnDescriptor columnDesc = new HColumnDescriptor(new Text(column), + maxVersions, compression, inMemory, maxLength, bloomFilterDesc); + + return columnDesc; + } + +} Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/HBaseShell.jj =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/HBaseShell.jj (revision 574112) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/HBaseShell.jj (working copy) @@ -36,6 +36,7 @@ /** * Parsing command line. + * */ public class Parser { private String QueryString; @@ -60,25 +61,33 @@ | "\n" } -TOKEN: +TOKEN: /** for HQL statements */ { + | | | | - | + | + | | | | | + | + | | | + | + | + | + | + | | - | - | | | - | + | + | | | | @@ -88,53 +97,86 @@ | | "> - | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | } -TOKEN : +TOKEN : /** Altools */ { - - | - | - | + + | + | + | +} + +TOKEN : /** Literals */ +{ + + | + | )? + | "." (["0"-"9"])+ ()? + | (["0"-"9"])+ + | (["0"-"9"])+ ()? + > + | <#EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > + | | } /** * Parses the given array of command line arguments. + * */ Command terminatedCommand() : { - Command statement = null; + Command statement = null; } { - ([statement = cmdStatement()] ";" | ) + ([statement = cmdStatement()] ";" | ) { - return statement; + return statement; } } Command cmdStatement() : { - Command cmd = null; + Command cmd = null; } { ( - cmd = exitCommand() - | cmd = helpCommand() - | cmd = showCommand() - | cmd = descCommand() - | cmd = createCommand() - | cmd = dropCommand() - | cmd = insertCommand() - | cmd = deleteCommand() - | cmd = selectCommand() - | cmd = clearCommand() - | cmd = fsCommand() + cmd = exitCommand() + | cmd = helpCommand() + | cmd = showCommand() + | cmd = descCommand() + | cmd = createCommand() + | cmd = dropCommand() + | cmd = alterCommand() + | cmd = insertCommand() + | cmd = deleteCommand() + | cmd = selectCommand() + | cmd = enableCommand() + | cmd = disableCommand() + | cmd = clearCommand() + | cmd = fsCommand() ) - { - return cmd; - } + { + return cmd; + } } ExitCommand exitCommand() : @@ -154,8 +196,8 @@ { ( - t = - { query.add(t.image.toString()); } + t = + { query.add(t.image.toString()); } )* { @@ -171,43 +213,43 @@ String argument = ""; } { - - [ - ( - t= - | t= - | t= - | t= - | t= - | t= - | t= - | t= + | t= + | t= + | t= + | t= + ) + { + argument = t.image.toString(); + } + ] { - help.setArgument(argument); - return help; + help.setArgument(argument); + return help; } } ShowCommand showCommand() : { ShowCommand show = new ShowCommand(); - String argument = null; + String arg = null; } { - - [ - argument = getString() - ] - + + [ arg = Identifier() ] { - show.setArgument(argument); - return show; + show.setArgument(arg); + return show; } } @@ -217,265 +259,354 @@ String argument = null; } { - - [ - argument = getString() - ] - + ( | ) + argument = Identifier() { - desc.setArgument(argument); - return desc; + desc.setArgument(argument); + return desc; } } -CreateCommand createCommand() : +Map ColumnSpec() : { - CreateCommand create = new CreateCommand(); - String argument = null; - List columnfamilies = null; - int limit = 1; + Map columnSpec = new HashMap(); + int n = -1; + Token t = null; } { - - argument = getString() + ( + + n = Number() { - create.setTable(argument); + columnSpec.put("MAX_VERSIONS", n); } - - - columnfamilies = getLiteralValues() + | + + n = Number() + { + columnSpec.put("MAX_LENGTH", n); + } + | + + + ( t= + | t= + | t= ) { - create.setColumnfamilies(columnfamilies); + columnSpec.put("COMPRESSION", t.image.toString()); } + | + + { + columnSpec.put("IN_MEMORY", true); + } + | + + + ( t= + | t= + | t= + ) + { + columnSpec.put("BLOOMFILTER", t.image.toString()); + } + | + + n = Number() + { + columnSpec.put("VECTOR_SIZE", n); + } + | + + n = Number() + { + columnSpec.put("NUM_HASH", n); + } + | + n = Number() + { + columnSpec.put("NUM_ENTRIES", n); + } + )* - [ limit = getInt() { - try{ - create.setLimit(limit); - }catch(ClassCastException ce) { - throw generateParseException(); - } - } ] - { return create; } + { return columnSpec; } } -DropCommand dropCommand() : +CreateCommand createCommand() : { - DropCommand drop = new DropCommand(); - String argument = null; + CreateCommand createCommand = new CreateCommand(); + String table = null; + Map columnSpec = null; + String column = null; } { - - [ - argument = getString() - ] - + + + table = Identifier() { - drop.setArgument(argument); - return drop; + createCommand.setTable(table); } + + + + column = Identifier() + columnSpec = ColumnSpec() + { + createCommand.addColumnSpec(column, columnSpec); + } + + ( + + column = Identifier() + columnSpec = ColumnSpec() + { + createCommand.addColumnSpec(column, columnSpec); + } + )* + + + { return createCommand; } } -InsertCommand insertCommand() : +AlterCommand alterCommand() : { - InsertCommand in = new InsertCommand(); - Map> cond = null; - List columnfamilies = null; - List values = null; - String table = null; + AlterCommand alterCommand = new AlterCommand(); + String table = null; + String column = null; + Map columnSpec = null; } { - - table = getString() + +
table = Identifier() + { alterCommand.setTable(table); } + + ( + LOOKAHEAD(2) + column = Identifier() columnSpec = ColumnSpec() + { + alterCommand.setOperationType(AlterCommand.OperationType.ADD); + alterCommand.addColumnSpec(column, columnSpec); + } + | + + { - in.setTable(table); + alterCommand.setOperationType(AlterCommand.OperationType.ADD); } - - columnfamilies = getLiteralValues() - { - in.setColumnfamilies(columnfamilies); + + column = Identifier() columnSpec = ColumnSpec() + { + alterCommand.addColumnSpec(column, columnSpec); } - - values = getLiteralValues() - { - in.setValues(values); - } - cond = WhereClause() - { - try{ - in.setCondition(cond); - }catch(ClassCastException ce) { - throw generateParseException(); + ( + + column = Identifier() + columnSpec = ColumnSpec() + { + alterCommand.addColumnSpec(column, columnSpec); } - } - { - return in; + )* + + | + column = Identifier() + { + alterCommand.setOperationType(AlterCommand.OperationType.DROP); + alterCommand.setColumn(column); } + | + column = Identifier() columnSpec = ColumnSpec() + { + alterCommand.setOperationType(AlterCommand.OperationType.CHANGE); + alterCommand.addColumnSpec(column, columnSpec); + } + ) + { return alterCommand; } } -DeleteCommand deleteCommand() : +DropCommand dropCommand() : { - DeleteCommand del = new DeleteCommand(); - Map> cond = null; - String argument = null; + DropCommand drop = new DropCommand(); + List tableList = null; } { - - argument = getString() - { - del.setTable(argument); - } - - cond = WhereClause() { - try{ - del.setCondition(cond); - }catch(ClassCastException ce) { - throw generateParseException(); - } - } - { - return del; - } + +
+ tableList = TableList() + { + drop.setTableList(tableList); + return drop; + } } -SelectCommand selectCommand() : +InsertCommand insertCommand() : { - SelectCommand select = new SelectCommand(); - Map> cond = null; - String argument = null; - int limit; + InsertCommand in = new InsertCommand(); + List columnfamilies = null; + List values = null; + String table = null; + Token t = null; } { - + columns = ColumnList() + + tableName = Identifier() { - try{ - result.putAll(ConditionExpression()); - }catch(ParseException pe) { - exception.add(pe.toString()); - result.put("error", exception); + select.setColumns(columns); + select.setTable(tableName); + } + + [ ( + { select.setWhere(true); } + | ) + + rowKey = getStringLiteral() + { + select.setRowKey(rowKey); + } + ] + + [ + timestamp = getStringLiteral() + { + select.setTimestamp(timestamp); + } + ] + + [ + + numVersion = Number() + { + select.setVersion(numVersion); } - } - ( - { + ] + + [ limit = Number() { try{ - result.putAll(ConditionExpression()); - }catch(ParseException pe) { - exception.add(pe.toString()); - result.put("error", exception); + select.setLimit(limit); + }catch(ClassCastException ce) { + throw generateParseException(); } - } - )* - - { return result; } + } ] + { return select; } } -Map> ConditionExpression() : +EnableCommand enableCommand() : { - Token tSearchName, tComparator, tComparand; - Map> tmp = - new HashMap>(); - List values = - new ArrayList(); + EnableCommand enableCommand = new EnableCommand(); + String table = null; } { - ( - tSearchName= - | tSearchName= - | tSearchName=