From b8c47d0ac9a45e2936f6c5e41e517db473fae6da Mon Sep 17 00:00:00 2001 From: hayden Date: Wed, 27 Sep 2023 17:28:41 +0800 Subject: [PATCH] feat: declare copyright ownership --- src/grammar/generic/SqlLexer.g4 | 5 +++++ src/grammar/generic/SqlParser.g4 | 5 +++++ src/grammar/hive/HiveSqlLexer.g4 | 6 ++++++ src/grammar/hive/HiveSqlParser.g4 | 6 ++++++ src/grammar/pgsql/PostgreSQLLexer.g4 | 15 +++++++++------ src/grammar/plsql/PlSqlLexer.g4 | 5 +++++ src/grammar/plsql/PlSqlParser.g4 | 5 +++++ src/grammar/spark/SparkSqlLexer.g4 | 8 +++++--- src/grammar/spark/SparkSqlParser.g4 | 8 +++++--- src/grammar/trinosql/TrinoSql.g4 | 19 +++++++++++++++++++ 10 files changed, 70 insertions(+), 12 deletions(-) diff --git a/src/grammar/generic/SqlLexer.g4 b/src/grammar/generic/SqlLexer.g4 index a1745b1..d0192d1 100644 --- a/src/grammar/generic/SqlLexer.g4 +++ b/src/grammar/generic/SqlLexer.g4 @@ -23,6 +23,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/** + * This file is an adaptation of antlr's grammars-v4/sql/mysql/Positive-Technologies/MySqlLexer.g4 grammar. + * Reference: https://github.com/antlr/grammars-v4/blob/master/sql/mysql/Positive-Technologies/MySqlLexer.g4 + */ + lexer grammar SqlLexer; channels { MYSQLCOMMENT, ERRORCHANNEL } diff --git a/src/grammar/generic/SqlParser.g4 b/src/grammar/generic/SqlParser.g4 index 2ca69c3..35038af 100644 --- a/src/grammar/generic/SqlParser.g4 +++ b/src/grammar/generic/SqlParser.g4 @@ -23,6 +23,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/** + * This file is an adaptation of antlr's grammars-v4/sql/mysql/Positive-Technologies/MySqlParser.g4 grammar. + * Reference: https://github.com/antlr/grammars-v4/blob/master/sql/mysql/Positive-Technologies/MySqlParser.g4 + */ + parser grammar SqlParser; options { tokenVocab=SqlLexer; } diff --git a/src/grammar/hive/HiveSqlLexer.g4 b/src/grammar/hive/HiveSqlLexer.g4 index 3a9a22b..830aae0 100644 --- a/src/grammar/hive/HiveSqlLexer.g4 +++ b/src/grammar/hive/HiveSqlLexer.g4 @@ -14,6 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ + +/** + * This file is an adaptation of antlr's grammars-v4/sql/hive/v4/HiveLexer.g4 grammar. + * Reference: https://github.com/antlr/grammars-v4/blob/master/sql/hive/v4/HiveLexer.g4 + */ + lexer grammar HiveSqlLexer; // unsupported option caseInsensitive in antlr4@4.9 diff --git a/src/grammar/hive/HiveSqlParser.g4 b/src/grammar/hive/HiveSqlParser.g4 index 4db1e35..7d66629 100644 --- a/src/grammar/hive/HiveSqlParser.g4 +++ b/src/grammar/hive/HiveSqlParser.g4 @@ -14,6 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ + +/** + * This file is an adaptation of antlr/grammars-v4's sql/hive/v4/HiveParser.g4 grammar. + * Reference: https://github.com/antlr/grammars-v4/blob/master/sql/hive/v4/HiveParser.g4 + */ + parser grammar HiveSqlParser; options diff --git a/src/grammar/pgsql/PostgreSQLLexer.g4 b/src/grammar/pgsql/PostgreSQLLexer.g4 index bef5c42..8734112 100644 --- a/src/grammar/pgsql/PostgreSQLLexer.g4 +++ b/src/grammar/pgsql/PostgreSQLLexer.g4 @@ -1,8 +1,3 @@ -/* - based on - https://github.com/tunnelvisionlabs/antlr4-grammar-postgresql/blob/master/src/com/tunnelvisionlabs/postgresql/PostgreSqlLexer.g4 - */ - /* * [The "MIT license"] Copyright (C) 2014 Sam Harwell, Tunnel Vision Laboratories, LLC * @@ -23,8 +18,16 @@ * other dealings in this Software without prior written authorization from Tunnel Vision * Laboratories, LLC. */ + +/** + * This file is an adaptation of tunnelvisionlabs's antlr4-grammar-postgresql/src/com/tunnelvisionlabs/postgresql/PostgreSqlLexer.g4 grammar. + * Reference: https://github.com/tunnelvisionlabs/antlr4-grammar-postgresql/blob/master/src/com/tunnelvisionlabs/postgresql/PostgreSqlLexer.g4 + */ + lexer grammar PostgreSQLLexer; -/* Reference: http://www.postgresql.org/docs/9.3/static/sql-syntax-lexical.html + +/** + * Reference Doc: http://www.postgresql.org/docs/9.3/static/sql-syntax-lexical.html */ options { diff --git a/src/grammar/plsql/PlSqlLexer.g4 b/src/grammar/plsql/PlSqlLexer.g4 index 0774471..36a8c01 100644 --- a/src/grammar/plsql/PlSqlLexer.g4 +++ b/src/grammar/plsql/PlSqlLexer.g4 @@ -18,6 +18,11 @@ * limitations under the License. */ +/** + * This file is an adaptation of antlr's grammars-v4/sql/plsql/PlSqlLexer.g4 grammar. + * Reference: https://github.com/antlr/grammars-v4/blob/master/sql/plsql/PlSqlLexer.g4 + */ + lexer grammar PlSqlLexer; options { diff --git a/src/grammar/plsql/PlSqlParser.g4 b/src/grammar/plsql/PlSqlParser.g4 index 2a4cf44..02ca62a 100644 --- a/src/grammar/plsql/PlSqlParser.g4 +++ b/src/grammar/plsql/PlSqlParser.g4 @@ -18,6 +18,11 @@ * limitations under the License. */ +/** + * This file is an adaptation of antlr's grammars-v4/sql/plsql/PlSqlParser.g4 grammar. + * Reference: https://github.com/antlr/grammars-v4/blob/master/sql/plsql/PlSqlParser.g4 + */ + parser grammar PlSqlParser; options { diff --git a/src/grammar/spark/SparkSqlLexer.g4 b/src/grammar/spark/SparkSqlLexer.g4 index 8793c10..3c4dcda 100644 --- a/src/grammar/spark/SparkSqlLexer.g4 +++ b/src/grammar/spark/SparkSqlLexer.g4 @@ -1,5 +1,3 @@ -// Grammar file from: https://github.com/apache/spark/blob/master/sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseLexer.g4 - /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +11,11 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * This file is an adaptation of Presto's presto-parser/src/main/antlr4/com/facebook/presto/sql/parser/SqlBase.g4 grammar. + */ + +/** + * This file is an adaptation of spark's spark/sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseLexer.g4 grammar. + * Reference: https://github.com/apache/spark/blob/master/sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseLexer.g4 */ lexer grammar SparkSqlLexer; diff --git a/src/grammar/spark/SparkSqlParser.g4 b/src/grammar/spark/SparkSqlParser.g4 index 5542bca..f68dd61 100644 --- a/src/grammar/spark/SparkSqlParser.g4 +++ b/src/grammar/spark/SparkSqlParser.g4 @@ -1,5 +1,3 @@ -// Grammar file from: https://github.com/apache/spark/blob/master/sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseParser.g4 - /* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +11,11 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * This file is an adaptation of Presto's presto-parser/src/main/antlr4/com/facebook/presto/sql/parser/SqlBase.g4 grammar. + */ + +/** + * This file is an adaptation of spark's spark/sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseParser.g4 grammar. + * Reference: https://github.com/apache/spark/blob/master/sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseParser.g4 */ parser grammar SparkSqlParser; diff --git a/src/grammar/trinosql/TrinoSql.g4 b/src/grammar/trinosql/TrinoSql.g4 index a3f6f58..302ab25 100644 --- a/src/grammar/trinosql/TrinoSql.g4 +++ b/src/grammar/trinosql/TrinoSql.g4 @@ -1,3 +1,22 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * This file is an adaptation of trino's trino/core/trino-parser/src/main/antlr4/io/trino/sql/parser/SqlBase.g4 grammar. + * Reference: https://github.com/trinodb/trino/blob/385/core/trino-parser/src/main/antlr4/io/trino/sql/parser/SqlBase.g4 + */ + grammar TrinoSql; tokens {