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

update fixes vol 2 #3

Closed
wants to merge 1 commit into from
Closed
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
11 changes: 6 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ resolver = "2"

package.authors = ["Dragoș Tiselice <[email protected]>"]
package.edition = "2021"
package.version = "0.1.0"
package.version = "0.0.0-prealpha0"

[workspace.dependencies]
pest = { path = "./pest" }
pest_meta = { path = "./meta" }
pest_generator = { path = "./generator" }
pest3 = { path = "./pest", package = "pest3" }
pest3_meta = { path = "./meta", package = "pest3_meta" }
pest3_generator = { path = "./generator", package = "pest3_generator" }
unicode-width = { version = "0.1.11" }
pest2 = { version = "2.7.6", package = "pest" }
pest2 = { version = "2.7.8", package = "pest" }
pest2_derive = { version = "2.7.8", package = "pest_derive" }
6 changes: 3 additions & 3 deletions derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "pest_derive"
name = "pest3_derive"

# authors = [] # List authors later :)
version.workspace = true
Expand All @@ -11,8 +11,8 @@ edition.workspace = true
proc-macro = true

[dependencies]
pest_generator.workspace = true
pest3_generator.workspace = true

[dev-dependencies]
pest.workspace = true
pest3.workspace = true
anyhow = "1"
4 changes: 2 additions & 2 deletions derive/examples/reader.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use pest::typed::{PairTree, TypedNode as _};
use pest_derive::Parser;
use pest3::typed::{PairTree, TypedNode as _};
use pest3_derive::Parser;
use std::io::{stdin, BufRead};

#[derive(Parser)]
Expand Down
2 changes: 1 addition & 1 deletion derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ use proc_macro::TokenStream;
)
)]
pub fn derive_typed_parser(input: TokenStream) -> TokenStream {
pest_generator::typed::derive_typed_parser(input.into(), true, true).into()
pest3_generator::typed::derive_typed_parser(input.into(), true, true).into()
}
4 changes: 2 additions & 2 deletions derive/tests/grammar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
//! and modified.
//! Overridden the macro [`parses_to`].

use pest::{
use pest3::{
token::Pair,
typed::{PairTree, TypedNode},
};
use pest_derive::Parser;
use pest3_derive::Parser;

#[derive(Parser)]
#[grammar = "tests/grammar.pest"]
Expand Down
4 changes: 2 additions & 2 deletions derive/tests/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// Grammar rules of a sample JSON parser
#[allow(missing_docs)]
pub mod json {
use pest_derive::Parser;
use pest3_derive::Parser;

/// JSON parser.
#[derive(Parser)]
Expand All @@ -14,7 +14,7 @@ pub mod json {

#[cfg(test)]
mod tests {
use pest::typed::{PairContainer, TypedParser};
use pest3::typed::{PairContainer, TypedParser};

use crate::{json, json::generics::*};
#[test]
Expand Down
4 changes: 2 additions & 2 deletions derive/tests/sample.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(unused_variables)]
use anyhow::Result;
use pest::typed::TypedNode as _;
use pest_derive::Parser;
use pest3::typed::TypedNode as _;
use pest3_derive::Parser;

#[derive(Parser)]
#[grammar = "../meta/tests/pest3sample.pest"]
Expand Down
6 changes: 3 additions & 3 deletions derive/tests/sequence.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use pest::typed::TypedNode;
use pest_derive::Parser;
use pest3::typed::TypedNode;
use pest3_derive::Parser;

#[derive(Parser)]
#[grammar_inline = r#"
Expand All @@ -22,7 +22,7 @@ macro_rules! test {
($name:ident, $input:literal, $($fields:tt)*) => {
mod $name {
use super::rules;
use pest::typed::TypedNode;
use pest3::typed::TypedNode;

#[test]
fn matched() -> anyhow::Result<()> {
Expand Down
4 changes: 2 additions & 2 deletions derive/tests/skip.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(unused_variables)]
use anyhow::Result;
use pest::typed::TypedNode as _;
use pest_derive::Parser;
use pest3::typed::TypedNode as _;
use pest3_derive::Parser;
tomtau marked this conversation as resolved.
Show resolved Hide resolved

#[derive(Parser)]
#[grammar_inline = r#"
Expand Down
6 changes: 3 additions & 3 deletions generator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "pest_generator"
name = "pest3_generator"
version.workspace = true
authors.workspace = true
edition.workspace = true
Expand All @@ -8,8 +8,8 @@ edition.workspace = true
proc-macro2 = "1.0"
quote = "1.0"
syn = "2.0"
pest_meta.workspace = true
pest.workspace = true
pest3_meta.workspace = true
pest3.workspace = true

[dev-dependencies]
lazy_static = { version = "1.4.0" }
2 changes: 1 addition & 1 deletion generator/src/common.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Some common codes that most backends will use.

use pest_meta::{doc::DocComment, parser::ParseRule};
use pest3_meta::{doc::DocComment, parser::ParseRule};
use proc_macro2::{Ident, TokenStream};
use quote::{format_ident, quote};
use std::path::PathBuf;
Expand Down
4 changes: 2 additions & 2 deletions generator/src/typed/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{
types::option_type,
types::pest,
};
use pest_meta::{
use pest3_meta::{
doc::DocComment,
error::rename_meta_rule,
parser::{self, fmt_sep, ParseExpr, ParseNode, ParseRule, PathArgs, Range, Trivia},
Expand Down Expand Up @@ -620,7 +620,7 @@ pub fn derive_typed_parser(
mod tests {
use super::*;
use lazy_static::lazy_static;
use pest_meta::{
use pest3_meta::{
doc::DocComment,
parser::{self, ParseRule},
};
Expand Down
5 changes: 3 additions & 2 deletions generator/src/typed/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use super::{
generator::{ProcessedPathArgs, RuleRef},
output::generics,
};
use pest::unicode::unicode_property_names;
use pest_meta::parser::ParseRule;
use pest3::unicode::unicode_property_names;
use pest3_meta::parser::ParseRule;
use proc_macro2::{Ident, TokenStream};
use quote::{format_ident, quote};
use std::{
Expand Down Expand Up @@ -232,6 +232,7 @@ impl<'g> ModuleSystem<'g> {
("stack", Rc::new(ModuleNode::Collection(pest_stack))),
("unicode", Rc::new(pest_unicode)),
]);
// FIXME: make "pest" paths to refer to pest3 crate for the moment
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheVeryDarkness I tried to quickly rename the crates to pest3*, so that the prototype can later be published on crates.io independently of existing pest crates, but it managed to break generator/derive due to the intermingling with "pest" path imports in the grammar (to be clear, the paths in the grammars should still be "pest::", not "pest3").

Anyway, as you were previously asking about the modules or working on them #2 (comment) , feel free to revert this change or refactor it as you see fit

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, and that's fine. I've been working on that for days but haven't made any commit, so it won't affect me.

let root = ModuleNode::Collection(HashMap::from([(
"pest",
Rc::new(ModuleNode::Collection(pest)),
Expand Down
2 changes: 1 addition & 1 deletion generator/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use quote::quote;

pub fn pest() -> TokenStream {
quote! {
::pest
::pest3
}
}
pub fn _str() -> TokenStream {
Expand Down
Loading