public ColumnIndexOutOfBoundsException(TextualDatabase database, TextualTable table, int index) { TextualDatabase = database; TextualTable = table; message = string.Format(MESSAGE_FORMAT, table.Name, index); }
public ColumnAlreadyExistsException(TextualDatabase database, TextualTable table, string column) { TextualDatabase = database; TextualTable = table; message = string.Format(MESSAGE_FORMAT, table.Name, column); }
private TextualTable parseTable(TextualDatabase db) { // name: string name = expectToken(TokenType.Identifier).Value; expectToken(TokenType.Colon); TextualTable table = new TextualTable(db, name); // | column1 | column2 | column3 | expectToken(TokenType.Pipe); while (!matchToken(TokenType.Dash)) { table.Columns.Add(expectToken(TokenType.Identifier).Value); expectToken(TokenType.Pipe); } // ------------- while (acceptToken(TokenType.Dash)) { ; } // Rows while (!matchToken(TokenType.Question)) { table.AddRow(parseRow(table)); } // ? expectToken(TokenType.Question); return(table); }
public RowNotFoundException(TextualDatabase database, TextualTable table, TextualRow row) { TextualDatabase = database; TextualTable = table; TextualRow = row; message = string.Format(MESSAGE_FORMAT, table.Name); }
public TextualDatabase ParseDatabase(string name) { TextualDatabase db = new TextualDatabase(name); while (!endOfStream) { db.AddTable(parseTable(db)); } return(db); }
public bool OpenDatabase(string file) { try { Database = TextualDatabase.Parse(file, File.ReadAllText(file)); } catch (ComponentException ce) { throw ce; } catch (Exception) { return(false); } return(true); }
public static TextualTable ExecuteOperation(TextualDatabase database, string op) { var tokens = new Scanner(op).Scan(); return(new OperationParser(database, tokens).Parse()); }
public TextualDeleteTableOperation(TextualDatabase database) { this.database = database; }
public TableNotFoundException(TextualDatabase database, string tableName) { TextualDatabase = database; message = string.Format(MESSAGE_FORMAT, database.Name, tableName); }
public TableAlreadyExistsException(TextualDatabase database, string tableName) { TextualDatabase = database; message = string.Format(MESSAGE_FORMAT, tableName); }
public TextualCreateTableOperation(TextualDatabase database, string name) { Result = new TextualTable(database, name); }
public OperationParser(TextualDatabase database, List <Token> tokens) { this.database = database; this.tokens = tokens; position = 0; }