Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions _deprecated/sql/mysql/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Deprecated MySQL Grammars

This folder contains MySQL grammars which have been deprecated and are no longer maintained.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 0 additions & 33 deletions sql/mysql/Oracle/README.md

This file was deleted.

57 changes: 0 additions & 57 deletions sql/mysql/Oracle/pom.xml

This file was deleted.

File renamed without changes.
File renamed without changes.
33 changes: 29 additions & 4 deletions sql/mysql/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
# MySQL Grammars
# Oracle's MySQL Grammar

This folder contains MySQL grammars from different authors. See the specific sub folders for more details:
## General

* [Oracle](Oracle) - A complete MySQL grammar including the latest language features of MySQL. This grammar is directly derived from the MySQL Yacc server grammar and is updated twice a year to stay in sync with the MySQL server enhancements. It supports all server versions starting from 8.0 and is driving the parsers in the [MySQL Shell for VS Code](https://marketplace.visualstudio.com/items?itemName=Oracle.mysql-shell-for-vs-code). <br/>A **special feature** of this grammar is that you can switch the MySQL server version used at runtime, to adjust things like code completion and syntax checking for the server you are connected to.
* [Positive Technologies](Positive-Technologies) - A grammar created from the official documentation (5.6, 5.7, 8.0)
This parser grammar is derived from the official Oracle grammar posted here in original/, which is derived from sources in the MySQL Shell for VS Code extension.

https://github.com/mysql/mysql-shell-plugins/tree/8928ada7d9e37a4075291880738983752b315fee/gui/frontend/src/parsing/mysql

This grammar is set to recognize version "8.0.20".

Includes updates to commit https://github.com/mysql/mysql-shell-plugins/commit/d0271b1244d9686c30ce95bae92f4cf4c135d36d.

## License

* [BSD3](https://opensource.org/license/bsd-3-clause)

## Target Agnostic

This grammar is "target agnostic". Unaltered, the .g4 files will not work for Antlr4ng, Cpp, Go, and Python3. You will need to first run `python transformGrammar.py` provided in the target-specific directory. The script modifies the .g4 files for the port.

## Modifying this grammar

This grammar is current hand-written. The plan is to generate the ports directly from the sources at https://github.com/mysql/mysql-shell-plugins.

## Issues

* The grammar is ambiguous, but generally performs well, except for bitrix_queries_cut.sql, which contains ~3000 ambiguities.

## Performance

<img src="./times.svg">
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
70 changes: 55 additions & 15 deletions sql/mysql/pom.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>mysqlparent</artifactId> <!-- required Maven non-sense -->
<packaging>pom</packaging>
<name>MySQL Grammars</name>
<parent>
<groupId>org.antlr.grammars</groupId>
<artifactId>sqlparent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modules>
<module>Oracle</module>
<module>Positive-Technologies</module>
</modules>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>mysql</artifactId>
<packaging>jar</packaging>
<name>MySQL grammar</name>
<parent>
<groupId>org.antlr.grammars</groupId>
<artifactId>mysqlparent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>${antlr.version}</version>
<configuration>
<sourceDirectory>${basedir}</sourceDirectory>
<includes>
<include>MySQLLexer.g4</include>
<include>MySQLParser.g4</include>
</includes>
<visitor>true</visitor>
<listener>true</listener>
</configuration>
<executions>
<execution>
<goals>
<goal>antlr4</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.khubla.antlr</groupId>
<artifactId>antlr4test-maven-plugin</artifactId>
<version>${antlr4test-maven-plugin.version}</version>
<configuration>
<verbose>false</verbose>
<showTree>false</showTree>
<entryPoint>queries</entryPoint>
<grammarName>MySQL</grammarName>
<packageName></packageName>
<exampleFiles>examples</exampleFiles>
</configuration>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
File renamed without changes
Loading