Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Mysql ANTLR4 parser #486

Merged
merged 14 commits into from
Jan 10, 2024
Merged

Add Mysql ANTLR4 parser #486

merged 14 commits into from
Jan 10, 2024

Conversation

NQPhuc
Copy link
Contributor

@NQPhuc NQPhuc commented Dec 21, 2023

Summary

  • Add new mysql parser using antlr grammar (based on: https://github.com/antlr/grammars-v4/tree/master/sql/mysql/Positive-Technologies)

  • The old postgres parser can still be used through: sql2dbml --mysql-legacy

  • Implement MySQLASTGen visitor to generate the AST from the parse tree. Note that not all nodes will be visited in our visitor, only the nodes related to model_structure and thus DBML is.

  • Update tests and doc.

  • Improve Error Handling for both Postgres and Mysql new parser to be able to throw multiple errors.

  • Note: Files in ANTLR/parsers/mysql are auto-generated and can be safely ignored.

  • Benchmark result
    benchmark-27-12-2023

Issue

Lasting Changes (Technical)

  • Update AST classes typing.
  • Unify commonly used constants in both MySQLASTGen and PostgresASTGen.
  • Update eslint ecmaVersion to 2020 to recognize new syntax such as ?.

Checklist

Please check directly on the box once each of these are done

  • Documentation (if necessary)
  • Tests (integration test/unit test)
  • Integration Tests Passed
  • Code Review

@NQPhuc NQPhuc marked this pull request as ready for review December 27, 2023 10:12
dbml-homepage/docs/cli/README.md Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Breaking Change 💥 A type of pull request used for changelog categories PR: New Feature 🚀 A type of pull request used for changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants