Esempio n. 1
0
 protected void parseLegalDocStrWithoutTree(String s, Object... additionalErrInfo) {
   try {
     parseLegalDoc(new Document(s), additionalErrInfo, parser.getGrammarVersion(), false);
   } catch (MisconfigurationException e) {
     throw new RuntimeException(e);
   }
 }
Esempio n. 2
0
 protected static SimpleNode parseLegalDoc(
     IDocument doc, Object[] additionalErrInfo, PyParser parser) {
   try {
     return parseLegalDoc(doc, additionalErrInfo, parser.getGrammarVersion(), true);
   } catch (MisconfigurationException e) {
     throw new RuntimeException(e);
   }
 }
Esempio n. 3
0
  protected Throwable parseILegalDoc(IDocument doc, boolean generateTree) {
    Tuple<ISimpleNode, Throwable> objects;
    try {
      objects =
          PyParser.reparseDocument(new ParserInfo(doc, parser.getGrammarVersion(), generateTree));
    } catch (MisconfigurationException e) {
      throw new RuntimeException(e);
    }

    Throwable err = objects.o2;
    if (err == null) {
      fail("Expected a ParseException and the doc was successfully parsed.");
    }
    if (!(err instanceof ParseException) && !(err instanceof TokenMgrError)) {
      fail("Expected a ParseException and received:" + err.getClass());
    }
    return err;
  }