Java 类org.antlr.v4.runtime.tree.ParseTreeProperty 实例源码

项目:yauaa    文件:UserAgentTreeFlattener.java   
/**
 * Parse the useragent and return every part that was found.
 *
 * @param userAgent The useragent instance that needs to be parsed
 * @return If the parse was valid (i.e. were there any parser errors: true=valid; false=has errors
 */
private UserAgent parseIntoCleanUserAgent(UserAgent userAgent) {
    if (userAgent.getUserAgentString() == null) {
        userAgent.set(SYNTAX_ERROR, "true", 1);
        return userAgent; // Cannot parse this
    }

    // Parse the userAgent into tree
    UserAgentContext userAgentContext = parseUserAgent(userAgent);

    // Walk the tree an inform the calling analyzer about all the nodes found
    state = new ParseTreeProperty<>();

    State rootState = new State("agent");
    rootState.calculatePath(PathType.CHILD, false);
    state.put(userAgentContext, rootState);

    if (userAgent.hasSyntaxError()) {
        inform(null, SYNTAX_ERROR, "true");
    } else {
        inform(null, SYNTAX_ERROR, "false");
    }

    WALKER.walk(this, userAgentContext);
    return userAgent;
}
项目:Reo    文件:Listener.java   
/**
 * Sets the file name, and clears all parse tree properties.
 */
public void setFileName(String filename) {
    this.filename = filename;
    imports.clear();
    section = new ParseTreeProperty<String>();
    components = new ParseTreeProperty<ComponentExpression<T>>();
    formula = new ParseTreeProperty<PredicateExpression>();
    instances = new ParseTreeProperty<InstanceExpression<T>>();
    terms = new ParseTreeProperty<TermExpression>();
    termsList = new ParseTreeProperty<List<TermExpression>>();
    signatureExpressions = new ParseTreeProperty<SignatureExpression>();
    parameterlists = new ParseTreeProperty<List<ParameterExpression>>();
    parameters = new ParseTreeProperty<ParameterExpression>();
    nodelists = new ParseTreeProperty<List<NodeExpression>>();
    nodes = new ParseTreeProperty<NodeExpression>();
    typetags = new ParseTreeProperty<TypeTag>();
    portlists = new ParseTreeProperty<List<PortExpression>>();
    ports = new ParseTreeProperty<PortExpression>();
    variables = new ParseTreeProperty<VariableExpression>();
    atoms = new ParseTreeProperty<T>();
}
项目:transportlanguage    文件:OTLDListener.java   
public OTLDListener() {
    this.functions = new ParseTreeProperty<>();
    this.conditionals = new ParseTreeProperty<>();
    this.stack = new Stack<>();
    this.errors = new ArrayList<>();
    this.waypoints = new HashMap<>();
    this.lastFunction = null;
}
项目:Bramspr    文件:BramsprChecker.java   
/**
 * Starts the context checking.
 * 
 * Will print out the amount of errors afterwards. If there were any errors, calls {@link System#exit System.exit}.
 * 
 * @param tree
 *            The parse tree to be context checked.
 * @return {@link #parseTreeDecoration}
 */
public ParseTreeProperty<Symbol> check(ParseTree tree) {
    this.parseTreeDecoration = new ParseTreeProperty<Symbol>();

    this.visit(tree);

    if (this.getErrorCount() > 0) {
        System.err.println("There were " + this.getErrorCount() + " errors detected.");
        System.err.println("Aborting compilation: cannot compile code with errors.");
        System.exit(1); // Did not compile correctly
    }

    return this.parseTreeDecoration;
}
项目:udidb    文件:CExpressionCompiler.java   
@VisibleForTesting
static void resolveSymbols(ParserRuleContext parseTree,
                                   ParseTreeProperty<NodeState> states,
                                   ExecutionContext executionContext,
                                   Function currentFunction,
                                   long pc)
{
    SymbolResolutionVisitor resolutionVisitor = new SymbolResolutionVisitor(states, executionContext, currentFunction, pc);
    parseTree.accept(resolutionVisitor);
}
项目:udidb    文件:CExpressionCompiler.java   
@VisibleForTesting
static void typeCheckExpression(ParserRuleContext parseTree,
                                        ParseTreeProperty<NodeState> states)
{
    TypeCheckingVisitor typeCheckingVisitor = new TypeCheckingVisitor(states);
    parseTree.accept(typeCheckingVisitor);
}
项目:udidb    文件:CExpressionCompiler.java   
@VisibleForTesting
static void simplifyExpression(ParserRuleContext parseTree,
                                       ParseTreeProperty<NodeState> states,
                                       ExecutionContext executionContext)
{
    ExpressionSimplificationVisitor visitor = new ExpressionSimplificationVisitor(states, executionContext);
    parseTree.accept(visitor);
}
项目:udidb    文件:CExpressionCompiler.java   
@VisibleForTesting
static Expression generateCode(ParserRuleContext parseTree,
                                       ParseTreeProperty<NodeState> states,
                                       ExecutionContext executionContext)
{
    CodeGenVisitor visitor = new CodeGenVisitor(states, executionContext);
    return parseTree.accept(visitor);
}
项目:udidb    文件:SymbolResolutionVisitor.java   
public SymbolResolutionVisitor(ParseTreeProperty<NodeState> states,
        ExecutionContext executionContext,
        Function currentFunction,
        long pc)
{
    super(states);
    this.currentFunction = currentFunction;
    this.pc = pc;
    this.executable = executionContext.getExecutable();
}
项目:udidb    文件:SymbolResolutionVisitorTest.java   
private static SymbolResolutionVisitor createVisitor() throws Exception
{
    ExecutionContext executionContext = mock(ExecutionContext.class);
    Function currentFunction = mock(Function.class);
    ParseTreeProperty<NodeState> states = new ParseTreeProperty<>();

    return new SymbolResolutionVisitor(states, executionContext, currentFunction, 0);
}
项目:udidb    文件:ExpressionSimplificationVisitorTest.java   
private void runSimplification(ParserRuleContext parseTree,
                               ParseTreeProperty<NodeState> states,
                               ExecutionContext executionContext) throws Exception
{

    long pc = executionContext.getCurrentThread().getPC();
    Function currentFunction = executionContext.getExecutable().getContainingFunction(pc);

    CExpressionCompiler.resolveSymbols(parseTree, states, executionContext, currentFunction, pc);

    CExpressionCompiler.typeCheckExpression(parseTree, states);

    CExpressionCompiler.simplifyExpression(parseTree, states, executionContext);
}
项目:udidb    文件:ExpressionSimplificationVisitorTest.java   
private void testSimplification(String input, String output, ExecutionContext executionContext) throws Exception
{
    ParseTreeProperty<NodeState> states = new ParseTreeProperty<>();

    ParserRuleContext parseTree = CExpressionCompiler.createParseTree(input);

    runSimplification(parseTree, states, executionContext);

    NodeState nodeState = states.get(parseTree);
    assertNotNull(nodeState);
    assertNotNull(nodeState.getExpressionValue());
    assertEquals(nodeState.getExpressionValue().toString(), output);
}
项目:ontolib    文件:OboParserListener.java   
/**
 * Flush the {@link #values} mapping for allowing garbage collection.
 */
void clearValues() {
  values = new ParseTreeProperty<>();
}
项目:boqa    文件:OboParserListener.java   
/**
 * Flush the {@link #values} mapping for allowing garbage collection.
 */
void clearValues() {
  values = new ParseTreeProperty<>();
}
项目:graylog-plugin-pipeline-processor    文件:PipelineRuleParser.java   
public ParseTreeProperty<Expression> expressions() {
    return exprs;
}
项目:graylog-plugin-pipeline-processor    文件:PipelineRuleParser.java   
public ParseTreeProperty<Map<String, Expression>> arguments() {
    return args;
}
项目:graylog-plugin-pipeline-processor    文件:PipelineRuleParser.java   
public ParseTreeProperty<List<Expression>> argumentLists() {
    return argsLists;
}
项目:arithmetic    文件:NaiveInterpreterVisitor.java   
protected ParseTreeProperty<Double> getNumberNodesAnnotations() {
    return numberNodesAnnotations;
}
项目:arithmetic    文件:NaiveInterpreterVisitor.java   
protected void setNumberNodesAnnotations(
        ParseTreeProperty<Double> numberNodesAnnotations) {
    this.numberNodesAnnotations = numberNodesAnnotations;
}
项目:udidb    文件:CodeGenVisitor.java   
public CodeGenVisitor(ParseTreeProperty<NodeState> states, ExecutionContext executionContext)
{
    super(states);
    this.executionContext = executionContext;
}
项目:udidb    文件:TypeCheckingVisitor.java   
public TypeCheckingVisitor(ParseTreeProperty<NodeState> states)
{
    super(states);
}
项目:udidb    文件:ExpressionSimplificationVisitor.java   
public ExpressionSimplificationVisitor(ParseTreeProperty<NodeState> states, ExecutionContext executionContext)
{
    super(states);
    this.executionContext = executionContext;
}
项目:udidb    文件:BaseExpressionVisitor.java   
protected BaseExpressionVisitor(ParseTreeProperty<NodeState> states)
{
    this.states = states;
}
项目:udidb    文件:TypeCheckingVisitorTest.java   
private static TypeCheckingVisitor createVisitor() throws Exception
{
    ParseTreeProperty<NodeState> states = new ParseTreeProperty<>();

    return new TypeCheckingVisitor(states);
}
项目:apt    文件:RegexParser.java   
private RegexListener(Set<Symbol> alphabet) {
    this.automatons = new ParseTreeProperty<>();
    this.automaton  = null;
    this.alphabet   = alphabet;
}
项目:MatrixC    文件:SemanticListener.java   
public SemanticListener(List<Symbol> builtinDeclarations) {
  this.semanticErrors = new LinkedList<>();

  this.expressionTypes = new ParseTreeProperty<>();

  this.functions = new ParseTreeProperty<>();

  this.builtinDeclarations = builtinDeclarations;
}