private void throwParseException(Token token, String message) throws ParseException { StringBuilder buf = new StringBuilder(); buf.append(message); buf.append(": \u005c""); buf.append(token.image); buf.append("\u005c" at line "); buf.append(token.beginLine); buf.append(", column "); buf.append(token.beginColumn); ParseException e = new ParseException(buf.toString()); e.currentToken = token; throw e; }
retval += add_escapes(tok.image); retval += " \""; tok = tok.next;
/** * This constructor is used by the method "generateParseException" * in the generated parser. Calling this constructor generates * a new object of this type with the fields "currentToken", * "expectedTokenSequences", and "tokenImage" set. */ public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal ) { super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal)); currentToken = currentTokenVal; expectedTokenSequences = expectedTokenSequencesVal; tokenImage = tokenImageVal; }
protected void crawl(File src, File dest) { for (File f : src.listFiles()) { if (f.isDirectory() && !f.isHidden() && !f.getName().startsWith(".")) { crawl(f, new File(dest, f.getName())); } else { try { parse(f, dest); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }
private void throwParseException(Token token, String message) throws ParseException { StringBuilder buf = new StringBuilder(); buf.append(message); buf.append(": \u005c""); buf.append(token.image); buf.append("\u005c" at line "); buf.append(token.beginLine); buf.append(", column "); buf.append(token.beginColumn); ParseException e = new ParseException(buf.toString()); e.currentToken = token; throw e; }
.getTypes(); if (typeDeclarations.size() > 1) { throw new ParseException( MessageFormat .format("Annotation [{0}] could not be parsed, it contains an unexpected type declaration.", throw new ParseException(MessageFormat.format( "Expected [{0}] as type declaration.", ClassOrInterfaceDeclaration.class.getName())); throw new ParseException(MessageFormat.format( "Expected [{0}] as type declaration.", "Dummy")); throw new ParseException( MessageFormat .format("Annotation [{0}] could not be parsed, it does not seem to contain an annotation declaration.",
exptokseq[i] = jj_expentries.get(i); return new ParseException(token, exptokseq, tokenImage);
exptokseq[i] = jj_expentries.get(i); return new ParseException(token, exptokseq, tokenImage);
public static CompilationUnit parse(final Reader reader, boolean considerComments) throws ParseException { try { String code = SourcesHelper.readerToString(reader); Reader reader1 = SourcesHelper.stringToReader(code); CompilationUnit cu = new ASTParser(reader1).CompilationUnit(); if (considerComments){ insertComments(cu,code); } return cu; } catch (IOException ioe){ throw new ParseException(ioe.getMessage()); } }
final public void RSIGNEDSHIFT() throws ParseException { if (getToken(1).kind == GT && ((GTToken)getToken(1)).realKind == RSIGNEDSHIFT) { } else { jj_consume_token(-1); throw new ParseException(); } jj_consume_token(GT); jj_consume_token(GT); }
final public void RSIGNEDSHIFT() throws ParseException { if (getToken(1).kind == GT && ((GTToken)getToken(1)).realKind == RSIGNEDSHIFT) { } else { jj_consume_token(-1); throw new ParseException(); } jj_consume_token(GT); jj_consume_token(GT); }
/** * Parses the Java code contained in the {@link InputStream} and returns a * {@link CompilationUnit} that represents it. * * @param in * {@link InputStream} containing Java source code * @param encoding * encoding of the source code * @return CompilationUnit representing the Java source code * @throws ParseException * if the source code has parser errors */ public static CompilationUnit parse(final InputStream in, final String encoding, boolean considerComments) throws ParseException { try { String code = SourcesHelper.streamToString(in, encoding); InputStream in1 = SourcesHelper.stringToStream(code); CompilationUnit cu = new ASTParser(in1, encoding).CompilationUnit(); if (considerComments){ insertComments(cu,code); } return cu; } catch (IOException ioe){ throw new ParseException(ioe.getMessage()); } }
jj_la1[116] = jj_gen; jj_consume_token(-1); throw new ParseException();
jj_la1[117] = jj_gen; jj_consume_token(-1); throw new ParseException();
jj_la1[53] = jj_gen; jj_consume_token(-1); throw new ParseException();
final public Type TypeArgument() throws ParseException { Type ret; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FLOAT: case INT: case LONG: case SHORT: case IDENTIFIER: ret = ReferenceType(); break; case HOOK: ret = Wildcard(); break; default: jj_la1[54] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return ret;} throw new Error("Missing return statement in function"); }
final public void RUNSIGNEDSHIFT() throws ParseException { if (getToken(1).kind == GT && ((GTToken)getToken(1)).realKind == RUNSIGNEDSHIFT) { } else { jj_consume_token(-1); throw new ParseException(); } jj_consume_token(GT); jj_consume_token(GT); jj_consume_token(GT); }
final public Type TypeArgument() throws ParseException { Type ret; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FLOAT: case INT: case LONG: case SHORT: case IDENTIFIER: ret = ReferenceType(); break; case HOOK: ret = Wildcard(); break; default: jj_la1[53] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return ret;} throw new Error("Missing return statement in function"); }
final public void RUNSIGNEDSHIFT() throws ParseException { if (getToken(1).kind == GT && ((GTToken)getToken(1)).realKind == RUNSIGNEDSHIFT) { } else { jj_consume_token(-1); throw new ParseException(); } jj_consume_token(GT); jj_consume_token(GT); jj_consume_token(GT); }
jj_la1[33] = jj_gen; jj_consume_token(-1); throw new ParseException();