-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change Lexing/Parsing of embedded docs to not eagerly validate #507
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev-ion-doc #507 +/- ##
===============================================
+ Coverage 80.84% 80.86% +0.01%
===============================================
Files 80 80
Lines 19398 19401 +3
Branches 19398 19401 +3
===============================================
+ Hits 15683 15689 +6
- Misses 3291 3293 +2
+ Partials 424 419 -5 ☔ View full report in Codecov by Sentry. |
Conformance comparison report
Number passing in both: 5732 Number failing in both: 611 Number passing in Base (3f9d17f) but now fail: 0 Number failing in Base (3f9d17f) but now pass: 0 |
e72d63b
to
6f4edd2
Compare
6f4edd2
to
6ae75a7
Compare
partiql-ast/src/pretty.rs
Outdated
@@ -394,7 +394,7 @@ impl PrettyDoc for Lit { | |||
Lit::FloatLit(inner) => arena.text(inner.to_string()), | |||
Lit::DoubleLit(inner) => arena.text(inner.to_string()), | |||
Lit::BoolLit(inner) => arena.text(inner.to_string()), | |||
Lit::IonStringLit(inner) => inner.pretty_doc(arena), | |||
Lit::EmbeddedDocLit(inner) => inner.pretty_doc(arena), // TODO better pretty for embedded doc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Work is needed to do type-specific pretty printing for embedded documents.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added #508
@@ -1978,6 +1978,7 @@ fn lit_to_value(lit: &Lit) -> Result<Value, AstTransformError> { | |||
Ok(val) | |||
} | |||
|
|||
// TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be moved/removed in a future PR as part of this dev-ion-doc
feature branch.
@@ -46,7 +46,7 @@ time = { version = "0.3", features = ["macros"] } | |||
criterion = "0.5" | |||
rand = "0.8" | |||
|
|||
assert_matches = "1.5" | |||
assert_matches = "1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to double-check: Do we want to move from 1.5
to 1
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's what all other crates use:
13:50❯ rg assert_matches -g "*.toml"
partiql-eval/Cargo.toml
35:assert_matches = "1"
partiql/Cargo.toml
49:assert_matches = "1"
partiql-logical-planner/Cargo.toml
42:assert_matches = "1"
partiql-parser/Cargo.toml
50:assert_matches = "1"
Co-authored-by: Arash Maymandi <[email protected]>
LineAndColumn::from(offset_tracker.at(query, BytePosition::from(1)).unwrap()), | ||
LineAndColumn::new(1, 2).unwrap() | ||
); | ||
// ion is not eagerly parsed, so unterminated ion does not cause a lex/parse error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When will an error be thrown for the unterminated Ion string? Probably when the contents of the document is later used?
This changes the lexer and parser to pass through strings enclosed in backticks un-parsed. (At current, these documents are parsed during lowering). Since embedded documents may themselves contain backticks, beginning and ending delimiters consist of an arbitrary odd numbers of backticks (e.g., `` ` ``, `` ``` ``, `` ````` `` etc.) that must be paired (e.g., `` `$ion_data_here::[]` ``, `` ```$ion_data_here::[ $string_with_embedded_backtick:"`" ]``` ``, etc.). As opening and closing delimiters are required to be odd in count of backticks, a contiguous string of backticks that is even is interpreted as an empty document.
This changes the lexer and parser to pass through strings enclosed in backticks un-parsed. (At current, these documents are parsed during lowering). Since embedded documents may themselves contain backticks, beginning and ending delimiters consist of an arbitrary odd numbers of backticks (e.g., `` ` ``, `` ``` ``, `` ````` `` etc.) that must be paired (e.g., `` `$ion_data_here::[]` ``, `` ```$ion_data_here::[ $string_with_embedded_backtick:"`" ]``` ``, etc.). As opening and closing delimiters are required to be odd in count of backticks, a contiguous string of backticks that is even is interpreted as an empty document.
* Change Lexing/Parsing of embedded docs to not eagerly validate (#507) This changes the lexer and parser to pass through strings enclosed in backticks un-parsed. (At current, these documents are parsed during lowering). Since embedded documents may themselves contain backticks, beginning and ending delimiters consist of an arbitrary odd numbers of backticks (e.g., `` ` ``, `` ``` ``, `` ````` `` etc.) that must be paired (e.g., `` `$ion_data_here::[]` ``, `` ```$ion_data_here::[ $string_with_embedded_backtick:"`" ]``` ``, etc.). As opening and closing delimiters are required to be odd in count of backticks, a contiguous string of backticks that is even is interpreted as an empty document. * Behavior-preserving refactor of `Value` into a module. (#509) * Behavior-preserving refactor of Value into a module. (#510) * Change modeling of Literals in the AST remove ambiguity (#517) Change parsing and AST-modeling of literals to not share AST structures with non-scalar expressions. * Change modeling of boxed ion literals to be lazy until evaluator. (#519) Changes the logical plan to have a distinct `Lit` type to hold literals instead of embedded `Value` * Refactor lifetimes for new rust warnings
This changes the lexer and parser to pass through strings enclosed in backticks un-parsed. (At current, these documents are parsed during lowering).
Since embedded documents may themselves contain backticks, beginning and ending delimiters consist of an arbitrary odd numbers of backticks (e.g.,
`
,```
,`````
etc.) that must be paired (e.g.,`$ion_data_here::[]`
,```$ion_data_here::[ $string_with_embedded_backtick:"`" ]```
, etc.).As opening and closing delimiters are required to be odd in count of backticks, a contiguous string of backticks that is even is interpreted as an empty document.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.