/*
// $Id: //open/dev/farrago/src/org/eigenbase/sql/parser/Parser.jj#19 $
// Package org.eigenbase is a class library of data management components.
// Copyright (C) 2005-2009 The Eigenbase Project
// Copyright (C) 2002-2009 SQLstream, Inc.
// Copyright (C) 2005-2009 LucidEra, Inc.
// Portions Copyright (C) 2003-2009 John V. Sichi
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later Eigenbase-approved version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
// jhyde, Mar 18, 2003
//
// This parser was derived from Parser.jj, part of the OpenJava system
// written by Michiaki Tatsubori.
*/
options {
    STATIC = false;
    IGNORE_CASE = true;
    UNICODE_INPUT = true;
}


PARSER_BEGIN(SqlParserImpl)

package org.eigenbase.sql.parser.impl;

import org.eigenbase.sql.*;
import org.eigenbase.sql.parser.*;
import org.eigenbase.sql.fun.*;
import org.eigenbase.trace.EigenbaseTrace;
import org.eigenbase.util.BitString;
import org.eigenbase.util14.DateTimeUtil;
import org.eigenbase.sql.type.SqlTypeName;
import org.eigenbase.resource.*;

import java.math.*;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.List;
import java.util.Iterator;
import java.util.logging.Logger;
import java.util.logging.Level;

/**
 * SQL parser, generated from Parser.jj and CommonParser.jj by JavaCC.
 *
 * <p>The public wrapper for this parser is {@link SqlParser}.
 *
 * @author jhyde
 * @since Mar 18, 2003
 * @version $Id: //open/dev/farrago/src/org/eigenbase/sql/parser/Parser.jj#19 $
 */
public class SqlParserImpl extends SqlAbstractParserImpl
{
    private static final Logger tracer = EigenbaseTrace.getParserTracer();

    private static Metadata metadata;

    // implement SqlAbstractParserImpl
    public SqlParseException normalizeException(Throwable ex)
    {
        try {
            if (ex instanceof ParseException) {
                ex = cleanupParseException((ParseException) ex);
            }
            return convertException(ex);
        } catch (ParseException e) {
            throw new AssertionError(e);
        }
    }

    // implement SqlAbstractParserImpl
    public Metadata getMetadata()
    {
        synchronized (SqlParserImpl.class) {
            if (metadata == null) {
                metadata = new MetadataImpl(
                    new SqlParserImpl(new java.io.StringReader("")));
            }
            return metadata;
        }
    }

    // implement SqlAbstractParserImpl
    public void setTabSize(int tabSize)
    {
        jj_input_stream.setTabSize(tabSize);
    }
}

PARSER_END(SqlParserImpl)


/*****************************************
 * Utility Codes for Semantical Analysis *
 *****************************************/

/* For Debug */
JAVACODE
void debug_message1()
{
    tracer.log(Level.INFO,  getToken( 0 ).image
        + " , " + getToken( 1 ).image );
}

String NonReservedKeyWord() :
{
    String kw;
}
{
    kw = CommonNonReservedKeyWord()
    {
        return kw;
    }
}

/**
 * Allows parser to be extended with new types of table references.  The
 * default implementation of this production is empty.
 */
SqlNode ExtendedTableRef() :
{
}
{
    UnusedExtension()
    {
        return null;
    }
}

/**
 * Allows an OVER clause following a table expression as an extension to
 * standard SQL syntax. The default implementation of this production is empty.
 */
SqlNode TableOverOpt() :
{
}
{
    {
        return null;
    }
}

/*
 * Parses dialect-specific keywords immediately following the SELECT keyword.
 */
void SqlSelectKeywords(List keywords) :
{}
{
    E()
}

/*
 * Parses dialect-specific keywords immediately following the INSERT keyword.
 */
void SqlInsertKeywords(List keywords) :
{}
{
    E()
}

SqlNode ExtendedBuiltinFunctionCall() :
{
}
{
    UnusedExtension()
    {
        return null;
    }
}

/*
* Parse Floor/Ceil function parameters
*/
SqlNode FloorCeilOptions( SqlParserPos pos, boolean floorFlag) :
{
    SqlNode node;
}
{
    node = StandardFloorCeilOptions( pos, floorFlag)
    {
        return node;
    }
}



// End Parser.jj

