diff options
-rw-r--r-- | shell.go | 25 |
1 files changed, 13 insertions, 12 deletions
@@ -140,20 +140,21 @@ var update = [...][]struct { }, } -var byteClass = map[byte]class{ - ' ': clBreak, - '\t': clBreak, - '\n': clNewline, - '\\': clQuote, - '\'': clSingle, - '"': clDouble, -} - func classOf(b byte) class { - if c, ok := byteClass[b]; ok { - return c + switch b { + case ' ', '\t': + return clBreak + case '\n': + return clNewline + case '\\': + return clQuote + case '\'': + return clSingle + case '"': + return clDouble + default: + return clOther } - return clOther } // A Scanner partitions input from a reader into tokens divided on space, tab, |