Traverse a string to determine the position of a vl-location-p.
(vl-string-findloc x loc) → offset
Function:
(defun vl-string-findloc (x loc) (declare (xargs :guard (and (stringp x) (vl-location-p loc)))) (let ((__function__ 'vl-string-findloc)) (declare (ignorable __function__)) (b* ((xl (length (string-fix x))) (tline (vl-location->line loc)) (tcol (vl-location->col loc))) (vl-string-findloc-aux x 0 xl 1 0 tline tcol))))
Theorem:
(defthm maybe-natp-of-vl-string-findloc (b* ((offset (vl-string-findloc x loc))) (maybe-natp offset)) :rule-classes :type-prescription)
Theorem:
(defthm bounds-of-vl-string-findloc (and (<= 0 (vl-string-findloc x loc)) (<= (vl-string-findloc x loc) (len (explode x)))) :rule-classes :linear)