@@ -3441,7 +3441,7 @@ Character positions (counting the Unicode code points rather than bytes) are rep
34413441`Nat`s. Indexing a `String` by a `String.Pos.Raw` takes constant time, while character positions need to
34423442be translated internally to byte positions, which takes linear time.
34433443
3444- A byte position `p` is *valid* for a string `s` if `0 ≤ p ≤ s.endPos ` and `p` lies on a UTF-8
3444+ A byte position `p` is *valid* for a string `s` if `0 ≤ p ≤ s.rawEndPos ` and `p` lies on a UTF-8
34453445character boundary, see `String.Pos.IsValid`.
34463446
34473447There is another type, `String.ValidPos`, which bundles the validity predicate. Using `String.ValidPos`
@@ -3501,8 +3501,8 @@ def String.utf8ByteSize (s : @& String) : Nat :=
35013501/--
35023502A UTF-8 byte position that points at the end of a string, just after the last character.
35033503
3504- * `"abc".endPos = ⟨3⟩`
3505- * `"L∃∀N".endPos = ⟨8⟩`
3504+ * `"abc".rawEndPos = ⟨3⟩`
3505+ * `"L∃∀N".rawEndPos = ⟨8⟩`
35063506 -/
35073507@[inline] def String.rawEndPos (s : String) : String.Pos.Raw where
35083508 byteIdx := utf8ByteSize s
@@ -4718,7 +4718,7 @@ inductive SourceInfo where
47184718 The `leading` whitespace is inferred after parsing by `Syntax.updateLeading`. This is because the
47194719 “preceding token” is not well-defined during parsing, especially in the presence of backtracking.
47204720 -/
4721- | original (leading : Substring) (pos : String.Pos.Raw) (trailing : Substring) (endPos : String.Pos.Raw)
4721+ | original (leading : Substring) (pos : String.Pos.Raw) (trailing : Substring) (rawEndPos : String.Pos.Raw)
47224722 /--
47234723 Synthetic syntax is syntax that was produced by a metaprogram or by Lean itself (e.g. by a
47244724 quotation). Synthetic syntax is annotated with a source span from the original syntax, which
@@ -4742,7 +4742,7 @@ inductive SourceInfo where
47424742 ```
47434743 In these cases, if the user hovers over `h` they will see information about both binding sites.
47444744 -/
4745- | synthetic (pos : String.Pos.Raw) (endPos : String.Pos.Raw) (canonical := false )
4745+ | synthetic (pos : String.Pos.Raw) (rawEndPos : String.Pos.Raw) (canonical := false )
47464746 /-- A synthesized token without position information. -/
47474747 | protected none
47484748
@@ -4769,9 +4769,9 @@ will also return `none`.
47694769-/
47704770def getTailPos? (info : SourceInfo) (canonicalOnly := false ) : Option String.Pos.Raw :=
47714771 match info, canonicalOnly with
4772- | original (endPos := endPos ) .., _
4773- | synthetic (endPos := endPos ) (canonical := true ) .., _
4774- | synthetic (endPos := endPos ) .., false => some endPos
4772+ | original (rawEndPos := rawEndPos ) .., _
4773+ | synthetic (rawEndPos := rawEndPos ) (canonical := true ) .., _
4774+ | synthetic (rawEndPos := rawEndPos ) .., false => some rawEndPos
47754775 | _, _ => none
47764776
47774777/--
@@ -5152,15 +5152,15 @@ position information.
51525152-/
51535153partial def getTailPos? (stx : Syntax) (canonicalOnly := false ) : Option String.Pos.Raw :=
51545154 match stx, canonicalOnly with
5155- | atom (SourceInfo.original (endPos := pos) ..) .., _
5156- | atom (SourceInfo.synthetic (endPos := pos) (canonical := true ) ..) _, _
5157- | atom (SourceInfo.synthetic (endPos := pos) ..) _, false
5158- | ident (SourceInfo.original (endPos := pos) ..) .., _
5159- | ident (SourceInfo.synthetic (endPos := pos) (canonical := true ) ..) .., _
5160- | ident (SourceInfo.synthetic (endPos := pos) ..) .., false
5161- | node (SourceInfo.original (endPos := pos) ..) .., _
5162- | node (SourceInfo.synthetic (endPos := pos) (canonical := true ) ..) .., _
5163- | node (SourceInfo.synthetic (endPos := pos) ..) .., false => some pos
5155+ | atom (SourceInfo.original (rawEndPos := pos) ..) .., _
5156+ | atom (SourceInfo.synthetic (rawEndPos := pos) (canonical := true ) ..) _, _
5157+ | atom (SourceInfo.synthetic (rawEndPos := pos) ..) _, false
5158+ | ident (SourceInfo.original (rawEndPos := pos) ..) .., _
5159+ | ident (SourceInfo.synthetic (rawEndPos := pos) (canonical := true ) ..) .., _
5160+ | ident (SourceInfo.synthetic (rawEndPos := pos) ..) .., false
5161+ | node (SourceInfo.original (rawEndPos := pos) ..) .., _
5162+ | node (SourceInfo.synthetic (rawEndPos := pos) (canonical := true ) ..) .., _
5163+ | node (SourceInfo.synthetic (rawEndPos := pos) ..) .., false => some pos
51645164 | node _ _ args, _ =>
51655165 let rec loop (i : Nat) : Option String.Pos.Raw :=
51665166 match decide (LT.lt i args.size) with
0 commit comments