private static int checkPart(String languageTag, int idx, boolean leader) { for (; idx < languageTag.length(); idx++) { int ch = languageTag.charAt(idx) ; if ( leader ) { if ( RiotChars.isA2Z(ch) ) continue ; } else { if ( RiotChars.isA2ZN(ch) ) continue ; } // Not acceptable. return idx ; } // Off end. return idx ; }
public static boolean isWhitespace(int ch) { return isHorizontalWhitespace(ch) || isNewlineChar(ch) || ch == '\f'; }
private static int skip1_PN_CHARS(String str, int idx) { char ch = str.charAt(idx) ; if ( isPNChars(ch) ) return idx + 1 ; return -1 ; }
public static boolean isPNChars_U_N(int ch) { // PN_CHARS_U | [0-9] return isPNCharsBase(ch) || ( ch == '_' ) || isDigit(ch); }
private void skip() { int ch = EOF; for (;;) { if ( reader.eof() ) return; ch = reader.peekChar(); if ( ch == CH_HASH ) { reader.readChar(); // Comment. Skip to NL for (;;) { ch = reader.peekChar(); if ( ch == EOF || isNewlineChar(ch) ) break; reader.readChar(); } } // Including excess newline chars from comment. if ( lineMode ) { if ( !isHorizontalWhitespace(ch) ) break; } else { if ( !isWhitespace(ch) ) break; } reader.readChar(); } }
if ( ch == EOF ) error("Blank node label missing (EOF found)"); if ( isWhitespace(ch) ) error("Blank node label missing"); if ( !RiotChars.isPNChars_U_N(ch) ) error("Blank node label does not start with alphabetic or _ :" + (char)ch); reader.readChar(); if ( !(RiotChars.isPNChars(ch) || ch == CH_DOT) ) break; reader.readChar();
reader.readChar(); processPLX(ch); } else if ( RiotChars.isPNChars_U_N(ch) ) { stringBuilder.append((char)ch); reader.readChar(); return ""; } else { if ( !RiotChars.isPNCharsBase(ch) ) return ""; stringBuilder.append((char)ch); else if ( isPNChars(ch) ) valid = true; else if ( ch == CH_DOT )
if ( isWhitespace(nextCh) ) exception("No whitespace after ^^ in literal with datatype") ; if ( ch == EOF ) exception("EOF found after " + CTRL_CHAR) ; if ( RiotChars.isWhitespace(ch) ) token.cntrlCode = -1 ; else reader.readChar() ; ch = reader.peekChar() ; if ( range(ch, '0', '9') ) { int ch2 = reader.peekChar() ; if ( !range(ch2, '0', '9') ) { if ( ch == CH_PLUS || ch == CH_MINUS || range(ch, '0', '9') ) { if ( isNewlineChar(ch) ) { int ch2 = reader.readChar() ; } while (isNewlineChar(reader.peekChar())) ; token.setType(TokenType.NL) ;
reader.readChar(); ch = reader.peekChar(); if ( range(ch, '0', '9') ) { int ch2 = reader.peekChar(); if ( !range(ch2, '0', '9') ) { if ( ch == CH_PLUS || ch == CH_MINUS || range(ch, '0', '9') ) { if ( isNewlineChar(ch) ) { int ch2 = reader.readChar(); } while (isNewlineChar(reader.peekChar())); token.setType(TokenType.NL);
private void readHex(PeekReader reader, StringBuilder sb) { // Just after the 0x, which are in sb int x = 0; for (;;) { int ch = reader.peekChar(); if ( !isHexChar(ch) ) break; reader.readChar(); sb.append((char)ch); x++; } if ( x == 0 ) error("No hex characters after " + sb.toString()); }
public static String encodeBNodeLabel(String label) { StringBuilder buff = new StringBuilder() ; // Must be at least one char and not a digit. buff.append(LabelLeadingLetter) ; for ( int i = 0 ; i < label.length() ; i++ ) { char ch = label.charAt(i) ; if ( ch == encodeMarkerChar ) { buff.append(ch) ; buff.append(ch) ; } else if ( RiotChars.isA2ZN(ch) ) buff.append(ch) ; else Chars.encodeAsHex(buff, encodeMarkerChar, ch) ; } return buff.toString() ; }
private void a2z(StringBuilder sb2) { for (;;) { int ch = reader.peekChar(); if ( isA2Z(ch) ) { reader.readChar(); stringBuilder.append((char)ch); } else return; } }
int ch = reader.peekChar(); if ( isAlphaNumeric(ch) || Chars.charInArray(ch, extraChars) ) { reader.readChar(); stringBuilder.append((char)ch);
public static boolean isPNChars_U(int ch) { //PN_CHARS_BASE | '_' return isPNCharsBase(ch) || ( ch == '_' ) ; }
int ch = reader.peekChar() ; if ( isAlphaNumeric(ch) || charInArray(ch, extraChars) ) { reader.readChar() ; stringBuilder.append((char)ch) ;
public void skipLine() { for (;;) { int ch = reader.peekChar(); if ( ch == EOF || isNewlineChar(ch) ) break; reader.readChar(); } }
private void skip() { int ch = EOF; for (;;) { if ( reader.eof() ) return; ch = reader.peekChar(); if ( ch == CH_HASH ) { reader.readChar(); // Comment. Skip to NL for (;;) { ch = reader.peekChar(); if ( ch == EOF || isNewlineChar(ch) ) break; reader.readChar(); } } // Including excess newline chars from comment. if ( lineMode ) { if ( !isHorizontalWhitespace(ch) ) break; } else { if ( !isWhitespace(ch) ) break; } reader.readChar(); } }
if ( ch == EOF ) error("Blank node label missing (EOF found)"); if ( isWhitespace(ch) ) error("Blank node label missing"); if ( !RiotChars.isPNChars_U_N(ch) ) error("Blank node label does not start with alphabetic or _ :" + (char)ch); reader.readChar(); if ( !(RiotChars.isPNChars(ch) || ch == CH_DOT) ) break; reader.readChar();
reader.readChar(); processPLX(ch); } else if ( RiotChars.isPNChars_U_N(ch) ) { stringBuilder.append((char)ch); reader.readChar(); return ""; } else { if ( !RiotChars.isPNCharsBase(ch) ) return ""; stringBuilder.append((char)ch); else if ( isPNChars(ch) ) valid = true; else if ( ch == CH_DOT )
if ( isWhitespace(nextCh) ) exception("No whitespace after ^^ in literal with datatype") ; if ( ch == EOF ) exception("EOF found after "+CTRL_CHAR) ; if ( RiotChars.isWhitespace(ch) ) token.cntrlCode = -1 ; else getReader().readChar() ; ch = getReader().peekChar() ; if ( range(ch, '0', '9') ) int ch2 = getReader().peekChar() ; if ( ! range(ch2, '0', '9') ) if ( ch == CH_PLUS || ch == CH_MINUS || range(ch, '0', '9') ) if ( isNewlineChar(ch) ) { int ch2 = getReader().readChar() ; } while (isNewlineChar(getReader().peekChar())) ; token.setType(TokenType.NL) ;