package stdint-literals
Small PPX for fixed size integer literals
Install
Dune Dependency
Authors
Maintainers
Sources
1.0.tar.gz
md5=acbbd5654b6d4af1c1d575ba150fab58
sha512=2dc61cbfef677e669b6169efc483d76a7ca75f013ed02b8b194a4b30681306d4788a153b86e2d0ea725881840426c278c8949dfba752f612152c9d87e9a90565
doc/src/stdint_literals/stdint_literals.ml.html
Source file stdint_literals.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
open Ppxlib let rewriter kind loc s = let number = Ast_builder.Default.pexp_constant ~loc (Parsetree.Pconst_integer (s, None)) in [%expr [%e (kind loc)] [%e number]] module Converter = struct let u8 loc = [%expr Stdint.Uint8.of_int] let u16 loc = [%expr Stdint.Uint16.of_int] let u32 loc = [%expr Stdint.Uint32.of_int] let u64 loc = [%expr Stdint.Uint64.of_int] let u128 loc = [%expr Stdint.Uint128.of_int] let s8 loc = [%expr Stdint.Int8.of_int] let s16 loc = [%expr Stdint.Int16.of_int] let s128 loc = [%expr Stdint.Int128.of_int] end module Rule = struct let patterns = Converter.[ ('u', u8); ('U', u16); ('i', u32); ('I', u64); ('w', u128); ('s', s8); ('S', s16); ('W', s128) ] let rule_of_pattern (ch, conv) = Ppxlib.Context_free.Rule.(constant Constant_kind.Integer ch (rewriter conv)) let all = List.map rule_of_pattern patterns end let () = Driver.register_transformation ~rules:Rule.all "Constant rewriting"
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>