JSDocの型アノテーションをパースする
import com.google.javascript.jscomp.parsing.JsDocInfoParser; public class Foo { public static void main(String[] args){ System.out.println(JsDocInfoParser.parseTypeString("(Array.<Element>|!jQuery)").toStringTree()); System.out.println(JsDocInfoParser.parseTypeString("jQuery.jqXHR=").toStringTree()); } }
PIPE 0 STRING Array 0 [length: 5] BLOCK STRING Element 0 [length: 7] BANG 0 STRING jQuery 0 [length: 6] STRING jQuery.jqXHR 0 [length: 12]