当前位置: 首页>>代码示例>>Java>>正文


Java ParseTreeProperty类代码示例

本文整理汇总了Java中org.antlr.v4.runtime.tree.ParseTreeProperty的典型用法代码示例。如果您正苦于以下问题:Java ParseTreeProperty类的具体用法?Java ParseTreeProperty怎么用?Java ParseTreeProperty使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ParseTreeProperty类属于org.antlr.v4.runtime.tree包,在下文中一共展示了ParseTreeProperty类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseIntoCleanUserAgent

import org.antlr.v4.runtime.tree.ParseTreeProperty; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:nielsbasjes,项目名称:yauaa,代码行数:32,代码来源:UserAgentTreeFlattener.java

示例2: setFileName

import org.antlr.v4.runtime.tree.ParseTreeProperty; //导入依赖的package包/类
/**
 * 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>();
}
 
开发者ID:ReoLanguage,项目名称:Reo,代码行数:24,代码来源:Listener.java

示例3: OTLDListener

import org.antlr.v4.runtime.tree.ParseTreeProperty; //导入依赖的package包/类
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;
}
 
开发者ID:jjkester,项目名称:transportlanguage,代码行数:9,代码来源:OTLDListener.java

示例4: check

import org.antlr.v4.runtime.tree.ParseTreeProperty; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:bcleenders,项目名称:Bramspr,代码行数:23,代码来源:BramsprChecker.java

示例5: resolveSymbols

import org.antlr.v4.runtime.tree.ParseTreeProperty; //导入依赖的package包/类
@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);
}
 
开发者ID:udidb,项目名称:udidb,代码行数:11,代码来源:CExpressionCompiler.java

示例6: typeCheckExpression

import org.antlr.v4.runtime.tree.ParseTreeProperty; //导入依赖的package包/类
@VisibleForTesting
static void typeCheckExpression(ParserRuleContext parseTree,
                                        ParseTreeProperty<NodeState> states)
{
    TypeCheckingVisitor typeCheckingVisitor = new TypeCheckingVisitor(states);
    parseTree.accept(typeCheckingVisitor);
}
 
开发者ID:udidb,项目名称:udidb,代码行数:8,代码来源:CExpressionCompiler.java

示例7: simplifyExpression

import org.antlr.v4.runtime.tree.ParseTreeProperty; //导入依赖的package包/类
@VisibleForTesting
static void simplifyExpression(ParserRuleContext parseTree,
                                       ParseTreeProperty<NodeState> states,
                                       ExecutionContext executionContext)
{
    ExpressionSimplificationVisitor visitor = new ExpressionSimplificationVisitor(states, executionContext);
    parseTree.accept(visitor);
}
 
开发者ID:udidb,项目名称:udidb,代码行数:9,代码来源:CExpressionCompiler.java

示例8: generateCode

import org.antlr.v4.runtime.tree.ParseTreeProperty; //导入依赖的package包/类
@VisibleForTesting
static Expression generateCode(ParserRuleContext parseTree,
                                       ParseTreeProperty<NodeState> states,
                                       ExecutionContext executionContext)
{
    CodeGenVisitor visitor = new CodeGenVisitor(states, executionContext);
    return parseTree.accept(visitor);
}
 
开发者ID:udidb,项目名称:udidb,代码行数:9,代码来源:CExpressionCompiler.java

示例9: SymbolResolutionVisitor

import org.antlr.v4.runtime.tree.ParseTreeProperty; //导入依赖的package包/类
public SymbolResolutionVisitor(ParseTreeProperty<NodeState> states,
        ExecutionContext executionContext,
        Function currentFunction,
        long pc)
{
    super(states);
    this.currentFunction = currentFunction;
    this.pc = pc;
    this.executable = executionContext.getExecutable();
}
 
开发者ID:udidb,项目名称:udidb,代码行数:11,代码来源:SymbolResolutionVisitor.java

示例10: createVisitor

import org.antlr.v4.runtime.tree.ParseTreeProperty; //导入依赖的package包/类
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);
}
 
开发者ID:udidb,项目名称:udidb,代码行数:9,代码来源:SymbolResolutionVisitorTest.java

示例11: runSimplification

import org.antlr.v4.runtime.tree.ParseTreeProperty; //导入依赖的package包/类
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);
}
 
开发者ID:udidb,项目名称:udidb,代码行数:15,代码来源:ExpressionSimplificationVisitorTest.java

示例12: testSimplification

import org.antlr.v4.runtime.tree.ParseTreeProperty; //导入依赖的package包/类
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);
}
 
开发者ID:udidb,项目名称:udidb,代码行数:14,代码来源:ExpressionSimplificationVisitorTest.java

示例13: clearValues

import org.antlr.v4.runtime.tree.ParseTreeProperty; //导入依赖的package包/类
/**
 * Flush the {@link #values} mapping for allowing garbage collection.
 */
void clearValues() {
  values = new ParseTreeProperty<>();
}
 
开发者ID:Phenomics,项目名称:ontolib,代码行数:7,代码来源:OboParserListener.java

示例14: expressions

import org.antlr.v4.runtime.tree.ParseTreeProperty; //导入依赖的package包/类
public ParseTreeProperty<Expression> expressions() {
    return exprs;
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:4,代码来源:PipelineRuleParser.java

示例15: arguments

import org.antlr.v4.runtime.tree.ParseTreeProperty; //导入依赖的package包/类
public ParseTreeProperty<Map<String, Expression>> arguments() {
    return args;
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-pipeline-processor,代码行数:4,代码来源:PipelineRuleParser.java


注:本文中的org.antlr.v4.runtime.tree.ParseTreeProperty类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。