Skip to content

Commit

Permalink
Merge branch 're-thc-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
parrt committed Jan 8, 2022
2 parents c339942 + 0cff8dc commit 7d2a37e
Show file tree
Hide file tree
Showing 16 changed files with 23 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
for (List<String> args : argumentSets) {
try {
// Create an instance of the ANTLR 4 build tool
tool = new CustomTool(args.toArray(new String[args.size()]));
tool = new CustomTool(args.toArray(new String[0]));
} catch (Exception e) {
log.error("The attempt to create the ANTLR 4 build tool failed, see exception report for details", e);
throw new MojoFailureException("Error creating an instanceof the ANTLR tool.", e);
Expand Down
7 changes: 2 additions & 5 deletions contributors.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
ANTLR Project Contributors Certification of Origin and Rights

NOTE: This tool is mature and Terence is mostly occupied elsewhere. We
can't accept any changes that could have widespread effects on thousands
of existing projects. Sorry!

All contributors to ANTLR v4 must formally agree to abide by this
certificate of origin by signing on the bottom with their github
userid, full name, email address (you can obscure your e-mail, but it
Expand Down Expand Up @@ -222,6 +218,7 @@ YYYY/MM/DD, github id, Full name, email
2019/01/01, khoroshilov, Alexey Khoroshilov, [email protected]
2019/01/02, wkhemir, Wail Khemir, [email protected]
2019/01/16, kuegi, Markus Zancolo, [email protected]
2019/01/29, hc-codersatlas, Harry Chan, [email protected]
2019/02/06, ralucado, Cristina Raluca Vijulie, ralucris.v[at]gmail[dot]com
2019/02/23, gedimitr, Gerasimos Dimitriadis, [email protected]
2019/03/13, base698, Justin Thomas, [email protected]
Expand Down Expand Up @@ -328,4 +325,4 @@ YYYY/MM/DD, github id, Full name, email
2021/12/03, eneko, Eneko Alonso, [email protected]
2021/12/16, Ketler13, Oleksandr Martyshchenko, [email protected]
2021/12/25, Tinker1024, Tinker1024, [email protected]
2021/12/31, Biswa96, Biswapriyo Nath, [email protected]
2021/12/31, Biswa96, Biswapriyo Nath, [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ protected boolean rawGenerateRecognizer(String grammarFileName,
files.add(grammarName + "BaseVisitor.cs");
}
}
addSourceFiles(files.toArray(new String[files.size()]));
addSourceFiles(files.toArray(new String[0]));
return true;
}

Expand Down
8 changes: 4 additions & 4 deletions runtime/Java/src/org/antlr/v4/runtime/LexerInterpreter.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class LexerInterpreter extends Lexer {

@Deprecated
public LexerInterpreter(String grammarFileName, Collection<String> tokenNames, Collection<String> ruleNames, Collection<String> modeNames, ATN atn, CharStream input) {
this(grammarFileName, VocabularyImpl.fromTokenNames(tokenNames.toArray(new String[tokenNames.size()])), ruleNames, new ArrayList<String>(), modeNames, atn, input);
this(grammarFileName, VocabularyImpl.fromTokenNames(tokenNames.toArray(new String[0])), ruleNames, new ArrayList<String>(), modeNames, atn, input);
}

@Deprecated
Expand All @@ -56,9 +56,9 @@ public LexerInterpreter(String grammarFileName, Vocabulary vocabulary, Collectio
tokenNames[i] = vocabulary.getDisplayName(i);
}

this.ruleNames = ruleNames.toArray(new String[ruleNames.size()]);
this.channelNames = channelNames.toArray(new String[channelNames.size()]);
this.modeNames = modeNames.toArray(new String[modeNames.size()]);
this.ruleNames = ruleNames.toArray(new String[0]);
this.channelNames = channelNames.toArray(new String[0]);
this.modeNames = modeNames.toArray(new String[0]);
this.vocabulary = vocabulary;

this._decisionToDFA = new DFA[atn.getNumberOfDecisions()];
Expand Down
4 changes: 2 additions & 2 deletions runtime/Java/src/org/antlr/v4/runtime/ParserInterpreter.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public class ParserInterpreter extends Parser {
@Deprecated
public ParserInterpreter(String grammarFileName, Collection<String> tokenNames,
Collection<String> ruleNames, ATN atn, TokenStream input) {
this(grammarFileName, VocabularyImpl.fromTokenNames(tokenNames.toArray(new String[tokenNames.size()])), ruleNames, atn, input);
this(grammarFileName, VocabularyImpl.fromTokenNames(tokenNames.toArray(new String[0])), ruleNames, atn, input);
}

public ParserInterpreter(String grammarFileName, Vocabulary vocabulary,
Expand All @@ -106,7 +106,7 @@ public ParserInterpreter(String grammarFileName, Vocabulary vocabulary,
tokenNames[i] = vocabulary.getDisplayName(i);
}

this.ruleNames = ruleNames.toArray(new String[ruleNames.size()]);
this.ruleNames = ruleNames.toArray(new String[0]);
this.vocabulary = vocabulary;

// init decision DFA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ else if (state instanceof StarLoopbackState) {
}
}

atn.lexerActions = legacyLexerActions.toArray(new LexerAction[legacyLexerActions.size()]);
atn.lexerActions = legacyLexerActions.toArray(new LexerAction[0]);
}
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/Java/src/org/antlr/v4/runtime/atn/ATNState.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public String toString() {
}

public Transition[] getTransitions() {
return transitions.toArray(new Transition[transitions.size()]);
return transitions.toArray(new Transition[0]);
}

public int getNumberOfTransitions() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,7 @@ protected DFAState.PredPrediction[] getPredicatePredictions(BitSet ambigAlts,
}

// System.out.println(Arrays.toString(altToPred)+"->"+pairs);
return pairs.toArray(new DFAState.PredPrediction[pairs.size()]);
return pairs.toArray(new DFAState.PredPrediction[0]);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,6 @@ else if ( p.getReturnState(index)!= EMPTY_RETURN_STATE) {
}
}

return result.toArray(new String[result.size()]);
return result.toArray(new String[0]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public AND(SemanticContext a, SemanticContext b) {
operands.add(reduced);
}

opnds = operands.toArray(new SemanticContext[operands.size()]);
opnds = operands.toArray(new SemanticContext[0]);
}

@Override
Expand Down Expand Up @@ -316,7 +316,7 @@ public OR(SemanticContext a, SemanticContext b) {
operands.add(reduced);
}

this.opnds = operands.toArray(new SemanticContext[operands.size()]);
this.opnds = operands.toArray(new SemanticContext[0]);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public String getGrammarFileName() {

@Override
public String[] getRuleNames() {
return g.rules.keySet().toArray(new String[g.rules.size()]);
return g.rules.keySet().toArray(new String[0]);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ protected void compileJavaParser(boolean leftRecursive) throws IOException {
}
}
extraOptions.add("-visitor");
String[] extraOptionsArray = extraOptions.toArray(new String[extraOptions.size()]);
String[] extraOptionsArray = extraOptions.toArray(new String[0]);
boolean success = rawGenerateAndBuildRecognizer(grammarFileName, body, parserName, lexerName, true, extraOptionsArray);
assertTrue(success);
}
Expand Down
2 changes: 1 addition & 1 deletion tool/src/org/antlr/v4/codegen/model/RuleFunction.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public Set<Decl> getDeclsForAllElements(List<AltAST> altASTs) {
}
}

for (String ref : nonOptional.toArray(new String[nonOptional.size()])) {
for (String ref : nonOptional.toArray(new String[0])) {
if (minFreq.count(ref) == 0) {
nonOptional.remove(ref);
}
Expand Down
4 changes: 2 additions & 2 deletions tool/src/org/antlr/v4/codegen/model/SerializedATN.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public String[][] getSegments() {
int segmentLimit = factory.getGenerator().getTarget().getSerializedATNSegmentLimit();
for (int i = 0; i < serialized.size(); i += segmentLimit) {
List<String> currentSegment = serialized.subList(i, Math.min(i + segmentLimit, serialized.size()));
segments.add(currentSegment.toArray(new String[currentSegment.size()]));
segments.add(currentSegment.toArray(new String[0]));
}

return segments.toArray(new String[segments.size()][]);
return segments.toArray(new String[0][]);
}
}
2 changes: 1 addition & 1 deletion tool/src/org/antlr/v4/codegen/model/TestSetInline.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private static Bitset[] createBitsets(OutputModelFactory factory,
current.ttypes.add(factory.getGenerator().getTarget().getTokenTypeAsTargetLabel(factory.getGrammar(), ttype));
}

return bitsetList.toArray(new Bitset[bitsetList.size()]);
return bitsetList.toArray(new Bitset[0]);
}

public static final class Bitset {
Expand Down
2 changes: 1 addition & 1 deletion tool/src/org/antlr/v4/tool/ast/GrammarAST.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public GrammarAST(int type, Token t, String text) {
}

public GrammarAST[] getChildrenAsArray() {
return children.toArray(new GrammarAST[children.size()]);
return children.toArray(new GrammarAST[0]);
}

public List<GrammarAST> getNodesWithType(int ttype) {
Expand Down

0 comments on commit 7d2a37e

Please sign in to comment.