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>
public class AbstractingCExpressionVisitor
extends org.antlr.v4.runtime.tree.AbstractParseTreeVisitor<StringBuilder>
Unparses the syntax tree into a string for use as a boolean abstraction.
This visitor produces almost the same string as
ParseTree.getText()
i.e., the result is the string passed to the parser where all characters ignored by the parser
are removed. Removed characters are mostly whitespace and comments, although the semantics of the
strings are equivalent (e.g., spaces in strings literals are kept).
The difference lies in some special cases:
- We handle the parse rule
Defined specialOperatorArgument?
specially and return"defined(argument)"
instead of"definedargument"
. This prevents clashes with macros called"definedargument"
and makes the result consistent with the semantically equivalent ruleDefined ('(' specialOperatorArgument ')')
.
- Author:
- Benjamin Moosherr
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringBuilder
aggregateResult
(StringBuilder aggregate, StringBuilder nextResult) protected StringBuilder
visitChildren
(org.antlr.v4.runtime.tree.RuleNode node) visitTerminal
(org.antlr.v4.runtime.tree.TerminalNode node) Methods inherited from class org.antlr.v4.runtime.tree.AbstractParseTreeVisitor
shouldVisitNextChild, visit, visitErrorNode
-
Constructor Details
-
AbstractingCExpressionVisitor
public AbstractingCExpressionVisitor()
-
-
Method Details
-
visitTerminal
- Specified by:
visitTerminal
in interfaceorg.antlr.v4.runtime.tree.ParseTreeVisitor<StringBuilder>
- Overrides:
visitTerminal
in classorg.antlr.v4.runtime.tree.AbstractParseTreeVisitor<StringBuilder>
-
defaultResult
- Overrides:
defaultResult
in classorg.antlr.v4.runtime.tree.AbstractParseTreeVisitor<StringBuilder>
-
aggregateResult
- Overrides:
aggregateResult
in classorg.antlr.v4.runtime.tree.AbstractParseTreeVisitor<StringBuilder>
-
visitChildren
- Specified by:
visitChildren
in interfaceorg.antlr.v4.runtime.tree.ParseTreeVisitor<StringBuilder>
- Overrides:
visitChildren
in classorg.antlr.v4.runtime.tree.AbstractParseTreeVisitor<StringBuilder>
-
visitSpecialOperator
-