static int raptor_ntriples_term_valid(unsigned char c, int position, raptor_ntriples_term_class term_class) { int result = 0; switch(term_class) { case RAPTOR_TERM_CLASS_URI: /* ends on > */ result = (c != '>'); break; case RAPTOR_TERM_CLASS_BNODEID: /* ends on first non [A-Za-z0-9_:][-.A-Za-z0-9]* */ result = IS_ASCII_ALPHA(c) || IS_ASCII_DIGIT(c) || c == '_' || c == ':'; if(position) /* FIXME * This isn't correct; '.' is allowed in positions 1..N-1 but * this calling convention of character-by-character cannot * check this. */ result = (result || c == '-' || c == '.'); break; case RAPTOR_TERM_CLASS_STRING: /* ends on " */ result = (c != '"'); break; case RAPTOR_TERM_CLASS_LANGUAGE: /* ends on first non [a-zA-Z]+ ('-' [a-zA-Z0-9]+ )? */ result = IS_ASCII_ALPHA(c); if(position) result = (result || IS_ASCII_DIGIT(c) || c == '-'); break; default: RAPTOR_DEBUG2("Unknown N-Triples term class %d", term_class); } return result; }
static int raptor_ntriples_term_valid(unsigned char c, int position, raptor_ntriples_term_class term_class) { int result=0; switch(term_class) { case RAPTOR_TERM_CLASS_URI: /* ends on > */ result=(c!= '>'); break; case RAPTOR_TERM_CLASS_BNODEID: /* ends on first non [A-Za-z][A-Za-z0-9]* */ result=IS_ASCII_ALPHA(c); if(position) result = (result || IS_ASCII_DIGIT(c)); break; case RAPTOR_TERM_CLASS_STRING: /* ends on " */ result=(c!= '"'); break; case RAPTOR_TERM_CLASS_LANGUAGE: /* ends on first non [a-z0-9]+ ('-' [a-z0-9]+ )? */ result=(IS_ASCII_ALPHA(c) || IS_ASCII_DIGIT(c)); if(position) result = (result || c=='-'); break; case RAPTOR_TERM_CLASS_FULL: result=1; break; default: RAPTOR_FATAL2("Unknown ntriples term %d", term_class); } return result; }
static int raptor_ntriples_term_valid(raptor_parser* rdf_parser, unsigned char c, int position, raptor_ntriples_term_class term_class) { int result = 0; switch(term_class) { case RAPTOR_TERM_CLASS_URI: /* ends on > */ result = (c != '>'); break; case RAPTOR_TERM_CLASS_BNODEID: /* ends on first non [A-Za-z][A-Za-z0-9]* */ result = IS_ASCII_ALPHA(c); if(position) result = (result || IS_ASCII_DIGIT(c)); break; case RAPTOR_TERM_CLASS_STRING: /* ends on " */ result = (c != '"'); break; case RAPTOR_TERM_CLASS_LANGUAGE: /* ends on first non [a-zA-Z]+ ('-' [a-zA-Z0-9]+ )? */ result = IS_ASCII_ALPHA(c); if(position) result = (result || IS_ASCII_DIGIT(c) || c == '-'); break; default: raptor_parser_error(rdf_parser, "Unknown N-Triples term class %d", term_class); } return result; }