All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.semanticweb.yars.turtle.TurtleParserInternal Maven / Gradle / Ivy

/* Generated By:JavaCC: Do not edit this line. TurtleParserInternal.java */
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.
 */

package org.semanticweb.yars.turtle;

import java.net.URI;

import org.semanticweb.yars.nx.*;
import org.semanticweb.yars.nx.parser.Callback;
import org.semanticweb.yars.turtle.TurtleParserBase;
import org.semanticweb.yars.turtle.TurtleParseException;


public class TurtleParserInternal extends TurtleParserBase implements TurtleParserInternalConstants {

// --- Entry point
  final public void parse(Callback callback, URI base) throws ParseException, TurtleParseException {
// maybe get base here as well
_callback = callback;
_prologue.setBase(base);
   _callback.startDocument();
    if (jj_2_1(2)) {
      jj_consume_token(BOM);
    } else {
      ;
    }
    label_1:
    while (true) {
      if (jj_2_2(2)) {
        ;
      } else {
        break label_1;
      }
      Statement();
    }
    jj_consume_token(0);
   _callback.endDocument();
  }

/** [2] in Turtle spec */
  final public void Statement() throws ParseException, TurtleParseException {
    if (jj_2_3(2)) {
      Directive();
    } else if (jj_2_4(2)) {
      Triples();
    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
    jj_consume_token(DOT);
  }

/** [3], [4], [5] */
  final public void Directive() throws ParseException {
                     Token t ; String iri ;
    if (jj_2_5(2)) {
      jj_consume_token(PREFIX);
      t = jj_consume_token(PNAME_NS);
      iri = IRIREF();
      String s = fixupPrefix(t.image, t.beginLine, t.beginColumn) ;
      setPrefix(t.beginLine, t.beginColumn, s, iri) ;
    } else if (jj_2_6(2)) {
      t = jj_consume_token(BASE);
      iri = IRIREF();
      setBase(iri, t.beginLine, t.beginColumn) ;
    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

// ---- TRIPLES

/** [6] */
  final public void Triples() throws ParseException, TurtleParseException {
                                              Node s ;
    if (jj_2_8(2)) {
      s = Subject();
      PredicateObjectList(s);
    } else if (jj_2_9(2)) {
      s = BlankNodePropertyList();
      if (jj_2_7(2)) {
        PredicateObjectList(s);
      } else {
        ;
      }
    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/** [7] */
  final public void PredicateObjectList(Node s) throws ParseException, TurtleParseException {
                                                                Node p ;
    p = Verb();
    ObjectList(s, p);
    label_2:
    while (true) {
      if (jj_2_10(2)) {
        ;
      } else {
        break label_2;
      }
      jj_consume_token(SEMICOLON);
      if (jj_2_11(2)) {
        p = Verb();
        ObjectList(s, p);
      } else {
        ;
      }
    }
  }

/** [8] */
  final public void ObjectList(Node s, Node p) throws ParseException, TurtleParseException {
    Object(s, p);
    label_3:
    while (true) {
      if (jj_2_12(2)) {
        ;
      } else {
        break label_3;
      }
      jj_consume_token(COMMA);
      Object(s, p);
    }
  }

/** [9] */
  final public Node Verb() throws ParseException, TurtleParseException {
                                           Node p ;
    if (jj_2_13(2)) {
      p = Predicate();
    } else if (jj_2_14(2)) {
      jj_consume_token(KW_A);
              p = nRDFtype ;
    } else if (jj_2_15(2)) {
      jj_consume_token(EQ);
        p = new Resource("http://www.w3.org/2002/07/owl#sameAs");
        if ( strictTurtle )
          {if (true) throw new TurtleParseException("= (owl:sameAs) not legal in Turtle",
                          token.beginLine, token.beginColumn ) ;}
    } else if (jj_2_16(2)) {
      jj_consume_token(ARROW);
        p = new Resource("http://www.w3.org/2000/10/swap/log#implies");
        if ( strictTurtle )
          {if (true) throw new TurtleParseException("=> (log:implies) not legal in Turtle",
                          token.beginLine, token.beginColumn ) ;}
    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
    {if (true) return p ;}
    throw new Error("Missing return statement in function");
  }

// -------- Triple expansions

// Anything that can stand in a node slot and which is
// a number of triples

/** [10] */
  final public Node Subject() throws ParseException, TurtleParseException {
                                               Node n;
    if (jj_2_17(2)) {
      n = IRI();
                   {if (true) return n ;}
    } else if (jj_2_18(2)) {
      n = BlankNode();
                      {if (true) return n ;}
    } else if (jj_2_19(2)) {
      n = Collection();
                      {if (true) return n ;}
    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }

/** [11] */
  final public Resource Predicate() throws ParseException, TurtleParseException {
                                                     Resource r;
    r = IRI();
              {if (true) return r;}
    throw new Error("Missing return statement in function");
  }

/** [12] */
  final public void Object(Node s, Node p) throws ParseException, TurtleParseException {
                                                           Node o ;
    if (jj_2_20(2)) {
      o = IRI();
              Nodes t = new Nodes(s,p,o) ;
    emitTriple(token.beginLine, token.beginColumn, t) ;
    } else if (jj_2_21(2)) {
      o = BlankNode();
                    Nodes t = new Nodes(s,p,o) ;
    emitTriple(token.beginLine, token.beginColumn, t) ;
    } else if (jj_2_22(2)) {
      o = Literal();
                    Nodes t = new Nodes(s,p,o) ;
    emitTriple(token.beginLine, token.beginColumn, t) ;
    } else if (jj_2_23(2)) {
      o = BlankNodePropertyList();
                                 Nodes t = new Nodes(s,p,o) ;
    emitTriple(token.beginLine, token.beginColumn, t) ;
    } else if (jj_2_24(2)) {
      Collection();
    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

/** [13] */
  final public Node Literal() throws ParseException, TurtleParseException {
                                               Node l ;
    if (jj_2_25(2)) {
      l = RDFLiteral();
                          {if (true) return l ;}
    } else if (jj_2_26(2)) {
      l = NumericLiteral();
                          {if (true) return l ;}
    } else if (jj_2_27(2)) {
      l = BooleanLiteral();
                          {if (true) return l ;}
    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }

/** [14] */
  final public Node BlankNodePropertyList() throws ParseException, TurtleParseException {
    jj_consume_token(LBRACKET);
      Node n = createBNode() ;
    PredicateObjectList(n);
    jj_consume_token(RBRACKET);
      {if (true) return n ;}
    throw new Error("Missing return statement in function");
  }

/** [15] */
  final public Node Collection() throws ParseException, TurtleParseException {
      Node listHead = nRDFnil ; Node lastCell = null ; Node n ;
    jj_consume_token(LPAREN);
    label_4:
    while (true) {
      if (jj_2_28(2)) {
        ;
      } else {
        break label_4;
      }
      Object(null, null);
    }
    jj_consume_token(RPAREN);
                                            {if (true) return null;}
    throw new Error("Missing return statement in function");
  }

/** [16] */
  final public Literal NumericLiteral() throws ParseException {
                             Token t ;
    if (jj_2_29(2)) {
      t = jj_consume_token(INTEGER);
                  {if (true) return createLiteralInteger(t.image) ;}
    } else if (jj_2_30(2)) {
      t = jj_consume_token(DECIMAL);
                  {if (true) return createLiteralDecimal(t.image) ;}
    } else if (jj_2_31(2)) {
      t = jj_consume_token(DOUBLE);
                 {if (true) return createLiteralDouble(t.image) ;}
    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }

  final public Literal RDFLiteral() throws ParseException, TurtleParseException {
                                                    Token t ; String lex = null ;
    lex = String();
    String lang = null ; Resource dt = null ;
    if (jj_2_34(2)) {
      if (jj_2_32(2)) {
        lang = Langtag();
      } else if (jj_2_33(2)) {
        jj_consume_token(DATATYPE);
        dt = IRI();
      } else {
        jj_consume_token(-1);
        throw new ParseException();
      }
    } else {
      ;
    }
      {if (true) return new Literal(lex, lang, dt);}
    throw new Error("Missing return statement in function");
  }

  final public String Langtag() throws ParseException {
                     Token t ;
    if (jj_2_35(2)) {
      t = jj_consume_token(LANGTAG);
    } else if (jj_2_36(2)) {
      t = AnyDirective();
    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
    String lang = stripChars(t.image, 1) ; {if (true) return lang ;}
    throw new Error("Missing return statement in function");
  }

  final public Token AnyDirective() throws ParseException {
                         Token t ;
    if (jj_2_37(2)) {
      t = jj_consume_token(PREFIX);
    } else if (jj_2_38(2)) {
      t = jj_consume_token(BASE);
    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
                                    {if (true) return t ;}
    throw new Error("Missing return statement in function");
  }

  final public Literal BooleanLiteral() throws ParseException {
    if (jj_2_39(2)) {
      jj_consume_token(TRUE);
            {if (true) return XSD_TRUE;}
    } else if (jj_2_40(2)) {
      jj_consume_token(FALSE);
             {if (true) return XSD_FALSE ;}
    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }

  final public String String() throws ParseException, TurtleParseException {
                                               Token t ;  String lex ;
    if (jj_2_41(2)) {
      t = jj_consume_token(STRING_LITERAL1);
                            lex = stripQuotes(t.image) ;
    } else if (jj_2_42(2)) {
      t = jj_consume_token(STRING_LITERAL2);
                            lex = stripQuotes(t.image) ;
    } else if (jj_2_43(2)) {
      t = jj_consume_token(STRING_LITERAL_LONG1);
                                 lex = stripQuotes3(t.image) ;
    } else if (jj_2_44(2)) {
      t = jj_consume_token(STRING_LITERAL_LONG2);
                                 lex = stripQuotes3(t.image) ;
    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
      lex = unescapeStr(lex,  t.beginLine, t.beginColumn) ;
      {if (true) return lex ;}
    throw new Error("Missing return statement in function");
  }

  final public Resource IRI() throws ParseException, TurtleParseException {
                                               String iri;
    if (jj_2_45(2)) {
      iri = IRIREF();
                   {if (true) return createResource(iri);}
    } else if (jj_2_46(2)) {
      iri = PrefixedName();
                         {if (true) return new Resource(iri) ;}
    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }

  final public String PrefixedName() throws ParseException, TurtleParseException {
                                                     Token t ;
    if (jj_2_47(2)) {
      t = jj_consume_token(PNAME_LN);
      {if (true) return resolvePName(t.image, t.beginLine, t.beginColumn) ;}
    } else if (jj_2_48(2)) {
      t = jj_consume_token(PNAME_NS);
      {if (true) return resolvePName(t.image, t.beginLine, t.beginColumn) ;}
    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }

  final public Node BlankNode() throws ParseException {
                      Token t = null ;
    if (jj_2_49(2)) {
      t = jj_consume_token(BLANK_NODE_LABEL);
      {if (true) return createBNode(t.image, t.beginLine, t.beginColumn) ;}
    } else if (jj_2_50(2)) {
      jj_consume_token(ANON);
           {if (true) return createBNode() ;}
    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }

  final public String IRIREF() throws ParseException {
                    Token t ;
    t = jj_consume_token(IRI);
    {if (true) return t.image;}
    throw new Error("Missing return statement in function");
  }

  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_2_13(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_13(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(12, xla); }
  }

  private boolean jj_2_14(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_14(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(13, xla); }
  }

  private boolean jj_2_15(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_15(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(14, xla); }
  }

  private boolean jj_2_16(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_16(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(15, xla); }
  }

  private boolean jj_2_17(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_17(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(16, xla); }
  }

  private boolean jj_2_18(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_18(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(17, xla); }
  }

  private boolean jj_2_19(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_19(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(18, xla); }
  }

  private boolean jj_2_20(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_20(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(19, xla); }
  }

  private boolean jj_2_21(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_21(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(20, xla); }
  }

  private boolean jj_2_22(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_22(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(21, xla); }
  }

  private boolean jj_2_23(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_23(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(22, xla); }
  }

  private boolean jj_2_24(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_24(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(23, xla); }
  }

  private boolean jj_2_25(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_25(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(24, xla); }
  }

  private boolean jj_2_26(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_26(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(25, xla); }
  }

  private boolean jj_2_27(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_27(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(26, xla); }
  }

  private boolean jj_2_28(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_28(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(27, xla); }
  }

  private boolean jj_2_29(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_29(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(28, xla); }
  }

  private boolean jj_2_30(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_30(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(29, xla); }
  }

  private boolean jj_2_31(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_31(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(30, xla); }
  }

  private boolean jj_2_32(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_32(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(31, xla); }
  }

  private boolean jj_2_33(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_33(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(32, xla); }
  }

  private boolean jj_2_34(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_34(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(33, xla); }
  }

  private boolean jj_2_35(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_35(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(34, xla); }
  }

  private boolean jj_2_36(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_36(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(35, xla); }
  }

  private boolean jj_2_37(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_37(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(36, xla); }
  }

  private boolean jj_2_38(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_38(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(37, xla); }
  }

  private boolean jj_2_39(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_39(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(38, xla); }
  }

  private boolean jj_2_40(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_40(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(39, xla); }
  }

  private boolean jj_2_41(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_41(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(40, xla); }
  }

  private boolean jj_2_42(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_42(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(41, xla); }
  }

  private boolean jj_2_43(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_43(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(42, xla); }
  }

  private boolean jj_2_44(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_44(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(43, xla); }
  }

  private boolean jj_2_45(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_45(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(44, xla); }
  }

  private boolean jj_2_46(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_46(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(45, xla); }
  }

  private boolean jj_2_47(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_47(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(46, xla); }
  }

  private boolean jj_2_48(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_48(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(47, xla); }
  }

  private boolean jj_2_49(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_49(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(48, xla); }
  }

  private boolean jj_2_50(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_50(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(49, xla); }
  }

  private boolean jj_3_20() {
    if (jj_3R_16()) return true;
    return false;
  }

  private boolean jj_3R_14() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_20()) {
    jj_scanpos = xsp;
    if (jj_3_21()) {
    jj_scanpos = xsp;
    if (jj_3_22()) {
    jj_scanpos = xsp;
    if (jj_3_23()) {
    jj_scanpos = xsp;
    if (jj_3_24()) return true;
    }
    }
    }
    }
    return false;
  }

  private boolean jj_3R_15() {
    if (jj_3R_16()) return true;
    return false;
  }

  private boolean jj_3_19() {
    if (jj_3R_18()) return true;
    return false;
  }

  private boolean jj_3_18() {
    if (jj_3R_17()) return true;
    return false;
  }

  private boolean jj_3_17() {
    if (jj_3R_16()) return true;
    return false;
  }

  private boolean jj_3R_10() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_17()) {
    jj_scanpos = xsp;
    if (jj_3_18()) {
    jj_scanpos = xsp;
    if (jj_3_19()) return true;
    }
    }
    return false;
  }

  private boolean jj_3_16() {
    if (jj_scan_token(ARROW)) return true;
    return false;
  }

  private boolean jj_3_15() {
    if (jj_scan_token(EQ)) return true;
    return false;
  }

  private boolean jj_3_14() {
    if (jj_scan_token(KW_A)) return true;
    return false;
  }

  private boolean jj_3_13() {
    if (jj_3R_15()) return true;
    return false;
  }

  private boolean jj_3_11() {
    if (jj_3R_12()) return true;
    if (jj_3R_13()) return true;
    return false;
  }

  private boolean jj_3R_12() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_13()) {
    jj_scanpos = xsp;
    if (jj_3_14()) {
    jj_scanpos = xsp;
    if (jj_3_15()) {
    jj_scanpos = xsp;
    if (jj_3_16()) return true;
    }
    }
    }
    return false;
  }

  private boolean jj_3R_8() {
    if (jj_scan_token(IRI)) return true;
    return false;
  }

  private boolean jj_3_12() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_3R_14()) return true;
    return false;
  }

  private boolean jj_3R_13() {
    if (jj_3R_14()) return true;
    return false;
  }

  private boolean jj_3_50() {
    if (jj_scan_token(ANON)) return true;
    return false;
  }

  private boolean jj_3_49() {
    if (jj_scan_token(BLANK_NODE_LABEL)) return true;
    return false;
  }

  private boolean jj_3R_17() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_49()) {
    jj_scanpos = xsp;
    if (jj_3_50()) return true;
    }
    return false;
  }

  private boolean jj_3_10() {
    if (jj_scan_token(SEMICOLON)) return true;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_11()) jj_scanpos = xsp;
    return false;
  }

  private boolean jj_3R_9() {
    if (jj_3R_12()) return true;
    if (jj_3R_13()) return true;
    return false;
  }

  private boolean jj_3_48() {
    if (jj_scan_token(PNAME_NS)) return true;
    return false;
  }

  private boolean jj_3_47() {
    if (jj_scan_token(PNAME_LN)) return true;
    return false;
  }

  private boolean jj_3_7() {
    if (jj_3R_9()) return true;
    return false;
  }

  private boolean jj_3R_25() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_47()) {
    jj_scanpos = xsp;
    if (jj_3_48()) return true;
    }
    return false;
  }

  private boolean jj_3_9() {
    if (jj_3R_11()) return true;
    return false;
  }

  private boolean jj_3_8() {
    if (jj_3R_10()) return true;
    if (jj_3R_9()) return true;
    return false;
  }

  private boolean jj_3R_7() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_8()) {
    jj_scanpos = xsp;
    if (jj_3_9()) return true;
    }
    return false;
  }

  private boolean jj_3_46() {
    if (jj_3R_25()) return true;
    return false;
  }

  private boolean jj_3_45() {
    if (jj_3R_8()) return true;
    return false;
  }

  private boolean jj_3R_16() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_45()) {
    jj_scanpos = xsp;
    if (jj_3_46()) return true;
    }
    return false;
  }

  private boolean jj_3_38() {
    if (jj_scan_token(BASE)) return true;
    return false;
  }

  private boolean jj_3_44() {
    if (jj_scan_token(STRING_LITERAL_LONG2)) return true;
    return false;
  }

  private boolean jj_3_43() {
    if (jj_scan_token(STRING_LITERAL_LONG1)) return true;
    return false;
  }

  private boolean jj_3_42() {
    if (jj_scan_token(STRING_LITERAL2)) return true;
    return false;
  }

  private boolean jj_3_41() {
    if (jj_scan_token(STRING_LITERAL1)) return true;
    return false;
  }

  private boolean jj_3R_26() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_41()) {
    jj_scanpos = xsp;
    if (jj_3_42()) {
    jj_scanpos = xsp;
    if (jj_3_43()) {
    jj_scanpos = xsp;
    if (jj_3_44()) return true;
    }
    }
    }
    return false;
  }

  private boolean jj_3_36() {
    if (jj_3R_24()) return true;
    return false;
  }

  private boolean jj_3_4() {
    if (jj_3R_7()) return true;
    return false;
  }

  private boolean jj_3_6() {
    if (jj_scan_token(BASE)) return true;
    if (jj_3R_8()) return true;
    return false;
  }

  private boolean jj_3_40() {
    if (jj_scan_token(FALSE)) return true;
    return false;
  }

  private boolean jj_3_5() {
    if (jj_scan_token(PREFIX)) return true;
    if (jj_scan_token(PNAME_NS)) return true;
    return false;
  }

  private boolean jj_3R_6() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_5()) {
    jj_scanpos = xsp;
    if (jj_3_6()) return true;
    }
    return false;
  }

  private boolean jj_3_39() {
    if (jj_scan_token(TRUE)) return true;
    return false;
  }

  private boolean jj_3R_22() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_39()) {
    jj_scanpos = xsp;
    if (jj_3_40()) return true;
    }
    return false;
  }

  private boolean jj_3_37() {
    if (jj_scan_token(PREFIX)) return true;
    return false;
  }

  private boolean jj_3R_24() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_37()) {
    jj_scanpos = xsp;
    if (jj_3_38()) return true;
    }
    return false;
  }

  private boolean jj_3_3() {
    if (jj_3R_6()) return true;
    return false;
  }

  private boolean jj_3R_5() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_3()) {
    jj_scanpos = xsp;
    if (jj_3_4()) return true;
    }
    return false;
  }

  private boolean jj_3_35() {
    if (jj_scan_token(LANGTAG)) return true;
    return false;
  }

  private boolean jj_3R_23() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_35()) {
    jj_scanpos = xsp;
    if (jj_3_36()) return true;
    }
    return false;
  }

  private boolean jj_3_2() {
    if (jj_3R_5()) return true;
    return false;
  }

  private boolean jj_3_1() {
    if (jj_scan_token(BOM)) return true;
    return false;
  }

  private boolean jj_3_33() {
    if (jj_scan_token(DATATYPE)) return true;
    if (jj_3R_16()) return true;
    return false;
  }

  private boolean jj_3_34() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_32()) {
    jj_scanpos = xsp;
    if (jj_3_33()) return true;
    }
    return false;
  }

  private boolean jj_3_32() {
    if (jj_3R_23()) return true;
    return false;
  }

  private boolean jj_3R_20() {
    if (jj_3R_26()) return true;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_34()) jj_scanpos = xsp;
    return false;
  }

  private boolean jj_3_31() {
    if (jj_scan_token(DOUBLE)) return true;
    return false;
  }

  private boolean jj_3_30() {
    if (jj_scan_token(DECIMAL)) return true;
    return false;
  }

  private boolean jj_3_29() {
    if (jj_scan_token(INTEGER)) return true;
    return false;
  }

  private boolean jj_3R_21() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_29()) {
    jj_scanpos = xsp;
    if (jj_3_30()) {
    jj_scanpos = xsp;
    if (jj_3_31()) return true;
    }
    }
    return false;
  }

  private boolean jj_3_28() {
    if (jj_3R_14()) return true;
    return false;
  }

  private boolean jj_3R_18() {
    if (jj_scan_token(LPAREN)) return true;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3_28()) { jj_scanpos = xsp; break; }
    }
    if (jj_scan_token(RPAREN)) return true;
    return false;
  }

  private boolean jj_3R_11() {
    if (jj_scan_token(LBRACKET)) return true;
    if (jj_3R_9()) return true;
    return false;
  }

  private boolean jj_3_27() {
    if (jj_3R_22()) return true;
    return false;
  }

  private boolean jj_3_26() {
    if (jj_3R_21()) return true;
    return false;
  }

  private boolean jj_3_25() {
    if (jj_3R_20()) return true;
    return false;
  }

  private boolean jj_3R_19() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_25()) {
    jj_scanpos = xsp;
    if (jj_3_26()) {
    jj_scanpos = xsp;
    if (jj_3_27()) return true;
    }
    }
    return false;
  }

  private boolean jj_3_24() {
    if (jj_3R_18()) return true;
    return false;
  }

  private boolean jj_3_23() {
    if (jj_3R_11()) return true;
    return false;
  }

  private boolean jj_3_22() {
    if (jj_3R_19()) return true;
    return false;
  }

  private boolean jj_3_21() {
    if (jj_3R_17()) return true;
    return false;
  }

  /** Generated Token Manager. */
  public TurtleParserInternalTokenManager token_source;
  JavaCharStream 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[0];
  static private int[] jj_la1_0;
  static private int[] jj_la1_1;
  static private int[] jj_la1_2;
  static {
      jj_la1_init_0();
      jj_la1_init_1();
      jj_la1_init_2();
   }
   private static void jj_la1_init_0() {
      jj_la1_0 = new int[] {};
   }
   private static void jj_la1_init_1() {
      jj_la1_1 = new int[] {};
   }
   private static void jj_la1_init_2() {
      jj_la1_2 = new int[] {};
   }
  final private JJCalls[] jj_2_rtns = new JJCalls[50];
  private boolean jj_rescan = false;
  private int jj_gc = 0;

  /** Constructor with InputStream. */
  public TurtleParserInternal(java.io.InputStream stream) {
     this(stream, null);
  }
  /** Constructor with InputStream and supplied encoding */
  public TurtleParserInternal(java.io.InputStream stream, String encoding) {
    try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
    token_source = new TurtleParserInternalTokenManager(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 0; 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 < 0; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  /** Constructor. */
  public TurtleParserInternal(java.io.Reader stream) {
    jj_input_stream = new JavaCharStream(stream, 1, 1);
    token_source = new TurtleParserInternalTokenManager(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 0; 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 < 0; 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 TurtleParserInternal(TurtleParserInternalTokenManager tm) {
    token_source = tm;
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 0; 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(TurtleParserInternalTokenManager tm) {
    token_source = tm;
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 0; 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[68];
    if (jj_kind >= 0) {
      la1tokens[jj_kind] = true;
      jj_kind = -1;
    }
    for (int i = 0; i < 0; 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;
            case 12: jj_3_13(); break;
            case 13: jj_3_14(); break;
            case 14: jj_3_15(); break;
            case 15: jj_3_16(); break;
            case 16: jj_3_17(); break;
            case 17: jj_3_18(); break;
            case 18: jj_3_19(); break;
            case 19: jj_3_20(); break;
            case 20: jj_3_21(); break;
            case 21: jj_3_22(); break;
            case 22: jj_3_23(); break;
            case 23: jj_3_24(); break;
            case 24: jj_3_25(); break;
            case 25: jj_3_26(); break;
            case 26: jj_3_27(); break;
            case 27: jj_3_28(); break;
            case 28: jj_3_29(); break;
            case 29: jj_3_30(); break;
            case 30: jj_3_31(); break;
            case 31: jj_3_32(); break;
            case 32: jj_3_33(); break;
            case 33: jj_3_34(); break;
            case 34: jj_3_35(); break;
            case 35: jj_3_36(); break;
            case 36: jj_3_37(); break;
            case 37: jj_3_38(); break;
            case 38: jj_3_39(); break;
            case 39: jj_3_40(); break;
            case 40: jj_3_41(); break;
            case 41: jj_3_42(); break;
            case 42: jj_3_43(); break;
            case 43: jj_3_44(); break;
            case 44: jj_3_45(); break;
            case 45: jj_3_46(); break;
            case 46: jj_3_47(); break;
            case 47: jj_3_48(); break;
            case 48: jj_3_49(); break;
            case 49: jj_3_50(); 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;
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy