Search in sources :

Example 1 with TokenFinder

use of org.develnext.jphp.core.tokenizer.TokenFinder in project jphp by jphp-compiler.

the class Token method of.

public static Token of(TokenMeta meta) {
    TokenFinder finder = new TokenFinder();
    Class<? extends Token> clazz = finder.find(meta);
    try {
        return clazz.getConstructor(TokenMeta.class).newInstance(meta);
    } catch (InvocationTargetException e) {
        throw new RuntimeException(e.getTargetException());
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : TokenFinder(org.develnext.jphp.core.tokenizer.TokenFinder) TokenMeta(org.develnext.jphp.core.tokenizer.TokenMeta) InvocationTargetException(java.lang.reflect.InvocationTargetException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)1 TokenFinder (org.develnext.jphp.core.tokenizer.TokenFinder)1 TokenMeta (org.develnext.jphp.core.tokenizer.TokenMeta)1