Package com.pogofish.jadt.parser.javacc.generated

Examples of com.pogofish.jadt.parser.javacc.generated.Token


     * Mostly testing for coverage
     */
    @Test
    public void testNonJavaCommentSpecialToken() {
        final JavaCCParserImpl p1 = parserImpl("whatever");
        final Token token = new Token(BaseJavaCCParserImplConstants.IDENTIFIER, "hello");
        final Token specialtoken1 = new Token(BaseJavaCCParserImplConstants.WS, "   ");
        token.specialToken = specialtoken1;
        final Token specialtoken2 = new Token(BaseJavaCCParserImplConstants.JAVA_EOL_COMMENT, "// hello");
        token.specialToken.specialToken = specialtoken2;
        final List<JavaComment> comments = p1.tokenComments(token);
        assertEquals(list(_JavaEOLComment("// hello")), comments);
    }
View Full Code Here


     * Check that the next tokenType, symbol, and lineNo from the tokenizer are
     * as expected
     */
    private void check(BaseJavaCCParserImplTokenManager tokenizer,
            String expectedSymbol, int expectedTokenType, int expectedLineNo) {
        final Token token = tokenizer.getNextToken();
        final String actualSymbol = token.kind == EOF ? "<EOF>" : token.image;
        assertEquals("Expected token type " + expectedTokenType
                + " with symbol " + expectedSymbol + " but got " + token.kind
                + " with symbol " + actualSymbol, expectedTokenType, token.kind);
        assertEquals("Got correct token type " + expectedTokenType
View Full Code Here

    protected String badIdentifier(String expected) {
        error(expected);

        final String id = "@" + (nextId++);
        if (!peekPunctuation()) {
            final Token token = getNextToken();
            return "BAD_IDENTIFIER" + "_" + friendlyName(token) + id;
        } else {
            return "NO_IDENTIFIER" + id;
        }
    }
View Full Code Here

     *
     * @param n
     * @return
     */
    private Token lookahead(int n) {
        Token current = token;
        for (int i = 0; i < n; i++) {
            if (current.next == null) {
                current.next = token_source.getNextToken();
            }
            current = current.next;
View Full Code Here

    /**
     * Return all the comments attached to the current token (the last token matched)
     */
    protected List<JavaComment> tokenComments(Token token) {
        final List<JavaComment> comments = new ArrayList<JavaComment>();
        Token comment = token.specialToken;
        while(comment != null) {
            switch(comment.kind) {
            case JAVA_EOL_COMMENT:
                comments.add(_JavaEOLComment(comment.image));
                break;
View Full Code Here

TOP

Related Classes of com.pogofish.jadt.parser.javacc.generated.Token

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.