You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2023/05/28 16:24:15 UTC
[jena] branch main updated: GH-1883: Move test-only Turtle parser generator
This is an automated email from the ASF dual-hosted git repository.
andy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git
The following commit(s) were added to refs/heads/main by this push:
new 3c0514e8e4 GH-1883: Move test-only Turtle parser generator
new fbea3b00d9 Merge pull request #1884 from afs/ttl-test
3c0514e8e4 is described below
commit 3c0514e8e4fcc79cf5e5fcbf515c01f5065e14d7
Author: Andy Seaborne <an...@apache.org>
AuthorDate: Sat May 27 16:21:26 2023 +0100
GH-1883: Move test-only Turtle parser generator
---
.../ttl_test/turtle/parser/JavaCharStream.java | 73 +++++++++++-----------
.../ttl_test/turtle/parser/ParseException.java | 2 +-
.../apache/jena/ttl_test/turtle/parser/Token.java | 2 +-
.../jena/ttl_test/turtle/parser/TokenMgrError.java | 5 +-
.../jena/ttl_test/turtle/parser/TurtleParser.java | 2 +-
.../turtle/parser/TurtleParserTokenManager.java | 2 +-
jena-core/{Grammar => testing/ttl_test}/README | 2 +-
.../ttl_test/turtle-test-parser} | 4 +-
.../turtle.jj => testing/ttl_test/turtle-test.jj} | 12 ++--
9 files changed, 52 insertions(+), 52 deletions(-)
diff --git a/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/JavaCharStream.java b/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/JavaCharStream.java
index 3c1893e47a..589c6a76dd 100644
--- a/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/JavaCharStream.java
+++ b/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/JavaCharStream.java
@@ -31,7 +31,7 @@ public
class JavaCharStream
{
/** Whether parser is static. */
-
+
@SuppressWarnings("all")
public static final boolean staticFlag = false;
@@ -83,7 +83,7 @@ public static final boolean staticFlag = false;
}
/* Position in buffer. */
-
+
@SuppressWarnings("all")
public int bufpos = -1;
int bufsize;
@@ -108,10 +108,10 @@ public int bufpos = -1;
protected int tabSize = 1;
protected boolean trackLineColumn = true;
-
+
@SuppressWarnings("all")
public void setTabSize(int i) { tabSize = i; }
-
+
@SuppressWarnings("all")
public int getTabSize() { return tabSize; }
@@ -203,7 +203,7 @@ public int getTabSize() { return tabSize; }
}
/* @return starting character for token. */
-
+
@SuppressWarnings("all")
public char BeginToken() throws java.io.IOException
{
@@ -285,7 +285,7 @@ public char BeginToken() throws java.io.IOException
}
/* Read a character. */
-
+
@SuppressWarnings("all")
public char readChar() throws java.io.IOException
{
@@ -385,7 +385,7 @@ public char readChar() throws java.io.IOException
* @see #getEndColumn
*/
@Deprecated
-
+
@SuppressWarnings("all")
public int getColumn() {
return bufcolumn[bufpos];
@@ -397,7 +397,7 @@ public int getColumn() {
* @return the line number.
*/
@Deprecated
-
+
@SuppressWarnings("all")
public int getLine() {
return bufline[bufpos];
@@ -406,7 +406,7 @@ public int getLine() {
/** Get end column.
* @return the end column or -1
*/
-
+
@SuppressWarnings("all")
public int getEndColumn() {
return bufcolumn[bufpos];
@@ -415,7 +415,7 @@ public int getEndColumn() {
/** Get end line.
* @return the end line number or -1
*/
-
+
@SuppressWarnings("all")
public int getEndLine() {
return bufline[bufpos];
@@ -423,21 +423,21 @@ public int getEndLine() {
/** Get the beginning column.
* @return column of token start */
-
+
@SuppressWarnings("all")
public int getBeginColumn() {
return bufcolumn[tokenBegin];
}
/** @return line number of token start */
-
+
@SuppressWarnings("all")
public int getBeginLine() {
return bufline[tokenBegin];
}
/** Retreat. */
-
+
@SuppressWarnings("all")
public void backup(int amount) {
@@ -452,7 +452,7 @@ public void backup(int amount) {
* @param startcolumn column number of the first character of the stream.
* @param buffersize size of the buffer
*/
-
+
@SuppressWarnings("all")
public JavaCharStream(java.io.Reader dstream,
int startline, int startcolumn, int buffersize)
@@ -473,7 +473,7 @@ public JavaCharStream(java.io.Reader dstream,
* @param startline line number of the first character of the stream, mostly for error messages.
* @param startcolumn column number of the first character of the stream.
*/
-
+
@SuppressWarnings("all")
public JavaCharStream(java.io.Reader dstream,
int startline, int startcolumn)
@@ -483,15 +483,16 @@ public JavaCharStream(java.io.Reader dstream,
/** Constructor.
* @param dstream the underlying data source.
+ * @param startline line number of the first character of the stream, mostly for error messages.
*/
-
+
@SuppressWarnings("all")
public JavaCharStream(java.io.Reader dstream)
{
this(dstream, 1, 1, 4096);
}
/* Reinitialise. */
-
+
@SuppressWarnings("all")
public void ReInit(java.io.Reader dstream,
int startline, int startcolumn, int buffersize)
@@ -514,7 +515,7 @@ public void ReInit(java.io.Reader dstream,
}
/* Reinitialise. */
-
+
@SuppressWarnings("all")
public void ReInit(java.io.Reader dstream,
int startline, int startcolumn)
@@ -523,14 +524,14 @@ public void ReInit(java.io.Reader dstream,
}
/* Reinitialise. */
-
+
@SuppressWarnings("all")
public void ReInit(java.io.Reader dstream)
{
ReInit(dstream, 1, 1, 4096);
}
/** Constructor. */
-
+
@SuppressWarnings("all")
public JavaCharStream(java.io.InputStream dstream, String encoding, int startline,
int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
@@ -544,7 +545,7 @@ public JavaCharStream(java.io.InputStream dstream, String encoding, int startlin
* @param startcolumn column number of the first character of the stream.
* @param buffersize size of the buffer
*/
-
+
@SuppressWarnings("all")
public JavaCharStream(java.io.InputStream dstream, int startline,
int startcolumn, int buffersize)
@@ -559,7 +560,7 @@ public JavaCharStream(java.io.InputStream dstream, int startline,
* @param startcolumn column number of the first character of the stream.
* @throws UnsupportedEncodingException encoding is invalid or unsupported.
*/
-
+
@SuppressWarnings("all")
public JavaCharStream(java.io.InputStream dstream, String encoding, int startline,
int startcolumn) throws java.io.UnsupportedEncodingException
@@ -572,7 +573,7 @@ public JavaCharStream(java.io.InputStream dstream, String encoding, int startlin
* @param startline line number of the first character of the stream, mostly for error messages.
* @param startcolumn column number of the first character of the stream.
*/
-
+
@SuppressWarnings("all")
public JavaCharStream(java.io.InputStream dstream, int startline,
int startcolumn)
@@ -585,7 +586,7 @@ public JavaCharStream(java.io.InputStream dstream, int startline,
* @param encoding the character encoding of the data stream.
* @throws UnsupportedEncodingException encoding is invalid or unsupported.
*/
-
+
@SuppressWarnings("all")
public JavaCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
{
@@ -595,7 +596,7 @@ public JavaCharStream(java.io.InputStream dstream, String encoding) throws java.
/** Constructor.
* @param dstream the underlying data source.
*/
-
+
@SuppressWarnings("all")
public JavaCharStream(java.io.InputStream dstream)
{
@@ -609,7 +610,7 @@ public JavaCharStream(java.io.InputStream dstream)
* @param startcolumn column number of the first character of the stream.
* @param buffersize size of the buffer
*/
-
+
@SuppressWarnings("all")
public void ReInit(java.io.InputStream dstream, String encoding, int startline,
int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
@@ -623,7 +624,7 @@ public void ReInit(java.io.InputStream dstream, String encoding, int startline,
* @param startcolumn column number of the first character of the stream.
* @param buffersize size of the buffer
*/
-
+
@SuppressWarnings("all")
public void ReInit(java.io.InputStream dstream, int startline,
int startcolumn, int buffersize)
@@ -637,7 +638,7 @@ public void ReInit(java.io.InputStream dstream, int startline,
* @param startcolumn column number of the first character of the stream.
* @throws UnsupportedEncodingException encoding is invalid or unsupported.
*/
-
+
@SuppressWarnings("all")
public void ReInit(java.io.InputStream dstream, String encoding, int startline,
int startcolumn) throws java.io.UnsupportedEncodingException
@@ -649,7 +650,7 @@ public void ReInit(java.io.InputStream dstream, String encoding, int startline,
* @param startline line number of the first character of the stream, mostly for error messages.
* @param startcolumn column number of the first character of the stream.
*/
-
+
@SuppressWarnings("all")
public void ReInit(java.io.InputStream dstream, int startline,
int startcolumn)
@@ -661,7 +662,7 @@ public void ReInit(java.io.InputStream dstream, int startline,
* @param encoding the character encoding of the data stream.
* @throws UnsupportedEncodingException encoding is invalid or unsupported.
*/
-
+
@SuppressWarnings("all")
public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
{
@@ -671,7 +672,7 @@ public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.
/** Reinitialise.
* @param dstream the underlying data source.
*/
-
+
@SuppressWarnings("all")
public void ReInit(java.io.InputStream dstream)
{
@@ -680,7 +681,7 @@ public void ReInit(java.io.InputStream dstream)
/** Get the token timage.
* @return token image as String */
-
+
@SuppressWarnings("all")
public String GetImage()
{
@@ -694,7 +695,7 @@ public String GetImage()
/** Get the suffix as an array of characters.
* @param len the length of the array to return.
* @return suffix */
-
+
@SuppressWarnings("all")
public char[] GetSuffix(int len)
{
@@ -713,7 +714,7 @@ public char[] GetSuffix(int len)
}
/** Set buffers back to null when finished. */
-
+
@SuppressWarnings("all")
public void Done()
{
@@ -729,7 +730,7 @@ public void Done()
* @param newLine the new line number.
* @param newCol the new column number.
*/
-
+
@SuppressWarnings("all")
public void adjustBeginLineColumn(int newLine, int newCol)
{
@@ -778,4 +779,4 @@ public void adjustBeginLineColumn(int newLine, int newCol)
void setTrackLineColumn(boolean tlc) { trackLineColumn = tlc; }
}
-/* JavaCC - OriginalChecksum=932c0f047fc42f112a9b58627aff6634 (do not edit this line) */
+/* JavaCC - OriginalChecksum=9de559d5082595b79322998d8e7a955b (do not edit this line) */
diff --git a/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/ParseException.java b/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/ParseException.java
index 6dbe9d7607..f6d43f3bdc 100644
--- a/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/ParseException.java
+++ b/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/ParseException.java
@@ -210,4 +210,4 @@ public class ParseException extends Exception {
}
}
-/* JavaCC - OriginalChecksum=ecd3464b87732582c6aa01912829856c (do not edit this line) */
+/* JavaCC - OriginalChecksum=10dc416469508e8065e3958be462e2cd (do not edit this line) */
diff --git a/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/Token.java b/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/Token.java
index e3a019caa0..33f592cd23 100644
--- a/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/Token.java
+++ b/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/Token.java
@@ -147,4 +147,4 @@ public class Token implements java.io.Serializable {
}
}
-/* JavaCC - OriginalChecksum=b7752bd299ace9b496b80e3041bb8e31 (do not edit this line) */
+/* JavaCC - OriginalChecksum=879d3febc0185e65e0b92d55458baddd (do not edit this line) */
diff --git a/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/TokenMgrError.java b/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/TokenMgrError.java
index bd939e2857..6b25d2dff9 100644
--- a/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/TokenMgrError.java
+++ b/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/TokenMgrError.java
@@ -123,11 +123,10 @@ public class TokenMgrError extends Error
* Note: You can customize the lexical error message by modifying this method.
*/
protected static String LexicalErr(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar) {
- char curChar1 = (char)curChar;
return("Lexical error at line " + //
errorLine + ", column " + //
errorColumn + ". Encountered: " + //
- (EOFSeen ? "<EOF>" : ("'" + addEscapes(String.valueOf(curChar)) + "' (" + (int)curChar + "),")) + //
+ (EOFSeen ? "<EOF>" : ("'" + addEscapes(String.valueOf(curChar)) + "' (" + curChar + "),")) + //
(errorAfter == null || errorAfter.length() == 0 ? "" : " after prefix \"" + addEscapes(errorAfter) + "\"")) + //
(lexState == 0 ? "" : " (in lexical state " + lexState + ")");
}
@@ -165,4 +164,4 @@ public class TokenMgrError extends Error
this(LexicalErr(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
}
}
-/* JavaCC - OriginalChecksum=736a7f2dfde55835f349bdb3205f2740 (do not edit this line) */
+/* JavaCC - OriginalChecksum=1ccc5440ac04daf89788416d736930a7 (do not edit this line) */
diff --git a/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/TurtleParser.java b/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/TurtleParser.java
index 26618b1a4b..2431c43ae3 100644
--- a/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/TurtleParser.java
+++ b/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/TurtleParser.java
@@ -20,8 +20,8 @@
package org.apache.jena.ttl_test.turtle.parser;
-import org.apache.jena.graph.* ;
import org.apache.jena.ttl_test.turtle.*;
+import org.apache.jena.graph.* ;
public class TurtleParser extends TurtleParserBase implements TurtleParserConstants {
diff --git a/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/TurtleParserTokenManager.java b/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/TurtleParserTokenManager.java
index a791ffba2c..e07e1e1305 100644
--- a/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/TurtleParserTokenManager.java
+++ b/jena-core/src/test/java/org/apache/jena/ttl_test/turtle/parser/TurtleParserTokenManager.java
@@ -19,8 +19,8 @@
*/
package org.apache.jena.ttl_test.turtle.parser;
-import org.apache.jena.graph.* ;
import org.apache.jena.ttl_test.turtle.*;
+import org.apache.jena.graph.* ;
/** Token Manager. */
@SuppressWarnings ("unused")
diff --git a/jena-core/Grammar/README b/jena-core/testing/ttl_test/README
similarity index 71%
rename from jena-core/Grammar/README
rename to jena-core/testing/ttl_test/README
index a4540363e1..712f26a7e6 100644
--- a/jena-core/Grammar/README
+++ b/jena-core/testing/ttl_test/README
@@ -1,4 +1,4 @@
-This is a Turtle parser used in support of jena-core tests.
+This is a Turtle parser used in support of jena-core tests and nothing more.
It is not compliant with RDF 1.1 Turtle.
diff --git a/jena-core/Grammar/turtle-parser b/jena-core/testing/ttl_test/turtle-test-parser
similarity index 95%
rename from jena-core/Grammar/turtle-parser
rename to jena-core/testing/ttl_test/turtle-test-parser
index 2ecff0acff..1d2a135fe4 100755
--- a/jena-core/Grammar/turtle-parser
+++ b/jena-core/testing/ttl_test/turtle-test-parser
@@ -17,8 +17,8 @@
# Parser builder
-DIR="../src/test/java/org/apache/jena/ttl/turtle/parser"
-FILE=turtle.jj
+DIR="../../src/test/java/org/apache/jena/ttl_test/turtle/parser"
+FILE=turtle-test.jj
CLASS=TurtleParser
(cd "$DIR" ; rm -f *.java )
diff --git a/jena-core/Grammar/turtle.jj b/jena-core/testing/ttl_test/turtle-test.jj
similarity index 97%
rename from jena-core/Grammar/turtle.jj
rename to jena-core/testing/ttl_test/turtle-test.jj
index aaeba4689b..d9d078d8de 100644
--- a/jena-core/Grammar/turtle.jj
+++ b/jena-core/testing/ttl_test/turtle-test.jj
@@ -54,9 +54,9 @@ PARSER_BEGIN(TurtleParser)
* limitations under the License.
*/
-package org.apache.jena.ttl.turtle.parser;
+package org.apache.jena.ttl_test.turtle.parser;
-import org.apache.jena.ttl.turtle.*;
+import org.apache.jena.ttl_test.turtle.*;
import org.apache.jena.graph.* ;
public class TurtleParser extends TurtleParserBase
@@ -135,7 +135,7 @@ void ObjectList(Node s, Node p): { Node o ; }
void Object(Node s, Node p): { Node o ; }
{
o = GraphNode()
- { Triple t = new Triple(s,p,o) ;
+ { Triple t = Triple.create(s,p,o) ;
emitTriple(token.beginLine, token.beginColumn, t) ; }
}
@@ -194,12 +194,12 @@ Node Collection() :
listHead = cell ;
if ( lastCell != null )
emitTriple(token.beginLine, token.beginColumn,
- new Triple(lastCell, nRDFrest, cell)) ;
+ Triple.create(lastCell, nRDFrest, cell)) ;
}
n = GraphNode()
{
emitTriple(token.beginLine, token.beginColumn,
- new Triple(cell, nRDFfirst, n)) ;
+ Triple.create(cell, nRDFfirst, n)) ;
lastCell = cell ;
}
) +
@@ -207,7 +207,7 @@ Node Collection() :
<RPAREN>
{ if ( lastCell != null )
emitTriple(token.beginLine, token.beginColumn,
- new Triple(lastCell, nRDFrest, nRDFnil)) ;
+ Triple.create(lastCell, nRDFrest, nRDFnil)) ;
return listHead ; }
}