Skip to content

Commit 6db9a81

Browse files
authored
Refactors peg module into a directory. (#34)
Moves the Pest derived parser into the `gen` submodule to make it easier to ignore for code coverage. Exports the derived parser to the `peg` module. Moves the PartiQL grammar file into the `peg` module sub-directory. Adds codecov ignore for `peg::gen` which only contains the generated Pest parser. Fixes #29.
1 parent b6fa75b commit 6db9a81

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

.github/codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ coverage:
1212
ignore:
1313
# Ignore the Pest generated code until we have a better way to test
1414
# and target coverage for it
15-
- "partiql-parser/src/peg.rs"
15+
- "partiql-parser/src/peg/gen.rs"

partiql-parser/src/peg/gen.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Copyright Amazon.com, Inc. or its affiliates.
2+
3+
use pest_derive::Parser;
4+
5+
#[derive(Parser)]
6+
#[grammar = "peg/partiql.pest"]
7+
pub(crate) struct PartiQLParser;

partiql-parser/src/peg.rs renamed to partiql-parser/src/peg/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
//! Contains the [Pest](https://pest.rs) defined parser for PartiQL and a wrapper APIs that
44
//! can be exported for users to consume.
55
6+
mod gen;
7+
68
use crate::prelude::*;
79
use crate::result::{illegal_state, syntax_error};
810
use pest::iterators::{Pair, Pairs};
911
use pest::{Parser, RuleType};
10-
use pest_derive::Parser;
1112

12-
#[derive(Parser)]
13-
#[grammar = "partiql.pest"]
14-
pub(crate) struct PartiQLParser;
13+
pub(crate) use gen::PartiQLParser;
14+
pub(crate) use gen::Rule;
1515

1616
/// Extension methods for working with [`Pairs`].
1717
pub(crate) trait PairsExt<'val, R: RuleType> {
File renamed without changes.

0 commit comments

Comments
 (0)