Browse Source

опция NoNum

kpmy 9 years ago
parent
commit
006692d303
1 changed files with 6 additions and 1 deletions
  1. 6 1
      sc.go

+ 6 - 1
sc.go

@@ -51,6 +51,7 @@ type Opts struct {
 	Skip func(r rune) bool
 	Skip func(r rune) bool
 
 
 	NoStrings bool
 	NoStrings bool
+	NoNum     bool
 }
 }
 
 
 type Scanner interface {
 type Scanner interface {
@@ -378,7 +379,11 @@ func (s *sc) get() (sym Symbol) {
 			sym.Code, _ = s.opts.SpaceMap[sym.Value]
 			sym.Code, _ = s.opts.SpaceMap[sym.Value]
 			s.next()
 			s.next()
 		case unicode.IsDigit(s.ch):
 		case unicode.IsDigit(s.ch):
-			sym = s.num()
+			if !s.opts.NoNum {
+				sym = s.num()
+			} else {
+				justRune()
+			}
 		default:
 		default:
 			justRune()
 			justRune()
 		}
 		}