Class AbstractingCExpressionVisitor
java.lang.Object
org.antlr.v4.runtime.tree.AbstractParseTreeVisitor<StringBuilder>
org.variantsync.diffdetective.feature.cpp.AbstractingCExpressionVisitor
- All Implemented Interfaces:
org.antlr.v4.runtime.tree.ParseTreeVisitor<StringBuilder>
,CExpressionVisitor<StringBuilder>
public class AbstractingCExpressionVisitor
extends org.antlr.v4.runtime.tree.AbstractParseTreeVisitor<StringBuilder>
implements CExpressionVisitor<StringBuilder>
Visitor that abstracts all symbols of a formula, given as ANTLR parse tree, that might interfere with further formula analysis.
This visitor traverses the given tree and substitutes all formula substrings with replacements by calling
BooleanAbstraction
.
Not all formulas or parts of a formula might require abstraction (e.g., 'A && B'). Therefore, this visitor should not be used directly.
Instead, you may use a ControllingCExpressionVisitor
which internally uses an AbstractingCExpressionVisitor
to control how formulas are abstracted, and only abstracts those parts of a formula that require it.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionVisit a parse tree produced byCExpressionParser.additiveExpression()
.Visit a parse tree produced byCExpressionParser.andExpression()
.Visit a parse tree produced byCExpressionParser.argumentExpressionList()
.Visit a parse tree produced byCExpressionParser.assignmentExpression()
.Visit a parse tree produced byCExpressionParser.assignmentOperator()
.Visit a parse tree produced byCExpressionParser.conditionalExpression()
.Visit a parse tree produced byCExpressionParser.equalityExpression()
.Visit a parse tree produced byCExpressionParser.exclusiveOrExpression()
.private StringBuilder
visitExpression
(org.antlr.v4.runtime.ParserRuleContext expressionContext, Function<org.antlr.v4.runtime.tree.ParseTree, Boolean> instanceCheck) Abstract all child nodes in the parse tree.Visit a parse tree produced byCExpressionParser.expression()
.Visit a parse tree produced byCExpressionParser.inclusiveOrExpression()
.Visit a parse tree produced byCExpressionParser.logicalAndExpression()
.Visit a parse tree produced byCExpressionParser.logicalOperand()
.Visit a parse tree produced byCExpressionParser.logicalOrExpression()
.Visit a parse tree produced byCExpressionParser.macroExpression()
.Visit a parse tree produced byCExpressionParser.multiplicativeExpression()
.Visit a parse tree produced byCExpressionParser.namespaceExpression()
.Visit a parse tree produced byCExpressionParser.primaryExpression()
.Visit a parse tree produced byCExpressionParser.relationalExpression()
.Visit a parse tree produced byCExpressionParser.shiftExpression()
.Visit a parse tree produced byCExpressionParser.specialOperator()
.Visit a parse tree produced byCExpressionParser.specialOperatorArgument()
.Visit a parse tree produced byCExpressionParser.unaryOperator()
.Methods inherited from class org.antlr.v4.runtime.tree.AbstractParseTreeVisitor
aggregateResult, defaultResult, shouldVisitNextChild, visit, visitChildren, visitErrorNode, visitTerminal
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.antlr.v4.runtime.tree.ParseTreeVisitor
visit, visitChildren, visitErrorNode, visitTerminal
-
Constructor Details
-
AbstractingCExpressionVisitor
public AbstractingCExpressionVisitor()
-
-
Method Details
-
visitConditionalExpression
Description copied from interface:CExpressionVisitor
Visit a parse tree produced byCExpressionParser.conditionalExpression()
.- Specified by:
visitConditionalExpression
in interfaceCExpressionVisitor<StringBuilder>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
visitPrimaryExpression
Description copied from interface:CExpressionVisitor
Visit a parse tree produced byCExpressionParser.primaryExpression()
.- Specified by:
visitPrimaryExpression
in interfaceCExpressionVisitor<StringBuilder>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
visitUnaryOperator
Description copied from interface:CExpressionVisitor
Visit a parse tree produced byCExpressionParser.unaryOperator()
.- Specified by:
visitUnaryOperator
in interfaceCExpressionVisitor<StringBuilder>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
visitNamespaceExpression
Description copied from interface:CExpressionVisitor
Visit a parse tree produced byCExpressionParser.namespaceExpression()
.- Specified by:
visitNamespaceExpression
in interfaceCExpressionVisitor<StringBuilder>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
visitMultiplicativeExpression
public StringBuilder visitMultiplicativeExpression(CExpressionParser.MultiplicativeExpressionContext ctx) Description copied from interface:CExpressionVisitor
Visit a parse tree produced byCExpressionParser.multiplicativeExpression()
.- Specified by:
visitMultiplicativeExpression
in interfaceCExpressionVisitor<StringBuilder>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
visitAdditiveExpression
Description copied from interface:CExpressionVisitor
Visit a parse tree produced byCExpressionParser.additiveExpression()
.- Specified by:
visitAdditiveExpression
in interfaceCExpressionVisitor<StringBuilder>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
visitShiftExpression
Description copied from interface:CExpressionVisitor
Visit a parse tree produced byCExpressionParser.shiftExpression()
.- Specified by:
visitShiftExpression
in interfaceCExpressionVisitor<StringBuilder>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
visitRelationalExpression
Description copied from interface:CExpressionVisitor
Visit a parse tree produced byCExpressionParser.relationalExpression()
.- Specified by:
visitRelationalExpression
in interfaceCExpressionVisitor<StringBuilder>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
visitEqualityExpression
Description copied from interface:CExpressionVisitor
Visit a parse tree produced byCExpressionParser.equalityExpression()
.- Specified by:
visitEqualityExpression
in interfaceCExpressionVisitor<StringBuilder>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
visitAndExpression
Description copied from interface:CExpressionVisitor
Visit a parse tree produced byCExpressionParser.andExpression()
.- Specified by:
visitAndExpression
in interfaceCExpressionVisitor<StringBuilder>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
visitExclusiveOrExpression
Description copied from interface:CExpressionVisitor
Visit a parse tree produced byCExpressionParser.exclusiveOrExpression()
.- Specified by:
visitExclusiveOrExpression
in interfaceCExpressionVisitor<StringBuilder>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
visitInclusiveOrExpression
Description copied from interface:CExpressionVisitor
Visit a parse tree produced byCExpressionParser.inclusiveOrExpression()
.- Specified by:
visitInclusiveOrExpression
in interfaceCExpressionVisitor<StringBuilder>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
visitSpecialOperator
Description copied from interface:CExpressionVisitor
Visit a parse tree produced byCExpressionParser.specialOperator()
.- Specified by:
visitSpecialOperator
in interfaceCExpressionVisitor<StringBuilder>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
visitSpecialOperatorArgument
public StringBuilder visitSpecialOperatorArgument(CExpressionParser.SpecialOperatorArgumentContext ctx) Description copied from interface:CExpressionVisitor
Visit a parse tree produced byCExpressionParser.specialOperatorArgument()
.- Specified by:
visitSpecialOperatorArgument
in interfaceCExpressionVisitor<StringBuilder>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
visitLogicalAndExpression
Description copied from interface:CExpressionVisitor
Visit a parse tree produced byCExpressionParser.logicalAndExpression()
.- Specified by:
visitLogicalAndExpression
in interfaceCExpressionVisitor<StringBuilder>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
visitLogicalOrExpression
Description copied from interface:CExpressionVisitor
Visit a parse tree produced byCExpressionParser.logicalOrExpression()
.- Specified by:
visitLogicalOrExpression
in interfaceCExpressionVisitor<StringBuilder>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
visitLogicalOperand
Description copied from interface:CExpressionVisitor
Visit a parse tree produced byCExpressionParser.logicalOperand()
.- Specified by:
visitLogicalOperand
in interfaceCExpressionVisitor<StringBuilder>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
visitMacroExpression
Description copied from interface:CExpressionVisitor
Visit a parse tree produced byCExpressionParser.macroExpression()
.- Specified by:
visitMacroExpression
in interfaceCExpressionVisitor<StringBuilder>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
visitArgumentExpressionList
public StringBuilder visitArgumentExpressionList(CExpressionParser.ArgumentExpressionListContext ctx) Description copied from interface:CExpressionVisitor
Visit a parse tree produced byCExpressionParser.argumentExpressionList()
.- Specified by:
visitArgumentExpressionList
in interfaceCExpressionVisitor<StringBuilder>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
visitAssignmentExpression
Description copied from interface:CExpressionVisitor
Visit a parse tree produced byCExpressionParser.assignmentExpression()
.- Specified by:
visitAssignmentExpression
in interfaceCExpressionVisitor<StringBuilder>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
visitAssignmentOperator
Description copied from interface:CExpressionVisitor
Visit a parse tree produced byCExpressionParser.assignmentOperator()
.- Specified by:
visitAssignmentOperator
in interfaceCExpressionVisitor<StringBuilder>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
visitExpression
Description copied from interface:CExpressionVisitor
Visit a parse tree produced byCExpressionParser.expression()
.- Specified by:
visitExpression
in interfaceCExpressionVisitor<StringBuilder>
- Parameters:
ctx
- the parse tree- Returns:
- the visitor result
-
visitExpression
private StringBuilder visitExpression(org.antlr.v4.runtime.ParserRuleContext expressionContext, Function<org.antlr.v4.runtime.tree.ParseTree, Boolean> instanceCheck) Abstract all child nodes in the parse tree.- Parameters:
expressionContext
- The root of the subtree to abstractinstanceCheck
- A check for expected child node types- Returns:
- The abstracted formula of the subtree
-