File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -10,11 +10,6 @@ pub mod lr;
10
10
#[ cfg( test) ]
11
11
mod test;
12
12
13
- // TODO: we have `lex_source` and `lex_source_recovery` and don't have the same
14
- // structure for PR. Probably we should have a single approach to the inclusion
15
- // and naming of a function which returns both the tokens & errors, and a
16
- // function that returns both.
17
-
18
13
/// Lex PRQL into LR, returning both the LR and any errors encountered
19
14
pub fn lex_source_recovery ( source : & str , source_id : u16 ) -> ( Option < Vec < Token > > , Vec < Error > ) {
20
15
let ( tokens, lex_errors) = lexer ( ) . parse_recovery ( source) ;
Original file line number Diff line number Diff line change @@ -14,13 +14,14 @@ pub(crate) mod stmt;
14
14
mod test;
15
15
mod types;
16
16
17
+ // Note that `parse_source` is in `prqlc` crate, not in `prqlc-parser` crate,
18
+ // because it logs using the logging framework in `prqlc`.
19
+
17
20
pub fn parse_lr_to_pr (
18
21
source : & str ,
19
22
source_id : u16 ,
20
23
lr : Vec < lr:: Token > ,
21
24
) -> ( Option < Vec < pr:: Stmt > > , Vec < Error > ) {
22
- // We don't want comments in the AST (but we do intend to use them as part of
23
- // formatting)
24
25
let stream = prepare_stream ( lr. into_iter ( ) , source, source_id) ;
25
26
let ( pr, parse_errors) = stmt:: source ( ) . parse_recovery ( stream) ;
26
27
Original file line number Diff line number Diff line change @@ -53,6 +53,10 @@ pub fn parse(file_tree: &SourceTree) -> Result<pr::ModuleDef, Errors> {
53
53
}
54
54
55
55
/// Build PR AST from a PRQL query string.
56
+ // We have this function in `prqlc` rather than in `prqlc-parser` crate since
57
+ // our logging is in `prqlc` and we want to log the LR. (We could split the logging
58
+ // out into a separate crate, but it has dependencies on `prqlc` internals and
59
+ // would be an effort)
56
60
pub ( crate ) fn parse_source ( source : & str , source_id : u16 ) -> Result < Vec < pr:: Stmt > , Vec < Error > > {
57
61
let ( tokens, mut errors) = prqlc_parser:: lexer:: lex_source_recovery ( source, source_id) ;
58
62
You can’t perform that action at this time.
0 commit comments