-
Notifications
You must be signed in to change notification settings - Fork 403
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
Fix multi line formatting #10780
base: main
Are you sure you want to change the base?
Fix multi line formatting #10780
Conversation
9192d46
to
8862885
Compare
Signed-off-by: Max Große <[email protected]>
Signed-off-by: Max Große <[email protected]>
Signed-off-by: Max Große <[email protected]>
Signed-off-by: Max Große <[email protected]>
Signed-off-by: Max Große <[email protected]>
Signed-off-by: Max Große <[email protected]>
Signed-off-by: Max Große <[email protected]>
Signed-off-by: Max Große <[email protected]>
Signed-off-by: Max Große <[email protected]>
Signed-off-by: Max Große <[email protected]>
5fefd7f
to
e7024d4
Compare
Signed-off-by: Max Große <[email protected]>
46bcf1c
to
2cb7891
Compare
@@ -5,6 +5,7 @@ open Stdune | |||
type t = | |||
| Atom of Loc.t * Atom.t | |||
| Quoted_string of Loc.t * string | |||
| Block_string of Loc.t * string |
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.
Is it possible to introduce the Block_string only in the CST?
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.
Not without further work: Dune_sexp.parse
parses all values into a list of Encoded.t
which are actually Ast.t
values and turns those back into Cst.t
. So if we don't have a Block_string
in the AST we lose precision so to speak, because we would turn a Cst.Block_string
into a Ast.Quoted_string
and then we can no longer know if it's really a Quoted_string
or a Block_string
.
Maybe we could somehow adjust the parsing function and add an option to directly return it as Cst.t
values.
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.
Why not change string
by a richer abstract type that would remember whether it came from a quoted string or a blocked string, as well as having a to_string
to get the underlying string. The type could also include the Loc.t
.
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.
I really like this idea and will probably implement it like this, but there is more work to be done for block strings that are also templates.
No description provided.