Interface DiffLineFormulaExtractor

All Known Implementing Classes:
AbstractingFormulaExtractor, CPPDiffLineFormulaExtractor, JPPDiffLineFormulaExtractor, MarlinCPPDiffLineFormulaExtractor

public interface DiffLineFormulaExtractor
Interface for extracting a formula from a line containing an annotation. The line might be preceded by a '-', '+', or ' '. For example, given the line "+#if defined(A) || B()", the extractor should extract "defined(A) || B".

Further alterations of the extracted formula are allowed. For instance, the extracted formula might be abstracted (e.g., by simplifying the call to "defined(A)" leaving only the argument "A", or substituting it with "DEFINED_A").

Author:
Paul Bittner, Sören Viegener, Benjamin Moosherr, Alexander Schultheiß
  • Method Summary

    Modifier and Type
    Method
    Description
    Extracts the feature formula as a string from a line (possibly within a diff).
    default String
    Resolves any macros in the given formula that are relevant for feature annotations.
  • Method Details

    • extractFormula

      String extractFormula(String line) throws UnparseableFormulaException
      Extracts the feature formula as a string from a line (possibly within a diff).
      Parameters:
      line - The line of which to get the feature mapping
      Returns:
      The feature mapping as a String of the given line
      Throws:
      UnparseableFormulaException
    • resolveFeatureMacroFunctions

      default String resolveFeatureMacroFunctions(String formula)
      Resolves any macros in the given formula that are relevant for feature annotations. For example, in Marlin, feature annotations are given by the custom ENABLED and DISABLED macros, which have to be unwrapped.
      Parameters:
      formula - The formula whose feature macros to resolve.
      Returns:
      The parseable formula as string. The default implementation returns the input string.