All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.netflix.infix.InfixCompiler Maven / Gradle / Ivy

There is a newer version: 0.40.13
Show newest version
package com.netflix.infix;

import com.google.common.base.Predicate;
import com.netflix.infix.lang.infix.antlr.EventFilterParser;
import com.netflix.infix.lang.infix.antlr.PredicateTranslatable;

/**
 * Compile an INFIX string into a Predicate
 * 
 * @author elandau
 */
public class InfixCompiler implements PredicateCompiler {
    public Predicate compile(String input) throws Exception {
        EventFilterParser parser               = EventFilterParser.createParser(input);
        EventFilterParser.filter_return result = parser.filter();
        
        return ((PredicateTranslatable) result.getTree()).translate();
    }
}