-
Notifications
You must be signed in to change notification settings - Fork 463
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 char payload #5759
Change char payload #5759
Conversation
@@ -21,7 +21,7 @@ open Lambda | |||
|
|||
let rec struct_const ppf = function | |||
| Const_base(Const_int n) -> fprintf ppf "%i" n | |||
| Const_base(Const_char c) -> fprintf ppf "%C" c | |||
| Const_base(Const_char i) -> fprintf ppf "%C" (Char.unsafe_chr i) | |||
| Const_base(Const_string (s, _)) -> fprintf ppf "%S" s |
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 should be adapted, '%C' may not apply any more
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.
Thank you! I'm fixing this.
@@ -379,7 +379,7 @@ let is_cons = function | |||
|
|||
let pretty_const c = match c with | |||
| Const_int i -> Printf.sprintf "%d" i | |||
| Const_char c -> Printf.sprintf "%C" c | |||
| Const_char i -> Printf.sprintf "%s" (Pprintast.string_of_int_as_char i) | |||
| Const_string (s, _) -> Printf.sprintf "%S" s |
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.
Printast.string_of_int_as_char vs Ext_util.string_of_int_as_char?
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 seems they are the same but shared across two repos
LGTM, this also fixes #5753, you may add a changelog after it landed |
I landed changes in syntax repo, you also need update the submodule in later commits |
* change Pconst_char payload (WIP) * tweak * tweak * representation of char for lambda * lib * bugfix: replace wrong pp * libs * bugfix: replace wrong print * use unsafe_chr to handle possible overflow char * safe print int as char * reduce duplication * (re)use encodeCodepoint to support string_of_int_as_char * some refactor * libs * changelog
* change Pconst_char payload (WIP) * tweak * tweak * representation of char for lambda * lib * bugfix: replace wrong pp * libs * bugfix: replace wrong print * use unsafe_chr to handle possible overflow char * safe print int as char * reduce duplication * (re)use encodeCodepoint to support string_of_int_as_char * some refactor * libs * changelog
This PR changes the payload of
Pconst_char
. Related context: #5750 #5749As I understand, the payload of
char-related types
uses magic starting from parsing to JavaScript dumping.So lots of files were changed.
There are some things I don't quite understand:
The syntax repository and the compiler repository have some modules that are not exactly the same. Which one should we use for synchronization?
Because I modified the payload of
Pconst_char
, I had to modifyparser.mly
in the compiler repository, but I'm not sure if I'm safe to do that.If my practice is on the right track, I will open another PR to submit the remaining part of
syntax
repo.