Simplify
This commit is contained in:
@ -31,7 +31,7 @@ public final class CharStreamFactory {
|
||||
public static CharStream simpleCharStream(Reader input, Function<? super String, ? extends JavaccTokenDocument> documentMaker) {
|
||||
String source = toString(input);
|
||||
JavaccTokenDocument document = documentMaker.apply(source);
|
||||
return new SimpleCharStream(source, document);
|
||||
return new SimpleCharStream(document);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -47,7 +47,7 @@ public final class CharStreamFactory {
|
||||
public static CharStream javaCharStream(Reader input, Function<? super String, ? extends JavaccTokenDocument> documentMaker) {
|
||||
String source = toString(input);
|
||||
JavaccTokenDocument tokens = documentMaker.apply(source);
|
||||
return new JavaCharStream(source, tokens);
|
||||
return new JavaCharStream(tokens);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,9 +27,9 @@ public class JavaCharStream extends JavaCharStreamBase {
|
||||
|
||||
private int[] startOffsets;
|
||||
|
||||
public JavaCharStream(String fulltext, JavaccTokenDocument document) {
|
||||
super(new StringReader(fulltext));
|
||||
this.fullText = fulltext;
|
||||
public JavaCharStream(JavaccTokenDocument document) {
|
||||
super(new StringReader(document.getFullText()));
|
||||
this.fullText = document.getFullText();
|
||||
this.document = document;
|
||||
this.startOffsets = new int[bufsize];
|
||||
maxNextCharInd = fullText.length();
|
||||
|
@ -9,8 +9,8 @@ package net.sourceforge.pmd.lang.ast.impl.javacc;
|
||||
*/
|
||||
public class SimpleCharStream extends JavaCharStream {
|
||||
|
||||
public SimpleCharStream(String fulltext, JavaccTokenDocument document) {
|
||||
super(fulltext, document);
|
||||
public SimpleCharStream(JavaccTokenDocument document) {
|
||||
super(document);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,8 +28,8 @@ public class CppCharStream extends SimpleCharStream {
|
||||
private static final char NEWLINE = '\n';
|
||||
private static final char CARRIAGE_RETURN = '\r';
|
||||
|
||||
public CppCharStream(String fulltext, JavaccTokenDocument document) {
|
||||
super(fulltext, document);
|
||||
public CppCharStream(JavaccTokenDocument document) {
|
||||
super(document);
|
||||
}
|
||||
|
||||
|
||||
@ -76,6 +76,6 @@ public class CppCharStream extends SimpleCharStream {
|
||||
: null;
|
||||
}
|
||||
};
|
||||
return new CppCharStream(source, document);
|
||||
return new CppCharStream(document);
|
||||
}
|
||||
}
|
||||
|
@ -11,8 +11,8 @@ import net.sourceforge.pmd.cpd.token.JavaCCTokenFilter;
|
||||
import net.sourceforge.pmd.lang.TokenManager;
|
||||
import net.sourceforge.pmd.lang.ast.GenericToken;
|
||||
import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken;
|
||||
import net.sourceforge.pmd.lang.modelica.ast.ModelicaTokenManager;
|
||||
import net.sourceforge.pmd.lang.modelica.ast.ModelicaTokenKinds;
|
||||
import net.sourceforge.pmd.lang.modelica.ast.ModelicaTokenManager;
|
||||
|
||||
|
||||
public class ModelicaTokenizer extends JavaCCTokenizer {
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang.modelica.ast;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
Reference in New Issue
Block a user