Skip to content

Commit

Permalink
internal: Further restrict visibility of some items
Browse files Browse the repository at this point in the history
Now they're in `mod` they don't even need to be `pub(crate)`
  • Loading branch information
max-sixty committed Jul 14, 2024
1 parent 26fa0ad commit 1a8be91
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
20 changes: 8 additions & 12 deletions prqlc/prqlc-parser/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub(crate) fn prepare_stream(
Stream::from_iter(eoi, tokens)
}

pub(crate) fn ident_part() -> impl Parser<TokenKind, String, Error = PError> + Clone {
fn ident_part() -> impl Parser<TokenKind, String, Error = PError> + Clone {
select! {
TokenKind::Ident(ident) => ident,
TokenKind::Keyword(ident) if &ident == "module" => ident,
Expand All @@ -75,7 +75,7 @@ pub(crate) fn ident_part() -> impl Parser<TokenKind, String, Error = PError> + C
})
}

pub(crate) fn keyword(kw: &'static str) -> impl Parser<TokenKind, (), Error = PError> + Clone {
fn keyword(kw: &'static str) -> impl Parser<TokenKind, (), Error = PError> + Clone {
just(TokenKind::Keyword(kw.to_string())).ignored()
}

Expand All @@ -92,11 +92,11 @@ pub(crate) fn new_line() -> impl Parser<TokenKind, (), Error = PError> + Clone {
.labelled("new line")
}

pub(crate) fn ctrl(char: char) -> impl Parser<TokenKind, (), Error = PError> + Clone {
fn ctrl(char: char) -> impl Parser<TokenKind, (), Error = PError> + Clone {
just(TokenKind::Control(char)).ignored()
}

pub(crate) fn into_stmt((annotations, kind): (Vec<Annotation>, StmtKind), span: Span) -> Stmt {
fn into_stmt((annotations, kind): (Vec<Annotation>, StmtKind), span: Span) -> Stmt {
Stmt {
kind,
span: Some(span),
Expand All @@ -105,7 +105,7 @@ pub(crate) fn into_stmt((annotations, kind): (Vec<Annotation>, StmtKind), span:
}
}

pub(crate) fn doc_comment() -> impl Parser<TokenKind, String, Error = PError> + Clone {
fn doc_comment() -> impl Parser<TokenKind, String, Error = PError> + Clone {
// doc comments must start on a new line, so we enforce a new line (which
// can also be a file start) before the doc comment
//
Expand All @@ -121,9 +121,7 @@ pub(crate) fn doc_comment() -> impl Parser<TokenKind, String, Error = PError> +
.labelled("doc comment")
}

pub(crate) fn with_doc_comment<'a, P, O>(
parser: P,
) -> impl Parser<TokenKind, O, Error = PError> + Clone + 'a
fn with_doc_comment<'a, P, O>(parser: P) -> impl Parser<TokenKind, O, Error = PError> + Clone + 'a
where
P: Parser<TokenKind, O, Error = PError> + Clone + 'a,
O: SupportsDocComment + 'a,
Expand All @@ -138,15 +136,13 @@ where
/// to be added to the result, as long as the result implements `SupportsDocComment`.
///
/// We could manage without it tbh,
pub(crate) trait SupportsDocComment {
trait SupportsDocComment {
fn with_doc_comment(self, doc_comment: Option<String>) -> Self;
}

/// Parse a sequence, allowing commas and new lines between items. Doesn't
/// include the surrounding delimiters.
pub(crate) fn sequence<'a, P, O>(
parser: P,
) -> impl Parser<TokenKind, Vec<O>, Error = PError> + Clone + 'a
fn sequence<'a, P, O>(parser: P) -> impl Parser<TokenKind, Vec<O>, Error = PError> + Clone + 'a
where
P: Parser<TokenKind, O, Error = PError> + Clone + 'a,
O: 'a,
Expand Down
5 changes: 1 addition & 4 deletions prqlc/prqlc-parser/src/parser/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,7 @@ fn var_def() -> impl Parser<TokenKind, StmtKind, Error = PError> + Clone {
value: Some(value),
ty: None,
})
})
// TODO: this isn't really accurate, since a standard `from artists`
// also counts as this; we should change
.labelled("variable definition");
});

let_.or(main_or_into)
}
Expand Down

0 comments on commit 1a8be91

Please sign in to comment.