/** * Returns a new Token object, by default. However, if you want, you * can create and return subclass objects based on the value of ofKind. * Simply add the cases to the switch for all those special cases. * For example, if you have a subclass of Token called IDToken that * you want to create if ofKind is ID, simply add something like : * * case MyParserConstants.ID : return new IDToken(ofKind, image); * * to the following switch statement. Then you can cast matchedToken * variable to the appropriate type and use sit in your lexical actions. */ public static Token newToken(int ofKind, String image) { switch(ofKind) { case JavaParserConstants.RUNSIGNEDSHIFT : case JavaParserConstants.RSIGNEDSHIFT : case JavaParserConstants.GT: return new GTToken(ofKind, image); default : return new Token(ofKind, image); } }
/** * Removes the leading comment marker (like {@code *}) of each line * of the comment as well as the start marker ({@code //}, {@code /*} or {@code /**} * and the end markers (<code>*/</code>). * * @param comment the raw comment * @return List of lines of the comments * * @deprecated This method will be removed with PMD 7.0.0. * It has been replaced by {@link Comment#getFilteredComment()}. */ @Deprecated // will be removed with PMD 7.0.0 public static List<String> multiLinesIn(String comment) { // temporary createa a Multiline Comment Node Token t = new Token(); t.image = comment; MultiLineComment node = new MultiLineComment(t); return Arrays.asList(Comment.NEWLINES_PATTERN.split(node.getFilteredComment())); }
/** Constructor with generated Token Manager. */ public JavaParser(JavaParserTokenManager tm) { token_source = tm; token = new Token(); token.next = jj_nt = token_source.getNextToken(); jj_gen = 0; for (int i = 0; i < 168; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); }
/** Constructor with user supplied CharStream. */ public JavaParser(CharStream stream) { token_source = new JavaParserTokenManager(stream); token = new Token(); token.next = jj_nt = token_source.getNextToken(); jj_gen = 0; for (int i = 0; i < 168; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); }
/** Reinitialise. */ public void ReInit(JavaParserTokenManager tm) { token_source = tm; token = new Token(); token.next = jj_nt = token_source.getNextToken(); jjtree.reset(); jj_gen = 0; for (int i = 0; i < 168; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); }
/** Reinitialise. */ public void ReInit(CharStream stream) { token_source.ReInit(stream); token = new Token(); token.next = jj_nt = token_source.getNextToken(); jj_lookingAhead = false; jjtree.reset(); jj_gen = 0; for (int i = 0; i < 168; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); }
/** * Returns a new Token object, by default. However, if you want, you * can create and return subclass objects based on the value of ofKind. * Simply add the cases to the switch for all those special cases. * For example, if you have a subclass of Token called IDToken that * you want to create if ofKind is ID, simply add something like : * * case MyParserConstants.ID : return new IDToken(ofKind, image); * * to the following switch statement. Then you can cast matchedToken * variable to the appropriate type and use sit in your lexical actions. */ public static Token newToken(int ofKind, String image) { switch(ofKind) { case JavaParserConstants.RUNSIGNEDSHIFT : case JavaParserConstants.RSIGNEDSHIFT : case JavaParserConstants.GT: return new GTToken(ofKind, image); default : return new Token(ofKind, image); } }
/** * Removes the leading comment marker (like {@code *}) of each line * of the comment as well as the start marker ({@code //}, {@code /*} or {@code /**} * and the end markers (<code>*/</code>). * * @param comment the raw comment * @return List of lines of the comments * * @deprecated This method will be removed with PMD 7.0.0. * It has been replaced by {@link Comment#getFilteredComment()}. */ @Deprecated // will be removed with PMD 7.0.0 public static List<String> multiLinesIn(String comment) { // temporary createa a Multiline Comment Node Token t = new Token(); t.image = comment; MultiLineComment node = new MultiLineComment(t); return Arrays.asList(Comment.NEWLINES_PATTERN.split(node.getFilteredComment())); }
/** Constructor with generated Token Manager. */ public JavaParser(JavaParserTokenManager tm) { token_source = tm; token = new Token(); token.next = jj_nt = token_source.getNextToken(); jj_gen = 0; for (int i = 0; i < 168; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); }
/** Reinitialise. */ public void ReInit(JavaParserTokenManager tm) { token_source = tm; token = new Token(); token.next = jj_nt = token_source.getNextToken(); jjtree.reset(); jj_gen = 0; for (int i = 0; i < 168; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); }
/** Constructor with user supplied CharStream. */ public JavaParser(CharStream stream) { token_source = new JavaParserTokenManager(stream); token = new Token(); token.next = jj_nt = token_source.getNextToken(); jj_gen = 0; for (int i = 0; i < 168; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); }
/** Reinitialise. */ public void ReInit(CharStream stream) { token_source.ReInit(stream); token = new Token(); token.next = jj_nt = token_source.getNextToken(); jj_lookingAhead = false; jjtree.reset(); jj_gen = 0; for (int i = 0; i < 168; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); }