aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shell.go25
1 files changed, 13 insertions, 12 deletions
diff --git a/shell.go b/shell.go
index e244d10..bfb6f8c 100644
--- a/shell.go
+++ b/shell.go
@@ -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,