Class MarlinCPPDiffLineFormulaExtractor

All Implemented Interfaces:
DiffLineFormulaExtractor

public class MarlinCPPDiffLineFormulaExtractor extends CPPDiffLineFormulaExtractor
Extracts formulas from preprocessor annotations in the marlin firmware. In particular, it resolves the 'ENABLED' and 'DISABLED' macros that are used in Marlin to check for features being (de-)selected.
Author:
Paul Bittner
  • Field Details

    • ENABLED_PATTERN

      private static final Pattern ENABLED_PATTERN
    • DISABLED_PATTERN

      private static final Pattern DISABLED_PATTERN
  • Constructor Details

    • MarlinCPPDiffLineFormulaExtractor

      public MarlinCPPDiffLineFormulaExtractor()
  • Method Details

    • resolveFeatureMacroFunctions

      public String resolveFeatureMacroFunctions(String formula)
      Description copied from interface: DiffLineFormulaExtractor
      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.
    • replaceAll

      private String replaceAll(Pattern pattern, String replacement, String string)