Examples of JapidParser


Examples of cn.bran.japid.compiler.JapidParser

  }

  @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

  }
 
  @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

  }
 
  @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);
  }
View Full Code Here

Examples of cn.bran.japid.compiler.JapidParser

  }

  @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);
  }
View Full Code Here

Examples of cn.bran.japid.compiler.JapidParser

  }
 
  @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

   */
  @Test
  public void testPatenthesisInTagInocation() {
    String src = "#{tag a, b.goo() | String c/}";
    List<String> tokens = new ArrayList<String>();
    JapidParser p = new JapidParser(src);
    loop: for (;;) {
      JapidParser.Token state = p.nextToken();
      switch (state) {
      case EOF:
        break loop;
      default:
        String tokenstring = p.getToken();
        tokens.add(tokenstring);
        System.out.println(state.name() + ": [" + tokenstring + "]");
      }
    }
  }
View Full Code Here

Examples of cn.bran.japid.compiler.JapidParser

  }
 
  @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

  }

  @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

  }

  @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

Examples of cn.bran.japid.compiler.JapidParser

   * test the parsing of `()
   */
  @Test
  public void testTemplateArgsWithDefaults() {
    String src = "`(A a, @Default(1)int b \n) \t \n end";
    JapidParser p = new JapidParser(src);
    List<TokenPair> tokens = p.allTokens();
    dumpTokens(tokens);
  }
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.