Consolidated Antlr grammars into dedicated package

This commit is contained in:
Steve Ebersole 2019-12-16 15:17:30 -06:00
parent 0ec232a326
commit 99d4201730
15 changed files with 24 additions and 23 deletions

View File

@ -385,10 +385,10 @@ class Antlr4Plugin implements Plugin<Project> {
} }
class Antlr4GenerationTask extends DefaultTask { class Antlr4GenerationTask extends DefaultTask {
static final String HQL_PCKG = 'org.hibernate.query.hql.internal' static final String HQL_PCKG = 'org.hibernate.grammars.hql'
static final String IMPORT_SQL_PCKG = 'org.hibernate.tool.hbm2ddl.grammar' static final String IMPORT_SQL_PCKG = 'org.hibernate.grammars.importsql'
static final String GRAPH_PCKG = 'org.hibernate.graph.internal.parse' static final String GRAPH_PCKG = 'org.hibernate.grammars.graph'
static final String ORDER_PCKG = 'org.hibernate.grammars.ordering' static final String ORDER_PCKG = 'org.hibernate.grammars.ordering'
List<GrammarDescriptor> grammarDescriptors = [ List<GrammarDescriptor> grammarDescriptors = [
new GrammarDescriptor( HQL_PCKG, 'HqlLexer' ), new GrammarDescriptor( HQL_PCKG, 'HqlLexer' ),

View File

@ -7,7 +7,7 @@ lexer grammar GraphLanguageLexer;
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/ */
package org.hibernate.graph.internal.parse; package org.hibernate.grammars.graph;
} }
@members { @members {

View File

@ -11,7 +11,7 @@ options {
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/ */
package org.hibernate.graph.internal.parse; package org.hibernate.grammars.graph;
} }
@members { @members {

View File

@ -8,7 +8,7 @@ lexer grammar HqlLexer;
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/ */
package org.hibernate.query.hql.internal; package org.hibernate.grammars.hql;
} }
WS : ( ' ' | '\t' | '\f' | EOL ) -> skip; WS : ( ' ' | '\t' | '\f' | EOL ) -> skip;

View File

@ -11,7 +11,7 @@ options {
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/ */
package org.hibernate.query.hql.internal; package org.hibernate.grammars.hql;
} }
@members { @members {

View File

@ -7,8 +7,7 @@ lexer grammar SqlStatementLexer;
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/ */
package org.hibernate.tool.hbm2ddl.grammar; package org.hibernate.grammars.importsql;
} }
STMT_END STMT_END

View File

@ -11,7 +11,7 @@ options {
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/ */
package org.hibernate.tool.hbm2ddl.grammar; package org.hibernate.grammars.importsql;
} }

View File

@ -1,6 +0,0 @@
STMT_END=1
MULTILINE_COMMENT=2
LINE_COMMENT=3
NEWLINE=4
WORD=5
QUOTED_TEXT=6

View File

@ -7,6 +7,9 @@
package org.hibernate.graph.internal.parse; package org.hibernate.graph.internal.parse;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.grammars.graph.GraphLanguageLexer;
import org.hibernate.grammars.graph.GraphLanguageParser;
import org.hibernate.grammars.graph.GraphLanguageParserBaseVisitor;
import org.hibernate.graph.InvalidGraphException; import org.hibernate.graph.InvalidGraphException;
import org.hibernate.graph.spi.AttributeNodeImplementor; import org.hibernate.graph.spi.AttributeNodeImplementor;
import org.hibernate.graph.spi.GraphImplementor; import org.hibernate.graph.spi.GraphImplementor;

View File

@ -6,6 +6,8 @@
*/ */
package org.hibernate.query.hql.internal; package org.hibernate.query.hql.internal;
import org.hibernate.grammars.hql.HqlLexer;
import org.hibernate.grammars.hql.HqlParser;
import org.hibernate.query.hql.HqlLogger; import org.hibernate.query.hql.HqlLogger;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;

View File

@ -22,6 +22,8 @@ import org.hibernate.NullPrecedence;
import org.hibernate.SortOrder; import org.hibernate.SortOrder;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService; import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.boot.registry.classloading.spi.ClassLoadingException; import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
import org.hibernate.grammars.hql.HqlParser;
import org.hibernate.grammars.hql.HqlParserBaseVisitor;
import org.hibernate.internal.util.collections.Stack; import org.hibernate.internal.util.collections.Stack;
import org.hibernate.internal.util.collections.StandardStack; import org.hibernate.internal.util.collections.StandardStack;
import org.hibernate.metamodel.CollectionClassification; import org.hibernate.metamodel.CollectionClassification;
@ -136,7 +138,7 @@ import org.jboss.logging.Logger;
import org.antlr.v4.runtime.Token; import org.antlr.v4.runtime.Token;
import static java.util.Arrays.asList; import static java.util.Arrays.asList;
import static org.hibernate.query.hql.internal.HqlParser.IDENTIFIER; import static org.hibernate.grammars.hql.HqlParser.IDENTIFIER;
/** /**
* Responsible for producing an SQM using visitation over an HQL parse tree generated by * Responsible for producing an SQM using visitation over an HQL parse tree generated by

View File

@ -7,6 +7,8 @@
package org.hibernate.query.hql.internal; package org.hibernate.query.hql.internal;
import org.hibernate.QueryException; import org.hibernate.QueryException;
import org.hibernate.grammars.hql.HqlLexer;
import org.hibernate.grammars.hql.HqlParser;
import org.hibernate.query.sqm.InterpretationException; import org.hibernate.query.sqm.InterpretationException;
import org.hibernate.query.hql.HqlTranslator; import org.hibernate.query.hql.HqlTranslator;
import org.hibernate.query.sqm.internal.SqmTreePrinter; import org.hibernate.query.sqm.internal.SqmTreePrinter;

View File

@ -9,8 +9,8 @@ package org.hibernate.tool.hbm2ddl;
import java.io.Reader; import java.io.Reader;
import java.util.List; import java.util.List;
import org.hibernate.tool.hbm2ddl.grammar.SqlStatementLexer; import org.hibernate.grammars.importsql.SqlStatementLexer;
import org.hibernate.tool.hbm2ddl.grammar.SqlStatementParser; import org.hibernate.grammars.importsql.SqlStatementParser;
import org.antlr.v4.runtime.CommonTokenStream; import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.UnbufferedCharStream; import org.antlr.v4.runtime.UnbufferedCharStream;

View File

@ -9,8 +9,8 @@ package org.hibernate.tool.hbm2ddl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.hibernate.tool.hbm2ddl.grammar.SqlStatementParser; import org.hibernate.grammars.importsql.SqlStatementParser;
import org.hibernate.tool.hbm2ddl.grammar.SqlStatementParserBaseListener; import org.hibernate.grammars.importsql.SqlStatementParserBaseListener;
/** /**
* @author Andrea Boriero * @author Andrea Boriero

View File

@ -21,7 +21,6 @@ import org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoo
import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder; import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder;
import org.hibernate.tool.hbm2ddl.ImportScriptException; import org.hibernate.tool.hbm2ddl.ImportScriptException;
import org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor; import org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor;
import org.hibernate.tool.hbm2ddl.grammar.SqlStatementParser;
import org.hibernate.tool.schema.SourceType; import org.hibernate.tool.schema.SourceType;
import org.hibernate.tool.schema.TargetType; import org.hibernate.tool.schema.TargetType;
import org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl; import org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl;