/*
// $Id: //open/dev/farrago/src/net/sf/farrago/parser/DdlParser.jj#35 $
// Farrago is an extensible data management system.
// Copyright (C) 2005-2009 The Eigenbase Project
// Copyright (C) 2004-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
*/

options {
    STATIC = false;
    IGNORE_CASE = true;
    UNICODE_INPUT = true;
}

PARSER_BEGIN(FarragoParserImpl)

package net.sf.farrago.parser.impl;

import net.sf.farrago.parser.*;
import net.sf.farrago.catalog.*;
import net.sf.farrago.resource.*;
import net.sf.farrago.ddl.*;
import net.sf.farrago.query.*;
import net.sf.farrago.session.*;
import org.eigenbase.reltype.*;
import org.eigenbase.sql.*;
import org.eigenbase.sql.fun.*;
import org.eigenbase.sql.parser.*;
import org.eigenbase.sql.type.*;
import org.eigenbase.util.*;
import org.eigenbase.util14.*;
import org.eigenbase.resource.*;
import net.sf.farrago.resource.*;
import java.math.*;
import java.util.*;
import javax.jmi.reflect.*;
import java.sql.*;

import net.sf.farrago.cwm.*;
import net.sf.farrago.cwm.core.*;
import net.sf.farrago.cwm.datatypes.*;
import net.sf.farrago.cwm.relational.*;
import net.sf.farrago.cwm.relational.enumerations.*;
import net.sf.farrago.cwm.keysindexes.*;
import net.sf.farrago.cwm.behavioral.*;

import net.sf.farrago.fem.med.*;
import net.sf.farrago.fem.security.*;
import net.sf.farrago.fem.sql2003.*;


/**
 * Farrago SQL parser implementation, generated from DdlParser.jj and
 * CommonParser.jj by JavaCC.
 *
 * @author John V. Sichi
 * @version $Id: //open/dev/farrago/src/net/sf/farrago/parser/DdlParser.jj#35 $
 */
public class FarragoParserImpl extends FarragoAbstractParserImpl
{
    private static Metadata metadata;

    // implement FarragoAbstractParserImpl
    public SqlParserPos getCurrentPosition()
    {
        return new SqlParserPos(
            token.beginLine,
            token.beginColumn);
    }

    // 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 (FarragoParserImpl.class) {
            if (metadata == null) {
                metadata = new MetadataImpl(
                    new FarragoParserImpl(new java.io.StringReader("")));
            }
            return metadata;
        }
    }

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

PARSER_END(FarragoParserImpl)


/*****************************************
 * Syntactical Descriptions              *
 *****************************************/

/**
 * 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()
}

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

CwmModelElement ExtensionModelDefinition() :
{
}
{
    UnusedExtension()
    {
        return null;
    }
}

CwmModelElement ExtensionModelSchemaObjDefinition() :
{
}
{
    UnusedExtension()
    {
        return null;
    }
}

CwmModelElement ExtensionModelDrop() :
{
}
{
    UnusedExtension()
    {
        return null;
    }
}

DdlStmt ExtensionModelAlter() :
{
}
{
    UnusedExtension()
    {
        return null;
    }
}

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 DdlParser.jj
