Skip to content
This repository was archived by the owner on Apr 8, 2024. It is now read-only.

Commit a981182

Browse files
committed
Bump GLL
1 parent ac1799e commit a981182

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ name = "snapshots"
3333
path = "src/bin/snapshots.rs"
3434

3535
[patch.'crates-io']
36-
gll = { git = "https://github.com/cad97/gll", rev = "a6caa18976239f9e259df9b33f9ce6fea8b7df7c" }
37-
grammer = { git = "https://github.com/lykenware/grammer", rev = "e108acbe83271761538bf5b2ff2daeaaafa5919c" }
36+
gll = { git = "https://github.com/rust-lang/gll", rev = "f387326ea8fc48762c31f0dd5adc3d8d227328e4" }
37+
grammer = { git = "https://github.com/lykenware/grammer", rev = "ed4fc4f9be9aa2c1a6c3245ba4e91684ddff5f2f" }

build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ fn main() {
2727
println!("cargo:rerun-if-changed={}", path.display());
2828

2929
let src = fs::read_to_string(&path).unwrap();
30-
let fragment: gll::proc_macro::Grammar = src.parse().unwrap();
31-
grammar.extend(fragment.0);
30+
let fragment = gll::parse_grammar(src.parse().unwrap()).unwrap();
31+
grammar.extend(fragment);
3232
}
3333

3434
// Generate a Rust parser from the combined grammar and write it out.

src/bin/coverage.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ use std::{
99
};
1010

1111
use derive_more::Add;
12-
use gll::runtime::{MoreThanOne, ParseNodeKind, ParseNodeShape};
12+
use gll::{
13+
forest::{MoreThanOne, GrammarReflector},
14+
parse_node::ParseNodeShape,
15+
};
1316
use rayon::prelude::*;
1417
use rust_grammar::parse;
1518
use serde::{Deserialize, Serialize};
@@ -78,7 +81,7 @@ type ModuleContentsHandle = parse::OwnedHandle<
7881

7982
enum Error<A> {
8083
Lex(proc_macro2::LexError),
81-
Parse(gll::runtime::ParseError<A>),
84+
Parse(gll::parser::ParseError<A>),
8285
}
8386

8487
impl<A> From<proc_macro2::LexError> for Error<A> {
@@ -87,8 +90,8 @@ impl<A> From<proc_macro2::LexError> for Error<A> {
8790
}
8891
}
8992

90-
impl<A> From<gll::runtime::ParseError<A>> for Error<A> {
91-
fn from(error: gll::runtime::ParseError<A>) -> Self {
93+
impl<A> From<gll::parser::ParseError<A>> for Error<A> {
94+
fn from(error: gll::parser::ParseError<A>) -> Self {
9295
Error::Parse(error)
9396
}
9497
}
@@ -159,11 +162,11 @@ fn ambiguity_check(handle: &ModuleContentsHandle) -> Result<(), MoreThanOne> {
159162
}
160163
}
161164
};
162-
match source.kind.shape() {
165+
match forest.grammar.parse_node_shape(source.kind) {
163166
ParseNodeShape::Opaque => {}
164-
ParseNodeShape::Alias(_) => add_children(&[source.unpack_alias()]),
167+
ParseNodeShape::Alias(_) => add_children(&[forest.unpack_alias(source)]),
165168
ParseNodeShape::Opt(_) => {
166-
if let Some(child) = source.unpack_opt() {
169+
if let Some(child) = forest.unpack_opt(source) {
167170
add_children(&[child]);
168171
}
169172
}

src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#[allow(
2-
unused_imports,
32
non_camel_case_types,
4-
clippy::redundant_closure_call,
5-
clippy::type_complexity,
3+
unused_imports,
64
clippy::cognitive_complexity,
7-
clippy::large_enum_variant
5+
clippy::large_enum_variant,
6+
clippy::needless_lifetimes,
7+
clippy::redundant_closure_call,
8+
clippy::type_complexity
89
)]
910
pub mod parse {
1011
include!(concat!(env!("OUT_DIR"), "/parse.rs"));

0 commit comments

Comments
 (0)