Rename encapsulator to quote char.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1398187 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ddfe9df74f
commit
350d34d5cf
|
@ -110,7 +110,7 @@ final class CSVLexer extends Lexer {
|
|||
// empty token return EORECORD("")
|
||||
// noop: tkn.content.append("");
|
||||
token.type = EORECORD;
|
||||
} else if (isEncapsulator(c)) {
|
||||
} else if (isQuoteChar(c)) {
|
||||
// consume encapsulated token
|
||||
encapsulatedTokenLexer(token);
|
||||
} else if (isEndOfFile(c)) {
|
||||
|
@ -204,8 +204,8 @@ final class CSVLexer extends Lexer {
|
|||
|
||||
if (isEscape(c)) {
|
||||
tkn.content.append((char) readEscape());
|
||||
} else if (isEncapsulator(c)) {
|
||||
if (isEncapsulator(in.lookAhead())) {
|
||||
} else if (isQuoteChar(c)) {
|
||||
if (isQuoteChar(in.lookAhead())) {
|
||||
// double or escaped encapsulator -> add single encapsulator to token
|
||||
c = in.read();
|
||||
tkn.content.append((char) c);
|
||||
|
|
|
@ -43,7 +43,7 @@ abstract class Lexer {
|
|||
|
||||
private final char delimiter;
|
||||
private final char escape;
|
||||
private final char encapsulator;
|
||||
private final char quoteChar;
|
||||
private final char commmentStart;
|
||||
|
||||
final boolean ignoreSurroundingSpaces;
|
||||
|
@ -59,7 +59,7 @@ abstract class Lexer {
|
|||
this.in = in;
|
||||
this.delimiter = format.getDelimiter();
|
||||
this.escape = mapNullToDisabled(format.getEscape());
|
||||
this.encapsulator = mapNullToDisabled(format.getQuoteChar());
|
||||
this.quoteChar = mapNullToDisabled(format.getQuoteChar());
|
||||
this.commmentStart = mapNullToDisabled(format.getCommentStart());
|
||||
this.ignoreSurroundingSpaces = format.getIgnoreSurroundingSpaces();
|
||||
this.ignoreEmptyLines = format.getIgnoreEmptyLines();
|
||||
|
@ -153,8 +153,8 @@ abstract class Lexer {
|
|||
return c == escape;
|
||||
}
|
||||
|
||||
boolean isEncapsulator(final int c) {
|
||||
return c == encapsulator;
|
||||
boolean isQuoteChar(final int c) {
|
||||
return c == quoteChar;
|
||||
}
|
||||
|
||||
boolean isCommentStart(final int c) {
|
||||
|
|
|
@ -110,7 +110,7 @@ class CSVLexer1306663 extends Lexer {
|
|||
// empty token return EORECORD("")
|
||||
//noop: tkn.content.append("");
|
||||
tkn.type = EORECORD;
|
||||
} else if (isEncapsulator(c)) {
|
||||
} else if (isQuoteChar(c)) {
|
||||
// consume encapsulated token
|
||||
encapsulatedTokenLexer(tkn);
|
||||
} else if (isEndOfFile(c)) {
|
||||
|
@ -196,8 +196,8 @@ class CSVLexer1306663 extends Lexer {
|
|||
|
||||
if (isEscape(c)) {
|
||||
tkn.content.append((char) readEscape());
|
||||
} else if (isEncapsulator(c)) {
|
||||
if (isEncapsulator(in.lookAhead())) {
|
||||
} else if (isQuoteChar(c)) {
|
||||
if (isQuoteChar(in.lookAhead())) {
|
||||
// double or escaped encapsulator -> add single encapsulator to token
|
||||
c = in.read();
|
||||
tkn.content.append((char) c);
|
||||
|
|
|
@ -110,7 +110,7 @@ class CSVLexer1306667 extends Lexer {
|
|||
// empty token return EORECORD("")
|
||||
//noop: tkn.content.append("");
|
||||
tkn.type = EORECORD;
|
||||
} else if (isEncapsulator(c)) {
|
||||
} else if (isQuoteChar(c)) {
|
||||
// consume encapsulated token
|
||||
encapsulatedTokenLexer(tkn);
|
||||
} else if (isEndOfFile(c)) {
|
||||
|
@ -196,8 +196,8 @@ class CSVLexer1306667 extends Lexer {
|
|||
|
||||
if (isEscape(c)) {
|
||||
tkn.content.append((char) readEscape());
|
||||
} else if (isEncapsulator(c)) {
|
||||
if (isEncapsulator(in.lookAhead())) {
|
||||
} else if (isQuoteChar(c)) {
|
||||
if (isQuoteChar(in.lookAhead())) {
|
||||
// double or escaped encapsulator -> add single encapsulator to token
|
||||
c = in.read();
|
||||
tkn.content.append((char) c);
|
||||
|
|
|
@ -64,7 +64,7 @@ class CSVLexer3 extends Lexer {
|
|||
if (isCommentStart(intch)) {
|
||||
return CharType.COMMENT_START;
|
||||
}
|
||||
if (isEncapsulator(intch)) {
|
||||
if (isQuoteChar(intch)) {
|
||||
return CharType.ENCAP;
|
||||
}
|
||||
if (isEscape(intch)) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
testCSV85.csv CommentStart=# CheckComments
|
||||
Delimiter=<,> Encapsulator=<"> CommentStart=<#>
|
||||
Delimiter=<,> QuoteChar=<"> CommentStart=<#>
|
||||
# Comment 1
|
||||
5:[a, b, c, e, f]#Comment 1
|
||||
# Very Long
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
testCSV85.csv CommentStart=# IgnoreEmpty=true CheckComments
|
||||
Delimiter=<,> Encapsulator=<"> CommentStart=<#> EmptyLines:ignored
|
||||
Delimiter=<,> QuoteChar=<"> CommentStart=<#> EmptyLines:ignored
|
||||
# Comment 1
|
||||
5:[a, b, c, e, f]#Comment 1
|
||||
# Very Long
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
test.csv IgnoreEmpty=true
|
||||
Delimiter=<,> Encapsulator=<"> EmptyLines:ignored
|
||||
Delimiter=<,> QuoteChar=<"> EmptyLines:ignored
|
||||
4:[A, B, C, D]
|
||||
1:[# plain values]
|
||||
4:[a, b, c, d]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
test.csv IgnoreEmpty=true CommentStart=#
|
||||
Delimiter=<,> Encapsulator=<"> CommentStart=<#> EmptyLines:ignored
|
||||
Delimiter=<,> QuoteChar=<"> CommentStart=<#> EmptyLines:ignored
|
||||
4:[A, B, C, D]
|
||||
4:[a, b, c, d]
|
||||
4:[ e , f , g, h ]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
test.csv
|
||||
Delimiter=<,> Encapsulator=<">
|
||||
Delimiter=<,> QuoteChar=<">
|
||||
4:[A, B, C, D]
|
||||
1:[# plain values]
|
||||
4:[a, b, c, d]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
test.csv IgnoreSpaces=true
|
||||
Delimiter=<,> Encapsulator=<"> SurroundingSpaces:ignored
|
||||
Delimiter=<,> QuoteChar=<"> SurroundingSpaces:ignored
|
||||
4:[A, B, C, D]
|
||||
1:[# plain values]
|
||||
4:[a, b, c, d]
|
||||
|
|
Loading…
Reference in New Issue