// end of file reached
if (this.eof == true)
return null;
TOKEN sparql1_1token = null;
ILuposToken token = null;
int beginChar = (this.currentToken!=null)?
this.currentToken.getBeginChar() + this.currentToken.getContents().length() - 1 :
this.beginCharOffset - 1;
// catch thrown error if unknown token exists
try {
// Get the token from the SPARQL 1.1 parser
sparql1_1token = this.parser.getNextToken();
//sparql 1.1 parser return eof flag
if (sparql1_1token.getKind() == 0) {
token = testOfComment(content, beginChar + 1, content.length());
if(token!=null){
this.currentToken = token;
return token;
}
setEOF(true);
return null;
}
final int startOfBeginChar = beginChar + 1;
// Generate a LuposToken by using the given SPARQL 1.1 token
final String image = sparql1_1token.getImage();
final int imageLength = image.length();
char firstChar = image.charAt(0);
// determine real start of the token...
do {
beginChar++;
while(beginChar<content.length() && content.charAt(beginChar)!=firstChar){
beginChar++;
}
} while((beginChar + imageLength < content.length()) && content.substring(beginChar, beginChar + imageLength).compareTo(image)!=0);
token = testOfComment(content, startOfBeginChar, beginChar);
if(token == null){
token = this.parser.create(this.TOKEN_MAP[sparql1_1token.getKind()], image, beginChar);
} else {
setReader(this.stream, token.getBeginChar() + token.getContents().length(), this.endCharOffset);
}
} catch (Error e) {
token = errorHandling(beginChar, content);
}