Fix printing of bytes in parsers/lexers

This commit is contained in:
Tom Jack 2020-01-09 16:51:23 -06:00
parent 1b0ed4d4de
commit 5cef850bdd
5 changed files with 7 additions and 7 deletions

View File

@ -145,7 +145,7 @@ let proj_token = function
| Bytes Region.{region; value = s,b} ->
region,
sprintf "Bytes (\"%s\", \"0x%s\")"
s (Hex.to_string b)
s (Hex.show b)
| Begin region -> region, "Begin"
| Else region -> region, "Else"
| End region -> region, "End"

View File

@ -105,7 +105,7 @@ let print_bytes state {region; value} =
let line =
sprintf "%s: Bytes (\"%s\", \"0x%s\")\n"
(compact state region) lexeme
(Hex.to_string abstract)
(Hex.show abstract)
in Buffer.add_string state#buffer line
let print_int state {region; value} =
@ -712,7 +712,7 @@ and pp_ne_injection :
and pp_bytes state {value=lexeme,hex; region} =
pp_loc_node (state#pad 2 0) lexeme region;
pp_node (state#pad 2 1) (Hex.to_string hex)
pp_node (state#pad 2 1) (Hex.show hex)
and pp_int state {value=lexeme,z; region} =
pp_loc_node (state#pad 2 0) lexeme region;

View File

@ -126,7 +126,7 @@ let proj_token = function
| Bytes Region.{region; value = s,b} ->
region,
sprintf "Bytes (\"%s\", \"0x%s\")"
s (Hex.to_string b)
s (Hex.show b)
| Int Region.{region; value = s,n} ->
region, sprintf "Int (\"%s\", %s)" s (Z.to_string n)

View File

@ -90,7 +90,7 @@ let print_bytes state {region; value} =
let line =
sprintf "%s: Bytes (\"%s\", \"0x%s\")\n"
(compact state region) lexeme
(Hex.to_string abstract)
(Hex.show abstract)
in Buffer.add_string state#buffer line
let print_int state {region; value} =
@ -1093,7 +1093,7 @@ and pp_pattern state = function
and pp_bytes state {value=lexeme,hex; region} =
pp_loc_node (state#pad 2 0) lexeme region;
pp_node (state#pad 2 1) (Hex.to_string hex)
pp_node (state#pad 2 1) (Hex.show hex)
and pp_int state {value=lexeme,z; region} =
pp_loc_node (state#pad 2 0) lexeme region;

View File

@ -140,7 +140,7 @@ let proj_token = function
| Bytes Region.{region; value = s,b} ->
region,
sprintf "Bytes (\"%s\", \"0x%s\")"
s (Hex.to_string b)
s (Hex.show b)
| Else region -> region, "Else"
| False region -> region, "False"
| If region -> region, "If"