package styled-ppx
Type-safe styled components for ReScript and Melange
Install
Dune Dependency
Authors
Maintainers
Sources
styled-ppx-0.56.0.tbz
sha256=f93a08d11849c6010fc3e1c5650d811a14dc60d1f2ea74edb6e2514f12d9f35f
sha512=ad90141c288c368ee60455380706deacc41daffb412e9716c28eadc7aff0360110ca0b953a71b4c58eb6ad33c4dafbc066a9002cc0b17a2fd2dd8a5714f7c668
doc/src/styled-ppx.css-parser/Parser_location.ml.html
Source file Parser_location.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 38 39 40 41 42 43 44 45 46 47
let to_ppxlib_location ?(loc_ghost = false) (start_pos : Lexing.position) (end_pos : Lexing.position) : Ppxlib.location = { loc_start = start_pos; loc_end = end_pos; loc_ghost } let print_location label ({ loc_start; loc_end; _ } : Ppxlib.location) = let loc_start_column = loc_start.pos_cnum - loc_start.pos_bol in let loc_end_column = loc_end.pos_cnum - loc_end.pos_bol in Printf.sprintf "%s start %d %d %d (L:%d c:%d) end %d %d %d (L:%d c:%d)" label loc_start.pos_lnum loc_start.pos_bol loc_start.pos_cnum loc_start.pos_lnum loc_start_column loc_end.pos_lnum loc_end.pos_bol loc_end.pos_cnum loc_end.pos_lnum loc_end_column let intersection (loc1 : Ppxlib.location) (loc2 : Ppxlib.location) : Ppxlib.location = let start_pos = Lexing. { pos_fname = loc1.loc_start.pos_fname; pos_lnum = loc1.loc_start.pos_lnum + loc2.loc_start.pos_lnum - 1; pos_bol = loc1.loc_start.pos_bol + loc2.loc_start.pos_bol; pos_cnum = loc1.loc_start.pos_cnum + loc2.loc_start.pos_cnum; } in let end_pos = Lexing. { pos_fname = loc1.loc_end.pos_fname; pos_lnum = loc1.loc_start.pos_lnum + loc2.loc_end.pos_lnum - 1; pos_bol = loc1.loc_start.pos_bol + loc2.loc_end.pos_bol; pos_cnum = loc1.loc_start.pos_cnum + loc2.loc_end.pos_cnum; } in { Ppxlib.Location.loc_start = start_pos; loc_end = end_pos; loc_ghost = false; } let update_loc_with_delimiter (loc : Ppxlib.location) delimiter : Ppxlib.location = let offset = match delimiter with None -> 0 | Some s -> String.length s + 1 in let loc_start = { loc.loc_start with pos_cnum = loc.loc_start.pos_cnum + offset } and loc_end = { loc.loc_end with pos_cnum = loc.loc_end.pos_cnum + offset } in { loc_start; loc_end; loc_ghost = false }
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>