private boolean scanExpr(SymbolTable symbolTable,Tokens tokens,String data,int currentOffset,int endOffset) throws XNIException {
  int ch;
  int openParen=0;
  int closeParen=0;
  int nameOffset, dataOffset;
  boolean isQName=false;
  String name=null;
  String prefix=null;
  String schemeData=null;
  StringBuffer schemeDataBuff=new StringBuffer();
  while (true) {
    if (currentOffset == endOffset) {
      break;
    }
    ch=data.charAt(currentOffset);
    while (ch == ' ' || ch == 0x0A || ch == 0x09 || ch == 0x0D) {
      if (++currentOffset == endOffset) {
        break;
      }
      ch=data.charAt(currentOffset);
    }
    if (currentOffset == endOffset) {
      break;
    }
    byte chartype=(ch >= 0x80) ? CHARTYPE_NONASCII : fASCIICharMap[ch];
switch (chartype) {
case CHARTYPE_OPEN_PAREN:
      addToken(tokens,Tokens.XPTRTOKEN_OPEN_PAREN);
    openParen++;
  ++currentOffset;
break;
case CHARTYPE_CLOSE_PAREN:
addToken(tokens,Tokens.XPTRTOKEN_CLOSE_PAREN);
closeParen++;
++currentOffset;
break;
case CHARTYPE_CARRET:
case CHARTYPE_COLON:
case CHARTYPE_DIGIT:
case CHARTYPE_EQUAL:
case CHARTYPE_LETTER:
case CHARTYPE_MINUS:
case CHARTYPE_NONASCII:
case CHARTYPE_OTHER:
case CHARTYPE_PERIOD:
case CHARTYPE_SLASH:
case CHARTYPE_UNDERSCORE:
case CHARTYPE_WHITESPACE:
if (openParen == 0) {
nameOffset=currentOffset;
currentOffset=scanNCName(data,endOffset,currentOffset);
if (currentOffset == nameOffset) {
reportError("InvalidShortHandPointer",new Object[]{data});
return false;
}
if (currentOffset < endOffset) {
ch=data.charAt(currentOffset);
}
 else {
ch=-1;
}
name=symbolTable.addSymbol(data.substring(nameOffset,currentOffset));
prefix=XMLSymbols.EMPTY_STRING;
if (ch == ':') {
if (++currentOffset == endOffset) {
return false;
}
ch=data.charAt(currentOffset);
prefix=name;
nameOffset=currentOffset;
currentOffset=scanNCName(data,endOffset,currentOffset);
if (currentOffset == nameOffset) {
return false;
}
if (currentOffset < endOffset) {
ch=data.charAt(currentOffset);
}
 else {
ch=-1;
}
isQName=true;
name=symbolTable.addSymbol(data.substring(nameOffset,currentOffset));
}
if (currentOffset != endOffset) {
addToken(tokens,Tokens.XPTRTOKEN_SCHEMENAME);
tokens.addToken(prefix);
tokens.addToken(name);
isQName=false;
}
 else if (currentOffset == endOffset) {
addToken(tokens,Tokens.XPTRTOKEN_SHORTHAND);
tokens.addToken(name);
isQName=false;
}
closeParen=0;
break;
}
 else if (openParen > 0 && closeParen == 0 && name != null) {
dataOffset=currentOffset;
currentOffset=scanData(data,schemeDataBuff,endOffset,currentOffset);
if (currentOffset == dataOffset) {
reportError("InvalidSchemeDataInXPointer",new Object[]{data});
return false;
}
if (currentOffset < endOffset) {
ch=data.charAt(currentOffset);
}
 else {
ch=-1;
}
schemeData=symbolTable.addSymbol(schemeDataBuff.toString());
addToken(tokens,Tokens.XPTRTOKEN_SCHEMEDATA);
tokens.addToken(schemeData);
openParen=0;
schemeDataBuff.delete(0,schemeDataBuff.length());
}
 else {
return false;
}
}
}
return true;
}

private boolean scanExpr ( SymbolTable symbolTable , Tokens tokens , String data , int currentOffset , int endOffset ) throws XNIException { int ch ; int openParen = 0 ; int closeParen = 0 ; int nameOffset , dataOffset ; boolean isQName = false ; String name = null ; String prefix = null ; String schemeData = null ; StringBuffer schemeDataBuff = new StringBuffer ( ) ; while ( true ) { if ( currentOffset == endOffset ) { break ; } ch = data . charAt ( currentOffset ) ; while ( ch == ' ' || ch == 0x0A || ch == 0x09 || ch == 0x0D ) { if ( ++ currentOffset == endOffset ) { break ; } ch = data . charAt ( currentOffset ) ; } if ( currentOffset == endOffset ) { break ; } byte chartype = ( ch >= 0x80 ) ? CHARTYPE_NONASCII : fASCIICharMap [ ch ] ; switch ( chartype ) { case CHARTYPE_OPEN_PAREN : addToken ( tokens , Tokens . XPTRTOKEN_OPEN_PAREN ) ; openParen ++ ; ++ currentOffset ; break ; case CHARTYPE_CLOSE_PAREN : addToken ( tokens , Tokens . XPTRTOKEN_CLOSE_PAREN ) ; closeParen ++ ; ++ currentOffset ; break ; case CHARTYPE_CARRET : case CHARTYPE_COLON : case CHARTYPE_DIGIT : case CHARTYPE_EQUAL : case CHARTYPE_LETTER : case CHARTYPE_MINUS : case CHARTYPE_NONASCII : case CHARTYPE_OTHER : case CHARTYPE_PERIOD : case CHARTYPE_SLASH : case CHARTYPE_UNDERSCORE : case CHARTYPE_WHITESPACE : if ( openParen == 0 ) { nameOffset = currentOffset ; currentOffset = scanNCName ( data , endOffset , currentOffset ) ; if ( currentOffset == nameOffset ) { reportError ( "InvalidShortHandPointer" , new Object [ ] { data } ) ; return false ; } if ( currentOffset < endOffset ) { ch = data . charAt ( currentOffset ) ; } else { ch = - 1 ; } name = symbolTable . addSymbol ( data . substring ( nameOffset , currentOffset ) ) ; prefix = XMLSymbols . EMPTY_STRING ; if ( ch == ':' ) { if ( ++ currentOffset == endOffset ) { return false ; } ch = data . charAt ( currentOffset ) ; prefix = name ; nameOffset = currentOffset ; currentOffset = scanNCName ( data , endOffset , currentOffset ) ; if ( currentOffset == nameOffset ) { return false ; } if ( currentOffset < endOffset ) { ch = data . charAt ( currentOffset ) ; } else { ch = - 1 ; } isQName = true ; name = symbolTable . addSymbol ( data . substring ( nameOffset , currentOffset ) ) ; } if ( currentOffset != endOffset ) { addToken ( tokens , Tokens . XPTRTOKEN_SCHEMENAME ) ; tokens . addToken ( prefix ) ; tokens . addToken ( name ) ; isQName = false ; } else if ( currentOffset == endOffset ) { addToken ( tokens , Tokens . XPTRTOKEN_SHORTHAND ) ; tokens . addToken ( name ) ; isQName = false ; } closeParen = 0 ; break ; } else if ( openParen > 0 && closeParen == 0 && name != null ) { dataOffset = currentOffset ; currentOffset = scanData ( data , schemeDataBuff , endOffset , currentOffset ) ; if ( currentOffset == dataOffset ) { reportError ( "InvalidSchemeDataInXPointer" , new Object [ ] { data } ) ; return false ; } if ( currentOffset < endOffset ) { ch = data . charAt ( currentOffset ) ; } else { ch = - 1 ; } schemeData = symbolTable . addSymbol ( schemeDataBuff . toString ( ) ) ; addToken ( tokens , Tokens . XPTRTOKEN_SCHEMEDATA ) ; tokens . addToken ( schemeData ) ; openParen = 0 ; schemeDataBuff . delete ( 0 , schemeDataBuff . length ( ) ) ; } else { return false ; } } } return true ; }
scans the xpointer expression
