1
2
3
4
5
6
7
8
9
10
11 package org.csveed.token;
12
13
14
15
16 public enum ParseState {
17
18
19 SKIP_LINE(false, false, false, false, true),
20
21
22 SKIP_LINE_FINISHED(false, true, false, false, true),
23
24
25 COMMENT_LINE(false, false, false, false, true),
26
27
28 COMMENT_LINE_FINISHED(false, true, false, false, true),
29
30
31 START_OF_LINE(false, false, false, false, false),
32
33
34 OUTSIDE_BEFORE_FIELD(false, false, false, false, false),
35
36
37 OUTSIDE_AFTER_FIELD(false, false, false, false, false),
38
39
40 INSIDE_FIELD(true, false, false, false, false),
41
42
43 FIRST_CHAR_INSIDE_QUOTED_FIELD(false, false, false, true, false),
44
45
46 INSIDE_QUOTED_FIELD(true, false, false, true, false),
47
48
49 ESCAPING(false, false, false, false, false),
50
51
52 SEPARATOR(false, false, true, false, false),
53
54
55 LINE_FINISHED(false, true, true, false, false),
56
57
58 FINISHED(false, true, true, false, false);
59
60
61 private final boolean tokenize;
62
63
64 private final boolean lineFinished;
65
66
67 private final boolean popToken;
68
69
70 private final boolean upgradeQuoteToEscape;
71
72
73 private final boolean ignore;
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89 ParseState(final boolean tokenize, final boolean lineFinished, final boolean popToken,
90 final boolean upgradeQuoteToEscape, final boolean ignore) {
91 this.tokenize = tokenize;
92 this.lineFinished = lineFinished;
93 this.popToken = popToken;
94 this.upgradeQuoteToEscape = upgradeQuoteToEscape;
95 this.ignore = ignore;
96 }
97
98
99
100
101
102
103 public boolean isTokenize() {
104 return this.tokenize;
105 }
106
107
108
109
110
111
112 public boolean isLineFinished() {
113 return this.lineFinished;
114 }
115
116
117
118
119
120
121 public boolean isPopToken() {
122 return this.popToken;
123 }
124
125
126
127
128
129
130 public boolean isUpgradeQuoteToEscape() {
131 return this.upgradeQuoteToEscape;
132 }
133
134
135
136
137
138
139 public boolean isIgnore() {
140 return this.ignore;
141 }
142
143
144
145
146
147
148 public boolean trim() {
149 return this == INSIDE_FIELD;
150 }
151 }