File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -1210,10 +1210,16 @@ def getHexNumVal (s : Syntax.HexNum) : Nat :=
12101210 isHexNum? s.raw |>.getD 0
12111211
12121212/-- Returns the number of hexadecimal digits. -/
1213- def getHexNumSize (s : Syntax.HexNum) : Nat :=
1213+ partial def getHexNumSize (s : Syntax.HexNum) : Nat :=
12141214 match Syntax.isLit? hexnumKind s.raw with
1215- | some val => val.utf8ByteSize
1215+ | some val => go val 0 0
12161216 | _ => 0
1217+ where
1218+ go (s : String) (p : String.Pos.Raw) (n : Nat) : Nat :=
1219+ if String.Internal.atEnd s p then
1220+ n
1221+ else
1222+ go s (String.Internal.next s p) (if String.Internal.get s p = '_' then n else n + 1 )
12171223
12181224/--
12191225Extracts the parsed name from the syntax of an identifier.
Original file line number Diff line number Diff line change @@ -22,3 +22,7 @@ macro_rules
2222/-- info: (3, 10) : Nat × Nat -/
2323#guard_msgs in
2424#check #00a
25+
26+ /-- info: (8, 65536) : Nat × Nat -/
27+ #guard_msgs in
28+ #check #0001_0000
You can’t perform that action at this time.
0 commit comments