You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sebb <se...@gmail.com> on 2012/10/15 16:58:29 UTC
Re: svn commit: r1398187 - in /commons/proper/csv/trunk/src:
main/java/org/apache/commons/csv/ test/java/org/apache/commons/csv/ test/resources/CSVFileParser/
On 15 October 2012 04:37, <gg...@apache.org> wrote:
> Author: ggregory
> Date: Mon Oct 15 03:37:34 2012
> New Revision: 1398187
>
> URL: http://svn.apache.org/viewvc?rev=1398187&view=rev
> Log:
> Rename encapsulator to quote char.
Please discuss such changes on the dev list first.
> Modified:
> commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java
> commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java
> commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306663.java
> commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306667.java
> commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer3.java
> commons/proper/csv/trunk/src/test/resources/CSVFileParser/testCSV85_default.txt
> commons/proper/csv/trunk/src/test/resources/CSVFileParser/testCSV85_ignoreEmpty.txt
> commons/proper/csv/trunk/src/test/resources/CSVFileParser/test_default.txt
> commons/proper/csv/trunk/src/test/resources/CSVFileParser/test_default_comment.txt
> commons/proper/csv/trunk/src/test/resources/CSVFileParser/test_rfc4180.txt
> commons/proper/csv/trunk/src/test/resources/CSVFileParser/test_rfc4180_trim.txt
>
> Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java
> URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java?rev=1398187&r1=1398186&r2=1398187&view=diff
> ==============================================================================
> --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java (original)
> +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVLexer.java Mon Oct 15 03:37:34 2012
> @@ -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);
>
> Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java
> URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java?rev=1398187&r1=1398186&r2=1398187&view=diff
> ==============================================================================
> --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java (original)
> +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Lexer.java Mon Oct 15 03:37:34 2012
> @@ -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) {
>
> Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306663.java
> URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306663.java?rev=1398187&r1=1398186&r2=1398187&view=diff
> ==============================================================================
> --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306663.java (original)
> +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306663.java Mon Oct 15 03:37:34 2012
> @@ -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);
>
> Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306667.java
> URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306667.java?rev=1398187&r1=1398186&r2=1398187&view=diff
> ==============================================================================
> --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306667.java (original)
> +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer1306667.java Mon Oct 15 03:37:34 2012
> @@ -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);
>
> Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer3.java
> URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer3.java?rev=1398187&r1=1398186&r2=1398187&view=diff
> ==============================================================================
> --- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer3.java (original)
> +++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexer3.java Mon Oct 15 03:37:34 2012
> @@ -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)) {
>
> Modified: commons/proper/csv/trunk/src/test/resources/CSVFileParser/testCSV85_default.txt
> URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/resources/CSVFileParser/testCSV85_default.txt?rev=1398187&r1=1398186&r2=1398187&view=diff
> ==============================================================================
> --- commons/proper/csv/trunk/src/test/resources/CSVFileParser/testCSV85_default.txt (original)
> +++ commons/proper/csv/trunk/src/test/resources/CSVFileParser/testCSV85_default.txt Mon Oct 15 03:37:34 2012
> @@ -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
>
> Modified: commons/proper/csv/trunk/src/test/resources/CSVFileParser/testCSV85_ignoreEmpty.txt
> URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/resources/CSVFileParser/testCSV85_ignoreEmpty.txt?rev=1398187&r1=1398186&r2=1398187&view=diff
> ==============================================================================
> --- commons/proper/csv/trunk/src/test/resources/CSVFileParser/testCSV85_ignoreEmpty.txt (original)
> +++ commons/proper/csv/trunk/src/test/resources/CSVFileParser/testCSV85_ignoreEmpty.txt Mon Oct 15 03:37:34 2012
> @@ -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
>
> Modified: commons/proper/csv/trunk/src/test/resources/CSVFileParser/test_default.txt
> URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/resources/CSVFileParser/test_default.txt?rev=1398187&r1=1398186&r2=1398187&view=diff
> ==============================================================================
> --- commons/proper/csv/trunk/src/test/resources/CSVFileParser/test_default.txt (original)
> +++ commons/proper/csv/trunk/src/test/resources/CSVFileParser/test_default.txt Mon Oct 15 03:37:34 2012
> @@ -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]
>
> Modified: commons/proper/csv/trunk/src/test/resources/CSVFileParser/test_default_comment.txt
> URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/resources/CSVFileParser/test_default_comment.txt?rev=1398187&r1=1398186&r2=1398187&view=diff
> ==============================================================================
> --- commons/proper/csv/trunk/src/test/resources/CSVFileParser/test_default_comment.txt (original)
> +++ commons/proper/csv/trunk/src/test/resources/CSVFileParser/test_default_comment.txt Mon Oct 15 03:37:34 2012
> @@ -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 ]
>
> Modified: commons/proper/csv/trunk/src/test/resources/CSVFileParser/test_rfc4180.txt
> URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/resources/CSVFileParser/test_rfc4180.txt?rev=1398187&r1=1398186&r2=1398187&view=diff
> ==============================================================================
> --- commons/proper/csv/trunk/src/test/resources/CSVFileParser/test_rfc4180.txt (original)
> +++ commons/proper/csv/trunk/src/test/resources/CSVFileParser/test_rfc4180.txt Mon Oct 15 03:37:34 2012
> @@ -1,5 +1,5 @@
> test.csv
> -Delimiter=<,> Encapsulator=<">
> +Delimiter=<,> QuoteChar=<">
> 4:[A, B, C, D]
> 1:[# plain values]
> 4:[a, b, c, d]
>
> Modified: commons/proper/csv/trunk/src/test/resources/CSVFileParser/test_rfc4180_trim.txt
> URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/resources/CSVFileParser/test_rfc4180_trim.txt?rev=1398187&r1=1398186&r2=1398187&view=diff
> ==============================================================================
> --- commons/proper/csv/trunk/src/test/resources/CSVFileParser/test_rfc4180_trim.txt (original)
> +++ commons/proper/csv/trunk/src/test/resources/CSVFileParser/test_rfc4180_trim.txt Mon Oct 15 03:37:34 2012
> @@ -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]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org