digi := [0-9]
import com.alibaba.service.template.*; import com.alibaba.turbine.module.screen.TemplateScreen; import com.alibaba.turbine.service.rundata.RunData; import com.alibaba.webx.WebxException; method=com.alibaba.manometer.module.screen.Shuffle.execute(RunData, TemplateContext) method=java.lang.Long.valueOf(long) method=java.util.concurrent.ConcurrentLinkedQueue.poll()
TOKEN : { <METHOD : "method"> | <IMPORT : "import"> } TOKEN : { <IDENT : <ALPHA> (<ALPHA>|<NUM>)*> | <ALPHA : (["a"-"z","A"-"Z"])> | <NUM : (["0"-"9"])> | <COMMA : ","> | <SEMICOLON : ";"> | <LPAREN : "("> | <RPAREN : ")"> | <DOMAIN : "."> | <ASSIGN : "="> | <STAR : "*"> }
param ::= ((IDENT ('.' IDENT)* ) (IDENT)?)* method ::= IDENT ('.' IDENT)* clazz ::= IDENT ('.' IDENT)* (';')* statMethod ::= METHOD '=' method '(' param (,param)* ')' impPack ::= IMPORT '=' clazz parse ::= (impPack|statMethod)
parse() : {} { ( ( impPack() | statMethod() ) )* } impPack() : {} { ( <IMPORT> clazz() ) } statMethod() : {} { ( <METHOD><ASSIGN>method()<LPAREN>param() ( <COMMA> param() )* <RPAREN> ) } method() : {} { ( <IDENT> ( <DOMAIN><IDENT> )* ) } clazz() : {} { ( <IDENT> ( <DOMAIN> ( <IDENT> | [ LOOKAHEAD( { getToken(1).kind == STAR && getToken(2).kind == SEMICOLON } ) <STAR> | <SEMICOLON> ] ) )* (<SEMICOLON>)* ) } String param() : {Token t;StringBuilder sb = new StringBuilder();} { ( ( <IDENT> ( <DOMAIN><IDENT> )* ) (<IDENT>)? )* }
至于其他的jjdoc(用于编写BNF)和jjTree(构建语法树),后续有时间再学习下,javacc只是一些基本的词法分析+简单语义定义的使用。