extra.go 311 B

123456789101112131415161718192021
  1. package scanner
  2. import (
  3. "strings"
  4. "unicode"
  5. )
  6. // extra functions used to hijack the upstream text/scanner
  7. func detectIdent(ch rune) bool {
  8. if unicode.IsLetter(ch) {
  9. return true
  10. }
  11. if unicode.IsDigit(ch) {
  12. return true
  13. }
  14. if strings.ContainsRune("_:/+-@%^.!=", ch) {
  15. return true
  16. }
  17. return false
  18. }