Skip to content

Commit 5ae9e61

Browse files
committed
Renames pestion to pest-ion.
Updates surrounding meta-data and README. Also renames the following types: * `PestionResult` => `PestToIonResult` * `PestionError` => `PestToIonError`
1 parent 783de7f commit 5ae9e61

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ members = [
66
"partiql-irgen",
77
"partiql-parser",
88
"partiql-rewriter",
9-
"pestion",
9+
"pest-ion",
1010
]

pestion/Cargo.toml renamed to pest-ion/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
2-
name = "pestion"
2+
name = "pest-ion"
33
authors = ["PartiQL Team <[email protected]>"]
44
description = "A simple Pest grammar to Ion converter"
5-
homepage = "https://github.com/partiql/partiql-lang-rust/pestion"
6-
repository = "https://github.com/partiql/partiql-lang-rust/pestion"
5+
homepage = "https://github.com/partiql/partiql-lang-rust/pest-ion"
6+
repository = "https://github.com/partiql/partiql-lang-rust/pest-ion"
77
license = "Apache-2.0"
88
readme = "README.md"
99
keywords = ["parser", "peg", "pest", "ion", "cli"]

pestion/README.md renamed to pest-ion/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Pestion
1+
# Pest to Ion
22

33
This is a simple tool and library for converting [Pest] grammars to [Ion] data format.
44

pestion/src/lib.rs renamed to pest-ion/src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
//! The easiest way to convert [Pest] grammars to Ion is from a `str` slice:
88
//!
99
//! ```
10-
//! use pestion::*;
10+
//! use pest_ion::*;
1111
//! use ion_rs::value::*;
1212
//! use ion_rs::value::reader::*;
1313
//!
14-
//! fn main() -> PestionResult<()> {
14+
//! fn main() -> PestToIonResult<()> {
1515
//! // parse a Pest grammar and convert it to Ion element
1616
//! let actual = r#"a = @{ "a" | "b" ~ "c" }"#.try_pest_to_element()?;
1717
//!
@@ -60,7 +60,7 @@ pub trait TryPestToElement {
6060
///
6161
/// This returns `Err` if the the conversion fails. For example, this can happen if the
6262
/// source is not a valid Pest grammar.
63-
fn try_pest_to_element(&self) -> PestionResult<Self::Element>;
63+
fn try_pest_to_element(&self) -> PestToIonResult<Self::Element>;
6464
}
6565

6666
/// Infallible conversion of a Pest grammar (or part of a grammar) into Ion [`Element`].
@@ -78,7 +78,7 @@ impl TryPestToElement for &str {
7878
type Element = OwnedElement;
7979

8080
/// Parses a `str` slice as a Pest grammar and serializes the AST into [`Element`].
81-
fn try_pest_to_element(&self) -> PestionResult<Self::Element> {
81+
fn try_pest_to_element(&self) -> PestToIonResult<Self::Element> {
8282
let pairs = PestParser::parse(Rule::grammar_rules, *self)?;
8383
let ast = match consume_rules(pairs) {
8484
Ok(ast) => ast,
@@ -422,7 +422,7 @@ mod tests {
422422
},
423423
}"#
424424
)]
425-
fn good<T, S>(#[case] input: T, #[case] ion_literal: S) -> PestionResult<()>
425+
fn good<T, S>(#[case] input: T, #[case] ion_literal: S) -> PestToIonResult<()>
426426
where
427427
T: TryPestToElement<Element = OwnedElement> + Debug,
428428
S: AsRef<str>,
@@ -452,9 +452,9 @@ mod tests {
452452
#[case::empty_rule(r#"a = {}"#)]
453453
#[case::self_reference(r#"a = { a }"#)]
454454
#[case::double_rule(r#"a = { "a" }\n a = { "b" }"#)]
455-
fn pest_errors<T: TryPestToElement>(#[case] input: T) -> PestionResult<()> {
455+
fn pest_errors<T: TryPestToElement>(#[case] input: T) -> PestToIonResult<()> {
456456
match input.try_pest_to_element() {
457-
Err(PestionError::Pest(_)) => {}
457+
Err(PestToIonError::Pest(_)) => {}
458458
something => {
459459
unreachable!("Got result we did not expect: {:?}", something);
460460
}

pestion/src/result.rs renamed to pest-ion/src/result.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
use thiserror::Error;
66

77
/// Main [`Result`] type for Pest to Ion.
8-
pub type PestionResult<T> = Result<T, PestionError>;
8+
pub type PestToIonResult<T> = Result<T, PestToIonError>;
99

1010
/// Error type for problems in this crate.
1111
#[derive(Error, Debug)]
12-
pub enum PestionError {
12+
pub enum PestToIonError {
1313
/// An error working with [`pest_meta`].
1414
#[error("Pest Error: {0}")]
1515
Pest(#[from] pest::error::Error<pest_meta::parser::Rule>),
@@ -19,11 +19,11 @@ pub enum PestionError {
1919
Ion(#[from] ion_rs::result::IonError),
2020

2121
/// General error from this library.
22-
#[error("Pestion Error: {0}")]
22+
#[error("Pest to Ion Error: {0}")]
2323
Invalid(String),
2424
}
2525

2626
/// Convenience function to create a general error result.
27-
pub fn invalid<T, S: Into<String>>(message: S) -> PestionResult<T> {
28-
Err(PestionError::Invalid(message.into()))
27+
pub fn invalid<T, S: Into<String>>(message: S) -> PestToIonResult<T> {
28+
Err(PestToIonError::Invalid(message.into()))
2929
}

0 commit comments

Comments
 (0)