Skip to content

Commit

Permalink
GH-3957 split NOT IN and NOT EXISTS into separate tokens
Browse files Browse the repository at this point in the history
- regenerate parser from javacc using 7.0.4.
  • Loading branch information
abrokenjester committed Jun 5, 2022
1 parent 42e4da8 commit 315b4cd
Show file tree
Hide file tree
Showing 15 changed files with 4,667 additions and 4,453 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated By:JavaCC: Do not edit this line. CharStream.java Version 5.0 */
/* Generated By:JavaCC: Do not edit this line. CharStream.java Version 7.0 */
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
package org.eclipse.rdf4j.query.parser.sparql.ast;

Expand All @@ -24,7 +24,7 @@ public interface CharStream {
@Deprecated
/**
* Returns the column position of the character last read.
*
*
* @deprecated
* @see #getEndColumn
*/
Expand All @@ -33,7 +33,7 @@ public interface CharStream {
@Deprecated
/**
* Returns the line number of the character last read.
*
*
* @deprecated
* @see #getEndLine
*/
Expand Down Expand Up @@ -99,5 +99,12 @@ public interface CharStream {
*/
void Done();

void setTabSize(int i);

int getTabSize();

boolean getTrackLineColumn();

void setTrackLineColumn(boolean trackLineColumn);
}
/* JavaCC - OriginalChecksum=d5d02d7f2852c9b712f39bed41ca22b5 (do not edit this line) */
/* JavaCC - OriginalChecksum=58e372464b9dd95cab2ce2c1aafe56b5 (do not edit this line) */
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
/*******************************************************************************
* Copyright (c) 2018 Eclipse RDF4J contributors, Aduna, and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Distribution License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*******************************************************************************/
/* Generated By:JavaCC: Do not edit this line. JJTSyntaxTreeBuilderState.java Version 5.0 */
/* Generated By:JavaCC: Do not edit this line. JJTSyntaxTreeBuilderState.java Version 7.0.4 */
package org.eclipse.rdf4j.query.parser.sparql.ast;

public class JJTSyntaxTreeBuilderState {
Expand All @@ -17,8 +10,8 @@ public class JJTSyntaxTreeBuilderState {
private boolean node_created;

public JJTSyntaxTreeBuilderState() {
nodes = new java.util.ArrayList<>();
marks = new java.util.ArrayList<>();
nodes = new java.util.ArrayList<Node>();
marks = new java.util.ArrayList<Integer>();
sp = 0;
mk = 0;
}
Expand Down Expand Up @@ -128,4 +121,4 @@ public void closeNodeScope(Node n, boolean condition) {
}
}
}
/* JavaCC - OriginalChecksum=1e5a09b86097bc3480ddaf59d3a653ea (do not edit this line) */
/* JavaCC - OriginalChecksum=47f2d422caef2af3172a09b7c82b6b58 (do not edit this line) */
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* java-like unicode escape processing).
*/

public class JavaCharStream {
public class JavaCharStream implements CharStream {
/** Whether parser is static. */
public static final boolean staticFlag = false;
public static final IOException IO_EXCEPTION = new IOException() {
Expand Down Expand Up @@ -95,12 +95,13 @@ static final int hexval(char c) throws java.io.IOException {
protected int nextCharInd = -1;
protected int inBuf = 0;
protected int tabSize = 8;
private boolean trackLineColumn;

protected void setTabSize(int i) {
public void setTabSize(int i) {
tabSize = i;
}

protected int getTabSize(int i) {
public int getTabSize() {
return tabSize;
}

Expand Down Expand Up @@ -567,5 +568,15 @@ public void adjustBeginLineColumn(int newLine, int newCol) {
column = bufcolumn[j];
}

@Override
public boolean getTrackLineColumn() {
return trackLineColumn;
}

@Override
public void setTrackLineColumn(boolean trackLineColumn) {
this.trackLineColumn = trackLineColumn;
}

}
/* JavaCC - OriginalChecksum=9012f7ef5b4871a848f6a44bc2895f5a (do not edit this line) */
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015 Eclipse RDF4J contributors, Aduna, and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Distribution License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*******************************************************************************/
/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */
/* JavaCCOptions:KEEP_LINE_COL=null */
/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 7.0 */
/* JavaCCOptions:KEEP_LINE_COLUMN=true */
package org.eclipse.rdf4j.query.parser.sparql.ast;

/**
Expand All @@ -23,12 +16,20 @@ public class ParseException extends Exception {
*/
private static final long serialVersionUID = 1L;

/**
* The end of line string for this machine.
*/
protected static String EOL = System.getProperty("line.separator", "\n");

/**
* This constructor is used by the method "generateParseException" in the generated parser. Calling this constructor
* generates a new object of this type with the fields "currentToken", "expectedTokenSequences", and "tokenImage"
* set.
*/
public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal) {
public ParseException(Token currentTokenVal,
int[][] expectedTokenSequencesVal,
String[] tokenImageVal
) {
super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal));
currentToken = currentTokenVal;
expectedTokenSequences = expectedTokenSequencesVal;
Expand Down Expand Up @@ -74,9 +75,11 @@ public ParseException(String message) {
* object has been created due to a parse error, and you do not catch it (it gets thrown from the parser) the
* correct error message gets displayed.
*/
private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) {
String eol = System.getProperty("line.separator", "\n");
StringBuilder expected = new StringBuilder();
private static String initialise(Token currentToken,
int[][] expectedTokenSequences,
String[] tokenImage) {

StringBuffer expected = new StringBuffer();
int maxSize = 0;
for (int i = 0; i < expectedTokenSequences.length; i++) {
if (maxSize < expectedTokenSequences[i].length) {
Expand All @@ -88,14 +91,13 @@ private static String initialise(Token currentToken, int[][] expectedTokenSequen
if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
expected.append("...");
}
expected.append(eol).append(" ");
expected.append(EOL).append(" ");
}
String retval = "Encountered \"";
Token tok = currentToken.next;
for (int i = 0; i < maxSize; i++) {
if (i != 0) {
if (i != 0)
retval += " ";
}
if (tok.kind == 0) {
retval += tokenImage[0];
break;
Expand All @@ -107,32 +109,31 @@ private static String initialise(Token currentToken, int[][] expectedTokenSequen
tok = tok.next;
}
retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
retval += "." + eol;
if (expectedTokenSequences.length == 1) {
retval += "Was expecting:" + eol + " ";
retval += "." + EOL;

if (expectedTokenSequences.length == 0) {
// Nothing to add here
} else {
retval += "Was expecting one of:" + eol + " ";
if (expectedTokenSequences.length == 1) {
retval += "Was expecting:" + EOL + " ";
} else {
retval += "Was expecting one of:" + EOL + " ";
}
retval += expected.toString();
}
retval += expected.toString();

return retval;
}

/**
* The end of line string for this machine.
*/
protected String eol = System.getProperty("line.separator", "\n");

/**
* Used to convert raw characters to their escaped version when these raw version cannot be used as part of an ASCII
* string literal.
*/
static String add_escapes(String str) {
StringBuilder retval = new StringBuilder();
StringBuffer retval = new StringBuffer();
char ch;
for (int i = 0; i < str.length(); i++) {
switch (str.charAt(i)) {
case 0:
continue;
case '\b':
retval.append("\\b");
continue;
Expand Down Expand Up @@ -171,4 +172,4 @@ static String add_escapes(String str) {
}

}
/* JavaCC - OriginalChecksum=44b767a95658c78aaac10930de7b91e2 (do not edit this line) */
/* JavaCC - OriginalChecksum=649920eccb74b9252241ec7205edc72a (do not edit this line) */
Loading

0 comments on commit 315b4cd

Please sign in to comment.