diff --git a/csparql-core/pom.xml b/csparql-core/pom.xml index ed04b50..030a7b3 100644 --- a/csparql-core/pom.xml +++ b/csparql-core/pom.xml @@ -35,14 +35,14 @@ --> +License, Version 2.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software distributed +under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES +OR CONDITIONS OF ANY KIND, either express or implied. See the License for +the specific language governing permissions and limitations under the License. --> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 eu.larkc.csparql @@ -92,4 +92,21 @@ ${project.version} + + + + + org.codehaus.mojo + javacc-maven-plugin + 2.6 + + + + javacc + + + + + + diff --git a/csparql-core/src/main/java/eu/larkc/csparql/core/new_parser/CsparqlParser.java b/csparql-core/src/main/java/eu/larkc/csparql/core/new_parser/CsparqlParser.java deleted file mode 100644 index a09fb90..0000000 --- a/csparql-core/src/main/java/eu/larkc/csparql/core/new_parser/CsparqlParser.java +++ /dev/null @@ -1,1585 +0,0 @@ -/** - * Copyright 2011-2015 DEIB - Politecnico di Milano - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Acknowledgements: - * We would like to thank Davide Barbieri, Emanuele Della Valle, - * Marco Balduini, Soheila Dehghanzadeh, Shen Gao, and - * Daniele Dell'Aglio for the effort in the development of the software. - * - * This work is partially supported by - * - the European LarKC project (FP7-215535) of DEIB, Politecnico di - * Milano - * - the ERC grant “Search Computing” awarded to prof. Stefano Ceri - * - the European ModaClouds project (FP7-ICT-2011-8-318484) of DEIB, - * Politecnico di Milano - * - the IBM Faculty Award 2013 grated to prof. Emanuele Della Valle; - * - the City Data Fusion for Event Management 2013 project funded - * by EIT Digital of DEIB, Politecnico di Milano - * - the Dynamic and Distributed Information Systems Group of the - * University of Zurich; - * - INSIGHT NUIG and Science Foundation Ireland (SFI) under grant - * No. SFI/12/RC/2289 - */ -/* Generated By:JavaCC: Do not edit this line. CsparqlParser.java */ -package eu.larkc.csparql.core.new_parser ; - -import java.io.StringReader; - -import eu.larkc.csparql.core.new_parser.utility_files.*; - -public class CsparqlParser extends CsparqlParserBase implements CsparqlParserConstants { - -public static CsparqlParser createAndParse(String queryString) throws ParseException{ - CsparqlParser parser = new CsparqlParser(new StringReader(TextUtilities.queryTextEnhancer(queryString))); -// System.out.println(TextUtilities.queryTextEnhancer(queryString)); - parser.Query(); - return parser; - } - - final public void Query() throws ParseException { - RegisterClause(); - label_1: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case PREFIX: - case BASE: - ; - break; - default: - jj_la1[0] = jj_gen; - break label_1; - } - Prologue(); - } - if (jj_2_1(5)) { - SelectClause(); - } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case CONSTRUCT: - ConstructClause(); - break; - case DESCRIBE: - DescribeClause(); - break; - case ASK: - AskClause(); - break; - default: - jj_la1[1] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - label_2: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case FROM: - ; - break; - default: - jj_la1[2] = jj_gen; - break label_2; - } - if (jj_2_2(5)) { - FromClause(); - } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case FROM: - FromStreamClause(); - break; - default: - jj_la1[3] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case WHERE: - WhereClause(); - break; - default: - jj_la1[4] = jj_gen; - ; - } - setSparqlQuery(sparqlQuery) ; - jj_consume_token(0); - } - - final public void Prologue() throws ParseException { - Token t; - if (jj_2_4(2)) { - t = jj_consume_token(PREFIX); - sparqlQuery = sparqlQuery + t.image ; - label_3: - while (true) { - if (jj_2_3(2)) { - t = jj_consume_token(SINGLELETTERTEXT); - sparqlQuery = sparqlQuery + t.image ; - } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case NUMBERS: - t = jj_consume_token(NUMBERS); - sparqlQuery = sparqlQuery + t.image ; - break; - case SYMBOL: - t = jj_consume_token(SYMBOL); - sparqlQuery = sparqlQuery + t.image ; - break; - default: - jj_la1[5] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SINGLELETTERTEXT: - case NUMBERS: - case SYMBOL: - ; - break; - default: - jj_la1[6] = jj_gen; - break label_3; - } - } - label_4: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SPACE: - ; - break; - default: - jj_la1[7] = jj_gen; - break label_4; - } - t = jj_consume_token(SPACE); - sparqlQuery = sparqlQuery + t.image ; - } - t = jj_consume_token(IRIref); - sparqlQuery = sparqlQuery + t.image ; - } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case BASE: - t = jj_consume_token(BASE); - sparqlQuery = sparqlQuery + t.image ; - t = jj_consume_token(IRIref); - sparqlQuery = sparqlQuery + t.image ; - break; - default: - jj_la1[8] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - label_5: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SPACE: - ; - break; - default: - jj_la1[9] = jj_gen; - break label_5; - } - t = jj_consume_token(SPACE); - sparqlQuery = sparqlQuery + t.image ; - } - sparqlQuery = sparqlQuery + "\u005cn"; - } - - final public void RegisterClause() throws ParseException { - Token t ; String queryName =""; - if (jj_2_5(3)) { - jj_consume_token(REGISTERSTREAM); - setOutputIsStream(true); - } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case REGISTERQUERY: - jj_consume_token(REGISTERQUERY); - setOutputIsStream(false); - break; - default: - jj_la1[10] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - label_6: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SINGLELETTERTEXT: - t = jj_consume_token(SINGLELETTERTEXT); - queryName = queryName + t.image ; - break; - case NUMBERS: - t = jj_consume_token(NUMBERS); - queryName = queryName + t.image ; - break; - default: - jj_la1[11] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SINGLELETTERTEXT: - case NUMBERS: - ; - break; - default: - jj_la1[12] = jj_gen; - break label_6; - } - } - jj_consume_token(SPACE); - jj_consume_token(AS); - setCsparqlQueryName(queryName.trim()); - label_7: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SPACE: - ; - break; - default: - jj_la1[13] = jj_gen; - break label_7; - } - jj_consume_token(SPACE); - } - } - - final public void AddClause() throws ParseException { - Token t; - t = jj_consume_token(ADD); - sparqlQuery = sparqlQuery + t.image ; - label_8: - while (true) { - label_9: - while (true) { - if (jj_2_6(2)) { - t = jj_consume_token(AS); - sparqlQuery = sparqlQuery + t.image ; - } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SINGLELETTERTEXT: - t = jj_consume_token(SINGLELETTERTEXT); - sparqlQuery = sparqlQuery + t.image ; - break; - case SYMBOL: - t = jj_consume_token(SYMBOL); - sparqlQuery = sparqlQuery + t.image ; - break; - case NUMBERS: - t = jj_consume_token(NUMBERS); - sparqlQuery = sparqlQuery + t.image ; - break; - default: - jj_la1[14] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SINGLELETTERTEXT: - case NUMBERS: - case SYMBOL: - case AS: - ; - break; - default: - jj_la1[15] = jj_gen; - break label_9; - } - } - t = jj_consume_token(SPACE); - sparqlQuery = sparqlQuery + t.image ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SINGLELETTERTEXT: - case NUMBERS: - case SYMBOL: - case AS: - ; - break; - default: - jj_la1[16] = jj_gen; - break label_8; - } - } - sparqlQuery = sparqlQuery + "\u005cn"; - } - - final public void DescribeClause() throws ParseException { - Token t; - t = jj_consume_token(DESCRIBE); - sparqlQuery = sparqlQuery + t.image ; - label_10: - while (true) { - label_11: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case ADD: - t = jj_consume_token(ADD); - sparqlQuery = sparqlQuery + t.image ; - break; - case CONSTRUCT: - t = jj_consume_token(CONSTRUCT); - sparqlQuery = sparqlQuery + t.image ; - break; - case SELECT: - t = jj_consume_token(SELECT); - sparqlQuery = sparqlQuery + t.image ; - break; - case AS: - t = jj_consume_token(AS); - sparqlQuery = sparqlQuery + t.image ; - break; - case SINGLELETTERTEXT: - t = jj_consume_token(SINGLELETTERTEXT); - sparqlQuery = sparqlQuery + t.image ; - break; - case SYMBOL: - t = jj_consume_token(SYMBOL); - sparqlQuery = sparqlQuery + t.image ; - break; - case NUMBERS: - t = jj_consume_token(NUMBERS); - sparqlQuery = sparqlQuery + t.image ; - break; - default: - jj_la1[17] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SELECT: - case ADD: - case CONSTRUCT: - case SINGLELETTERTEXT: - case NUMBERS: - case SYMBOL: - case AS: - ; - break; - default: - jj_la1[18] = jj_gen; - break label_11; - } - } - t = jj_consume_token(SPACE); - sparqlQuery = sparqlQuery + t.image ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SELECT: - case ADD: - case CONSTRUCT: - case SINGLELETTERTEXT: - case NUMBERS: - case SYMBOL: - case AS: - ; - break; - default: - jj_la1[19] = jj_gen; - break label_10; - } - } - label_12: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SPACE: - ; - break; - default: - jj_la1[20] = jj_gen; - break label_12; - } - t = jj_consume_token(SPACE); - sparqlQuery = sparqlQuery + t.image ; - } - sparqlQuery = sparqlQuery + "\u005cn"; - } - - final public void AskClause() throws ParseException { - Token t; - t = jj_consume_token(ASK); - sparqlQuery = sparqlQuery + t.image ; - sparqlQuery = sparqlQuery + "\u005cn"; - } - - final public void SelectClause() throws ParseException { - Token t; - t = jj_consume_token(SELECT); - sparqlQuery = sparqlQuery + t.image ; - label_13: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SINGLELETTERTEXT: - case NUMBERS: - case SYMBOL: - case IRIref: - case SPACE: - case AS: - ; - break; - default: - jj_la1[21] = jj_gen; - break label_13; - } - if (jj_2_7(3)) { - t = jj_consume_token(SINGLELETTERTEXT); - sparqlQuery = sparqlQuery + t.image ; - } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SYMBOL: - t = jj_consume_token(SYMBOL); - sparqlQuery = sparqlQuery + t.image ; - break; - case NUMBERS: - t = jj_consume_token(NUMBERS); - sparqlQuery = sparqlQuery + t.image ; - break; - case IRIref: - t = jj_consume_token(IRIref); - sparqlQuery = sparqlQuery + t.image ; - break; - case SPACE: - t = jj_consume_token(SPACE); - sparqlQuery = sparqlQuery + t.image ; - break; - case AS: - t = jj_consume_token(AS); - sparqlQuery = sparqlQuery + t.image ; - break; - default: - jj_la1[22] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - } - sparqlQuery = sparqlQuery + "\u005cn"; - } - - final public void ConstructClause() throws ParseException { - Token t; - t = jj_consume_token(CONSTRUCT); - sparqlQuery = sparqlQuery + t.image ; - label_14: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SINGLELETTERTEXT: - case NUMBERS: - case SYMBOL: - case IRIref: - case SPACE: - ; - break; - default: - jj_la1[23] = jj_gen; - break label_14; - } - if (jj_2_8(3)) { - t = jj_consume_token(SINGLELETTERTEXT); - sparqlQuery = sparqlQuery + t.image ; - } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SYMBOL: - t = jj_consume_token(SYMBOL); - sparqlQuery = sparqlQuery + t.image ; - break; - case NUMBERS: - t = jj_consume_token(NUMBERS); - sparqlQuery = sparqlQuery + t.image ; - break; - case IRIref: - t = jj_consume_token(IRIref); - sparqlQuery = sparqlQuery + t.image ; - break; - case SPACE: - t = jj_consume_token(SPACE); - sparqlQuery = sparqlQuery + t.image ; - break; - default: - jj_la1[24] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - } - sparqlQuery = sparqlQuery + "\u005cn"; - } - - final public void FromClause() throws ParseException { - Token t; - t = jj_consume_token(FROM); - sparqlQuery = sparqlQuery + t.image ; - //t = " " { s = s + t.image ; } - //((t = { s = s + t.image ; } | t = { s = s + t.image ; })+ t = " " { s = s + t.image ; })+ - t = jj_consume_token(IRIref); - sparqlQuery = sparqlQuery + t.image ; - label_15: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SPACE: - ; - break; - default: - jj_la1[25] = jj_gen; - break label_15; - } - t = jj_consume_token(SPACE); - sparqlQuery = sparqlQuery + t.image ; - } - sparqlQuery = sparqlQuery + "\u005cn"; - } - - final public void FromStreamClause() throws ParseException { - Token t ; String streamName =""; String s1 =""; - Window window; - jj_consume_token(FROM); - label_16: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case NAMED: - ; - break; - default: - jj_la1[26] = jj_gen; - break label_16; - } - jj_consume_token(NAMED); - } - jj_consume_token(STREAM); - t = jj_consume_token(IRIref); - streamName = t.image ; - jj_consume_token(SPACE); - label_17: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SPACE: - ; - break; - default: - jj_la1[27] = jj_gen; - break label_17; - } - jj_consume_token(SPACE); - } - jj_consume_token(RANGE); - window = Window(); - jj_consume_token(SYMBOL); - label_18: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SPACE: - ; - break; - default: - jj_la1[28] = jj_gen; - break label_18; - } - jj_consume_token(SPACE); - } - StreamInfo si = new StreamInfo(streamName,window) ; - addStreams(si); - } - - final public Window Window() throws ParseException { - Window window; - if (jj_2_9(2)) { - window = LogicalWindow(); - {if (true) return window;} - } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SPACE: - case TRIPLES: - window = PhysicalWindow(); - {if (true) return window;} - break; - default: - jj_la1[29] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - throw new Error("Missing return statement in function"); - } - - final public TimeUnit TimeUnit() throws ParseException { - Token t; String timeunit = ""; - label_19: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SPACE: - ; - break; - default: - jj_la1[30] = jj_gen; - break label_19; - } - t = jj_consume_token(SPACE); - timeunit = timeunit + t.image ; - } - t = jj_consume_token(SINGLELETTERTEXT); - timeunit = timeunit + t.image ; - if(!timeunit.equals("ms") && !timeunit.equals("s") && !timeunit.equals("m") && !timeunit.equals("h") && !timeunit.equals("d")) - {if (true) throw new ParseException();} - {if (true) return TimeUnit.getUnitOfMeasure(timeunit);} - throw new Error("Missing return statement in function"); - } - - final public TimeIntervalDescription WindowOverlap() throws ParseException { - Token t; String tempStepValue = ""; - TimeIntervalDescription stepDescription = new TimeIntervalDescription(); - TimeUnit tm; - label_20: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SPACE: - ; - break; - default: - jj_la1[31] = jj_gen; - break label_20; - } - t = jj_consume_token(SPACE); - } - if (jj_2_10(2)) { - t = jj_consume_token(STEP); - label_21: - while (true) { - t = jj_consume_token(NUMBERS); - tempStepValue = tempStepValue + t.image ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case NUMBERS: - ; - break; - default: - jj_la1[32] = jj_gen; - break label_21; - } - } - tm = TimeUnit(); - stepDescription.setTimeUnit(tm) ; stepDescription.setValue(Integer.parseInt(tempStepValue)); {if (true) return stepDescription;} - } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case TUMBLING: - t = jj_consume_token(TUMBLING); - {if (true) return null;} - break; - default: - jj_la1[33] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - throw new Error("Missing return statement in function"); - } - - final public LogicalWindow LogicalWindow() throws ParseException { - Token t; String tempRangeValue = ""; - label_22: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SPACE: - ; - break; - default: - jj_la1[34] = jj_gen; - break label_22; - } - jj_consume_token(SPACE); - } - TimeIntervalDescription rangeDescription = new TimeIntervalDescription(); - TimeIntervalDescription stepDescription = new TimeIntervalDescription(); - TimeUnit tm; - boolean isTumbling; - label_23: - while (true) { - t = jj_consume_token(NUMBERS); - tempRangeValue = tempRangeValue + t.image ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case NUMBERS: - ; - break; - default: - jj_la1[35] = jj_gen; - break label_23; - } - } - tm = TimeUnit(); - stepDescription = WindowOverlap(); - rangeDescription.setTimeUnit(tm) ; - rangeDescription.setValue(Integer.parseInt(tempRangeValue)); - if(stepDescription == null) - isTumbling = true; - else - isTumbling = false; - - {if (true) return new LogicalWindow(rangeDescription,stepDescription,isTumbling) ;} - throw new Error("Missing return statement in function"); - } - - final public PhysicalWindow PhysicalWindow() throws ParseException { - Token t; String windowRange = ""; - label_24: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SPACE: - ; - break; - default: - jj_la1[36] = jj_gen; - break label_24; - } - t = jj_consume_token(SPACE); - } - t = jj_consume_token(TRIPLES); - label_25: - while (true) { - t = jj_consume_token(NUMBERS); - windowRange = windowRange + t.image ; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case NUMBERS: - ; - break; - default: - jj_la1[37] = jj_gen; - break label_25; - } - } - {if (true) return new PhysicalWindow(Integer.parseInt(windowRange)) ;} - throw new Error("Missing return statement in function"); - } - - final public void WhereClause() throws ParseException { - Token t; - t = jj_consume_token(WHERE); - sparqlQuery = sparqlQuery + t.image ; - if (jj_2_12(5)) { - label_26: - while (true) { - if (jj_2_11(5)) { - t = jj_consume_token(SPACE); - sparqlQuery = sparqlQuery + t.image ; - label_27: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SINGLELETTERTEXT: - t = jj_consume_token(SINGLELETTERTEXT); - sparqlQuery = sparqlQuery + t.image ; - break; - case SYMBOL: - t = jj_consume_token(SYMBOL); - sparqlQuery = sparqlQuery + t.image ; - break; - case NUMBERS: - t = jj_consume_token(NUMBERS); - sparqlQuery = sparqlQuery + t.image ; - break; - case IRIref: - t = jj_consume_token(IRIref); - sparqlQuery = sparqlQuery + t.image ; - break; - case SELECT: - t = jj_consume_token(SELECT); - sparqlQuery = sparqlQuery + t.image ; - break; - case AS: - t = jj_consume_token(AS); - sparqlQuery = sparqlQuery + t.image ; - break; - case WHERE: - t = jj_consume_token(WHERE); - sparqlQuery = sparqlQuery + t.image ; - break; - default: - jj_la1[38] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SELECT: - case WHERE: - case SINGLELETTERTEXT: - case NUMBERS: - case SYMBOL: - case IRIref: - case AS: - ; - break; - default: - jj_la1[39] = jj_gen; - break label_27; - } - } - } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SPACE: - t = jj_consume_token(SPACE); - sparqlQuery = sparqlQuery + t.image ; - break; - default: - jj_la1[40] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SPACE: - ; - break; - default: - jj_la1[41] = jj_gen; - break label_26; - } - } - } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SYMBOL: - t = jj_consume_token(SYMBOL); - sparqlQuery = sparqlQuery + t.image ; - label_28: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SELECT: - case WHERE: - case SINGLELETTERTEXT: - case NUMBERS: - case SYMBOL: - case IRIref: - case SPACE: - case AS: - ; - break; - default: - jj_la1[42] = jj_gen; - break label_28; - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SINGLELETTERTEXT: - t = jj_consume_token(SINGLELETTERTEXT); - sparqlQuery = sparqlQuery + t.image ; - break; - case SYMBOL: - t = jj_consume_token(SYMBOL); - sparqlQuery = sparqlQuery + t.image ; - break; - case NUMBERS: - t = jj_consume_token(NUMBERS); - sparqlQuery = sparqlQuery + t.image ; - break; - case IRIref: - t = jj_consume_token(IRIref); - sparqlQuery = sparqlQuery + t.image ; - break; - case SELECT: - t = jj_consume_token(SELECT); - sparqlQuery = sparqlQuery + t.image ; - break; - case AS: - t = jj_consume_token(AS); - sparqlQuery = sparqlQuery + t.image ; - break; - case WHERE: - t = jj_consume_token(WHERE); - sparqlQuery = sparqlQuery + t.image ; - break; - case SPACE: - t = jj_consume_token(SPACE); - sparqlQuery = sparqlQuery + t.image ; - break; - default: - jj_la1[43] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - break; - default: - jj_la1[44] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - sparqlQuery = sparqlQuery + "\u005cn"; - } - - private boolean jj_2_1(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_1(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(0, xla); } - } - - private boolean jj_2_2(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_2(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(1, xla); } - } - - private boolean jj_2_3(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_3(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(2, xla); } - } - - private boolean jj_2_4(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_4(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(3, xla); } - } - - private boolean jj_2_5(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_5(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(4, xla); } - } - - private boolean jj_2_6(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_6(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(5, xla); } - } - - private boolean jj_2_7(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_7(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(6, xla); } - } - - private boolean jj_2_8(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_8(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(7, xla); } - } - - private boolean jj_2_9(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_9(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(8, xla); } - } - - private boolean jj_2_10(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_10(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(9, xla); } - } - - private boolean jj_2_11(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_11(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(10, xla); } - } - - private boolean jj_2_12(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_12(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(11, xla); } - } - - private boolean jj_3R_55() { - if (jj_scan_token(SPACE)) return true; - return false; - } - - private boolean jj_3R_41() { - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_55()) { jj_scanpos = xsp; break; } - } - if (jj_scan_token(SINGLELETTERTEXT)) return true; - return false; - } - - private boolean jj_3_6() { - if (jj_scan_token(AS)) return true; - return false; - } - - private boolean jj_3R_38() { - if (jj_scan_token(NUMBERS)) return true; - return false; - } - - private boolean jj_3_9() { - if (jj_3R_32()) return true; - return false; - } - - private boolean jj_3_5() { - if (jj_scan_token(REGISTERSTREAM)) return true; - return false; - } - - private boolean jj_3R_31() { - Token xsp; - xsp = jj_scanpos; - if (jj_3_3()) { - jj_scanpos = xsp; - if (jj_3R_38()) { - jj_scanpos = xsp; - if (jj_3R_39()) return true; - } - } - return false; - } - - private boolean jj_3_3() { - if (jj_scan_token(SINGLELETTERTEXT)) return true; - return false; - } - - private boolean jj_3R_49() { - if (jj_scan_token(SPACE)) return true; - return false; - } - - private boolean jj_3R_39() { - if (jj_scan_token(SYMBOL)) return true; - return false; - } - - private boolean jj_3R_48() { - if (jj_scan_token(WHERE)) return true; - return false; - } - - private boolean jj_3R_47() { - if (jj_scan_token(AS)) return true; - return false; - } - - private boolean jj_3R_46() { - if (jj_scan_token(SELECT)) return true; - return false; - } - - private boolean jj_3R_45() { - if (jj_scan_token(IRIref)) return true; - return false; - } - - private boolean jj_3R_37() { - if (jj_scan_token(SPACE)) return true; - return false; - } - - private boolean jj_3R_44() { - if (jj_scan_token(NUMBERS)) return true; - return false; - } - - private boolean jj_3R_43() { - if (jj_scan_token(SYMBOL)) return true; - return false; - } - - private boolean jj_3_4() { - if (jj_scan_token(PREFIX)) return true; - Token xsp; - if (jj_3R_31()) return true; - while (true) { - xsp = jj_scanpos; - if (jj_3R_31()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_34() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_42()) { - jj_scanpos = xsp; - if (jj_3R_43()) { - jj_scanpos = xsp; - if (jj_3R_44()) { - jj_scanpos = xsp; - if (jj_3R_45()) { - jj_scanpos = xsp; - if (jj_3R_46()) { - jj_scanpos = xsp; - if (jj_3R_47()) { - jj_scanpos = xsp; - if (jj_3R_48()) return true; - } - } - } - } - } - } - return false; - } - - private boolean jj_3R_42() { - if (jj_scan_token(SINGLELETTERTEXT)) return true; - return false; - } - - private boolean jj_3R_30() { - if (jj_scan_token(FROM)) return true; - if (jj_scan_token(IRIref)) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_37()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3_8() { - if (jj_scan_token(SINGLELETTERTEXT)) return true; - return false; - } - - private boolean jj_3_11() { - if (jj_scan_token(SPACE)) return true; - Token xsp; - if (jj_3R_34()) return true; - while (true) { - xsp = jj_scanpos; - if (jj_3R_34()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_35() { - Token xsp; - xsp = jj_scanpos; - if (jj_3_11()) { - jj_scanpos = xsp; - if (jj_3R_49()) return true; - } - return false; - } - - private boolean jj_3R_54() { - if (jj_scan_token(AS)) return true; - return false; - } - - private boolean jj_3R_53() { - if (jj_scan_token(SPACE)) return true; - return false; - } - - private boolean jj_3_12() { - Token xsp; - if (jj_3R_35()) return true; - while (true) { - xsp = jj_scanpos; - if (jj_3R_35()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_52() { - if (jj_scan_token(IRIref)) return true; - return false; - } - - private boolean jj_3_2() { - if (jj_3R_30()) return true; - return false; - } - - private boolean jj_3R_51() { - if (jj_scan_token(NUMBERS)) return true; - return false; - } - - private boolean jj_3R_50() { - if (jj_scan_token(SYMBOL)) return true; - return false; - } - - private boolean jj_3_1() { - if (jj_3R_29()) return true; - return false; - } - - private boolean jj_3_7() { - if (jj_scan_token(SINGLELETTERTEXT)) return true; - return false; - } - - private boolean jj_3R_36() { - Token xsp; - xsp = jj_scanpos; - if (jj_3_7()) { - jj_scanpos = xsp; - if (jj_3R_50()) { - jj_scanpos = xsp; - if (jj_3R_51()) { - jj_scanpos = xsp; - if (jj_3R_52()) { - jj_scanpos = xsp; - if (jj_3R_53()) { - jj_scanpos = xsp; - if (jj_3R_54()) return true; - } - } - } - } - } - return false; - } - - private boolean jj_3R_29() { - if (jj_scan_token(SELECT)) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_36()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_40() { - if (jj_scan_token(NUMBERS)) return true; - return false; - } - - private boolean jj_3R_32() { - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_scan_token(18)) { jj_scanpos = xsp; break; } - } - if (jj_3R_40()) return true; - while (true) { - xsp = jj_scanpos; - if (jj_3R_40()) { jj_scanpos = xsp; break; } - } - if (jj_3R_41()) return true; - return false; - } - - private boolean jj_3R_33() { - if (jj_scan_token(NUMBERS)) return true; - return false; - } - - private boolean jj_3_10() { - if (jj_scan_token(STEP)) return true; - Token xsp; - if (jj_3R_33()) return true; - while (true) { - xsp = jj_scanpos; - if (jj_3R_33()) { jj_scanpos = xsp; break; } - } - return false; - } - - /** Generated Token Manager. */ - public CsparqlParserTokenManager token_source; - SimpleCharStream jj_input_stream; - /** Current token. */ - public Token token; - /** Next token. */ - public Token jj_nt; - private int jj_ntk; - private Token jj_scanpos, jj_lastpos; - private int jj_la; - private int jj_gen; - final private int[] jj_la1 = new int[45]; - static private int[] jj_la1_0; - static { - jj_la1_init_0(); - } - private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0x60,0xd00,0x1000,0x1000,0x2000,0x18000,0x1c000,0x40000,0x40,0x40000,0x100000,0xc000,0xc000,0x40000,0x1c000,0x41c000,0x41c000,0x41ca80,0x41ca80,0x41ca80,0x40000,0x47c000,0x478000,0x7c000,0x78000,0x40000,0x800000,0x40000,0x40000,0x8040000,0x40000,0x40000,0x8000,0x4000000,0x40000,0x8000,0x40000,0x8000,0x43e080,0x43e080,0x40000,0x40000,0x47e080,0x47e080,0x10000,}; - } - final private JJCalls[] jj_2_rtns = new JJCalls[12]; - private boolean jj_rescan = false; - private int jj_gc = 0; - - /** Constructor with InputStream. */ - public CsparqlParser(java.io.InputStream stream) { - this(stream, null); - } - /** Constructor with InputStream and supplied encoding */ - public CsparqlParser(java.io.InputStream stream, String encoding) { - try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source = new CsparqlParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 45; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - /** Reinitialise. */ - public void ReInit(java.io.InputStream stream) { - ReInit(stream, null); - } - /** Reinitialise. */ - public void ReInit(java.io.InputStream stream, String encoding) { - try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 45; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - /** Constructor. */ - public CsparqlParser(java.io.Reader stream) { - jj_input_stream = new SimpleCharStream(stream, 1, 1); - token_source = new CsparqlParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 45; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - /** Reinitialise. */ - public void ReInit(java.io.Reader stream) { - jj_input_stream.ReInit(stream, 1, 1); - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 45; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - /** Constructor with generated Token Manager. */ - public CsparqlParser(CsparqlParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 45; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - /** Reinitialise. */ - public void ReInit(CsparqlParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 45; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - private Token jj_consume_token(int kind) throws ParseException { - Token oldToken; - if ((oldToken = token).next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - if (token.kind == kind) { - jj_gen++; - if (++jj_gc > 100) { - jj_gc = 0; - for (int i = 0; i < jj_2_rtns.length; i++) { - JJCalls c = jj_2_rtns[i]; - while (c != null) { - if (c.gen < jj_gen) c.first = null; - c = c.next; - } - } - } - return token; - } - token = oldToken; - jj_kind = kind; - throw generateParseException(); - } - -static private final class LookaheadSuccess extends java.lang.Error { } - final private LookaheadSuccess jj_ls = new LookaheadSuccess(); - private boolean jj_scan_token(int kind) { - if (jj_scanpos == jj_lastpos) { - jj_la--; - if (jj_scanpos.next == null) { - jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); - } else { - jj_lastpos = jj_scanpos = jj_scanpos.next; - } - } else { - jj_scanpos = jj_scanpos.next; - } - if (jj_rescan) { - int i = 0; Token tok = token; - while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } - if (tok != null) jj_add_error_token(kind, i); - } - if (jj_scanpos.kind != kind) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; - return false; - } - - -/** Get the next Token. */ - final public Token getNextToken() { - if (token.next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - jj_gen++; - return token; - } - -/** Get the specific Token. */ - final public Token getToken(int index) { - Token t = token; - for (int i = 0; i < index; i++) { - if (t.next != null) t = t.next; - else t = t.next = token_source.getNextToken(); - } - return t; - } - - private int jj_ntk() { - if ((jj_nt=token.next) == null) - return (jj_ntk = (token.next=token_source.getNextToken()).kind); - else - return (jj_ntk = jj_nt.kind); - } - - private java.util.List jj_expentries = new java.util.ArrayList(); - private int[] jj_expentry; - private int jj_kind = -1; - private int[] jj_lasttokens = new int[100]; - private int jj_endpos; - - private void jj_add_error_token(int kind, int pos) { - if (pos >= 100) return; - if (pos == jj_endpos + 1) { - jj_lasttokens[jj_endpos++] = kind; - } else if (jj_endpos != 0) { - jj_expentry = new int[jj_endpos]; - for (int i = 0; i < jj_endpos; i++) { - jj_expentry[i] = jj_lasttokens[i]; - } - jj_entries_loop: for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) { - int[] oldentry = (int[])(it.next()); - if (oldentry.length == jj_expentry.length) { - for (int i = 0; i < jj_expentry.length; i++) { - if (oldentry[i] != jj_expentry[i]) { - continue jj_entries_loop; - } - } - jj_expentries.add(jj_expentry); - break jj_entries_loop; - } - } - if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; - } - } - - /** Generate ParseException. */ - public ParseException generateParseException() { - jj_expentries.clear(); - boolean[] la1tokens = new boolean[28]; - if (jj_kind >= 0) { - la1tokens[jj_kind] = true; - jj_kind = -1; - } - for (int i = 0; i < 45; i++) { - if (jj_la1[i] == jj_gen) { - for (int j = 0; j < 32; j++) { - if ((jj_la1_0[i] & (1< jj_gen) { - jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; - switch (i) { - case 0: jj_3_1(); break; - case 1: jj_3_2(); break; - case 2: jj_3_3(); break; - case 3: jj_3_4(); break; - case 4: jj_3_5(); break; - case 5: jj_3_6(); break; - case 6: jj_3_7(); break; - case 7: jj_3_8(); break; - case 8: jj_3_9(); break; - case 9: jj_3_10(); break; - case 10: jj_3_11(); break; - case 11: jj_3_12(); break; - } - } - p = p.next; - } while (p != null); - } catch(LookaheadSuccess ls) { } - } - jj_rescan = false; - } - - private void jj_save(int index, int xla) { - JJCalls p = jj_2_rtns[index]; - while (p.gen > jj_gen) { - if (p.next == null) { p = p.next = new JJCalls(); break; } - p = p.next; - } - p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; - } - - static final class JJCalls { - int gen; - Token first; - int arg; - JJCalls next; - } - -} diff --git a/csparql-core/src/main/java/eu/larkc/csparql/core/new_parser/CsparqlParserConstants.java b/csparql-core/src/main/java/eu/larkc/csparql/core/new_parser/CsparqlParserConstants.java deleted file mode 100644 index e90b844..0000000 --- a/csparql-core/src/main/java/eu/larkc/csparql/core/new_parser/CsparqlParserConstants.java +++ /dev/null @@ -1,129 +0,0 @@ -/** - * Copyright 2011-2015 DEIB - Politecnico di Milano - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Acknowledgements: - * We would like to thank Davide Barbieri, Emanuele Della Valle, - * Marco Balduini, Soheila Dehghanzadeh, Shen Gao, and - * Daniele Dell'Aglio for the effort in the development of the software. - * - * This work is partially supported by - * - the European LarKC project (FP7-215535) of DEIB, Politecnico di - * Milano - * - the ERC grant “Search Computing” awarded to prof. Stefano Ceri - * - the European ModaClouds project (FP7-ICT-2011-8-318484) of DEIB, - * Politecnico di Milano - * - the IBM Faculty Award 2013 grated to prof. Emanuele Della Valle; - * - the City Data Fusion for Event Management 2013 project funded - * by EIT Digital of DEIB, Politecnico di Milano - * - the Dynamic and Distributed Information Systems Group of the - * University of Zurich; - * - INSIGHT NUIG and Science Foundation Ireland (SFI) under grant - * No. SFI/12/RC/2289 - */ -/* Generated By:JavaCC: Do not edit this line. CsparqlParserConstants.java */ -package eu.larkc.csparql.core.new_parser ; - - -/** - * Token literal values and constants. - * Generated by org.javacc.parser.OtherFilesGen#start() - */ -public interface CsparqlParserConstants { - - /** End of File. */ - int EOF = 0; - /** RegularExpression Id. */ - int PREFIX = 5; - /** RegularExpression Id. */ - int BASE = 6; - /** RegularExpression Id. */ - int SELECT = 7; - /** RegularExpression Id. */ - int DESCRIBE = 8; - /** RegularExpression Id. */ - int ADD = 9; - /** RegularExpression Id. */ - int ASK = 10; - /** RegularExpression Id. */ - int CONSTRUCT = 11; - /** RegularExpression Id. */ - int FROM = 12; - /** RegularExpression Id. */ - int WHERE = 13; - /** RegularExpression Id. */ - int SINGLELETTERTEXT = 14; - /** RegularExpression Id. */ - int NUMBERS = 15; - /** RegularExpression Id. */ - int SYMBOL = 16; - /** RegularExpression Id. */ - int IRIref = 17; - /** RegularExpression Id. */ - int SPACE = 18; - /** RegularExpression Id. */ - int REGISTERSTREAM = 19; - /** RegularExpression Id. */ - int REGISTERQUERY = 20; - /** RegularExpression Id. */ - int STREAM = 21; - /** RegularExpression Id. */ - int AS = 22; - /** RegularExpression Id. */ - int NAMED = 23; - /** RegularExpression Id. */ - int RANGE = 24; - /** RegularExpression Id. */ - int STEP = 25; - /** RegularExpression Id. */ - int TUMBLING = 26; - /** RegularExpression Id. */ - int TRIPLES = 27; - - /** Lexical state. */ - int DEFAULT = 0; - - /** Literal token values. */ - String[] tokenImage = { - "", - "\"\\t\"", - "\"\\n\"", - "\"\\r\"", - "\"\\f\"", - "\"prefix \"", - "\"base \"", - "\"select \"", - "\"describe \"", - "\"add \"", - "\"ask \"", - "\"construct \"", - "\" from \"", - "\"where {\"", - "", - "", - "", - "", - "\" \"", - "\"register stream \"", - "\"register query \"", - "\"stream \"", - "\"as \"", - "\"named \"", - "\"[range \"", - "\"step \"", - "\"tumbling \"", - "\"triples \"", - }; - -} diff --git a/csparql-core/src/main/java/eu/larkc/csparql/core/new_parser/CsparqlParserTokenManager.java b/csparql-core/src/main/java/eu/larkc/csparql/core/new_parser/CsparqlParserTokenManager.java deleted file mode 100644 index d303749..0000000 --- a/csparql-core/src/main/java/eu/larkc/csparql/core/new_parser/CsparqlParserTokenManager.java +++ /dev/null @@ -1,1056 +0,0 @@ -/** - * Copyright 2011-2015 DEIB - Politecnico di Milano - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Acknowledgements: - * We would like to thank Davide Barbieri, Emanuele Della Valle, - * Marco Balduini, Soheila Dehghanzadeh, Shen Gao, and - * Daniele Dell'Aglio for the effort in the development of the software. - * - * This work is partially supported by - * - the European LarKC project (FP7-215535) of DEIB, Politecnico di - * Milano - * - the ERC grant “Search Computing” awarded to prof. Stefano Ceri - * - the European ModaClouds project (FP7-ICT-2011-8-318484) of DEIB, - * Politecnico di Milano - * - the IBM Faculty Award 2013 grated to prof. Emanuele Della Valle; - * - the City Data Fusion for Event Management 2013 project funded - * by EIT Digital of DEIB, Politecnico di Milano - * - the Dynamic and Distributed Information Systems Group of the - * University of Zurich; - * - INSIGHT NUIG and Science Foundation Ireland (SFI) under grant - * No. SFI/12/RC/2289 - */ -/* Generated By:JavaCC: Do not edit this line. CsparqlParserTokenManager.java */ -package eu.larkc.csparql.core.new_parser ; -import java.io.StringReader; - -import eu.larkc.csparql.core.new_parser.utility_files.*; - -/** Token Manager. */ -public class CsparqlParserTokenManager implements CsparqlParserConstants -{ - - /** Debug output. */ - public java.io.PrintStream debugStream = System.out; - /** Set debug output. */ - public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } -private int jjStopAtPos(int pos, int kind) -{ - jjmatchedKind = kind; - jjmatchedPos = pos; - return pos + 1; -} -private int jjMoveStringLiteralDfa0_0() -{ - switch(curChar) - { - case 9: - jjmatchedKind = 1; - return jjMoveNfa_0(0, 0); - case 10: - jjmatchedKind = 2; - return jjMoveNfa_0(0, 0); - case 12: - jjmatchedKind = 4; - return jjMoveNfa_0(0, 0); - case 13: - jjmatchedKind = 3; - return jjMoveNfa_0(0, 0); - case 32: - jjmatchedKind = 18; - return jjMoveStringLiteralDfa1_0(0x1000L); - case 65: - return jjMoveStringLiteralDfa1_0(0x400600L); - case 66: - return jjMoveStringLiteralDfa1_0(0x40L); - case 67: - return jjMoveStringLiteralDfa1_0(0x800L); - case 68: - return jjMoveStringLiteralDfa1_0(0x100L); - case 78: - return jjMoveStringLiteralDfa1_0(0x800000L); - case 80: - return jjMoveStringLiteralDfa1_0(0x20L); - case 82: - return jjMoveStringLiteralDfa1_0(0x180000L); - case 83: - return jjMoveStringLiteralDfa1_0(0x2200080L); - case 84: - return jjMoveStringLiteralDfa1_0(0xc000000L); - case 87: - return jjMoveStringLiteralDfa1_0(0x2000L); - case 91: - return jjMoveStringLiteralDfa1_0(0x1000000L); - case 97: - return jjMoveStringLiteralDfa1_0(0x400600L); - case 98: - return jjMoveStringLiteralDfa1_0(0x40L); - case 99: - return jjMoveStringLiteralDfa1_0(0x800L); - case 100: - return jjMoveStringLiteralDfa1_0(0x100L); - case 110: - return jjMoveStringLiteralDfa1_0(0x800000L); - case 112: - return jjMoveStringLiteralDfa1_0(0x20L); - case 114: - return jjMoveStringLiteralDfa1_0(0x180000L); - case 115: - return jjMoveStringLiteralDfa1_0(0x2200080L); - case 116: - return jjMoveStringLiteralDfa1_0(0xc000000L); - case 119: - return jjMoveStringLiteralDfa1_0(0x2000L); - default : - return jjMoveNfa_0(0, 0); - } -} -private int jjMoveStringLiteralDfa1_0(long active0) -{ - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return jjMoveNfa_0(0, 0); - } - switch(curChar) - { - case 65: - return jjMoveStringLiteralDfa2_0(active0, 0x800040L); - case 68: - return jjMoveStringLiteralDfa2_0(active0, 0x200L); - case 69: - return jjMoveStringLiteralDfa2_0(active0, 0x180180L); - case 70: - return jjMoveStringLiteralDfa2_0(active0, 0x1000L); - case 72: - return jjMoveStringLiteralDfa2_0(active0, 0x2000L); - case 79: - return jjMoveStringLiteralDfa2_0(active0, 0x800L); - case 82: - return jjMoveStringLiteralDfa2_0(active0, 0x9000020L); - case 83: - return jjMoveStringLiteralDfa2_0(active0, 0x400400L); - case 84: - return jjMoveStringLiteralDfa2_0(active0, 0x2200000L); - case 85: - return jjMoveStringLiteralDfa2_0(active0, 0x4000000L); - case 97: - return jjMoveStringLiteralDfa2_0(active0, 0x800040L); - case 100: - return jjMoveStringLiteralDfa2_0(active0, 0x200L); - case 101: - return jjMoveStringLiteralDfa2_0(active0, 0x180180L); - case 102: - return jjMoveStringLiteralDfa2_0(active0, 0x1000L); - case 104: - return jjMoveStringLiteralDfa2_0(active0, 0x2000L); - case 111: - return jjMoveStringLiteralDfa2_0(active0, 0x800L); - case 114: - return jjMoveStringLiteralDfa2_0(active0, 0x9000020L); - case 115: - return jjMoveStringLiteralDfa2_0(active0, 0x400400L); - case 116: - return jjMoveStringLiteralDfa2_0(active0, 0x2200000L); - case 117: - return jjMoveStringLiteralDfa2_0(active0, 0x4000000L); - default : - break; - } - return jjMoveNfa_0(0, 1); -} -private int jjMoveStringLiteralDfa2_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjMoveNfa_0(0, 1); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return jjMoveNfa_0(0, 1); - } - switch(curChar) - { - case 32: - if ((active0 & 0x400000L) != 0L) - { - jjmatchedKind = 22; - jjmatchedPos = 2; - } - break; - case 65: - return jjMoveStringLiteralDfa3_0(active0, 0x1000000L); - case 68: - return jjMoveStringLiteralDfa3_0(active0, 0x200L); - case 69: - return jjMoveStringLiteralDfa3_0(active0, 0x2002020L); - case 71: - return jjMoveStringLiteralDfa3_0(active0, 0x180000L); - case 73: - return jjMoveStringLiteralDfa3_0(active0, 0x8000000L); - case 75: - return jjMoveStringLiteralDfa3_0(active0, 0x400L); - case 76: - return jjMoveStringLiteralDfa3_0(active0, 0x80L); - case 77: - return jjMoveStringLiteralDfa3_0(active0, 0x4800000L); - case 78: - return jjMoveStringLiteralDfa3_0(active0, 0x800L); - case 82: - return jjMoveStringLiteralDfa3_0(active0, 0x201000L); - case 83: - return jjMoveStringLiteralDfa3_0(active0, 0x140L); - case 97: - return jjMoveStringLiteralDfa3_0(active0, 0x1000000L); - case 100: - return jjMoveStringLiteralDfa3_0(active0, 0x200L); - case 101: - return jjMoveStringLiteralDfa3_0(active0, 0x2002020L); - case 103: - return jjMoveStringLiteralDfa3_0(active0, 0x180000L); - case 105: - return jjMoveStringLiteralDfa3_0(active0, 0x8000000L); - case 107: - return jjMoveStringLiteralDfa3_0(active0, 0x400L); - case 108: - return jjMoveStringLiteralDfa3_0(active0, 0x80L); - case 109: - return jjMoveStringLiteralDfa3_0(active0, 0x4800000L); - case 110: - return jjMoveStringLiteralDfa3_0(active0, 0x800L); - case 114: - return jjMoveStringLiteralDfa3_0(active0, 0x201000L); - case 115: - return jjMoveStringLiteralDfa3_0(active0, 0x140L); - default : - break; - } - return jjMoveNfa_0(0, 2); -} -private int jjMoveStringLiteralDfa3_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjMoveNfa_0(0, 2); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return jjMoveNfa_0(0, 2); - } - switch(curChar) - { - case 32: - if ((active0 & 0x200L) != 0L) - { - jjmatchedKind = 9; - jjmatchedPos = 3; - } - else if ((active0 & 0x400L) != 0L) - { - jjmatchedKind = 10; - jjmatchedPos = 3; - } - break; - case 66: - return jjMoveStringLiteralDfa4_0(active0, 0x4000000L); - case 67: - return jjMoveStringLiteralDfa4_0(active0, 0x100L); - case 69: - return jjMoveStringLiteralDfa4_0(active0, 0xa000c0L); - case 70: - return jjMoveStringLiteralDfa4_0(active0, 0x20L); - case 73: - return jjMoveStringLiteralDfa4_0(active0, 0x180000L); - case 78: - return jjMoveStringLiteralDfa4_0(active0, 0x1000000L); - case 79: - return jjMoveStringLiteralDfa4_0(active0, 0x1000L); - case 80: - return jjMoveStringLiteralDfa4_0(active0, 0xa000000L); - case 82: - return jjMoveStringLiteralDfa4_0(active0, 0x2000L); - case 83: - return jjMoveStringLiteralDfa4_0(active0, 0x800L); - case 98: - return jjMoveStringLiteralDfa4_0(active0, 0x4000000L); - case 99: - return jjMoveStringLiteralDfa4_0(active0, 0x100L); - case 101: - return jjMoveStringLiteralDfa4_0(active0, 0xa000c0L); - case 102: - return jjMoveStringLiteralDfa4_0(active0, 0x20L); - case 105: - return jjMoveStringLiteralDfa4_0(active0, 0x180000L); - case 110: - return jjMoveStringLiteralDfa4_0(active0, 0x1000000L); - case 111: - return jjMoveStringLiteralDfa4_0(active0, 0x1000L); - case 112: - return jjMoveStringLiteralDfa4_0(active0, 0xa000000L); - case 114: - return jjMoveStringLiteralDfa4_0(active0, 0x2000L); - case 115: - return jjMoveStringLiteralDfa4_0(active0, 0x800L); - default : - break; - } - return jjMoveNfa_0(0, 3); -} -private int jjMoveStringLiteralDfa4_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjMoveNfa_0(0, 3); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return jjMoveNfa_0(0, 3); - } - switch(curChar) - { - case 32: - if ((active0 & 0x40L) != 0L) - { - jjmatchedKind = 6; - jjmatchedPos = 4; - } - else if ((active0 & 0x2000000L) != 0L) - { - jjmatchedKind = 25; - jjmatchedPos = 4; - } - break; - case 65: - return jjMoveStringLiteralDfa5_0(active0, 0x200000L); - case 67: - return jjMoveStringLiteralDfa5_0(active0, 0x80L); - case 68: - return jjMoveStringLiteralDfa5_0(active0, 0x800000L); - case 69: - return jjMoveStringLiteralDfa5_0(active0, 0x2000L); - case 71: - return jjMoveStringLiteralDfa5_0(active0, 0x1000000L); - case 73: - return jjMoveStringLiteralDfa5_0(active0, 0x20L); - case 76: - return jjMoveStringLiteralDfa5_0(active0, 0xc000000L); - case 77: - return jjMoveStringLiteralDfa5_0(active0, 0x1000L); - case 82: - return jjMoveStringLiteralDfa5_0(active0, 0x100L); - case 83: - return jjMoveStringLiteralDfa5_0(active0, 0x180000L); - case 84: - return jjMoveStringLiteralDfa5_0(active0, 0x800L); - case 97: - return jjMoveStringLiteralDfa5_0(active0, 0x200000L); - case 99: - return jjMoveStringLiteralDfa5_0(active0, 0x80L); - case 100: - return jjMoveStringLiteralDfa5_0(active0, 0x800000L); - case 101: - return jjMoveStringLiteralDfa5_0(active0, 0x2000L); - case 103: - return jjMoveStringLiteralDfa5_0(active0, 0x1000000L); - case 105: - return jjMoveStringLiteralDfa5_0(active0, 0x20L); - case 108: - return jjMoveStringLiteralDfa5_0(active0, 0xc000000L); - case 109: - return jjMoveStringLiteralDfa5_0(active0, 0x1000L); - case 114: - return jjMoveStringLiteralDfa5_0(active0, 0x100L); - case 115: - return jjMoveStringLiteralDfa5_0(active0, 0x180000L); - case 116: - return jjMoveStringLiteralDfa5_0(active0, 0x800L); - default : - break; - } - return jjMoveNfa_0(0, 4); -} -private int jjMoveStringLiteralDfa5_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjMoveNfa_0(0, 4); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return jjMoveNfa_0(0, 4); - } - switch(curChar) - { - case 32: - if ((active0 & 0x1000L) != 0L) - { - jjmatchedKind = 12; - jjmatchedPos = 5; - } - else if ((active0 & 0x800000L) != 0L) - { - jjmatchedKind = 23; - jjmatchedPos = 5; - } - return jjMoveStringLiteralDfa6_0(active0, 0x2000L); - case 69: - return jjMoveStringLiteralDfa6_0(active0, 0x9000000L); - case 73: - return jjMoveStringLiteralDfa6_0(active0, 0x4000100L); - case 77: - return jjMoveStringLiteralDfa6_0(active0, 0x200000L); - case 82: - return jjMoveStringLiteralDfa6_0(active0, 0x800L); - case 84: - return jjMoveStringLiteralDfa6_0(active0, 0x180080L); - case 88: - return jjMoveStringLiteralDfa6_0(active0, 0x20L); - case 101: - return jjMoveStringLiteralDfa6_0(active0, 0x9000000L); - case 105: - return jjMoveStringLiteralDfa6_0(active0, 0x4000100L); - case 109: - return jjMoveStringLiteralDfa6_0(active0, 0x200000L); - case 114: - return jjMoveStringLiteralDfa6_0(active0, 0x800L); - case 116: - return jjMoveStringLiteralDfa6_0(active0, 0x180080L); - case 120: - return jjMoveStringLiteralDfa6_0(active0, 0x20L); - default : - break; - } - return jjMoveNfa_0(0, 5); -} -private int jjMoveStringLiteralDfa6_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjMoveNfa_0(0, 5); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return jjMoveNfa_0(0, 5); - } - switch(curChar) - { - case 32: - if ((active0 & 0x20L) != 0L) - { - jjmatchedKind = 5; - jjmatchedPos = 6; - } - else if ((active0 & 0x80L) != 0L) - { - jjmatchedKind = 7; - jjmatchedPos = 6; - } - else if ((active0 & 0x200000L) != 0L) - { - jjmatchedKind = 21; - jjmatchedPos = 6; - } - else if ((active0 & 0x1000000L) != 0L) - { - jjmatchedKind = 24; - jjmatchedPos = 6; - } - break; - case 66: - return jjMoveStringLiteralDfa7_0(active0, 0x100L); - case 69: - return jjMoveStringLiteralDfa7_0(active0, 0x180000L); - case 78: - return jjMoveStringLiteralDfa7_0(active0, 0x4000000L); - case 83: - return jjMoveStringLiteralDfa7_0(active0, 0x8000000L); - case 85: - return jjMoveStringLiteralDfa7_0(active0, 0x800L); - case 98: - return jjMoveStringLiteralDfa7_0(active0, 0x100L); - case 101: - return jjMoveStringLiteralDfa7_0(active0, 0x180000L); - case 110: - return jjMoveStringLiteralDfa7_0(active0, 0x4000000L); - case 115: - return jjMoveStringLiteralDfa7_0(active0, 0x8000000L); - case 117: - return jjMoveStringLiteralDfa7_0(active0, 0x800L); - case 123: - if ((active0 & 0x2000L) != 0L) - { - jjmatchedKind = 13; - jjmatchedPos = 6; - } - break; - default : - break; - } - return jjMoveNfa_0(0, 6); -} -private int jjMoveStringLiteralDfa7_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjMoveNfa_0(0, 6); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return jjMoveNfa_0(0, 6); - } - switch(curChar) - { - case 32: - if ((active0 & 0x8000000L) != 0L) - { - jjmatchedKind = 27; - jjmatchedPos = 7; - } - break; - case 67: - return jjMoveStringLiteralDfa8_0(active0, 0x800L); - case 69: - return jjMoveStringLiteralDfa8_0(active0, 0x100L); - case 71: - return jjMoveStringLiteralDfa8_0(active0, 0x4000000L); - case 82: - return jjMoveStringLiteralDfa8_0(active0, 0x180000L); - case 99: - return jjMoveStringLiteralDfa8_0(active0, 0x800L); - case 101: - return jjMoveStringLiteralDfa8_0(active0, 0x100L); - case 103: - return jjMoveStringLiteralDfa8_0(active0, 0x4000000L); - case 114: - return jjMoveStringLiteralDfa8_0(active0, 0x180000L); - default : - break; - } - return jjMoveNfa_0(0, 7); -} -private int jjMoveStringLiteralDfa8_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjMoveNfa_0(0, 7); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return jjMoveNfa_0(0, 7); - } - switch(curChar) - { - case 32: - if ((active0 & 0x100L) != 0L) - { - jjmatchedKind = 8; - jjmatchedPos = 8; - } - else if ((active0 & 0x4000000L) != 0L) - { - jjmatchedKind = 26; - jjmatchedPos = 8; - } - return jjMoveStringLiteralDfa9_0(active0, 0x180000L); - case 84: - return jjMoveStringLiteralDfa9_0(active0, 0x800L); - case 116: - return jjMoveStringLiteralDfa9_0(active0, 0x800L); - default : - break; - } - return jjMoveNfa_0(0, 8); -} -private int jjMoveStringLiteralDfa9_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjMoveNfa_0(0, 8); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return jjMoveNfa_0(0, 8); - } - switch(curChar) - { - case 32: - if ((active0 & 0x800L) != 0L) - { - jjmatchedKind = 11; - jjmatchedPos = 9; - } - break; - case 81: - return jjMoveStringLiteralDfa10_0(active0, 0x100000L); - case 83: - return jjMoveStringLiteralDfa10_0(active0, 0x80000L); - case 113: - return jjMoveStringLiteralDfa10_0(active0, 0x100000L); - case 115: - return jjMoveStringLiteralDfa10_0(active0, 0x80000L); - default : - break; - } - return jjMoveNfa_0(0, 9); -} -private int jjMoveStringLiteralDfa10_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjMoveNfa_0(0, 9); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return jjMoveNfa_0(0, 9); - } - switch(curChar) - { - case 84: - return jjMoveStringLiteralDfa11_0(active0, 0x80000L); - case 85: - return jjMoveStringLiteralDfa11_0(active0, 0x100000L); - case 116: - return jjMoveStringLiteralDfa11_0(active0, 0x80000L); - case 117: - return jjMoveStringLiteralDfa11_0(active0, 0x100000L); - default : - break; - } - return jjMoveNfa_0(0, 10); -} -private int jjMoveStringLiteralDfa11_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjMoveNfa_0(0, 10); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return jjMoveNfa_0(0, 10); - } - switch(curChar) - { - case 69: - return jjMoveStringLiteralDfa12_0(active0, 0x100000L); - case 82: - return jjMoveStringLiteralDfa12_0(active0, 0x80000L); - case 101: - return jjMoveStringLiteralDfa12_0(active0, 0x100000L); - case 114: - return jjMoveStringLiteralDfa12_0(active0, 0x80000L); - default : - break; - } - return jjMoveNfa_0(0, 11); -} -private int jjMoveStringLiteralDfa12_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjMoveNfa_0(0, 11); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return jjMoveNfa_0(0, 11); - } - switch(curChar) - { - case 69: - return jjMoveStringLiteralDfa13_0(active0, 0x80000L); - case 82: - return jjMoveStringLiteralDfa13_0(active0, 0x100000L); - case 101: - return jjMoveStringLiteralDfa13_0(active0, 0x80000L); - case 114: - return jjMoveStringLiteralDfa13_0(active0, 0x100000L); - default : - break; - } - return jjMoveNfa_0(0, 12); -} -private int jjMoveStringLiteralDfa13_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjMoveNfa_0(0, 12); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return jjMoveNfa_0(0, 12); - } - switch(curChar) - { - case 65: - return jjMoveStringLiteralDfa14_0(active0, 0x80000L); - case 89: - return jjMoveStringLiteralDfa14_0(active0, 0x100000L); - case 97: - return jjMoveStringLiteralDfa14_0(active0, 0x80000L); - case 121: - return jjMoveStringLiteralDfa14_0(active0, 0x100000L); - default : - break; - } - return jjMoveNfa_0(0, 13); -} -private int jjMoveStringLiteralDfa14_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjMoveNfa_0(0, 13); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return jjMoveNfa_0(0, 13); - } - switch(curChar) - { - case 32: - if ((active0 & 0x100000L) != 0L) - { - jjmatchedKind = 20; - jjmatchedPos = 14; - } - break; - case 77: - return jjMoveStringLiteralDfa15_0(active0, 0x80000L); - case 109: - return jjMoveStringLiteralDfa15_0(active0, 0x80000L); - default : - break; - } - return jjMoveNfa_0(0, 14); -} -private int jjMoveStringLiteralDfa15_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjMoveNfa_0(0, 14); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - return jjMoveNfa_0(0, 14); - } - switch(curChar) - { - case 32: - if ((active0 & 0x80000L) != 0L) - { - jjmatchedKind = 19; - jjmatchedPos = 15; - } - break; - default : - break; - } - return jjMoveNfa_0(0, 15); -} -static final long[] jjbitVec0 = { - 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL -}; -private int jjMoveNfa_0(int startState, int curPos) -{ - int strKind = jjmatchedKind; - int strPos = jjmatchedPos; - int seenUpto; - input_stream.backup(seenUpto = curPos + 1); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { throw new Error("Internal Error"); } - curPos = 0; - int startsAt = 0; - jjnewStateCnt = 6; - int i = 1; - jjstateSet[0] = startState; - int kind = 0x7fffffff; - for (;;) - { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) - { - long l = 1L << curChar; - do - { - switch(jjstateSet[--i]) - { - case 0: - if ((0xfc00fffe00000000L & l) != 0L) - { - if (kind > 16) - kind = 16; - } - else if ((0x3ff000000000000L & l) != 0L) - { - if (kind > 15) - kind = 15; - } - if (curChar == 60) - jjCheckNAddTwoStates(4, 5); - break; - case 1: - if ((0x3ff000000000000L & l) != 0L && kind > 15) - kind = 15; - break; - case 2: - if ((0xfc00fffe00000000L & l) != 0L && kind > 16) - kind = 16; - break; - case 3: - if (curChar == 60) - jjCheckNAddTwoStates(4, 5); - break; - case 4: - if ((0xfffffffa00000000L & l) != 0L) - jjCheckNAddTwoStates(4, 5); - break; - case 5: - if (curChar == 62 && kind > 17) - kind = 17; - break; - default : break; - } - } while(i != startsAt); - } - else if (curChar < 128) - { - long l = 1L << (curChar & 077); - do - { - switch(jjstateSet[--i]) - { - case 0: - if ((0x7fffffe07fffffeL & l) != 0L) - { - if (kind > 14) - kind = 14; - } - else if ((0x78000000e8000001L & l) != 0L) - { - if (kind > 16) - kind = 16; - } - break; - case 2: - if ((0x78000000e8000001L & l) != 0L && kind > 16) - kind = 16; - break; - case 4: - if ((0xc7fffffeafffffffL & l) != 0L) - jjAddStates(0, 1); - break; - default : break; - } - } while(i != startsAt); - } - else - { - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - do - { - switch(jjstateSet[--i]) - { - case 4: - if ((jjbitVec0[i2] & l2) != 0L) - jjAddStates(0, 1); - break; - default : break; - } - } while(i != startsAt); - } - if (kind != 0x7fffffff) - { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 6 - (jjnewStateCnt = startsAt))) - break; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { break; } - } - if (jjmatchedPos > strPos) - return curPos; - - int toRet = Math.max(curPos, seenUpto); - - if (curPos < toRet) - for (i = toRet - Math.min(curPos, seenUpto); i-- > 0; ) - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { throw new Error("Internal Error : Please send a bug report."); } - - if (jjmatchedPos < strPos) - { - jjmatchedKind = strKind; - jjmatchedPos = strPos; - } - else if (jjmatchedPos == strPos && jjmatchedKind > strKind) - jjmatchedKind = strKind; - - return toRet; -} -static final int[] jjnextStates = { - 4, 5, -}; - -/** Token literal values. */ -public static final String[] jjstrLiteralImages = { -"", null, null, null, null, null, null, null, null, null, null, null, null, -null, null, null, null, null, "\40", null, null, null, null, null, null, null, null, -null, }; - -/** Lexer state names. */ -public static final String[] lexStateNames = { - "DEFAULT", -}; -static final long[] jjtoToken = { - 0xfffffe1L, -}; -static final long[] jjtoSkip = { - 0x1eL, -}; -protected SimpleCharStream input_stream; -private final int[] jjrounds = new int[6]; -private final int[] jjstateSet = new int[12]; -protected char curChar; -/** Constructor. */ -public CsparqlParserTokenManager(SimpleCharStream stream){ - if (SimpleCharStream.staticFlag) - throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); - input_stream = stream; -} - -/** Constructor. */ -public CsparqlParserTokenManager(SimpleCharStream stream, int lexState){ - this(stream); - SwitchTo(lexState); -} - -/** Reinitialise parser. */ -public void ReInit(SimpleCharStream stream) -{ - jjmatchedPos = jjnewStateCnt = 0; - curLexState = defaultLexState; - input_stream = stream; - ReInitRounds(); -} -private void ReInitRounds() -{ - int i; - jjround = 0x80000001; - for (i = 6; i-- > 0;) - jjrounds[i] = 0x80000000; -} - -/** Reinitialise parser. */ -public void ReInit(SimpleCharStream stream, int lexState) -{ - ReInit(stream); - SwitchTo(lexState); -} - -/** Switch to specified lex state. */ -public void SwitchTo(int lexState) -{ - if (lexState >= 1 || lexState < 0) - throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); - else - curLexState = lexState; -} - -protected Token jjFillToken() -{ - final Token t; - final String curTokenImage; - final int beginLine; - final int endLine; - final int beginColumn; - final int endColumn; - String im = jjstrLiteralImages[jjmatchedKind]; - curTokenImage = (im == null) ? input_stream.GetImage() : im; - beginLine = input_stream.getBeginLine(); - beginColumn = input_stream.getBeginColumn(); - endLine = input_stream.getEndLine(); - endColumn = input_stream.getEndColumn(); - t = Token.newToken(jjmatchedKind, curTokenImage); - - t.beginLine = beginLine; - t.endLine = endLine; - t.beginColumn = beginColumn; - t.endColumn = endColumn; - - return t; -} - -int curLexState = 0; -int defaultLexState = 0; -int jjnewStateCnt; -int jjround; -int jjmatchedPos; -int jjmatchedKind; - -/** Get the next Token. */ -public Token getNextToken() -{ - Token matchedToken; - int curPos = 0; - - EOFLoop : - for (;;) - { - try - { - curChar = input_stream.BeginToken(); - } - catch(java.io.IOException e) - { - jjmatchedKind = 0; - matchedToken = jjFillToken(); - return matchedToken; - } - - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_0(); - if (jjmatchedKind != 0x7fffffff) - { - if (jjmatchedPos + 1 < curPos) - input_stream.backup(curPos - jjmatchedPos - 1); - if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) - { - matchedToken = jjFillToken(); - return matchedToken; - } - else - { - continue EOFLoop; - } - } - int error_line = input_stream.getEndLine(); - int error_column = input_stream.getEndColumn(); - String error_after = null; - boolean EOFSeen = false; - try { input_stream.readChar(); input_stream.backup(1); } - catch (java.io.IOException e1) { - EOFSeen = true; - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - if (curChar == '\n' || curChar == '\r') { - error_line++; - error_column = 0; - } - else - error_column++; - } - if (!EOFSeen) { - input_stream.backup(1); - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - } - throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); - } -} - -private void jjCheckNAdd(int state) -{ - if (jjrounds[state] != jjround) - { - jjstateSet[jjnewStateCnt++] = state; - jjrounds[state] = jjround; - } -} -private void jjAddStates(int start, int end) -{ - do { - jjstateSet[jjnewStateCnt++] = jjnextStates[start]; - } while (start++ != end); -} -private void jjCheckNAddTwoStates(int state1, int state2) -{ - jjCheckNAdd(state1); - jjCheckNAdd(state2); -} - -} diff --git a/csparql-core/src/main/java/eu/larkc/csparql/core/new_parser/ParseException.java b/csparql-core/src/main/java/eu/larkc/csparql/core/new_parser/ParseException.java deleted file mode 100644 index 931a64b..0000000 --- a/csparql-core/src/main/java/eu/larkc/csparql/core/new_parser/ParseException.java +++ /dev/null @@ -1,221 +0,0 @@ -/** - * Copyright 2011-2015 DEIB - Politecnico di Milano - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Acknowledgements: - * We would like to thank Davide Barbieri, Emanuele Della Valle, - * Marco Balduini, Soheila Dehghanzadeh, Shen Gao, and - * Daniele Dell'Aglio for the effort in the development of the software. - * - * This work is partially supported by - * - the European LarKC project (FP7-215535) of DEIB, Politecnico di - * Milano - * - the ERC grant “Search Computing” awarded to prof. Stefano Ceri - * - the European ModaClouds project (FP7-ICT-2011-8-318484) of DEIB, - * Politecnico di Milano - * - the IBM Faculty Award 2013 grated to prof. Emanuele Della Valle; - * - the City Data Fusion for Event Management 2013 project funded - * by EIT Digital of DEIB, Politecnico di Milano - * - the Dynamic and Distributed Information Systems Group of the - * University of Zurich; - * - INSIGHT NUIG and Science Foundation Ireland (SFI) under grant - * No. SFI/12/RC/2289 - */ -/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */ -/* JavaCCOptions:KEEP_LINE_COL=null */ -package eu.larkc.csparql.core.new_parser ; - -/** - * This exception is thrown when parse errors are encountered. - * You can explicitly create objects of this exception type by - * calling the method generateParseException in the generated - * parser. - * - * You can modify this class to customize your error reporting - * mechanisms so long as you retain the public fields. - */ -public class ParseException extends Exception { - - /** - * The version identifier for this Serializable class. - * Increment only if the serialized form of the - * class changes. - */ - private static final long serialVersionUID = 1L; - - /** - * 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 - ) - { - super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal)); - currentToken = currentTokenVal; - expectedTokenSequences = expectedTokenSequencesVal; - tokenImage = tokenImageVal; - } - - /** - * The following constructors are for use by you for whatever - * purpose you can think of. Constructing the exception in this - * manner makes the exception behave in the normal way - i.e., as - * documented in the class "Throwable". The fields "errorToken", - * "expectedTokenSequences", and "tokenImage" do not contain - * relevant information. The JavaCC generated code does not use - * these constructors. - */ - - public ParseException() { - super(); - } - - /** Constructor with message. */ - public ParseException(String message) { - super(message); - } - - - /** - * This is the last token that has been consumed successfully. If - * this object has been created due to a parse error, the token - * followng this token will (therefore) be the first error token. - */ - public Token currentToken; - - /** - * Each entry in this array is an array of integers. Each array - * of integers represents a sequence of tokens (by their ordinal - * values) that is expected at this point of the parse. - */ - public int[][] expectedTokenSequences; - - /** - * This is a reference to the "tokenImage" array of the generated - * parser within which the parse error occurred. This array is - * defined in the generated ...Constants interface. - */ - public String[] tokenImage; - - /** - * It uses "currentToken" and "expectedTokenSequences" to generate a parse - * error message and returns it. If this 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"); - StringBuffer expected = new StringBuffer(); - int maxSize = 0; - for (int i = 0; i < expectedTokenSequences.length; i++) { - if (maxSize < expectedTokenSequences[i].length) { - maxSize = expectedTokenSequences[i].length; - } - for (int j = 0; j < expectedTokenSequences[i].length; j++) { - expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' '); - } - if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { - expected.append("..."); - } - expected.append(eol).append(" "); - } - String retval = "Encountered \""; - Token tok = currentToken.next; - for (int i = 0; i < maxSize; i++) { - if (i != 0) retval += " "; - if (tok.kind == 0) { - retval += tokenImage[0]; - break; - } - retval += " " + tokenImage[tok.kind]; - retval += " \""; - retval += add_escapes(tok.image); - retval += " \""; - tok = tok.next; - } - retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; - retval += "." + eol; - if (expectedTokenSequences.length == 1) { - retval += "Was expecting:" + eol + " "; - } else { - retval += "Was expecting one of:" + eol + " "; - } - 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) { - 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; - case '\t': - retval.append("\\t"); - continue; - case '\n': - retval.append("\\n"); - continue; - case '\f': - retval.append("\\f"); - continue; - case '\r': - retval.append("\\r"); - continue; - case '\"': - retval.append("\\\""); - continue; - case '\'': - retval.append("\\\'"); - continue; - case '\\': - retval.append("\\\\"); - continue; - default: - if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { - String s = "0000" + Integer.toString(ch, 16); - retval.append("\\u" + s.substring(s.length() - 4, s.length())); - } else { - retval.append(ch); - } - continue; - } - } - return retval.toString(); - } - -} -/* JavaCC - OriginalChecksum=f9c9a8463104910eff64b3b4f93772a3 (do not edit this line) */ diff --git a/csparql-core/src/main/java/eu/larkc/csparql/core/new_parser/SimpleCharStream.java b/csparql-core/src/main/java/eu/larkc/csparql/core/new_parser/SimpleCharStream.java deleted file mode 100644 index 1667fbc..0000000 --- a/csparql-core/src/main/java/eu/larkc/csparql/core/new_parser/SimpleCharStream.java +++ /dev/null @@ -1,505 +0,0 @@ -/** - * Copyright 2011-2015 DEIB - Politecnico di Milano - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Acknowledgements: - * We would like to thank Davide Barbieri, Emanuele Della Valle, - * Marco Balduini, Soheila Dehghanzadeh, Shen Gao, and - * Daniele Dell'Aglio for the effort in the development of the software. - * - * This work is partially supported by - * - the European LarKC project (FP7-215535) of DEIB, Politecnico di - * Milano - * - the ERC grant “Search Computing” awarded to prof. Stefano Ceri - * - the European ModaClouds project (FP7-ICT-2011-8-318484) of DEIB, - * Politecnico di Milano - * - the IBM Faculty Award 2013 grated to prof. Emanuele Della Valle; - * - the City Data Fusion for Event Management 2013 project funded - * by EIT Digital of DEIB, Politecnico di Milano - * - the Dynamic and Distributed Information Systems Group of the - * University of Zurich; - * - INSIGHT NUIG and Science Foundation Ireland (SFI) under grant - * No. SFI/12/RC/2289 - */ -/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 5.0 */ -/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ -package eu.larkc.csparql.core.new_parser ; - -/** - * An implementation of interface CharStream, where the stream is assumed to - * contain only ASCII characters (without unicode processing). - */ - -public class SimpleCharStream -{ -/** Whether parser is static. */ - public static final boolean staticFlag = false; - int bufsize; - int available; - int tokenBegin; -/** Position in buffer. */ - public int bufpos = -1; - protected int bufline[]; - protected int bufcolumn[]; - - protected int column = 0; - protected int line = 1; - - protected boolean prevCharIsCR = false; - protected boolean prevCharIsLF = false; - - protected java.io.Reader inputStream; - - protected char[] buffer; - protected int maxNextCharInd = 0; - protected int inBuf = 0; - protected int tabSize = 8; - - protected void setTabSize(int i) { tabSize = i; } - protected int getTabSize(int i) { return tabSize; } - - - protected void ExpandBuff(boolean wrapAround) - { - char[] newbuffer = new char[bufsize + 2048]; - int newbufline[] = new int[bufsize + 2048]; - int newbufcolumn[] = new int[bufsize + 2048]; - - try - { - if (wrapAround) - { - System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); - System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); - buffer = newbuffer; - - System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); - System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); - bufline = newbufline; - - System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); - System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); - bufcolumn = newbufcolumn; - - maxNextCharInd = (bufpos += (bufsize - tokenBegin)); - } - else - { - System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); - buffer = newbuffer; - - System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); - bufline = newbufline; - - System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); - bufcolumn = newbufcolumn; - - maxNextCharInd = (bufpos -= tokenBegin); - } - } - catch (Throwable t) - { - throw new Error(t.getMessage()); - } - - - bufsize += 2048; - available = bufsize; - tokenBegin = 0; - } - - protected void FillBuff() throws java.io.IOException - { - if (maxNextCharInd == available) - { - if (available == bufsize) - { - if (tokenBegin > 2048) - { - bufpos = maxNextCharInd = 0; - available = tokenBegin; - } - else if (tokenBegin < 0) - bufpos = maxNextCharInd = 0; - else - ExpandBuff(false); - } - else if (available > tokenBegin) - available = bufsize; - else if ((tokenBegin - available) < 2048) - ExpandBuff(true); - else - available = tokenBegin; - } - - int i; - try { - if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) - { - inputStream.close(); - throw new java.io.IOException(); - } - else - maxNextCharInd += i; - return; - } - catch(java.io.IOException e) { - --bufpos; - backup(0); - if (tokenBegin == -1) - tokenBegin = bufpos; - throw e; - } - } - -/** Start. */ - public char BeginToken() throws java.io.IOException - { - tokenBegin = -1; - char c = readChar(); - tokenBegin = bufpos; - - return c; - } - - protected void UpdateLineColumn(char c) - { - column++; - - if (prevCharIsLF) - { - prevCharIsLF = false; - line += (column = 1); - } - else if (prevCharIsCR) - { - prevCharIsCR = false; - if (c == '\n') - { - prevCharIsLF = true; - } - else - line += (column = 1); - } - - switch (c) - { - case '\r' : - prevCharIsCR = true; - break; - case '\n' : - prevCharIsLF = true; - break; - case '\t' : - column--; - column += (tabSize - (column % tabSize)); - break; - default : - break; - } - - bufline[bufpos] = line; - bufcolumn[bufpos] = column; - } - -/** Read a character. */ - public char readChar() throws java.io.IOException - { - if (inBuf > 0) - { - --inBuf; - - if (++bufpos == bufsize) - bufpos = 0; - - return buffer[bufpos]; - } - - if (++bufpos >= maxNextCharInd) - FillBuff(); - - char c = buffer[bufpos]; - - UpdateLineColumn(c); - return c; - } - - @Deprecated - /** - * @deprecated - * @see #getEndColumn - */ - - public int getColumn() { - return bufcolumn[bufpos]; - } - - @Deprecated - /** - * @deprecated - * @see #getEndLine - */ - - public int getLine() { - return bufline[bufpos]; - } - - /** Get token end column number. */ - public int getEndColumn() { - return bufcolumn[bufpos]; - } - - /** Get token end line number. */ - public int getEndLine() { - return bufline[bufpos]; - } - - /** Get token beginning column number. */ - public int getBeginColumn() { - return bufcolumn[tokenBegin]; - } - - /** Get token beginning line number. */ - public int getBeginLine() { - return bufline[tokenBegin]; - } - -/** Backup a number of characters. */ - public void backup(int amount) { - - inBuf += amount; - if ((bufpos -= amount) < 0) - bufpos += bufsize; - } - - /** Constructor. */ - public SimpleCharStream(java.io.Reader dstream, int startline, - int startcolumn, int buffersize) - { - inputStream = dstream; - line = startline; - column = startcolumn - 1; - - available = bufsize = buffersize; - buffer = new char[buffersize]; - bufline = new int[buffersize]; - bufcolumn = new int[buffersize]; - } - - /** Constructor. */ - public SimpleCharStream(java.io.Reader dstream, int startline, - int startcolumn) - { - this(dstream, startline, startcolumn, 4096); - } - - /** Constructor. */ - public SimpleCharStream(java.io.Reader dstream) - { - this(dstream, 1, 1, 4096); - } - - /** Reinitialise. */ - public void ReInit(java.io.Reader dstream, int startline, - int startcolumn, int buffersize) - { - inputStream = dstream; - line = startline; - column = startcolumn - 1; - - if (buffer == null || buffersize != buffer.length) - { - available = bufsize = buffersize; - buffer = new char[buffersize]; - bufline = new int[buffersize]; - bufcolumn = new int[buffersize]; - } - prevCharIsLF = prevCharIsCR = false; - tokenBegin = inBuf = maxNextCharInd = 0; - bufpos = -1; - } - - /** Reinitialise. */ - public void ReInit(java.io.Reader dstream, int startline, - int startcolumn) - { - ReInit(dstream, startline, startcolumn, 4096); - } - - /** Reinitialise. */ - public void ReInit(java.io.Reader dstream) - { - ReInit(dstream, 1, 1, 4096); - } - /** Constructor. */ - public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, - int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException - { - this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); - } - - /** Constructor. */ - public SimpleCharStream(java.io.InputStream dstream, int startline, - int startcolumn, int buffersize) - { - this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); - } - - /** Constructor. */ - public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, - int startcolumn) throws java.io.UnsupportedEncodingException - { - this(dstream, encoding, startline, startcolumn, 4096); - } - - /** Constructor. */ - public SimpleCharStream(java.io.InputStream dstream, int startline, - int startcolumn) - { - this(dstream, startline, startcolumn, 4096); - } - - /** Constructor. */ - public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException - { - this(dstream, encoding, 1, 1, 4096); - } - - /** Constructor. */ - public SimpleCharStream(java.io.InputStream dstream) - { - this(dstream, 1, 1, 4096); - } - - /** Reinitialise. */ - public void ReInit(java.io.InputStream dstream, String encoding, int startline, - int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException - { - ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); - } - - /** Reinitialise. */ - public void ReInit(java.io.InputStream dstream, int startline, - int startcolumn, int buffersize) - { - ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); - } - - /** Reinitialise. */ - public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException - { - ReInit(dstream, encoding, 1, 1, 4096); - } - - /** Reinitialise. */ - public void ReInit(java.io.InputStream dstream) - { - ReInit(dstream, 1, 1, 4096); - } - /** Reinitialise. */ - public void ReInit(java.io.InputStream dstream, String encoding, int startline, - int startcolumn) throws java.io.UnsupportedEncodingException - { - ReInit(dstream, encoding, startline, startcolumn, 4096); - } - /** Reinitialise. */ - public void ReInit(java.io.InputStream dstream, int startline, - int startcolumn) - { - ReInit(dstream, startline, startcolumn, 4096); - } - /** Get token literal value. */ - public String GetImage() - { - if (bufpos >= tokenBegin) - return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); - else - return new String(buffer, tokenBegin, bufsize - tokenBegin) + - new String(buffer, 0, bufpos + 1); - } - - /** Get the suffix. */ - public char[] GetSuffix(int len) - { - char[] ret = new char[len]; - - if ((bufpos + 1) >= len) - System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); - else - { - System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, - len - bufpos - 1); - System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); - } - - return ret; - } - - /** Reset buffer when finished. */ - public void Done() - { - buffer = null; - bufline = null; - bufcolumn = null; - } - - /** - * Method to adjust line and column numbers for the start of a token. - */ - public void adjustBeginLineColumn(int newLine, int newCol) - { - int start = tokenBegin; - int len; - - if (bufpos >= tokenBegin) - { - len = bufpos - tokenBegin + inBuf + 1; - } - else - { - len = bufsize - tokenBegin + bufpos + 1 + inBuf; - } - - int i = 0, j = 0, k = 0; - int nextColDiff = 0, columnDiff = 0; - - while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) - { - bufline[j] = newLine; - nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; - bufcolumn[j] = newCol + columnDiff; - columnDiff = nextColDiff; - i++; - } - - if (i < len) - { - bufline[j] = newLine++; - bufcolumn[j] = newCol + columnDiff; - - while (i++ < len) - { - if (bufline[j = start % bufsize] != bufline[++start % bufsize]) - bufline[j] = newLine++; - else - bufline[j] = newLine; - } - } - - line = bufline[j]; - column = bufcolumn[j]; - } - -} -/* JavaCC - OriginalChecksum=158db661cf5c97bd7bf1572438b08655 (do not edit this line) */ diff --git a/csparql-core/src/main/java/eu/larkc/csparql/core/new_parser/Token.java b/csparql-core/src/main/java/eu/larkc/csparql/core/new_parser/Token.java deleted file mode 100644 index 1470960..0000000 --- a/csparql-core/src/main/java/eu/larkc/csparql/core/new_parser/Token.java +++ /dev/null @@ -1,165 +0,0 @@ -/** - * Copyright 2011-2015 DEIB - Politecnico di Milano - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Acknowledgements: - * We would like to thank Davide Barbieri, Emanuele Della Valle, - * Marco Balduini, Soheila Dehghanzadeh, Shen Gao, and - * Daniele Dell'Aglio for the effort in the development of the software. - * - * This work is partially supported by - * - the European LarKC project (FP7-215535) of DEIB, Politecnico di - * Milano - * - the ERC grant “Search Computing” awarded to prof. Stefano Ceri - * - the European ModaClouds project (FP7-ICT-2011-8-318484) of DEIB, - * Politecnico di Milano - * - the IBM Faculty Award 2013 grated to prof. Emanuele Della Valle; - * - the City Data Fusion for Event Management 2013 project funded - * by EIT Digital of DEIB, Politecnico di Milano - * - the Dynamic and Distributed Information Systems Group of the - * University of Zurich; - * - INSIGHT NUIG and Science Foundation Ireland (SFI) under grant - * No. SFI/12/RC/2289 - */ -/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ -/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ -package eu.larkc.csparql.core.new_parser ; - -/** - * Describes the input token stream. - */ - -public class Token implements java.io.Serializable { - - /** - * The version identifier for this Serializable class. - * Increment only if the serialized form of the - * class changes. - */ - private static final long serialVersionUID = 1L; - - /** - * An integer that describes the kind of this token. This numbering - * system is determined by JavaCCParser, and a table of these numbers is - * stored in the file ...Constants.java. - */ - public int kind; - - /** The line number of the first character of this Token. */ - public int beginLine; - /** The column number of the first character of this Token. */ - public int beginColumn; - /** The line number of the last character of this Token. */ - public int endLine; - /** The column number of the last character of this Token. */ - public int endColumn; - - /** - * The string image of the token. - */ - public String image; - - /** - * A reference to the next regular (non-special) token from the input - * stream. If this is the last token from the input stream, or if the - * token manager has not read tokens beyond this one, this field is - * set to null. This is true only if this token is also a regular - * token. Otherwise, see below for a description of the contents of - * this field. - */ - public Token next; - - /** - * This field is used to access special tokens that occur prior to this - * token, but after the immediately preceding regular (non-special) token. - * If there are no such special tokens, this field is set to null. - * When there are more than one such special token, this field refers - * to the last of these special tokens, which in turn refers to the next - * previous special token through its specialToken field, and so on - * until the first special token (whose specialToken field is null). - * The next fields of special tokens refer to other special tokens that - * immediately follow it (without an intervening regular token). If there - * is no such token, this field is null. - */ - public Token specialToken; - - /** - * An optional attribute value of the Token. - * Tokens which are not used as syntactic sugar will often contain - * meaningful values that will be used later on by the compiler or - * interpreter. This attribute value is often different from the image. - * Any subclass of Token that actually wants to return a non-null value can - * override this method as appropriate. - */ - public Object getValue() { - return null; - } - - /** - * No-argument constructor - */ - public Token() {} - - /** - * Constructs a new token for the specified Image. - */ - public Token(int kind) - { - this(kind, null); - } - - /** - * Constructs a new token for the specified Image and Kind. - */ - public Token(int kind, String image) - { - this.kind = kind; - this.image = image; - } - - /** - * Returns the image. - */ - public String toString() - { - return image; - } - - /** - * Returns a new Token object, by default. However, if you want, you - * can create and return subclass objects based on the value of ofKind. - * Simply add the cases to the switch for all those special cases. - * For example, if you have a subclass of Token called IDToken that - * you want to create if ofKind is ID, simply add something like : - * - * case MyParserConstants.ID : return new IDToken(ofKind, image); - * - * to the following switch statement. Then you can cast matchedToken - * variable to the appropriate type and use sit in your lexical actions. - */ - public static Token newToken(int ofKind, String image) - { - switch(ofKind) - { - default : return new Token(ofKind, image); - } - } - - public static Token newToken(int ofKind) - { - return newToken(ofKind, null); - } - -} -/* JavaCC - OriginalChecksum=064942b0c3d2b6f3e08319448462e2a0 (do not edit this line) */ diff --git a/csparql-core/Grammar/master.jj b/csparql-core/src/main/javacc/master.jj similarity index 99% rename from csparql-core/Grammar/master.jj rename to csparql-core/src/main/javacc/master.jj index fa8993a..077404d 100644 --- a/csparql-core/Grammar/master.jj +++ b/csparql-core/src/main/javacc/master.jj @@ -1,6 +1,7 @@ options { STATIC = false ; + JDK_VERSION = "1.5"; } PARSER_BEGIN(CsparqlParser) @@ -266,7 +267,7 @@ TOKEN [IGNORE_CASE] : | < ADD: "add " > | | -| +| | | |