use of org.apache.jena.riot.tokens.Token in project jena by apache.
the class JSONInputIterator method parseNodeInfo.
private String parseNodeInfo(String name) {
if (lookingAt(TokenType.STRING)) {
Token t = nextToken();
String value = t.getImage();
checkComma(TokenType.RBRACE);
return value;
} else {
exception(peekToken(), "Unexpected Token, expected a string as the value for the %s property", name);
return null;
}
}
use of org.apache.jena.riot.tokens.Token in project jena by apache.
the class JSONInputIterator method parseHeader.
private void parseHeader() {
do {
if (isPropertyName()) {
Token t = nextToken();
String name = t.getImage();
checkColon();
if (name.equals("vars")) {
parseVars();
} else if (name.equals("link")) {
// Throw away the links
skipLinks();
} else {
exception(t, "Unexpected property %s encountered in head object", name);
}
checkComma(TokenType.RBRACE);
} else if (lookingAt(TokenType.RBRACE)) {
nextToken();
return;
} else {
exception(peekToken(), "Unexpected Token encountered while parsing head object");
}
} while (true);
}
use of org.apache.jena.riot.tokens.Token in project jena by apache.
the class JSONInputIterator method parseToFirstResult.
private void parseToFirstResult() {
if (lookingAt(TokenType.LBRACE)) {
nextToken();
if (isPropertyName()) {
Token t = nextToken();
String name = t.getImage();
if (name.equals("bindings")) {
checkColon();
if (lookingAt(TokenType.LBRACKET)) {
nextToken();
} else {
exception(peekToken(), "Unexpected Token encountered, expected a [ for the start of the bindings array");
}
} else {
exception(t, "Unexpected Token encountered, expected the bindings property");
}
} else {
exception(peekToken(), "Unexpected Token ecnountered, expected the bindings property");
}
} else {
exception(peekToken(), "Unexpected Token encountered, expected a { to start the results list object");
}
}
use of org.apache.jena.riot.tokens.Token in project jena by apache.
the class JSONInputIterator method eof.
protected final boolean eof() {
if (tokenEOF != null)
return true;
if (!moreTokens()) {
tokenEOF = new Token(tokens.getLine(), tokens.getColumn());
tokenEOF.setType(TokenType.EOF);
return true;
}
return false;
}
use of org.apache.jena.riot.tokens.Token in project jena by apache.
the class JSONParserBase method nextToken.
protected final Token nextToken() {
if (eof())
return tokenEOF;
Token t = peekTokens.next();
currLine = t.getLine();
currCol = t.getColumn();
// if ( VERBOSE ) log.info("Move: " + t) ;
return t;
}
Aggregations