Fix literal bytes
This commit is contained in:
parent
e67e2098c2
commit
1b0ed4d4de
@ -378,7 +378,7 @@ let mk_string lexeme region =
|
||||
|
||||
let mk_bytes lexeme region =
|
||||
let norm = Str.(global_replace (regexp "_") "" lexeme) in
|
||||
let value = lexeme, Hex.of_string norm
|
||||
let value = lexeme, `Hex norm
|
||||
in Bytes Region.{region; value}
|
||||
|
||||
let mk_int lexeme region =
|
||||
|
@ -443,7 +443,7 @@ let mk_string lexeme region = String Region.{region; value=lexeme}
|
||||
|
||||
let mk_bytes lexeme region =
|
||||
let norm = Str.(global_replace (regexp "_") "" lexeme) in
|
||||
let value = lexeme, Hex.of_string norm
|
||||
let value = lexeme, `Hex norm
|
||||
in Bytes Region.{region; value}
|
||||
|
||||
type int_err = Non_canonical_zero
|
||||
|
@ -361,7 +361,7 @@ let mk_string lexeme region = String Region.{region; value=lexeme}
|
||||
|
||||
let mk_bytes lexeme region =
|
||||
let norm = Str.(global_replace (regexp "_") "" lexeme) in
|
||||
let value = lexeme, Hex.of_string norm
|
||||
let value = lexeme, `Hex norm
|
||||
in Bytes Region.{region; value}
|
||||
|
||||
let mk_int lexeme region =
|
||||
|
@ -356,7 +356,7 @@ let rec simpl_expression :
|
||||
return @@ e_literal ~loc Literal_unit
|
||||
| EBytes x ->
|
||||
let (x , loc) = r_split x in
|
||||
return @@ e_literal ~loc (Literal_bytes (Bytes.of_string @@ fst x))
|
||||
return @@ e_literal ~loc (Literal_bytes (Hex.to_bytes @@ snd x))
|
||||
| ETuple tpl -> simpl_tuple_expression @@ (npseq_to_list tpl.value)
|
||||
| ERecord r ->
|
||||
let (r , loc) = r_split r in
|
||||
|
@ -326,7 +326,7 @@ let rec simpl_expression (t:Raw.expr) : expr result =
|
||||
return @@ e_literal ~loc Literal_unit
|
||||
| EBytes x ->
|
||||
let (x' , loc) = r_split x in
|
||||
return @@ e_literal ~loc (Literal_bytes (Bytes.of_string @@ fst x'))
|
||||
return @@ e_literal ~loc (Literal_bytes (Hex.to_bytes @@ snd x'))
|
||||
| ETuple tpl ->
|
||||
let (tpl' , loc) = r_split tpl in
|
||||
simpl_tuple_expression ~loc @@ npseq_to_list tpl'.inside
|
||||
|
@ -1,5 +1,5 @@
|
||||
function concat_op (const s : bytes) : bytes is
|
||||
begin skip end with bytes_concat(s , ("7070" : bytes))
|
||||
begin skip end with bytes_concat(s , 0x7070)
|
||||
|
||||
function slice_op (const s : bytes) : bytes is
|
||||
begin skip end with bytes_slice(1n , 2n , s)
|
||||
|
@ -1,5 +1,5 @@
|
||||
let concat_op (s : bytes) : bytes =
|
||||
Bytes.concat s ("7070" : bytes)
|
||||
Bytes.concat s 0x7070
|
||||
|
||||
let slice_op (s : bytes) : bytes =
|
||||
Bytes.slice 1n 2n s
|
||||
|
@ -1,4 +1,4 @@
|
||||
let concat_op = (s: bytes): bytes => Bytes.concat(s, "7070": bytes);
|
||||
let concat_op = (s: bytes): bytes => Bytes.concat(s, 0x7070);
|
||||
|
||||
let slice_op = (s: bytes): bytes => Bytes.slice(1n, 2n, s);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user