240127.4 · 0b9a92418f4b39f85888e0704118fed7c2d36fe9
Improved performance by using switch statements instead of maps for state transitions.
reading declarations
Changes to properties.go. All files
@@ -160,10 +160,20 @@ func property(dictionary [][3]int, r rune) int { return propertySearch(dictionary, r)[2] } -// propertyWithGenCat returns the Unicode property value and General Category-// (see constants above) of the given code point.-func propertyWithGenCat(dictionary [][4]int, r rune) (property, generalCategory int) {- entry := propertySearch(dictionary, r)+// propertyLineBreak returns the Unicode property value and General Category+// (see constants above) of the given code point, as listed in the line break+// code points table, while fast tracking ASCII digits and letters.+func propertyLineBreak(r rune) (property, generalCategory int) {+ if r >= 'a' && r <= 'z' {+ return prAL, gcLl+ }+ if r >= 'A' && r <= 'Z' {+ return prAL, gcLu+ }+ if r >= '0' && r <= '9' {+ return prNU, gcNd+ }+ entry := propertySearch(lineBreakCodePoints, r) return entry[2], entry[3] }