protected Value parseQNameOrBoolean() throws IOException, RDFParseException {
  int c=readCodePoint();
  if (c == -1) {
    throwEOFException();
  }
  if (c != ':' && !TurtleUtil.isPrefixStartChar(c)) {
    reportError("Expected a ':' or a letter, found '" + new String(Character.toChars(c)) + "'",BasicParserSettings.VERIFY_RELATIVE_URIS);
  }
  String namespace=null;
  if (c == ':') {
    namespace=getNamespace("");
  }
 else {
    StringBuilder prefix=new StringBuilder(8);
    appendCodepoint(prefix,c);
    int previousChar=c;
    c=readCodePoint();
    while (TurtleUtil.isPrefixChar(c)) {
      appendCodepoint(prefix,c);
      previousChar=c;
      c=readCodePoint();
    }
    if (c != ':') {
      String value=prefix.toString();
      if (value.equals("true") || value.equals("false")) {
        unread(c);
        return createLiteral(value,null,XMLSchema.BOOLEAN,getLineNumber(),-1);
      }
    }
 else {
      if (previousChar == '.') {
        reportFatalError("prefix can not end with with '.'");
      }
    }
    verifyCharacterOrFail(c,":");
    namespace=getNamespace(prefix.toString());
  }
  StringBuilder localName=new StringBuilder(16);
  c=readCodePoint();
  if (TurtleUtil.isNameStartChar(c)) {
    if (c == '\\') {
      localName.append(readLocalEscapedChar());
    }
 else {
      appendCodepoint(localName,c);
    }
    int previousChar=c;
    c=readCodePoint();
    while (TurtleUtil.isNameChar(c)) {
      if (c == '\\') {
        localName.append(readLocalEscapedChar());
      }
 else {
        appendCodepoint(localName,c);
      }
      previousChar=c;
      c=readCodePoint();
    }
    unread(c);
    if (previousChar == '.') {
      unread(previousChar);
      localName.deleteCharAt(localName.length() - 1);
    }
  }
 else {
    unread(c);
  }
  String localNameString=localName.toString();
  for (int i=0; i < localNameString.length(); i++) {
    if (localNameString.charAt(i) == '%') {
      if (i > localNameString.length() - 3 || !ASCIIUtil.isHex(localNameString.charAt(i + 1)) || !ASCIIUtil.isHex(localNameString.charAt(i + 2))) {
        reportFatalError("Found incomplete percent-encoded sequence: " + localNameString);
      }
    }
  }
  return createURI(namespace + localNameString);
}

protected Value parseQNameOrBoolean ( ) throws IOException , RDFParseException { int c = readCodePoint ( ) ; if ( c == - 1 ) { throwEOFException ( ) ; } if ( c != ':' && ! TurtleUtil . isPrefixStartChar ( c ) ) { reportError ( "Expected a ':' or a letter, found '" + new String ( Character . toChars ( c ) ) + "'" , BasicParserSettings . VERIFY_RELATIVE_URIS ) ; } String namespace = null ; if ( c == ':' ) { namespace = getNamespace ( "" ) ; } else { StringBuilder prefix = new StringBuilder ( 8 ) ; appendCodepoint ( prefix , c ) ; int previousChar = c ; c = readCodePoint ( ) ; while ( TurtleUtil . isPrefixChar ( c ) ) { appendCodepoint ( prefix , c ) ; previousChar = c ; c = readCodePoint ( ) ; } if ( c != ':' ) { String value = prefix . toString ( ) ; if ( value . equals ( "true" ) || value . equals ( "false" ) ) { unread ( c ) ; return createLiteral ( value , null , XMLSchema . BOOLEAN , getLineNumber ( ) , - 1 ) ; } } else { if ( previousChar == '.' ) { reportFatalError ( "prefix can not end with with '.'" ) ; } } verifyCharacterOrFail ( c , ":" ) ; namespace = getNamespace ( prefix . toString ( ) ) ; } StringBuilder localName = new StringBuilder ( 16 ) ; c = readCodePoint ( ) ; if ( TurtleUtil . isNameStartChar ( c ) ) { if ( c == '\\' ) { localName . append ( readLocalEscapedChar ( ) ) ; } else { appendCodepoint ( localName , c ) ; } int previousChar = c ; c = readCodePoint ( ) ; while ( TurtleUtil . isNameChar ( c ) ) { if ( c == '\\' ) { localName . append ( readLocalEscapedChar ( ) ) ; } else { appendCodepoint ( localName , c ) ; } previousChar = c ; c = readCodePoint ( ) ; } unread ( c ) ; if ( previousChar == '.' ) { unread ( previousChar ) ; localName . deleteCharAt ( localName . length ( ) - 1 ) ; } } else { unread ( c ) ; } String localNameString = localName . toString ( ) ; for ( int i = 0 ; i < localNameString . length ( ) ; i ++ ) { if ( localNameString . charAt ( i ) == '%' ) { if ( i > localNameString . length ( ) - 3 || ! ASCIIUtil . isHex ( localNameString . charAt ( i + 1 ) ) || ! ASCIIUtil . isHex ( localNameString . charAt ( i + 2 ) ) ) { reportFatalError ( "Found incomplete percent-encoded sequence: " + localNameString ) ; } } } return createURI ( namespace + localNameString ) ; }
parses qnames and boolean values , which have equivalent starting characters .
