Skip to content

Commit

Permalink
Merge pull request #1888 from AllenInstitute/bugfix/1888-skip-trailin…
Browse files Browse the repository at this point in the history
…g-spaces-in-sf-code

Remove trailing whitespace in SF code
  • Loading branch information
t-b authored Sep 14, 2023
2 parents 1009140 + aa8b947 commit 09a408c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Packages/MIES/MIES_SweepFormula.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -2293,7 +2293,8 @@ static Function/S SF_PreprocessInput(string formula)
endsWithCR = StringEndsWith(formula, SF_CHAR_CR)

WAVE/T lines = ListToTextWave(formula, SF_CHAR_CR)
lines = StringFromList(0, lines[p], SF_CHAR_COMMENT)
lines[] = StringFromList(0, lines[p], SF_CHAR_COMMENT)
lines[] = RemoveEndingRegExp(lines[p], "[[:space:]]+$")
formula = TextWaveToList(lines, SF_CHAR_CR)
if(IsEmpty(formula))
return ""
Expand Down
8 changes: 7 additions & 1 deletion Packages/tests/UTF_DataGenerators.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,18 @@ static Function/WAVE SF_TestVariablesGen()
Make/FREE/T t4DimLbl = {"b"}
Make/FREE/T t4Result = {"a$b=1"}

// does not bug out with trailing whitespace
Make/FREE/T t5FormulaAndRest = {"a=[1]\r \rb=$a\r\r$b", "$b"}
t5FormulaAndRest[] = MIES_SF#SF_PreprocessInput(t5FormulaAndRest[p])
Make/FREE/T t5DimLbl = {"a", "b"}

Make/FREE/WAVE t1 = {t1FormulaAndRest, t1DimLbl, $""}
Make/FREE/WAVE t2 = {t2FormulaAndRest, t2DimLbl, $""}
Make/FREE/WAVE t3 = {t3FormulaAndRest, t3DimLbl, t3Result}
Make/FREE/WAVE t4 = {t4FormulaAndRest, t4DimLbl, t4Result}
Make/FREE/WAVE t5 = {t5FormulaAndRest, t5DimLbl, $""}

Make/FREE/WAVE wv = {t1, t2, t3, t4}
Make/FREE/WAVE wv = {t1, t2, t3, t4, t5}
return wv
End

Expand Down

0 comments on commit 09a408c

Please sign in to comment.