52938
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2018, the original author or authors.
|
|
3 |
*
|
|
4 |
* This software is distributable under the BSD license. See the terms of the
|
|
5 |
* BSD license in the documentation provided with this software.
|
|
6 |
*
|
58903
|
7 |
* https://opensource.org/licenses/BSD-3-Clause
|
52938
|
8 |
*/
|
|
9 |
package jdk.internal.org.jline.reader.impl;
|
|
10 |
|
|
11 |
import java.util.*;
|
|
12 |
import java.util.function.Predicate;
|
|
13 |
|
|
14 |
import jdk.internal.org.jline.reader.CompletingParsedLine;
|
|
15 |
import jdk.internal.org.jline.reader.EOFError;
|
|
16 |
import jdk.internal.org.jline.reader.ParsedLine;
|
|
17 |
import jdk.internal.org.jline.reader.Parser;
|
|
18 |
|
|
19 |
public class DefaultParser implements Parser {
|
|
20 |
|
58903
|
21 |
public enum Bracket {
|
|
22 |
ROUND, // ()
|
|
23 |
CURLY, // {}
|
|
24 |
SQUARE, // []
|
|
25 |
ANGLE; // <>
|
|
26 |
}
|
|
27 |
|
52938
|
28 |
private char[] quoteChars = {'\'', '"'};
|
|
29 |
|
|
30 |
private char[] escapeChars = {'\\'};
|
|
31 |
|
|
32 |
private boolean eofOnUnclosedQuote;
|
|
33 |
|
|
34 |
private boolean eofOnEscapedNewLine;
|
|
35 |
|
58903
|
36 |
private char[] openingBrackets = null;
|
|
37 |
|
|
38 |
private char[] closingBrackets = null;
|
|
39 |
|
52938
|
40 |
//
|
|
41 |
// Chainable setters
|
|
42 |
//
|
|
43 |
|
|
44 |
public DefaultParser quoteChars(final char[] chars) {
|
|
45 |
this.quoteChars = chars;
|
|
46 |
return this;
|
|
47 |
}
|
|
48 |
|
|
49 |
public DefaultParser escapeChars(final char[] chars) {
|
|
50 |
this.escapeChars = chars;
|
|
51 |
return this;
|
|
52 |
}
|
|
53 |
|
|
54 |
public DefaultParser eofOnUnclosedQuote(boolean eofOnUnclosedQuote) {
|
|
55 |
this.eofOnUnclosedQuote = eofOnUnclosedQuote;
|
|
56 |
return this;
|
|
57 |
}
|
|
58 |
|
58903
|
59 |
public DefaultParser eofOnUnclosedBracket(Bracket... brackets){
|
|
60 |
setEofOnUnclosedBracket(brackets);
|
|
61 |
return this;
|
|
62 |
}
|
|
63 |
|
52938
|
64 |
public DefaultParser eofOnEscapedNewLine(boolean eofOnEscapedNewLine) {
|
|
65 |
this.eofOnEscapedNewLine = eofOnEscapedNewLine;
|
|
66 |
return this;
|
|
67 |
}
|
|
68 |
|
|
69 |
//
|
|
70 |
// Java bean getters and setters
|
|
71 |
//
|
|
72 |
|
|
73 |
public void setQuoteChars(final char[] chars) {
|
|
74 |
this.quoteChars = chars;
|
|
75 |
}
|
|
76 |
|
|
77 |
public char[] getQuoteChars() {
|
|
78 |
return this.quoteChars;
|
|
79 |
}
|
|
80 |
|
|
81 |
public void setEscapeChars(final char[] chars) {
|
|
82 |
this.escapeChars = chars;
|
|
83 |
}
|
|
84 |
|
|
85 |
public char[] getEscapeChars() {
|
|
86 |
return this.escapeChars;
|
|
87 |
}
|
|
88 |
|
|
89 |
public void setEofOnUnclosedQuote(boolean eofOnUnclosedQuote) {
|
|
90 |
this.eofOnUnclosedQuote = eofOnUnclosedQuote;
|
|
91 |
}
|
|
92 |
|
|
93 |
public boolean isEofOnUnclosedQuote() {
|
|
94 |
return eofOnUnclosedQuote;
|
|
95 |
}
|
|
96 |
|
|
97 |
public void setEofOnEscapedNewLine(boolean eofOnEscapedNewLine) {
|
|
98 |
this.eofOnEscapedNewLine = eofOnEscapedNewLine;
|
|
99 |
}
|
|
100 |
|
|
101 |
public boolean isEofOnEscapedNewLine() {
|
|
102 |
return eofOnEscapedNewLine;
|
|
103 |
}
|
|
104 |
|
58903
|
105 |
public void setEofOnUnclosedBracket(Bracket... brackets){
|
|
106 |
if (brackets == null) {
|
|
107 |
openingBrackets = null;
|
|
108 |
closingBrackets = null;
|
|
109 |
} else {
|
|
110 |
Set<Bracket> bs = new HashSet<>(Arrays.asList(brackets));
|
|
111 |
openingBrackets = new char[bs.size()];
|
|
112 |
closingBrackets = new char[bs.size()];
|
|
113 |
int i = 0;
|
|
114 |
for (Bracket b : bs) {
|
|
115 |
switch (b) {
|
|
116 |
case ROUND:
|
|
117 |
openingBrackets[i] = '(';
|
|
118 |
closingBrackets[i] = ')';
|
|
119 |
break;
|
|
120 |
case CURLY:
|
|
121 |
openingBrackets[i] = '{';
|
|
122 |
closingBrackets[i] = '}';
|
|
123 |
break;
|
|
124 |
case SQUARE:
|
|
125 |
openingBrackets[i] = '[';
|
|
126 |
closingBrackets[i] = ']';
|
|
127 |
break;
|
|
128 |
case ANGLE:
|
|
129 |
openingBrackets[i] = '<';
|
|
130 |
closingBrackets[i] = '>';
|
|
131 |
break;
|
|
132 |
}
|
|
133 |
i++;
|
|
134 |
}
|
|
135 |
}
|
|
136 |
}
|
|
137 |
|
52938
|
138 |
public ParsedLine parse(final String line, final int cursor, ParseContext context) {
|
|
139 |
List<String> words = new LinkedList<>();
|
|
140 |
StringBuilder current = new StringBuilder();
|
|
141 |
int wordCursor = -1;
|
|
142 |
int wordIndex = -1;
|
|
143 |
int quoteStart = -1;
|
|
144 |
int rawWordCursor = -1;
|
|
145 |
int rawWordLength = -1;
|
|
146 |
int rawWordStart = 0;
|
58903
|
147 |
BracketChecker bracketChecker = new BracketChecker();
|
|
148 |
boolean quotedWord = false;
|
52938
|
149 |
|
|
150 |
for (int i = 0; (line != null) && (i < line.length()); i++) {
|
|
151 |
// once we reach the cursor, set the
|
|
152 |
// position of the selected index
|
|
153 |
if (i == cursor) {
|
|
154 |
wordIndex = words.size();
|
|
155 |
// the position in the current argument is just the
|
|
156 |
// length of the current argument
|
|
157 |
wordCursor = current.length();
|
|
158 |
rawWordCursor = i - rawWordStart;
|
|
159 |
}
|
|
160 |
|
|
161 |
if (quoteStart < 0 && isQuoteChar(line, i)) {
|
|
162 |
// Start a quote block
|
|
163 |
quoteStart = i;
|
58903
|
164 |
if (current.length()==0) {
|
|
165 |
quotedWord = true;
|
|
166 |
} else {
|
|
167 |
current.append(line.charAt(i));
|
|
168 |
}
|
|
169 |
} else if (quoteStart >= 0 && line.charAt(quoteStart) == line.charAt(i) && !isEscaped(line, i)) {
|
|
170 |
// End quote block
|
|
171 |
if (!quotedWord) {
|
|
172 |
current.append(line.charAt(i));
|
|
173 |
} else if (rawWordCursor >= 0 && rawWordLength < 0) {
|
|
174 |
rawWordLength = i - rawWordStart + 1;
|
|
175 |
}
|
|
176 |
quoteStart = -1;
|
|
177 |
quotedWord = false;
|
|
178 |
} else if (quoteStart < 0 && isDelimiter(line, i)) {
|
|
179 |
// Delimiter
|
|
180 |
if (current.length() > 0) {
|
52938
|
181 |
words.add(current.toString());
|
58903
|
182 |
current.setLength(0); // reset the arg
|
52938
|
183 |
if (rawWordCursor >= 0 && rawWordLength < 0) {
|
58903
|
184 |
rawWordLength = i - rawWordStart;
|
52938
|
185 |
}
|
|
186 |
}
|
58903
|
187 |
rawWordStart = i + 1;
|
52938
|
188 |
} else {
|
58903
|
189 |
if (!isEscapeChar(line, i)) {
|
|
190 |
current.append(line.charAt(i));
|
|
191 |
if (quoteStart < 0) {
|
|
192 |
bracketChecker.check(line, i);
|
52938
|
193 |
}
|
|
194 |
}
|
|
195 |
}
|
|
196 |
}
|
|
197 |
|
|
198 |
if (current.length() > 0 || cursor == line.length()) {
|
|
199 |
words.add(current.toString());
|
|
200 |
if (rawWordCursor >= 0 && rawWordLength < 0) {
|
|
201 |
rawWordLength = line.length() - rawWordStart;
|
|
202 |
}
|
|
203 |
}
|
|
204 |
|
|
205 |
if (cursor == line.length()) {
|
|
206 |
wordIndex = words.size() - 1;
|
|
207 |
wordCursor = words.get(words.size() - 1).length();
|
|
208 |
rawWordCursor = cursor - rawWordStart;
|
|
209 |
rawWordLength = rawWordCursor;
|
|
210 |
}
|
|
211 |
|
58903
|
212 |
if (context != ParseContext.COMPLETE) {
|
|
213 |
if (eofOnEscapedNewLine && isEscapeChar(line, line.length() - 1)) {
|
|
214 |
throw new EOFError(-1, -1, "Escaped new line", "newline");
|
|
215 |
}
|
|
216 |
if (eofOnUnclosedQuote && quoteStart >= 0) {
|
|
217 |
throw new EOFError(-1, -1, "Missing closing quote", line.charAt(quoteStart) == '\''
|
|
218 |
? "quote" : "dquote");
|
|
219 |
}
|
|
220 |
if (bracketChecker.isOpeningBracketMissing()) {
|
|
221 |
throw new EOFError(-1, -1, "Missing opening bracket", "missing: " + bracketChecker.getMissingOpeningBracket());
|
|
222 |
}
|
|
223 |
if (bracketChecker.isClosingBracketMissing()) {
|
|
224 |
throw new EOFError(-1, -1, "Missing closing brackets", "add: " + bracketChecker.getMissingClosingBrackets());
|
|
225 |
}
|
52938
|
226 |
}
|
|
227 |
|
58903
|
228 |
String openingQuote = quotedWord ? line.substring(quoteStart, quoteStart + 1) : null;
|
52938
|
229 |
return new ArgumentList(line, words, wordIndex, wordCursor, cursor, openingQuote, rawWordCursor, rawWordLength);
|
|
230 |
}
|
|
231 |
|
|
232 |
/**
|
|
233 |
* Returns true if the specified character is a whitespace parameter. Check to ensure that the character is not
|
58903
|
234 |
* escaped by any of {@link #getQuoteChars}, and is not escaped by any of the {@link #getEscapeChars}, and
|
52938
|
235 |
* returns true from {@link #isDelimiterChar}.
|
|
236 |
*
|
|
237 |
* @param buffer The complete command buffer
|
|
238 |
* @param pos The index of the character in the buffer
|
|
239 |
* @return True if the character should be a delimiter
|
|
240 |
*/
|
|
241 |
public boolean isDelimiter(final CharSequence buffer, final int pos) {
|
|
242 |
return !isQuoted(buffer, pos) && !isEscaped(buffer, pos) && isDelimiterChar(buffer, pos);
|
|
243 |
}
|
|
244 |
|
|
245 |
public boolean isQuoted(final CharSequence buffer, final int pos) {
|
|
246 |
return false;
|
|
247 |
}
|
|
248 |
|
|
249 |
public boolean isQuoteChar(final CharSequence buffer, final int pos) {
|
|
250 |
if (pos < 0) {
|
|
251 |
return false;
|
|
252 |
}
|
|
253 |
if (quoteChars != null) {
|
|
254 |
for (char e : quoteChars) {
|
|
255 |
if (e == buffer.charAt(pos)) {
|
|
256 |
return !isEscaped(buffer, pos);
|
|
257 |
}
|
|
258 |
}
|
|
259 |
}
|
|
260 |
return false;
|
|
261 |
}
|
|
262 |
|
58903
|
263 |
@Override
|
|
264 |
public boolean isEscapeChar(char ch) {
|
|
265 |
if (escapeChars != null) {
|
|
266 |
for (char e : escapeChars) {
|
|
267 |
if (e == ch) {
|
|
268 |
return true;
|
|
269 |
}
|
|
270 |
}
|
|
271 |
}
|
|
272 |
return false;
|
|
273 |
}
|
|
274 |
|
52938
|
275 |
/**
|
|
276 |
* Check if this character is a valid escape char (i.e. one that has not been escaped)
|
|
277 |
*
|
|
278 |
* @param buffer
|
|
279 |
* the buffer to check in
|
|
280 |
* @param pos
|
|
281 |
* the position of the character to check
|
|
282 |
* @return true if the character at the specified position in the given buffer is an escape
|
|
283 |
* character and the character immediately preceding it is not an escape character.
|
|
284 |
*/
|
|
285 |
public boolean isEscapeChar(final CharSequence buffer, final int pos) {
|
|
286 |
if (pos < 0) {
|
|
287 |
return false;
|
|
288 |
}
|
58903
|
289 |
char ch = buffer.charAt(pos);
|
|
290 |
return isEscapeChar(ch) && !isEscaped(buffer, pos);
|
52938
|
291 |
}
|
|
292 |
|
|
293 |
/**
|
|
294 |
* Check if a character is escaped (i.e. if the previous character is an escape)
|
|
295 |
*
|
|
296 |
* @param buffer
|
|
297 |
* the buffer to check in
|
|
298 |
* @param pos
|
|
299 |
* the position of the character to check
|
|
300 |
* @return true if the character at the specified position in the given buffer is an escape
|
|
301 |
* character and the character immediately preceding it is an escape character.
|
|
302 |
*/
|
|
303 |
public boolean isEscaped(final CharSequence buffer, final int pos) {
|
|
304 |
if (pos <= 0) {
|
|
305 |
return false;
|
|
306 |
}
|
|
307 |
return isEscapeChar(buffer, pos - 1);
|
|
308 |
}
|
|
309 |
|
|
310 |
/**
|
|
311 |
* Returns true if the character at the specified position if a delimiter. This method will only be called if
|
58903
|
312 |
* the character is not enclosed in any of the {@link #getQuoteChars}, and is not escaped by any of the
|
52938
|
313 |
* {@link #getEscapeChars}. To perform escaping manually, override {@link #isDelimiter} instead.
|
|
314 |
*
|
|
315 |
* @param buffer
|
|
316 |
* the buffer to check in
|
|
317 |
* @param pos
|
|
318 |
* the position of the character to check
|
|
319 |
* @return true if the character at the specified position in the given buffer is a delimiter.
|
|
320 |
*/
|
|
321 |
public boolean isDelimiterChar(CharSequence buffer, int pos) {
|
|
322 |
return Character.isWhitespace(buffer.charAt(pos));
|
|
323 |
}
|
|
324 |
|
|
325 |
private boolean isRawEscapeChar(char key) {
|
|
326 |
if (escapeChars != null) {
|
|
327 |
for (char e : escapeChars) {
|
|
328 |
if (e == key) {
|
|
329 |
return true;
|
|
330 |
}
|
|
331 |
}
|
|
332 |
}
|
|
333 |
return false;
|
|
334 |
}
|
|
335 |
|
|
336 |
private boolean isRawQuoteChar(char key) {
|
|
337 |
if (quoteChars != null) {
|
|
338 |
for (char e : quoteChars) {
|
|
339 |
if (e == key) {
|
|
340 |
return true;
|
|
341 |
}
|
|
342 |
}
|
|
343 |
}
|
|
344 |
return false;
|
|
345 |
}
|
|
346 |
|
58903
|
347 |
private class BracketChecker {
|
|
348 |
private int missingOpeningBracket = -1;
|
|
349 |
private List<Integer> nested = new ArrayList<>();
|
|
350 |
|
|
351 |
public BracketChecker(){}
|
|
352 |
|
|
353 |
public void check(final CharSequence buffer, final int pos){
|
|
354 |
if (openingBrackets == null || pos < 0) {
|
|
355 |
return;
|
|
356 |
}
|
|
357 |
int bid = bracketId(openingBrackets, buffer, pos);
|
|
358 |
if (bid >= 0) {
|
|
359 |
nested.add(bid);
|
|
360 |
} else {
|
|
361 |
bid = bracketId(closingBrackets, buffer, pos);
|
|
362 |
if (bid >= 0) {
|
|
363 |
if (!nested.isEmpty() && bid == nested.get(nested.size()-1)) {
|
|
364 |
nested.remove(nested.size()-1);
|
|
365 |
} else {
|
|
366 |
missingOpeningBracket = bid;
|
|
367 |
}
|
|
368 |
}
|
|
369 |
}
|
|
370 |
}
|
|
371 |
|
|
372 |
public boolean isOpeningBracketMissing(){
|
|
373 |
return missingOpeningBracket != -1;
|
|
374 |
}
|
|
375 |
|
|
376 |
public String getMissingOpeningBracket(){
|
|
377 |
if (!isOpeningBracketMissing()) {
|
|
378 |
return null;
|
|
379 |
}
|
|
380 |
return Character.toString(openingBrackets[missingOpeningBracket]);
|
|
381 |
}
|
|
382 |
|
|
383 |
public boolean isClosingBracketMissing(){
|
|
384 |
return !nested.isEmpty();
|
|
385 |
}
|
|
386 |
|
|
387 |
public String getMissingClosingBrackets(){
|
|
388 |
if (!isClosingBracketMissing()) {
|
|
389 |
return null;
|
|
390 |
}
|
|
391 |
StringBuilder out = new StringBuilder();
|
|
392 |
for (int i = nested.size() - 1; i > -1; i--) {
|
|
393 |
out.append(closingBrackets[nested.get(i)]);
|
|
394 |
}
|
|
395 |
return out.toString();
|
|
396 |
}
|
|
397 |
|
|
398 |
private int bracketId(final char[] brackets, final CharSequence buffer, final int pos){
|
|
399 |
for (int i=0; i < brackets.length; i++) {
|
|
400 |
if (buffer.charAt(pos) == brackets[i]) {
|
|
401 |
return i;
|
|
402 |
}
|
|
403 |
}
|
|
404 |
return -1;
|
|
405 |
}
|
|
406 |
}
|
|
407 |
|
52938
|
408 |
/**
|
|
409 |
* The result of a delimited buffer.
|
|
410 |
*
|
|
411 |
* @author <a href="mailto:mwp1@cornell.edu">Marc Prud'hommeaux</a>
|
|
412 |
*/
|
|
413 |
public class ArgumentList implements ParsedLine, CompletingParsedLine
|
|
414 |
{
|
|
415 |
private final String line;
|
|
416 |
|
|
417 |
private final List<String> words;
|
|
418 |
|
|
419 |
private final int wordIndex;
|
|
420 |
|
|
421 |
private final int wordCursor;
|
|
422 |
|
|
423 |
private final int cursor;
|
|
424 |
|
|
425 |
private final String openingQuote;
|
|
426 |
|
|
427 |
private final int rawWordCursor;
|
|
428 |
|
|
429 |
private final int rawWordLength;
|
|
430 |
|
|
431 |
@Deprecated
|
|
432 |
public ArgumentList(final String line, final List<String> words,
|
|
433 |
final int wordIndex, final int wordCursor,
|
|
434 |
final int cursor) {
|
|
435 |
this(line, words, wordIndex, wordCursor, cursor,
|
|
436 |
null, wordCursor, words.get(wordIndex).length());
|
|
437 |
}
|
|
438 |
|
|
439 |
/**
|
|
440 |
*
|
|
441 |
* @param line the command line being edited
|
|
442 |
* @param words the list of words
|
|
443 |
* @param wordIndex the index of the current word in the list of words
|
|
444 |
* @param wordCursor the cursor position within the current word
|
|
445 |
* @param cursor the cursor position within the line
|
|
446 |
* @param openingQuote the opening quote (usually '\"' or '\'') or null
|
|
447 |
* @param rawWordCursor the cursor position inside the raw word (i.e. including quotes and escape characters)
|
|
448 |
* @param rawWordLength the raw word length, including quotes and escape characters
|
|
449 |
*/
|
|
450 |
public ArgumentList(final String line, final List<String> words,
|
|
451 |
final int wordIndex, final int wordCursor,
|
|
452 |
final int cursor, final String openingQuote,
|
|
453 |
final int rawWordCursor, final int rawWordLength) {
|
|
454 |
this.line = line;
|
|
455 |
this.words = Collections.unmodifiableList(Objects.requireNonNull(words));
|
|
456 |
this.wordIndex = wordIndex;
|
|
457 |
this.wordCursor = wordCursor;
|
|
458 |
this.cursor = cursor;
|
|
459 |
this.openingQuote = openingQuote;
|
|
460 |
this.rawWordCursor = rawWordCursor;
|
|
461 |
this.rawWordLength = rawWordLength;
|
|
462 |
}
|
|
463 |
|
|
464 |
public int wordIndex() {
|
|
465 |
return this.wordIndex;
|
|
466 |
}
|
|
467 |
|
|
468 |
public String word() {
|
|
469 |
// TODO: word() should always be contained in words()
|
|
470 |
if ((wordIndex < 0) || (wordIndex >= words.size())) {
|
|
471 |
return "";
|
|
472 |
}
|
|
473 |
return words.get(wordIndex);
|
|
474 |
}
|
|
475 |
|
|
476 |
public int wordCursor() {
|
|
477 |
return this.wordCursor;
|
|
478 |
}
|
|
479 |
|
|
480 |
public List<String> words() {
|
|
481 |
return this.words;
|
|
482 |
}
|
|
483 |
|
|
484 |
public int cursor() {
|
|
485 |
return this.cursor;
|
|
486 |
}
|
|
487 |
|
|
488 |
public String line() {
|
|
489 |
return line;
|
|
490 |
}
|
|
491 |
|
|
492 |
public CharSequence escape(CharSequence candidate, boolean complete) {
|
|
493 |
StringBuilder sb = new StringBuilder(candidate);
|
|
494 |
Predicate<Integer> needToBeEscaped;
|
58903
|
495 |
String quote = openingQuote;
|
|
496 |
boolean middleQuotes = false;
|
|
497 |
if (openingQuote==null) {
|
|
498 |
for (int i=0; i < sb.length(); i++) {
|
|
499 |
if (isQuoteChar(sb, i)) {
|
|
500 |
middleQuotes = true;
|
|
501 |
break;
|
|
502 |
}
|
52938
|
503 |
}
|
|
504 |
}
|
58903
|
505 |
if (escapeChars != null) {
|
|
506 |
// Completion is protected by an opening quote:
|
|
507 |
// Delimiters (spaces) don't need to be escaped, nor do other quotes, but everything else does.
|
|
508 |
// Also, close the quote at the end
|
|
509 |
if (openingQuote != null) {
|
|
510 |
needToBeEscaped = i -> isRawEscapeChar(sb.charAt(i)) || String.valueOf(sb.charAt(i)).equals(openingQuote);
|
|
511 |
}
|
|
512 |
// Completion is protected by middle quotes:
|
|
513 |
// Delimiters (spaces) don't need to be escaped, nor do quotes, but everything else does.
|
|
514 |
else if (middleQuotes) {
|
|
515 |
needToBeEscaped = i -> isRawEscapeChar(sb.charAt(i));
|
|
516 |
}
|
|
517 |
// No quote protection, need to escape everything: delimiter chars (spaces), quote chars
|
|
518 |
// and escapes themselves
|
|
519 |
else {
|
|
520 |
needToBeEscaped = i -> isDelimiterChar(sb, i) || isRawEscapeChar(sb.charAt(i)) || isRawQuoteChar(sb.charAt(i));
|
|
521 |
}
|
|
522 |
for (int i = 0; i < sb.length(); i++) {
|
|
523 |
if (needToBeEscaped.test(i)) {
|
|
524 |
sb.insert(i++, escapeChars[0]);
|
|
525 |
}
|
|
526 |
}
|
|
527 |
} else if (openingQuote == null && !middleQuotes) {
|
|
528 |
for (int i = 0; i < sb.length(); i++) {
|
|
529 |
if (isDelimiterChar(sb, i)) {
|
|
530 |
quote = "'";
|
|
531 |
break;
|
|
532 |
}
|
|
533 |
}
|
|
534 |
}
|
|
535 |
if (quote != null) {
|
|
536 |
sb.insert(0, quote);
|
52938
|
537 |
if (complete) {
|
58903
|
538 |
sb.append(quote);
|
52938
|
539 |
}
|
|
540 |
}
|
|
541 |
return sb;
|
|
542 |
}
|
|
543 |
|
|
544 |
@Override
|
|
545 |
public int rawWordCursor() {
|
|
546 |
return rawWordCursor;
|
|
547 |
}
|
|
548 |
|
|
549 |
@Override
|
|
550 |
public int rawWordLength() {
|
|
551 |
return rawWordLength;
|
|
552 |
}
|
|
553 |
}
|
|
554 |
|
|
555 |
}
|