package p4spectec
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
P4-SpecTec: A mechanization toolchain for the P4 Programming Language
Install
dune-project
Dependency
Authors
Maintainers
Sources
v0.1.2.tar.gz
md5=1a3bc0a385fe1ecf403c019f49aa6de6
sha512=5d20b5821f33e2a3a5419b208606f27c01511994c2b3b1e1cdf4c077056dfd0aa81682af0720e1060ee2bfb0341918fcc4c53159820205a2bc32b725e5c1a714
doc/src/p4spectec.backend_splice/source.ml.html
Source file source.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(* Source file position tracker *) type t = { file : string; s : string; mutable i : int } let eos (src : t) = src.i = String.length src.s let get (src : t) = src.s.[src.i] let str (src : t) (j : int) = String.sub src.s j (src.i - j) let advn (src : t) (i : int) = src.i <- src.i + i let adv (src : t) = advn src 1 let left (src : t) = String.length src.s - src.i let col (src : t) = let j = ref src.i in while !j > 0 && src.s.[!j - 1] <> '\n' do decr j done; src.i - !j let pos (src : t) = let line = ref 1 in let col = ref 1 in for j = 0 to src.i - 1 do if src.s.[j] = '\n' then ( incr line; col := 1) else incr col done; Util.Source.{ file = src.file; line = !line; column = !col } let region src = let pos = pos src in Util.Source.{ left = pos; right = pos }
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>