File tree 1 file changed +12
-10
lines changed
src/main/scala/com/github/tototoshi/csv
1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change 15
15
*/
16
16
package com .github .tototoshi .csv
17
17
18
+ import scala .annotation .switch
19
+
18
20
object CSVParser {
19
21
20
- abstract sealed trait State
21
- case object Start extends State
22
- case object Field extends State
23
- case object Delimiter extends State
24
- case object End extends State
25
- case object QuoteStart extends State
26
- case object QuoteEnd extends State
27
- case object QuotedField extends State
22
+ private type State = Int
23
+ private final val Start = 0
24
+ private final val Field = 1
25
+ private final val Delimiter = 2
26
+ private final val End = 3
27
+ private final val QuoteStart = 4
28
+ private final val QuoteEnd = 5
29
+ private final val QuotedField = 6
28
30
29
31
/**
30
32
* {{{
@@ -45,7 +47,7 @@ object CSVParser {
45
47
46
48
while (state != End && pos < buflen) {
47
49
val c = buf(pos)
48
- state match {
50
+ ( state : @ switch) match {
49
51
case Start => {
50
52
c match {
51
53
case `quoteChar` => {
@@ -244,7 +246,7 @@ object CSVParser {
244
246
}
245
247
}
246
248
}
247
- state match {
249
+ ( state : @ switch) match {
248
250
case Delimiter => {
249
251
fields :+= " "
250
252
Some (fields.toList)
You can’t perform that action at this time.
0 commit comments