Skip to content

Commit c74d50f

Browse files
committed
wip
1 parent 6830ae3 commit c74d50f

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

rust/cbork-cddl-parser/src/parser.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ pub mod cddl_test {
5252
/// CDDL Standard Postlude - read from an external file
5353
const POSTLUDE: &str = include_str!("grammar/postlude.cddl");
5454

55-
/// Abstract Syntax Tree (AST) representing parsed CDDL syntax.
55+
/// PEST Abstract Syntax Tree (AST) representing parsed CDDL syntax.
5656
#[derive(Debug)]
5757
#[allow(dead_code)]
58-
pub(crate) enum Ast<'a> {
58+
pub(crate) enum PestAst<'a> {
5959
/// Represents the AST for RFC-8610 CDDL rules.
6060
Rfc8610(Pairs<'a, rfc_8610::Rule>),
6161
/// Represents the AST for RFC-9165 CDDL rules.
@@ -82,18 +82,18 @@ pub(crate) enum Ast<'a> {
8282
/// - If there is an issue with parsing the CDDL input.
8383
pub(crate) fn parse_cddl<'a>(
8484
input: &'a mut String, extension: &Extension,
85-
) -> anyhow::Result<Ast<'a>> {
85+
) -> anyhow::Result<PestAst<'a>> {
8686
input.push_str("\n\n");
8787
input.push_str(POSTLUDE);
8888

8989
let ast = match extension {
9090
Extension::RFC8610 => {
91-
rfc_8610::Parser::parse(rfc_8610::Rule::cddl, input).map(Ast::Rfc8610)?
91+
rfc_8610::Parser::parse(rfc_8610::Rule::cddl, input).map(PestAst::Rfc8610)?
9292
},
9393
Extension::RFC9165 => {
94-
rfc_9165::Parser::parse(rfc_9165::Rule::cddl, input).map(Ast::Rfc9165)?
94+
rfc_9165::Parser::parse(rfc_9165::Rule::cddl, input).map(PestAst::Rfc9165)?
9595
},
96-
Extension::CDDL => cddl::Parser::parse(cddl::Rule::cddl, input).map(Ast::Cddl)?,
96+
Extension::CDDL => cddl::Parser::parse(cddl::Rule::cddl, input).map(PestAst::Cddl)?,
9797
};
9898
Ok(ast)
9999
}

rust/cbork-cddl-parser/src/preprocessor/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ use pest::{
1313
RuleType,
1414
};
1515

16-
use crate::parser::{cddl, rfc_8610, rfc_9165, Ast};
16+
use crate::parser::{cddl, rfc_8610, rfc_9165, PestAst};
1717

1818
/// Processes the AST.
19-
pub(crate) fn process_ast(ast: Ast) -> anyhow::Result<()> {
19+
pub(crate) fn process_ast(ast: PestAst) -> anyhow::Result<()> {
2020
match ast {
21-
Ast::Rfc8610(ast) => {
21+
PestAst::Rfc8610(ast) => {
2222
let _exprs = process_root(ast, rfc_8610::Rule::cddl, rfc_8610::Rule::expr)?;
2323
},
24-
Ast::Rfc9165(ast) => {
24+
PestAst::Rfc9165(ast) => {
2525
let _exprs = process_root(ast, rfc_9165::Rule::cddl, rfc_9165::Rule::expr)?;
2626
},
27-
Ast::Cddl(ast) => {
27+
PestAst::Cddl(ast) => {
2828
let exprs = process_root(ast, cddl::Rule::cddl, cddl::Rule::expr)?;
2929

3030
for expr in exprs {

0 commit comments

Comments
 (0)