Skip to content

Commit

Permalink
Merge pull request #337 from stevefan1999-personal/patch-std-to-core
Browse files Browse the repository at this point in the history
change some std types to core equivalent
  • Loading branch information
kevinmehall authored Apr 6, 2023
2 parents e4440bc + 96ad5e5 commit f62301b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions peg-macros/grammar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ pub mod peg {
type PositionRepr = <Input as ::peg::Parse>::PositionRepr;
#[allow(unused_parens)]
struct ParseState<'input> {
_phantom: ::std::marker::PhantomData<(&'input ())>,
_phantom: ::core::marker::PhantomData<(&'input ())>,
primary_cache: ::std::collections::HashMap<usize, ::peg::RuleResult<SpannedExpr>>,
}
impl<'input> ParseState<'input> {
fn new() -> ParseState<'input> {
ParseState {
_phantom: ::std::marker::PhantomData,
_phantom: ::core::marker::PhantomData,
primary_cache: ::std::collections::HashMap::new(),
}
}
Expand All @@ -23,7 +23,7 @@ pub mod peg {
use proc_macro2::{Delimiter, Group, Ident, Literal, Span, TokenStream};
pub fn peg_grammar<'input>(
__input: &'input Input,
) -> ::std::result::Result<Grammar, ::peg::error::ParseError<PositionRepr>> {
) -> ::core::result::Result<Grammar, ::peg::error::ParseError<PositionRepr>> {
#![allow(non_snake_case, unused)]
let mut __err_state = ::peg::error::ErrorState::new(::peg::Parse::start(__input));
let mut __state = ParseState::new();
Expand Down
6 changes: 3 additions & 3 deletions peg-macros/translate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,14 @@ fn make_parse_state(grammar: &Grammar) -> TokenStream {
quote_spanned! { span =>
#[allow(unused_parens)]
struct ParseState<'input #(, #grammar_lifetime_params)*> {
_phantom: ::std::marker::PhantomData<(&'input () #(, &#grammar_lifetime_params ())*)>,
_phantom: ::core::marker::PhantomData<(&'input () #(, &#grammar_lifetime_params ())*)>,
#(#cache_fields_def),*
}

impl<'input #(, #grammar_lifetime_params)*> ParseState<'input #(, #grammar_lifetime_params)*> {
fn new() -> ParseState<'input #(, #grammar_lifetime_params)*> {
ParseState {
_phantom: ::std::marker::PhantomData,
_phantom: ::core::marker::PhantomData,
#(#cache_fields: ::std::collections::HashMap::new()),*
}
}
Expand Down Expand Up @@ -369,7 +369,7 @@ fn compile_rule_export(context: &Context, rule: &Rule) -> TokenStream {

quote_spanned! { span =>
#doc
#visibility fn #name<'input #(, #grammar_lifetime_params)* #(, #ty_params)*>(__input: #input_ty #extra_args_def #(, #rule_params)*) -> ::std::result::Result<#ret_ty, ::peg::error::ParseError<PositionRepr<#(#grammar_lifetime_params),*>>> {
#visibility fn #name<'input #(, #grammar_lifetime_params)* #(, #ty_params)*>(__input: #input_ty #extra_args_def #(, #rule_params)*) -> ::core::result::Result<#ret_ty, ::peg::error::ParseError<PositionRepr<#(#grammar_lifetime_params),*>>> {
#![allow(non_snake_case, unused)]

let mut __err_state = ::peg::error::ErrorState::new(::peg::Parse::start(__input));
Expand Down

0 comments on commit f62301b

Please sign in to comment.