File tree Expand file tree Collapse file tree
src/main/java/org/variantsync/diffdetective/feature Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,21 +44,14 @@ public AbstractingFormulaExtractor(Pattern annotationPattern) {
4444 public Node extractFormula (final String text ) throws UnparseableFormulaException {
4545 final Matcher matcher = annotationPattern .matcher (text );
4646
47- // Retrieve the formula from the macro line
48- String fm ;
49- if (matcher .find ()) {
50- if (matcher .group (3 ) != null ) {
51- fm = matcher .group (3 );
52- } else {
53- fm = matcher .group (4 );
54- }
55- } else {
47+ // Match the formula from the macro line
48+ if (!matcher .find ()) {
5649 throw new UnparseableFormulaException ("Could not extract formula from line \" " + text + "\" ." );
5750 }
5851
5952 // abstract complex formulas (e.g., if they contain arithmetics or macro calls)
6053 try {
61- return abstractFormula (fm );
54+ return abstractFormula (matcher . group ( 2 ) );
6255 } catch (UncheckedUnParseableFormulaException e ) {
6356 throw e .inner ();
6457 } catch (Exception e ) {
Original file line number Diff line number Diff line change 2424 */
2525public class CPPDiffLineFormulaExtractor extends AbstractingFormulaExtractor {
2626 // ^[+-]?\s*#\s*(if|ifdef|ifndef|elif)(\s+(.*)|\((.*)\))$
27- private static final String CPP_ANNOTATION_REGEX = "^[+-]?\\ s*#\\ s*(if|ifdef|ifndef|elif)(\\ s+(.*)|( \\ (.* \\ )) )$" ;
27+ private static final String CPP_ANNOTATION_REGEX = "^[+-]?\\ s*#\\ s*(if|ifdef|ifndef|elif)([ \\ s(].* )$" ;
2828 private static final Pattern CPP_ANNOTATION_PATTERN = Pattern .compile (CPP_ANNOTATION_REGEX );
2929
3030 public CPPDiffLineFormulaExtractor () {
Original file line number Diff line number Diff line change 2121 * @author Alexander Schultheiß
2222 */
2323public class JPPDiffLineFormulaExtractor extends AbstractingFormulaExtractor {
24- private static final String JPP_ANNOTATION_REGEX = "^[+-]?\\ s*//\\ s*#\\ s*(if|elif)(\\ s+(.*)|( \\ (.* \\ )) )$" ;
24+ private static final String JPP_ANNOTATION_REGEX = "^[+-]?\\ s*//\\ s*#\\ s*(if|elif)([ \\ s(].* )$" ;
2525 private static final Pattern JPP_ANNOTATION_PATTERN = Pattern .compile (JPP_ANNOTATION_REGEX );
2626
2727 public JPPDiffLineFormulaExtractor () {
You can’t perform that action at this time.
0 commit comments