// @Override
 public TableFromBuilder As(String alias)
 {
     if (alias == null)
     {
         throw new ArgumentException("alias cannot be null");
     }
     _from_item.setAlias(alias);
     return(this);
 } // As
        } // constructor

        // @Override
        public void parse(String delim, String itemToken)
        {
            FromItem fromItem;

            int parenthesisStart = itemToken.IndexOf('(');

            if (parenthesisStart != -1)
            {
                if (parenthesisStart != 0)
                {
                    throw new QueryParserException("Not capable of parsing FROM token: " + itemToken
                                                   + ". Expected parenthesis to start at first character.");
                }
                int parenthesisEnd = itemToken.IndexOf(')', parenthesisStart);
                if (parenthesisEnd == -1)
                {
                    throw new QueryParserException("Not capable of parsing FROM token: " + itemToken
                                                   + ". Expected end parenthesis.");
                }

                String subQueryString = itemToken.Substring(parenthesisStart + 1, parenthesisEnd);
                logger.debug("Parsing sub-query: {0}", subQueryString);

                Query subQuery = new QueryParser(_dataContext, subQueryString).parse();
                fromItem = new FromItem(subQuery);

                string alias = itemToken.Substring(parenthesisEnd + 1).Trim();
                if (!alias.IsEmpty())
                {
                    fromItem.setAlias(alias);
                }
            }
            else if (itemToken.ToUpper().IndexOf(" JOIN ") != -1)
            {
                fromItem = parseAllJoinItems(itemToken);
            }
            else
            {
                fromItem = parseTableItem(itemToken);
            }

            _query.from(fromItem);
        } // parse()
        } // parse()

        private FromItem parseTableItem(String itemToken)
        {
            // From token can be starting with [
            String tableNameToken;
            String aliasToken;

            char startDelimiter = itemToken.Trim()[0];

            if (delimiterMap.ContainsKey(startDelimiter))
            {
                char endDelimiter = delimiterMap[startDelimiter];
                int  endIndex     = itemToken.Trim().LastIndexOf(endDelimiter, itemToken.Trim().Length);
                if (endIndex <= 0)
                {
                    throw new QueryParserException("Not capable of parsing FROM token: " + itemToken + ". Expected end "
                                                   + endDelimiter);
                }
                tableNameToken = itemToken.Trim().Substring(1, endIndex).Trim();

                if (itemToken.Trim().Substring(1 + endIndex).Trim().Equals("", StringComparison.CurrentCultureIgnoreCase))
                {
                    /*
                     * As per code in FromClause Method: getItemByReference(FromItem
                     * item, String reference) if (alias == null && table != null &&
                     * reference.equals(table.getName())) { Either we have to change
                     * the code to add alias.equals("") there or return null here.
                     */
                    aliasToken = null;
                }
                else
                {
                    aliasToken = itemToken.Trim().Substring(1 + endIndex).Trim();
                }
            }
            else
            {
                // Default assumption is space being delimiter for tablename and
                // alias.. If otherwise use DoubleQuotes or [] around tableName
                String[] tokens = itemToken.Split(' ');
                tableNameToken = tokens[0];
                if (tokens.Length == 2)
                {
                    aliasToken = tokens[1];
                }
                else if (tokens.Length == 1)
                {
                    aliasToken = null;
                }
                else
                {
                    throw new QueryParserException("Not capable of parsing FROM token: " + itemToken);
                }
            }

            Table table = _dataContext.getTableByQualifiedLabel(tableNameToken);

            if (table == null)
            {
                throw new QueryParserException("Not capable of parsing FROM token: " + itemToken);
            }

            FromItem result = new FromItem(table);

            result.setAlias(aliasToken);
            result.setQuery(_query);
            return(result);
        } // parseTableItem()