-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds Pest Grammar to Ion Conversion (#38)
The purpose of this commit is the start of a tool to generate Ion formatted ASTs from Pest grammars, particularly that of PartiQL. We could then easily process the grammar outside of Rust in scripts that could be used to generate things like TextMate grammars for IDE support or LaTeX fragments for the specification document. Adds the `pest-ion` crate to provide a simple trait `TryPestToElement` and implementations over `&str` syntax definitions to parse Pest grammars and create their Ion `Element` serialized forms. Also adds `PestToElement` which is the infallible version of the trait (used mostly for Pest AST elements). Resolves #35.
- Loading branch information
Showing
5 changed files
with
533 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ members = [ | |
"partiql-irgen", | ||
"partiql-parser", | ||
"partiql-rewriter", | ||
"pest-ion", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[package] | ||
name = "pest-ion" | ||
authors = ["PartiQL Team <[email protected]>"] | ||
description = "A simple Pest grammar to Ion converter" | ||
homepage = "https://github.com/partiql/partiql-lang-rust/pest-ion" | ||
repository = "https://github.com/partiql/partiql-lang-rust/pest-ion" | ||
license = "Apache-2.0" | ||
readme = "README.md" | ||
keywords = ["parser", "peg", "pest", "ion", "cli"] | ||
categories = ["parser-implementations", "command-line-utilities"] | ||
exclude = [ | ||
"**/.git/**", | ||
"**/.github/**", | ||
"**/.travis.yml", | ||
"**/.appveyor.yml", | ||
] | ||
edition = "2018" | ||
version = "0.0.0" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
thiserror = "~1.0.25" | ||
pest = "~2.1.3" | ||
pest_meta = "~2.1.3" | ||
ion-rs = "~0.6.0" | ||
smallvec = "~1.6.1" | ||
|
||
[dev-dependencies] | ||
rstest = "~0.10.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Pest to Ion | ||
|
||
This is a simple tool and library for converting [Pest] grammars to [Ion] data format. | ||
|
||
The motivation for this is to make a portable way to introspect [Pest] grammars in other tools | ||
as a data format versus having to provide bespoke parsers for the Pest syntax in other platforms. | ||
|
||
[Pest]: https://pest.rs/ | ||
[Ion]: https://amzn.github.io/ion-docs/ |
Oops, something went wrong.