Class JPPDiffLineFormulaExtractor
java.lang.Object
org.variantsync.diffdetective.feature.AbstractingFormulaExtractor
org.variantsync.diffdetective.feature.jpp.JPPDiffLineFormulaExtractor
- All Implemented Interfaces:
DiffLineFormulaExtractor
Extracts the expression from a JavaPP (Java PreProcessor) statement .
For example, given the annotation "//#if defined(A) || B()", the extractor would extract "DEFINED_A || B".
The extractor detects if and elif annotations (other annotations do not have expressions).
The given JPP statement might also be a line in a diff (i.e., preceeded by a - or +).
- Author:
- Alexander Schultheiß
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
abstractFormula
(String formula) Abstract the given formula.Methods inherited from class org.variantsync.diffdetective.feature.AbstractingFormulaExtractor
extractFormula
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.variantsync.diffdetective.feature.DiffLineFormulaExtractor
resolveFeatureMacroFunctions
-
Field Details
-
JPP_ANNOTATION_REGEX
- See Also:
-
JPP_ANNOTATION_PATTERN
-
-
Constructor Details
-
JPPDiffLineFormulaExtractor
public JPPDiffLineFormulaExtractor()
-
-
Method Details
-
abstractFormula
Abstract the given formula.First, the visitor uses ANTLR to parse the formula into a parse tree gives the tree to a
AbstractingJPPExpressionVisitor
. The visitor traverses the tree starting from the root, searching for subtrees that must be abstracted. If such a subtree is found, the visitor abstracts the part of the formula in the subtree.- Specified by:
abstractFormula
in classAbstractingFormulaExtractor
- Parameters:
formula
- that is to be abstracted- Returns:
- the abstracted formula
-