Examples of allTokens()


Examples of cn.bran.japid.compiler.JapidParser.allTokens()

   */
  @Test
  public void testLineScript() {
    String src = "`code\n\t`code2 \r\nhtml`code3\nhello ``html`code4\nhello";
    JapidParser p = new JapidParser(src);
    List<TokenPair> tokens = p.allTokens();

    assertEquals(9, tokens.size());
    assertEquals("code", tokens.get(1).source.trim());
    assertEquals("code2", tokens.get(3).source.trim());
    assertEquals("code3", tokens.get(5).source.trim());
View Full Code Here

Examples of cn.bran.japid.compiler.JapidParser.allTokens()

  @Test
  public void testReverse() {
    String src = "@\n@{appliction.index()}";
    JapidParser p = new JapidParser(src);
    List<TokenPair> tokens = p.allTokens();
    assertEquals(5, tokens.size());
    assertEquals(Token.PLAIN, tokens.get(0).token);
    assertEquals(Token.SCRIPT_LINE, tokens.get(1).token);
    assertEquals(Token.PLAIN, tokens.get(2).token);
    assertEquals(Token.ACTION, tokens.get(3).token);
View Full Code Here

Examples of cn.bran.japid.compiler.JapidParser.allTokens()

  @Test
  public void testReverseStatic() {
    String src = "@\n@{'/public/static/stuff'}";
    JapidParser p = new JapidParser(src);
    List<TokenPair> tokens = p.allTokens();
    assertEquals(5, tokens.size());
    assertEquals(Token.PLAIN, tokens.get(0).token);
    assertEquals(Token.SCRIPT_LINE, tokens.get(1).token);
    assertEquals(Token.PLAIN, tokens.get(2).token);
    assertEquals(Token.ACTION, tokens.get(3).token);
View Full Code Here

Examples of cn.bran.japid.compiler.JapidParser.allTokens()

 
  @Test
  public void testLineScriptAt() {
    String src = "@code\n\r\t@code2 \r\nhtml@code3\n\rhello `html@code4\nhello";
    JapidParser p = new JapidParser(src);
    List<TokenPair> tokens = p.allTokens();
   
    assertEquals(9, tokens.size());
    assertEquals("code", tokens.get(1).source.trim());
    assertEquals("code2", tokens.get(3).source.trim());
    assertEquals("code3", tokens.get(5).source.trim());
View Full Code Here

Examples of cn.bran.japid.compiler.JapidParser.allTokens()

 
  @Test
  public void testTemplateArgs() {
    String src = "`(String a, a.b.A c)\nhello";
    JapidParser p = new JapidParser(src);
    List<TokenPair> tokens = p.allTokens();
    assertEquals(3, tokens.size());
    assertEquals(Token.TEMPLATE_ARGS, tokens.get(1).token);
  }

  @Test
View Full Code Here

Examples of cn.bran.japid.compiler.JapidParser.allTokens()

  @Test
  public void testTemplateArgsAt() {
    String src = "@(String a, a.b.A c)\nhello";
    JapidParser p = new JapidParser(src);
    List<TokenPair> tokens = p.allTokens();
    assertEquals(3, tokens.size());
    assertEquals(Token.TEMPLATE_ARGS, tokens.get(1).token);
  }
 
  @Test
View Full Code Here

Examples of cn.bran.japid.compiler.JapidParser.allTokens()

 
  @Test
  public void testBackquoteAlone() {
    String src = "hello \n  `\n ss\n`  ";
    JapidParser p = new JapidParser(src);
    List<TokenPair> tokens = p.allTokens();
//    dumpTokens(tokens);
    assertEquals(4, tokens.size());
    assertEquals(Token.PLAIN, tokens.get(0).token);
    assertEquals(Token.SCRIPT_LINE, tokens.get(1).token);
    assertEquals(Token.PLAIN, tokens.get(2).token);
View Full Code Here

Examples of cn.bran.japid.compiler.JapidParser.allTokens()

 
  @Test
  public void testScriptline() {
    String src = "hello `t Tag2 \"123\"`!";
    JapidParser p = new JapidParser(src);
    List<TokenPair> tokens = p.allTokens();
//    dumpTokens(tokens);
    assertEquals(3, tokens.size());
    assertEquals(Token.PLAIN, tokens.get(0).token);
    assertEquals(Token.SCRIPT_LINE, tokens.get(1).token);
    assertEquals(Token.PLAIN, tokens.get(2).token);
View Full Code Here

Examples of cn.bran.japid.compiler.JapidParser.allTokens()

  @Test
  public void testScriptlineWithAt() {
    String src = "@\nhello @t Tag2 \"123\"@!";
    JapidParser p = new JapidParser(src);
    List<TokenPair> tokens = p.allTokens();
    dumpTokens(tokens);
    assertEquals(5, tokens.size());
    assertEquals(Token.PLAIN, tokens.get(0).token);
    assertEquals(Token.SCRIPT_LINE, tokens.get(1).token);
    assertEquals(Token.PLAIN, tokens.get(2).token);
View Full Code Here

Examples of cn.bran.japid.compiler.JapidParser.allTokens()

  @Test
  public void testAtLiteral() {
    String src = "`@hello";
    JapidParser p = new JapidParser(src);
    List<TokenPair> tokens = p.allTokens();
    dumpTokens(tokens);
    assertEquals(1, tokens.size());
    assertEquals(Token.PLAIN, tokens.get(0).token);
  }
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.