Examples of CommentToken


Examples of cambridge.parser.tokens.CommentToken

               String directive = "";
               String args;

               while (true) {
                  if (peek(1) == Tokenizer.EOL) {
                     return new CommentToken(line, col, builder.toString(), getLineNo(), getColumn());
                  }

                  if ("".equals(directive) && Character.isWhitespace(peek(1))) {
                     directive = builder.substring(5);
                  }

                  if (peek(1) == '-' && peek(2) == '-' && peek(3) == '>') {
                     args = builder.substring(5 + directive.length() + 1).trim();
                     break;
                  }
                  builder.append(nextChar());
               }
               nextChar(3);

               builder.append("-->");

               ParserDirectiveToken tok = new ParserDirectiveToken(line, col, builder.toString(), getLineNo(), getColumn(), directive, args);
               if (peek(1) == '\r') {
                  if (peek(2) == '\n') {
                     nextChar(2);
                     tok.setTrailingSpace("\r\n");
                  } else {
                     tok.setTrailingSpace("\r");
                     nextChar();
                  }
               } else if (peek(1) == '\n') {
                  tok.setTrailingSpace("\n");
                  nextChar();
               }
               return tok;
            } else if (peek(1) == '-' && peek(2) == '-') {
               nextChar(2);
               // Comment block
               builder.append("!--");

               while (true) {
                  if (peek(1) == Tokenizer.EOL) {
                     return new CommentToken(line, col, builder.toString(), getLineNo(), getColumn());
                  }
                  if (peek(1) == '-' && peek(2) == '-' && peek(3) == '>') break;
                  builder.append(nextChar());
               }
               nextChar(3);
               builder.append("-->");
               return new CommentToken(line, col, builder.toString(), getLineNo(), getColumn());


               // CDATA Blocks
            } else if ("[CDATA[".equals(peekString(7))) {
               c = nextChar(7);
View Full Code Here

Examples of cambridge.parser.tokens.CommentToken

               String directive = "";
               String args;

               while (true) {
                  if (peek(1) == Tokenizer.EOL) {
                     return new CommentToken(line, col, builder.toString(), getLineNo(), getColumn());
                  }

                  if ("".equals(directive) && Character.isWhitespace(peek(1))) {
                     directive = builder.substring(5);
                  }

                  if (peek(1) == '-' && peek(2) == '-' && peek(3) == '>') {
                     args = builder.substring(5 + directive.length() + 1).trim();
                     break;
                  }
                  builder.append(nextChar());
               }
               nextChar(3);

               builder.append("-->");

               ParserDirectiveToken tok = new ParserDirectiveToken(line, col, builder.toString(), getLineNo(), getColumn(), directive, args);
               if (peek(1) == '\r') {
                  if (peek(2) == '\n') {
                     nextChar(2);
                     tok.setTrailingSpace("\r\n");
                  } else {
                     tok.setTrailingSpace("\r");
                     nextChar();
                  }
               } else if (peek(1) == '\n') {
                  tok.setTrailingSpace("\n");
                  nextChar();
               }
               return tok;
            } else if (peek(1) == '-' && peek(2) == '-') {
               nextChar(2);
               // Comment block
               builder.append("!--");

               while (true) {
                  if (peek(1) == Tokenizer.EOL) {
                     return new CommentToken(line, col, builder.toString(), getLineNo(), getColumn());
                  }
                  if (peek(1) == '-' && peek(2) == '-' && peek(3) == '>') break;
                  builder.append(nextChar());
               }
               nextChar(3);
               builder.append("-->");
               return new CommentToken(line, col, builder.toString(), getLineNo(), getColumn());


               // CDATA Blocks
            } else if ("[CDATA[".equals(peekString(7))) {
               c = nextChar(7);
View Full Code Here

Examples of com.barrybecker4.ca.dj.jigo.sgf.tokens.CommentToken

        else if( tokenName.equals( "P2" ) )
            token = createPlayer2MoveToken();

        // Comments, notes, and figures are next most common.
        else if( tokenName.equals( "C" ) || tokenName.equals( "COMMENT" ) )
          token = new CommentToken();
        else if( tokenName.equals( "N" ) || tokenName.equals( "NAME" ) )
          token = new NodeNameToken();

        // Lastly, tokens that belong to the first leaf of the first variation
        // appear once.  These are intentionally placed in this position as a
View Full Code Here

Examples of org.apache.tapestry.internal.parser.CommentToken

        List<TemplateToken> tokens = tokens("parameter_element.html");

        ParameterToken token4 = get(tokens, 4);
        assertEquals(token4.getName(), "fred");

        CommentToken token6 = get(tokens, 6);
        assertEquals(token6.getComment(), "fred content");

        TemplateToken token8 = get(tokens, 8);

        assertEquals(token8.getTokenType(), TokenType.END_ELEMENT);
    }
View Full Code Here

Examples of org.apache.tapestry.internal.parser.CommentToken

        List<TemplateToken> tokens = tokens("block_element.html");

        BlockToken token2 = get(tokens, 2);
        assertEquals(token2.getId(), "block0");

        CommentToken token4 = get(tokens, 4);
        assertEquals(token4.getComment(), "block0 content");

        BlockToken token8 = get(tokens, 8);
        assertNull(token8.getId());

        CommentToken token10 = get(tokens, 10);
        assertEquals(token10.getComment(), "anon block content");
    }
View Full Code Here

Examples of org.apache.tapestry.internal.parser.CommentToken

        // Again, whitespace before and after the comment adds some tokens

        assertEquals(tokens.size(), 5);

        CommentToken t = get(tokens, 2);

        // Comments are now trimmed of leading and trailing whitespace. This may mean
        // that the output isn't precisely what's in the template, but a) its a comment
        // and b) that's pretty much true of everything in the templates.

        assertEquals(t.getComment(), "Single line comment");
    }
View Full Code Here

Examples of org.apache.tapestry.internal.parser.CommentToken

        // Again, whitespace before and after the comment adds some tokens

        assertEquals(tokens.size(), 5);

        CommentToken t = get(tokens, 2);

        String comment = t.getComment().trim().replaceAll("\\s+", " ");

        assertEquals(comment, "Line one Line two Line three");
    }
View Full Code Here

Examples of org.apache.tapestry.internal.parser.CommentToken

        // Again, whitespace before and after the comment adds some tokens

        assertEquals(tokens.size(), 5);

        CommentToken t = get(tokens, 2);

        // Comments are now trimmed of leading and trailing whitespace. This may mean
        // that the output isn't precisely what's in the template, but a) its a comment
        // and b) that's pretty much true of everything in the templates.

        assertEquals(t.getComment(), "Single line comment");
    }
View Full Code Here

Examples of org.apache.tapestry.internal.parser.CommentToken

        // Again, whitespace before and after the comment adds some tokens

        assertEquals(tokens.size(), 5);

        CommentToken t = get(tokens, 2);

        String comment = t.getComment().trim().replaceAll("\\s+", " ");

        assertEquals(comment, "Line one Line two Line three");
    }
View Full Code Here

Examples of org.apache.tapestry.internal.parser.CommentToken

        List<TemplateToken> tokens = tokens("parameter_element.tml");

        ParameterToken token4 = get(tokens, 4);
        assertEquals(token4.getName(), "fred");

        CommentToken token6 = get(tokens, 6);
        assertEquals(token6.getComment(), "fred content");

        TemplateToken token8 = get(tokens, 8);

        assertEquals(token8.getTokenType(), TokenType.END_ELEMENT);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.