[mysql/oracle] Add remaining ports to support all targets. #4345
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements the rest of the ports of the mysql/oracle grammar. This is a necessary first step in generating each of the ports automatically from the official source (here). It also refactors the code to be more in line with standard OO development practices. These ports are necessary mainly because people want to pick a grammar and run with it. Asking them to write a port of the grammar is time-consuming and difficult.
Previously, from the original Antlr4ng port, initialization was done in the driver:
grammars-v4/sql/mysql/Oracle/original/TypeScript/demo.ts
Lines 23 to 27 in 00a96c9
This is actually a bad place to put initialization because it requires the user to read the driver code or readme. No one does either, and they just want it to "work." Also, driver code are not part of the grammar. Initialization should be done in a constructor, in line with OO practices.
In addition, the class SqlMode should be in its own file, not embedded in the lexer base class.
grammars-v4/sql/mysql/Oracle/original/TypeScript/MySQLBaseLexer.ts
Lines 12 to 19 in 00a96c9
It is used in the parser.
grammars-v4/sql/mysql/Oracle/original/TypeScript/MySQLBaseRecognizer.ts
Line 7 in 00a96c9
The method that creates a
Set<SqlMode>
is in the lexer. It should be in the class SqlModes.What was done?
Test.*
files were removed.StackQueue<>
was removed and all ports now use a standard queue data structure.