/** * */ public OBOFormatParser() { this(new MyStream(), Collections.emptyMap()); }
private String getParseTag() throws OBOFormatParserException { if (s.eof()) { error("Expected an id tag, not end of file."); } if (s.eol()) { error("Expected an id tag, not end of line"); } int i = s.indexOf(':'); if (i == -1) { error("Could not find tag separator ':' in line."); } String tag = s.rest().substring(0, i); s.advance(i+1); parseWs(); parseZeroOrMoreWs(); // Memory optimization // re-use the tag string OboFormatTag formatTag = OBOFormatConstants.getTag(tag); if (formatTag != null) { tag = formatTag.getTag(); } return mapDeprecatedTag(tag); }
/** * @param obodoc obodoc * @throws OBOFormatParserException parser exception */ public void parseEntityFrame(OBODoc obodoc) { parseZeroOrMoreWsOptCmtNl(); String rest = stream.rest(); if (rest.startsWith("[Term]")) { parseTermFrame(obodoc); } else if (rest.startsWith("[Instance]")) { LOG.error("Error: Instance frames are not supported yet. Parsing stopped at line: {}", Integer.valueOf( stream.getLineNo())); while (!stream.eof()) { stream.advanceLine(); } } else { parseTypedefFrame(obodoc); } }
private String getParseTag() { if (stream.eof()) { error("Expected an id tag, not end of file."); } if (stream.eol()) { error("Expected an id tag, not end of line"); } int i = stream.indexOf(':'); if (i == -1) { error("Could not find tag separator ':' in line."); } String tag = stream.rest().substring(0, i); stream.advance(i + 1); parseWs(); parseZeroOrMoreWs(); // Memory optimization // re-use the tag string OboFormatTag formatTag = OBOFormatConstants.getTag(tag); if (formatTag != null) { tag = formatTag.getTag(); } return mapDeprecatedTag(tag); }
private String getParseTag() { if (stream.eof()) { error("Expected an id tag, not end of file."); } if (stream.eol()) { error("Expected an id tag, not end of line"); } int i = stream.indexOf(':'); if (i == -1) { error("Could not find tag separator ':' in line."); } String tag = stream.rest().substring(0, i); stream.advance(i + 1); parseWs(); parseZeroOrMoreWs(); // Memory optimization // re-use the tag string OboFormatTag formatTag = OBOFormatConstants.getTag(tag); if (formatTag != null) { tag = formatTag.getTag(); } return mapDeprecatedTag(tag); }
/** * @param obodoc obodoc * @throws OBOFormatParserException parser exception */ public void parseEntityFrame(OBODoc obodoc) { parseZeroOrMoreWsOptCmtNl(); String rest = stream.rest(); if (rest.startsWith("[Term]")) { parseTermFrame(obodoc); } else if (rest.startsWith("[Instance]")) { LOG.error("Error: Instance frames are not supported yet. Parsing stopped at line: {}", Integer.valueOf( stream.getLineNo())); while (!stream.eof()) { stream.advanceLine(); } } else { parseTypedefFrame(obodoc); } }
private String getParseTag() { if (stream.eof()) { error("Expected an id tag, not end of file."); } if (stream.eol()) { error("Expected an id tag, not end of line"); } int i = stream.indexOf(':'); if (i == -1) { error("Could not find tag separator ':' in line."); } String tag = stream.rest().substring(0, i); stream.advance(i + 1); parseWs(); parseZeroOrMoreWs(); // Memory optimization // re-use the tag string OboFormatTag formatTag = OBOFormatConstants.getTag(tag); if (formatTag != null) { tag = formatTag.getTag(); } return mapDeprecatedTag(tag); }
private String getParseTag() { if (stream.eof()) { error("Expected an id tag, not end of file."); } if (stream.eol()) { error("Expected an id tag, not end of line"); } int i = stream.indexOf(':'); if (i == -1) { error("Could not find tag separator ':' in line."); } String tag = stream.rest().substring(0, i); stream.advance(i + 1); parseWs(); parseZeroOrMoreWs(); // Memory optimization // re-use the tag string OboFormatTag formatTag = OBOFormatConstants.getTag(tag); if (formatTag != null) { tag = formatTag.getTag(); } return mapDeprecatedTag(tag); }
/** * @param obodoc obodoc * @throws OBOFormatParserException parser exception */ public void parseEntityFrame(OBODoc obodoc) { parseZeroOrMoreWsOptCmtNl(); String rest = stream.rest(); if (rest.startsWith("[Term]")) { parseTermFrame(obodoc); } else if (rest.startsWith("[Instance]")) { LOG.error("Error: Instance frames are not supported yet. Parsing stopped at line: {}", Integer.valueOf( stream.getLineNo())); while (!stream.eof()) { stream.advanceLine(); } } else { parseTypedefFrame(obodoc); } }
/** * @param obodoc obodoc * @throws OBOFormatParserException parser exception */ public void parseEntityFrame(OBODoc obodoc) { parseZeroOrMoreWsOptCmtNl(); String rest = stream.rest(); if (rest.startsWith("[Term]")) { parseTermFrame(obodoc); } else if (rest.startsWith("[Instance]")) { LOG.error("Error: Instance frames are not supported yet. Parsing stopped at line: {}", Integer.valueOf( stream.getLineNo())); while (!stream.eof()) { stream.advanceLine(); } } else { parseTypedefFrame(obodoc); } }
/** * intersection_of-Tag Class-ID | intersection_of-Tag Relation-ID Class-ID. * * @param cl cl * @throws OBOFormatParserException parser exception */ private void parseTermIntersectionOf(Clause cl) { parseIdRef(cl); // consumed the first ID parseZeroOrMoreWs(); if (!stream.eol()) { char c = stream.peekChar(); if (c != '!' && c != '{') { // try to consume the second id parseIdRef(cl, true); } } }
/** * intersection_of-Tag Class-ID | intersection_of-Tag Relation-ID Class-ID. * * @param cl cl * @throws OBOFormatParserException parser exception */ private void parseTermIntersectionOf(Clause cl) { parseIdRef(cl); // consumed the first ID parseZeroOrMoreWs(); if (!stream.eol()) { char c = stream.peekChar(); if (c != '!' && c != '{') { // try to consume the second id parseIdRef(cl, true); } } }
/** * intersection_of-Tag Class-ID | intersection_of-Tag Relation-ID Class-ID. * * @param cl cl * @throws OBOFormatParserException parser exception */ private void parseTermIntersectionOf(Clause cl) { parseIdRef(cl); // consumed the first ID parseZeroOrMoreWs(); if (!stream.eol()) { char c = stream.peekChar(); if (c != '!' && c != '{') { // try to consume the second id parseIdRef(cl, true); } } }
/** * intersection_of-Tag Class-ID | intersection_of-Tag Relation-ID Class-ID. * * @param cl cl * @throws OBOFormatParserException parser exception */ private void parseTermIntersectionOf(Clause cl) { parseIdRef(cl); // consumed the first ID parseZeroOrMoreWs(); if (!stream.eol()) { char c = stream.peekChar(); if (c != '!' && c != '{') { // try to consume the second id parseIdRef(cl, true); } } }
private boolean parseImport(Clause cl) { parseZeroOrMoreWs(); String v = getParseUntil("!{"); v = removeTrailingWS(v); cl.setValue(v); // parse and ignore annotations for import statements parseZeroOrMoreWs(); if (s.peekCharIs('{')) { // do noy parse trailing qualifiers. getParseUntilAdv("}"); } parseHiddenComment(); // ignore return value, as comments are optional return true; }
private boolean parseImport(Clause cl) { parseZeroOrMoreWs(); String v = getParseUntil("!{"); v = removeTrailingWS(v); cl.setValue(v); // parse and ignore annotations for import statements parseZeroOrMoreWs(); if (stream.peekCharIs('{')) { // do noy parse trailing qualifiers. getParseUntilAdv("}"); } parseHiddenComment();// ignore return value, as comments are optional return true; }
private boolean parseImport(Clause cl) { parseZeroOrMoreWs(); String v = getParseUntil("!{"); v = removeTrailingWS(v); cl.setValue(v); // parse and ignore annotations for import statements parseZeroOrMoreWs(); if (stream.peekCharIs('{')) { // do noy parse trailing qualifiers. getParseUntilAdv("}"); } parseHiddenComment();// ignore return value, as comments are optional return true; }
protected void parseWs() throws OBOFormatParserException { if (s.eol()) { error("Expected at least one white space, but found end of line at pos: "+s.pos); } if (s.eof()) { error("Expected at least one white space, but found end of file."); } if (s.peekChar() == ' ') { s.advance(1); } else { warn("Expected white space at pos: "+s.pos); } }
private boolean parseImport(Clause cl) { parseZeroOrMoreWs(); String v = getParseUntil("!{"); v = removeTrailingWS(v); cl.setValue(v); // parse and ignore annotations for import statements parseZeroOrMoreWs(); if (stream.peekCharIs('{')) { // do noy parse trailing qualifiers. getParseUntilAdv("}"); } parseHiddenComment();// ignore return value, as comments are optional return true; }
protected void parseOneOrMoreWs() { if (stream.eol() || stream.eof()) { error("Expected at least one white space at pos: " + stream.pos); } int n = 0; while (stream.peekCharIs(' ')) { stream.advance(1); n++; } if (n == 0) { error("Expected at least one white space at pos: " + stream.pos); } }