Example #1
0
  private File getFileAst(String string) {
    try {
      StringReader reader = new StringReader(string);
      ErrorCorrectingParser parser = new ErrorCorrectingParser(new Lexer(reader));

      File fileAST = (File) parser.parse().value;
      return fileAST;
    } catch (Exception e) {
      return null;
    } catch (Error e) {
      return null;
    }
  }
Example #2
0
 protected File getFileAST(IDocument doc) {
   if (doc instanceof IEGLDocument) {
     IEGLDocument egldoc = (IEGLDocument) doc;
     return egldoc.getNewModelEGLFile();
   } else { // parse the content to FileAST tree
     ErrorCorrectingParser newParser;
     int whitespacemask =
         ErrorCorrectingParser.RETURN_BLOCK_COMMENT
             | ErrorCorrectingParser.RETURN_LINE_COMMENT
             | ErrorCorrectingParser.RETURN_LINEBREAKS;
     // TODO commented out EGLVAGCompatibilitySetting
     //	       	if(EGLVAGCompatibilitySetting.isVAGCompatibility())
     //	       		newParser = new ErrorCorrectingParser(new VAGLexer(new BufferedReader(new
     // StringReader(doc.get()))), whitespacemask);
     //	       	else
     newParser =
         new ErrorCorrectingParser(
             new Lexer(new BufferedReader(new StringReader(doc.get()))), whitespacemask);
     return (File) (newParser.parse().value);
   }
 }