Skip to content

Commit 8d11048

Browse files
committed
Remove support for crate visibility modifier
Dropped in rustc: rust-lang/rust#53120 (comment)
1 parent 400acf6 commit 8d11048

File tree

4 files changed

+68
-107
lines changed

4 files changed

+68
-107
lines changed

Cargo.lock

+33-30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

benches/expr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#![feature(test, crate_visibility_modifier)]
1+
#![feature(test)]
22
extern crate peg;
33

44
extern crate test;
55

66
use test::Bencher;
77

88
peg::parser!(grammar parser() for str {
9-
crate rule expr() = eq()
9+
pub(crate) rule expr() = eq()
1010

1111
#[cache]
1212
rule eq() = additive() "=" eq() / additive()

peg-macros/grammar.rs

+31-73
Original file line numberDiff line numberDiff line change
@@ -970,54 +970,31 @@ pub mod peg {
970970
#![allow(non_snake_case, unused, clippy::redundant_closure_call)]
971971
match {
972972
let str_start = __pos;
973-
match {
974-
let __choice_res =
975-
match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "pub") {
976-
::peg::RuleResult::Matched(__pos, __val) => {
977-
let __seq_res = match match __parse_PAREN_GROUP(
978-
__input,
979-
__state,
980-
__err_state,
981-
__pos,
982-
) {
983-
::peg::RuleResult::Matched(pos, _) => {
984-
::peg::RuleResult::Matched(pos, ())
985-
}
986-
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
987-
} {
988-
::peg::RuleResult::Matched(__newpos, _) => {
989-
::peg::RuleResult::Matched(__newpos, ())
990-
}
991-
::peg::RuleResult::Failed => ::peg::RuleResult::Matched(__pos, ()),
992-
};
993-
match __seq_res {
994-
::peg::RuleResult::Matched(__pos, _) => {
995-
::peg::RuleResult::Matched(__pos, ())
996-
}
997-
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
998-
}
999-
}
1000-
::peg::RuleResult::Failed => {
1001-
__err_state.mark_failure(__pos, "\"pub\"");
1002-
::peg::RuleResult::Failed
1003-
}
1004-
};
1005-
match __choice_res {
1006-
::peg::RuleResult::Matched(__pos, __value) => {
1007-
::peg::RuleResult::Matched(__pos, __value)
1008-
}
1009-
::peg::RuleResult::Failed => {
1010-
match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "crate") {
1011-
::peg::RuleResult::Matched(__pos, __val) => {
1012-
::peg::RuleResult::Matched(__pos, __val)
973+
match match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "pub") {
974+
::peg::RuleResult::Matched(__pos, __val) => {
975+
let __seq_res =
976+
match match __parse_PAREN_GROUP(__input, __state, __err_state, __pos) {
977+
::peg::RuleResult::Matched(pos, _) => {
978+
::peg::RuleResult::Matched(pos, ())
1013979
}
1014-
::peg::RuleResult::Failed => {
1015-
__err_state.mark_failure(__pos, "\"crate\"");
1016-
::peg::RuleResult::Failed
980+
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
981+
} {
982+
::peg::RuleResult::Matched(__newpos, _) => {
983+
::peg::RuleResult::Matched(__newpos, ())
1017984
}
985+
::peg::RuleResult::Failed => ::peg::RuleResult::Matched(__pos, ()),
986+
};
987+
match __seq_res {
988+
::peg::RuleResult::Matched(__pos, _) => {
989+
::peg::RuleResult::Matched(__pos, ())
1018990
}
991+
::peg::RuleResult::Failed => ::peg::RuleResult::Failed,
1019992
}
1020993
}
994+
::peg::RuleResult::Failed => {
995+
__err_state.mark_failure(__pos, "\"pub\"");
996+
::peg::RuleResult::Failed
997+
}
1021998
} {
1022999
::peg::RuleResult::Matched(__newpos, _) => ::peg::RuleResult::Matched(
10231000
__newpos,
@@ -3172,12 +3149,12 @@ pub mod peg {
31723149
}
31733150
::peg::RuleResult::Failed => {
31743151
let __choice_res =
3175-
match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "crate") {
3152+
match ::peg::ParseLiteral::parse_string_literal(__input, __pos, "rule") {
31763153
::peg::RuleResult::Matched(__pos, __val) => {
31773154
::peg::RuleResult::Matched(__pos, __val)
31783155
}
31793156
::peg::RuleResult::Failed => {
3180-
__err_state.mark_failure(__pos, "\"crate\"");
3157+
__err_state.mark_failure(__pos, "\"rule\"");
31813158
::peg::RuleResult::Failed
31823159
}
31833160
};
@@ -3187,13 +3164,13 @@ pub mod peg {
31873164
}
31883165
::peg::RuleResult::Failed => {
31893166
let __choice_res = match ::peg::ParseLiteral::parse_string_literal(
3190-
__input, __pos, "rule",
3167+
__input, __pos, "use",
31913168
) {
31923169
::peg::RuleResult::Matched(__pos, __val) => {
31933170
::peg::RuleResult::Matched(__pos, __val)
31943171
}
31953172
::peg::RuleResult::Failed => {
3196-
__err_state.mark_failure(__pos, "\"rule\"");
3173+
__err_state.mark_failure(__pos, "\"use\"");
31973174
::peg::RuleResult::Failed
31983175
}
31993176
};
@@ -3202,34 +3179,15 @@ pub mod peg {
32023179
::peg::RuleResult::Matched(__pos, __value)
32033180
}
32043181
::peg::RuleResult::Failed => {
3205-
let __choice_res =
3206-
match ::peg::ParseLiteral::parse_string_literal(
3207-
__input, __pos, "use",
3208-
) {
3209-
::peg::RuleResult::Matched(__pos, __val) => {
3210-
::peg::RuleResult::Matched(__pos, __val)
3211-
}
3212-
::peg::RuleResult::Failed => {
3213-
__err_state.mark_failure(__pos, "\"use\"");
3214-
::peg::RuleResult::Failed
3215-
}
3216-
};
3217-
match __choice_res {
3218-
::peg::RuleResult::Matched(__pos, __value) => {
3219-
::peg::RuleResult::Matched(__pos, __value)
3182+
match ::peg::ParseLiteral::parse_string_literal(
3183+
__input, __pos, "type",
3184+
) {
3185+
::peg::RuleResult::Matched(__pos, __val) => {
3186+
::peg::RuleResult::Matched(__pos, __val)
32203187
}
32213188
::peg::RuleResult::Failed => {
3222-
match ::peg::ParseLiteral::parse_string_literal(
3223-
__input, __pos, "type",
3224-
) {
3225-
::peg::RuleResult::Matched(__pos, __val) => {
3226-
::peg::RuleResult::Matched(__pos, __val)
3227-
}
3228-
::peg::RuleResult::Failed => {
3229-
__err_state.mark_failure(__pos, "\"type\"");
3230-
::peg::RuleResult::Failed
3231-
}
3232-
}
3189+
__err_state.mark_failure(__pos, "\"type\"");
3190+
::peg::RuleResult::Failed
32333191
}
32343192
}
32353193
}

peg-macros/grammar.rustpeg

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ rule item() -> Item
4343

4444
rule rust_doc_comment() -> Option<TokenStream> = $(("#" "[" "doc" "=" LITERAL() "]")*)?
4545

46-
rule rust_visibility() -> Option<TokenStream> = $("pub" PAREN_GROUP()? / "crate")?
46+
rule rust_visibility() -> Option<TokenStream> = $("pub" PAREN_GROUP()?)?
4747

4848
rule rust_use() -> TokenStream
4949
= v:$("use" rust_path() (
@@ -147,7 +147,7 @@ rule precedence_op() -> PrecedenceOperator
147147
{ PrecedenceOperator{ span, elements, action } }
148148

149149
rule sp() -> Span = ##next_span()
150-
rule KEYWORD() = "pub" / "crate" / "rule" / "use" / "type"
150+
rule KEYWORD() = "pub" / "rule" / "use" / "type"
151151
rule IDENT() -> Ident = !KEYWORD() i:##ident() {i}
152152
rule LITERAL() -> Literal = ##literal()
153153
rule PAREN_GROUP() -> Group = ##group(Delimiter::Parenthesis)

0 commit comments

Comments
 (0)