You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2017/09/16 18:58:25 UTC
groovy git commit: Replace Pair with Tuple2 further
Repository: groovy
Updated Branches:
refs/heads/master 7dc7cb52b -> de56fe3c7
Replace Pair with Tuple2 further
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/de56fe3c
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/de56fe3c
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/de56fe3c
Branch: refs/heads/master
Commit: de56fe3c7f371cbf96e1b0299fa4b6198dc8ca00
Parents: 7dc7cb5
Author: sunlan <su...@apache.org>
Authored: Sun Sep 17 02:58:18 2017 +0800
Committer: sunlan <su...@apache.org>
Committed: Sun Sep 17 02:58:18 2017 +0800
----------------------------------------------------------------------
.../parser/antlr4/util/PositionConfigureUtils.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/de56fe3c/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/util/PositionConfigureUtils.java
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/util/PositionConfigureUtils.java b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/util/PositionConfigureUtils.java
index bbe83eb..aba0244 100644
--- a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/util/PositionConfigureUtils.java
+++ b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/util/PositionConfigureUtils.java
@@ -18,10 +18,10 @@
*/
package org.apache.groovy.parser.antlr4.util;
+import groovy.lang.Tuple2;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.tree.TerminalNode;
import org.apache.groovy.parser.antlr4.GroovyParser;
-import org.apache.groovy.parser.antlr4.Pair;
import org.codehaus.groovy.ast.ASTNode;
import static org.codehaus.groovy.runtime.DefaultGroovyMethods.asBoolean;
@@ -50,7 +50,7 @@ public class PositionConfigureUtils {
return astNode;
}
- public static Pair<Integer, Integer> endPosition(Token token) {
+ public static Tuple2<Integer, Integer> endPosition(Token token) {
String stopText = token.getText();
int stopTextLength = 0;
int newLineCnt = 0;
@@ -60,9 +60,9 @@ public class PositionConfigureUtils {
}
if (0 == newLineCnt) {
- return new Pair<>(token.getLine(), token.getCharPositionInLine() + 1 + token.getText().length());
+ return new Tuple2<>(token.getLine(), token.getCharPositionInLine() + 1 + token.getText().length());
} else { // e.g. GStringEnd contains newlines, we should fix the location info
- return new Pair<>(token.getLine() + newLineCnt, stopTextLength - stopText.lastIndexOf('\n'));
+ return new Tuple2<>(token.getLine() + newLineCnt, stopTextLength - stopText.lastIndexOf('\n'));
}
}
@@ -105,9 +105,9 @@ public class PositionConfigureUtils {
}
public static <T extends ASTNode> void configureEndPosition(T astNode, Token token) {
- Pair<Integer, Integer> endPosition = endPosition(token);
- astNode.setLastLineNumber(endPosition.getKey());
- astNode.setLastColumnNumber(endPosition.getValue());
+ Tuple2<Integer, Integer> endPosition = endPosition(token);
+ astNode.setLastLineNumber(endPosition.getFirst());
+ astNode.setLastColumnNumber(endPosition.getSecond());
}
public static <T extends ASTNode> T configureAST(T astNode, ASTNode start, ASTNode stop) {