mirror of
https://github.com/uwol/proleap-vb6-parser.git
synced 2025-12-18 12:34:35 +03:00
removed guava
This commit is contained in:
23
pom.xml
23
pom.xml
@@ -21,7 +21,7 @@
|
|||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
<antlr.version>4.7</antlr.version>
|
<antlr.version>4.7.2</antlr.version>
|
||||||
</properties>
|
</properties>
|
||||||
<build>
|
<build>
|
||||||
<resources>
|
<resources>
|
||||||
@@ -49,11 +49,6 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-resources-plugin</artifactId>
|
|
||||||
<version>3.0.2</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
@@ -62,14 +57,10 @@
|
|||||||
<argLine>-Xmx2048m -Djava.awt.headless=true</argLine>
|
<argLine>-Xmx2048m -Djava.awt.headless=true</argLine>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-eclipse-plugin</artifactId>
|
|
||||||
<version>2.10</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.antlr</groupId>
|
<groupId>org.antlr</groupId>
|
||||||
<artifactId>antlr4-maven-plugin</artifactId>
|
<artifactId>antlr4-maven-plugin</artifactId>
|
||||||
<version>4.7</version>
|
<version>${antlr.version}</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>run antlr</id>
|
<id>run antlr</id>
|
||||||
@@ -113,6 +104,11 @@
|
|||||||
<artifactId>commons-io</artifactId>
|
<artifactId>commons-io</artifactId>
|
||||||
<version>2.5</version>
|
<version>2.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-lang</groupId>
|
||||||
|
<artifactId>commons-lang</artifactId>
|
||||||
|
<version>2.6</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.antlr</groupId>
|
<groupId>org.antlr</groupId>
|
||||||
<artifactId>antlr4</artifactId>
|
<artifactId>antlr4</artifactId>
|
||||||
@@ -123,11 +119,6 @@
|
|||||||
<artifactId>antlr4-runtime</artifactId>
|
<artifactId>antlr4-runtime</artifactId>
|
||||||
<version>${antlr.version}</version>
|
<version>${antlr.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.antlr</groupId>
|
|
||||||
<artifactId>antlr4-maven-plugin</artifactId>
|
|
||||||
<version>${antlr.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
import org.antlr.v4.runtime.CommonTokenStream;
|
import org.antlr.v4.runtime.CommonTokenStream;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
import io.proleap.vb6.VisualBasic6Parser.ArgContext;
|
import io.proleap.vb6.VisualBasic6Parser.ArgContext;
|
||||||
import io.proleap.vb6.VisualBasic6Parser.AttributeStmtContext;
|
import io.proleap.vb6.VisualBasic6Parser.AttributeStmtContext;
|
||||||
import io.proleap.vb6.VisualBasic6Parser.DeclareStmtContext;
|
import io.proleap.vb6.VisualBasic6Parser.DeclareStmtContext;
|
||||||
@@ -525,7 +523,7 @@ public abstract class ModuleImpl extends ScopeImpl implements Module {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Function> getFunctions() {
|
public List<Function> getFunctions() {
|
||||||
return Lists.newArrayList(functions.values());
|
return new ArrayList<>(functions.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -555,7 +553,7 @@ public abstract class ModuleImpl extends ScopeImpl implements Module {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PropertyGet> getPropertyGets() {
|
public List<PropertyGet> getPropertyGets() {
|
||||||
return Lists.newArrayList(propertyGets.values());
|
return new ArrayList<>(propertyGets.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -565,7 +563,7 @@ public abstract class ModuleImpl extends ScopeImpl implements Module {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PropertyLet> getPropertyLets() {
|
public List<PropertyLet> getPropertyLets() {
|
||||||
return Lists.newArrayList(propertyLets.values());
|
return new ArrayList<>(propertyLets.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -575,7 +573,7 @@ public abstract class ModuleImpl extends ScopeImpl implements Module {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PropertySet> getPropertySets() {
|
public List<PropertySet> getPropertySets() {
|
||||||
return Lists.newArrayList(propertySets.values());
|
return new ArrayList<>(propertySets.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -585,7 +583,7 @@ public abstract class ModuleImpl extends ScopeImpl implements Module {
|
|||||||
final EnumerationConstant enumerationConstant = getEnumerationConstant(name);
|
final EnumerationConstant enumerationConstant = getEnumerationConstant(name);
|
||||||
|
|
||||||
if (enumerationConstant != null) {
|
if (enumerationConstant != null) {
|
||||||
result = new ArrayList<ScopedElement>();
|
result = new ArrayList<>();
|
||||||
result.add(enumerationConstant);
|
result.add(enumerationConstant);
|
||||||
} else {
|
} else {
|
||||||
result = super.getScopedElementsInScope(name);
|
result = super.getScopedElementsInScope(name);
|
||||||
@@ -601,7 +599,7 @@ public abstract class ModuleImpl extends ScopeImpl implements Module {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Sub> getSubs() {
|
public List<Sub> getSubs() {
|
||||||
return Lists.newArrayList(subs.values());
|
return new ArrayList<Sub>(subs.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ import org.antlr.v4.runtime.ParserRuleContext;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
import io.proleap.vb6.VisualBasic6Parser;
|
import io.proleap.vb6.VisualBasic6Parser;
|
||||||
import io.proleap.vb6.VisualBasic6Parser.AmbiguousIdentifierContext;
|
import io.proleap.vb6.VisualBasic6Parser.AmbiguousIdentifierContext;
|
||||||
import io.proleap.vb6.VisualBasic6Parser.AppActivateStmtContext;
|
import io.proleap.vb6.VisualBasic6Parser.AppActivateStmtContext;
|
||||||
@@ -2456,7 +2454,7 @@ public abstract class ScopeImpl extends ScopedElementImpl implements Scope {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Constant> getConstants() {
|
public List<Constant> getConstants() {
|
||||||
return Lists.newArrayList(constants.values());
|
return new ArrayList<>(constants.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2616,7 +2614,7 @@ public abstract class ScopeImpl extends ScopedElementImpl implements Scope {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Variable> getVariables() {
|
public List<Variable> getVariables() {
|
||||||
return Lists.newArrayList(variables.values());
|
return new ArrayList<Variable>(variables.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void linkApiEnumerationCallWithApiEnumeration(final ApiEnumerationCall apiEnumerationCall,
|
protected void linkApiEnumerationCallWithApiEnumeration(final ApiEnumerationCall apiEnumerationCall,
|
||||||
|
|||||||
@@ -9,8 +9,7 @@
|
|||||||
package io.proleap.vb6.asg.metamodel.impl;
|
package io.proleap.vb6.asg.metamodel.impl;
|
||||||
|
|
||||||
import org.antlr.v4.runtime.ParserRuleContext;
|
import org.antlr.v4.runtime.ParserRuleContext;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import com.google.common.base.Strings;
|
|
||||||
|
|
||||||
import io.proleap.vb6.asg.metamodel.Module;
|
import io.proleap.vb6.asg.metamodel.Module;
|
||||||
import io.proleap.vb6.asg.metamodel.Program;
|
import io.proleap.vb6.asg.metamodel.Program;
|
||||||
@@ -60,6 +59,6 @@ public abstract class ScopedElementImpl extends ASGElementImpl implements Scoped
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected String getSymbol(final String name) {
|
protected String getSymbol(final String name) {
|
||||||
return Strings.isNullOrEmpty(name) ? name : name.toLowerCase();
|
return StringUtils.isEmpty(name) ? name : name.toLowerCase();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ import java.util.LinkedHashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
import io.proleap.vb6.VisualBasic6Parser.FunctionStmtContext;
|
import io.proleap.vb6.VisualBasic6Parser.FunctionStmtContext;
|
||||||
import io.proleap.vb6.asg.inference.impl.TypeInferenceImpl;
|
import io.proleap.vb6.asg.inference.impl.TypeInferenceImpl;
|
||||||
import io.proleap.vb6.asg.metamodel.Module;
|
import io.proleap.vb6.asg.metamodel.Module;
|
||||||
@@ -67,7 +65,7 @@ public class FunctionImpl extends ProcedureImpl implements Function {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Call> getCalls() {
|
public List<Call> getCalls() {
|
||||||
return Lists.newArrayList(getFunctionCalls());
|
return new ArrayList<>(getFunctionCalls());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ import java.util.LinkedHashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
import io.proleap.vb6.VisualBasic6Parser.PropertyGetStmtContext;
|
import io.proleap.vb6.VisualBasic6Parser.PropertyGetStmtContext;
|
||||||
import io.proleap.vb6.asg.inference.impl.TypeInferenceImpl;
|
import io.proleap.vb6.asg.inference.impl.TypeInferenceImpl;
|
||||||
import io.proleap.vb6.asg.metamodel.Module;
|
import io.proleap.vb6.asg.metamodel.Module;
|
||||||
@@ -67,7 +65,7 @@ public class PropertyGetImpl extends ProcedureImpl implements PropertyGet {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Call> getCalls() {
|
public List<Call> getCalls() {
|
||||||
return Lists.newArrayList(getPropertyGetCalls());
|
return new ArrayList<>(getPropertyGetCalls());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ package io.proleap.vb6.asg.metamodel.statement.property.let.impl;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
import io.proleap.vb6.VisualBasic6Parser.PropertyLetStmtContext;
|
import io.proleap.vb6.VisualBasic6Parser.PropertyLetStmtContext;
|
||||||
import io.proleap.vb6.asg.metamodel.Module;
|
import io.proleap.vb6.asg.metamodel.Module;
|
||||||
import io.proleap.vb6.asg.metamodel.VisibilityEnum;
|
import io.proleap.vb6.asg.metamodel.VisibilityEnum;
|
||||||
@@ -45,7 +43,7 @@ public class PropertyLetImpl extends ProcedureImpl implements PropertyLet {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Call> getCalls() {
|
public List<Call> getCalls() {
|
||||||
return Lists.newArrayList(getPropertyLetCalls());
|
return new ArrayList<>(getPropertyLetCalls());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ package io.proleap.vb6.asg.metamodel.statement.property.set.impl;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
import io.proleap.vb6.VisualBasic6Parser.PropertySetStmtContext;
|
import io.proleap.vb6.VisualBasic6Parser.PropertySetStmtContext;
|
||||||
import io.proleap.vb6.asg.metamodel.Module;
|
import io.proleap.vb6.asg.metamodel.Module;
|
||||||
import io.proleap.vb6.asg.metamodel.VisibilityEnum;
|
import io.proleap.vb6.asg.metamodel.VisibilityEnum;
|
||||||
@@ -45,7 +43,7 @@ public class PropertySetImpl extends ProcedureImpl implements PropertySet {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Call> getCalls() {
|
public List<Call> getCalls() {
|
||||||
return Lists.newArrayList(getPropertySetCalls());
|
return new ArrayList<>(getPropertySetCalls());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ package io.proleap.vb6.asg.metamodel.statement.sub.impl;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
import io.proleap.vb6.VisualBasic6Parser.SubStmtContext;
|
import io.proleap.vb6.VisualBasic6Parser.SubStmtContext;
|
||||||
import io.proleap.vb6.asg.metamodel.Module;
|
import io.proleap.vb6.asg.metamodel.Module;
|
||||||
import io.proleap.vb6.asg.metamodel.VisibilityEnum;
|
import io.proleap.vb6.asg.metamodel.VisibilityEnum;
|
||||||
@@ -44,7 +42,7 @@ public class SubImpl extends ProcedureImpl implements Sub {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Call> getCalls() {
|
public List<Call> getCalls() {
|
||||||
return Lists.newArrayList(getSubCalls());
|
return new ArrayList<>(getSubCalls());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
24
src/main/java/io/proleap/vb6/asg/util/StringUtils.java
Normal file
24
src/main/java/io/proleap/vb6/asg/util/StringUtils.java
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package io.proleap.vb6.asg.util;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public class StringUtils {
|
||||||
|
|
||||||
|
public static List<String> readLines(final InputStream inputStream, final Charset charset) throws IOException {
|
||||||
|
final InputStreamReader inputStreamReader = new InputStreamReader(inputStream, charset);
|
||||||
|
final BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
|
||||||
|
return bufferedReader.lines().collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String toString(final InputStream inputStream, final Charset charset) throws IOException {
|
||||||
|
final InputStreamReader inputStreamReader = new InputStreamReader(inputStream, charset);
|
||||||
|
final BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
|
||||||
|
return bufferedReader.lines().collect(Collectors.joining(System.lineSeparator()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,11 +19,10 @@ import java.util.Arrays;
|
|||||||
import org.antlr.v4.runtime.CharStreams;
|
import org.antlr.v4.runtime.CharStreams;
|
||||||
import org.antlr.v4.runtime.CommonTokenStream;
|
import org.antlr.v4.runtime.CommonTokenStream;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
|
||||||
|
|
||||||
import io.proleap.vb6.VisualBasic6Parser.StartRuleContext;
|
import io.proleap.vb6.VisualBasic6Parser.StartRuleContext;
|
||||||
import io.proleap.vb6.util.TreeUtils;
|
import io.proleap.vb6.util.TreeUtils;
|
||||||
|
|
||||||
@@ -111,7 +110,7 @@ public class TestGenerator {
|
|||||||
subOutputDirectory.mkdirs();
|
subOutputDirectory.mkdirs();
|
||||||
|
|
||||||
// determine the package name of test classes
|
// determine the package name of test classes
|
||||||
final String subPackageName = Strings.isNullOrEmpty(packageName) ? subInputDirectoryName
|
final String subPackageName = StringUtils.isEmpty(packageName) ? subInputDirectoryName
|
||||||
: packageName + "." + subInputDirectoryName;
|
: packageName + "." + subInputDirectoryName;
|
||||||
|
|
||||||
generateTestClasses(subInputDirectory, subOutputDirectory, subPackageName);
|
generateTestClasses(subInputDirectory, subOutputDirectory, subPackageName);
|
||||||
|
|||||||
@@ -22,11 +22,10 @@ import org.antlr.v4.runtime.CommonTokenStream;
|
|||||||
import org.antlr.v4.runtime.tree.Trees;
|
import org.antlr.v4.runtime.tree.Trees;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
|
||||||
|
|
||||||
import io.proleap.vb6.VisualBasic6Lexer;
|
import io.proleap.vb6.VisualBasic6Lexer;
|
||||||
import io.proleap.vb6.VisualBasic6Parser;
|
import io.proleap.vb6.VisualBasic6Parser;
|
||||||
import io.proleap.vb6.VisualBasic6Parser.StartRuleContext;
|
import io.proleap.vb6.VisualBasic6Parser.StartRuleContext;
|
||||||
@@ -59,7 +58,7 @@ public class VbParseTestRunnerImpl implements VbParseTestRunner {
|
|||||||
|
|
||||||
final String treeFileData = FileUtils.readFileToString(treeFile, StandardCharsets.UTF_8);
|
final String treeFileData = FileUtils.readFileToString(treeFile, StandardCharsets.UTF_8);
|
||||||
|
|
||||||
if (!Strings.isNullOrEmpty(treeFileData)) {
|
if (!StringUtils.isEmpty(treeFileData)) {
|
||||||
LOG.info("Comparing parse tree with file {}.", treeFile.getName());
|
LOG.info("Comparing parse tree with file {}.", treeFile.getName());
|
||||||
|
|
||||||
final String inputFileTree = Trees.toStringTree(startRule, parser);
|
final String inputFileTree = Trees.toStringTree(startRule, parser);
|
||||||
|
|||||||
@@ -7,9 +7,7 @@ import org.antlr.v4.runtime.Parser;
|
|||||||
import org.antlr.v4.runtime.misc.Utils;
|
import org.antlr.v4.runtime.misc.Utils;
|
||||||
import org.antlr.v4.runtime.tree.Tree;
|
import org.antlr.v4.runtime.tree.Tree;
|
||||||
import org.antlr.v4.runtime.tree.Trees;
|
import org.antlr.v4.runtime.tree.Trees;
|
||||||
import org.sonatype.inject.Nullable;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
|
||||||
|
|
||||||
public class TreeUtils {
|
public class TreeUtils {
|
||||||
|
|
||||||
@@ -18,13 +16,13 @@ public class TreeUtils {
|
|||||||
public static final String TAB = "\t";
|
public static final String TAB = "\t";
|
||||||
|
|
||||||
public static String indent(final int indent) {
|
public static String indent(final int indent) {
|
||||||
return Strings.repeat(TAB, indent);
|
return StringUtils.repeat(TAB, indent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.antlr.v4.runtime.tree.Trees.toStringTree(Tree, List<String>)
|
* @see org.antlr.v4.runtime.tree.Trees.toStringTree(Tree, List<String>)
|
||||||
*/
|
*/
|
||||||
public static String toStringTree(final Tree t, @Nullable final List<String> ruleNames, final int depth) {
|
public static String toStringTree(final Tree t, final List<String> ruleNames, final int depth) {
|
||||||
String s = Utils.escapeWhitespace(Trees.getNodeText(t, ruleNames), false);
|
String s = Utils.escapeWhitespace(Trees.getNodeText(t, ruleNames), false);
|
||||||
|
|
||||||
if (t.getChildCount() == 0) {
|
if (t.getChildCount() == 0) {
|
||||||
@@ -59,7 +57,7 @@ public class TreeUtils {
|
|||||||
/**
|
/**
|
||||||
* @see org.antlr.v4.runtime.tree.Trees.toStringTree(Tree, Parser)
|
* @see org.antlr.v4.runtime.tree.Trees.toStringTree(Tree, Parser)
|
||||||
*/
|
*/
|
||||||
public static String toStringTree(final Tree t, @Nullable final Parser recog) {
|
public static String toStringTree(final Tree t, final Parser recog) {
|
||||||
final String[] ruleNames = recog != null ? recog.getRuleNames() : null;
|
final String[] ruleNames = recog != null ? recog.getRuleNames() : null;
|
||||||
final List<String> ruleNamesList = ruleNames != null ? Arrays.asList(ruleNames) : null;
|
final List<String> ruleNamesList = ruleNames != null ? Arrays.asList(ruleNames) : null;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user