package sexp
S-expression swiss knife
Install
Dune Dependency
Authors
Maintainers
Sources
sexp-v0.15.0.tar.gz
sha256=7c0bc2f04bf7abda23ccf02ce10cf90cd9e60124736ffa6501388693f2f30ac0
doc/src/sexp.sexp_app_pattern/parser.ml.html
Source file parser.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
open Core module Pos = struct type t = { linenum : int ; charnum : int ; line : string option } [@@deriving sexp] let create code lexbuf = let pos = Lexing.lexeme_start_p lexbuf in let lines = String.split code ~on:'\n' in { linenum = pos.Lexing.pos_lnum ; charnum = pos.Lexing.pos_cnum - pos.Lexing.pos_bol ; line = List.nth lines (pos.Lexing.pos_lnum - 1) } ;; let location_str t = sprintf "line %d char %d" t.linenum t.charnum let line t = Option.value t.line ~default:"" end let parse_exn str = let lexbuf = Lexing.from_string str in let query = try Internal_parser.parse Lexer.next_token lexbuf with | Parsing.Parse_error -> let pos = Pos.create str lexbuf in failwithf "Parsing match query failed at %s in query %s" (Pos.location_str pos) (Pos.line pos) () | exn -> let pos = Pos.create str lexbuf in Exn.reraisef exn "Parsing match query failed at %s in query %s" (Pos.location_str pos) (Pos.line pos) () in query ;;
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>