Menu

#367 Dollar signs in strings as procedure arguments

v1.1.x
fixed
None
v1.1.0
Bug Fix
2018-11-11
2018-08-15
Erik Hänel
No

If one uses a dollar sign in a string literal, which is used as procedure argument, NumeRe will transform it into $thisfile~. A Similar issue might be that this is not possible:

write "\subsection{" + $thisfile~camelize(replaceall((string(j, 2), "_", " "))) + "}" -set file=sTARGETPATH+"overallreport.tex" -mode=app -nq

Analysis:

Actually, these are two different issues with different reasons

  • The reason for $thisfile~ is related to using namespace thisfile. The algorithm, which searches for procedures in the argument list, doesn't consider quotation marks. This has to be changed. The issue can be found in Procedure::execute and Procedure::procedureInterface
  • The second issue is a refactoring regression. In parser_VectorToExpr the below listed code snippet is wrong and has to be changed.

This is wrong:

// Append the last scalar and a comma, if it is needed
if (vScalars.size() > vVectors.size())
    sLine += vScalars.back();

it has to be changed to:

// Append the last scalar and a comma, if it is needed
if (vScalars.size() > vVectors.size())
    sLine += vScalars[vScalars.size()-2];

Implementation:

  • Implementation: The first issue was solved by introducing !isInQuotes(__sVarList, nVarPos-1) && at the two relevant locations, the second as proposed by the analysis.
  • Revision: [r383]
  • Implementation test: Expressions for both issues were created before fixing and were tested afterwards. No deviation occured.

Documentation:

  • ChangesLog: updated
  • Comments: the change was commented, more comments are not reasonable, because the whole file will be changed in the future
  • Documentation articles: Not needed - bug fix
  • Language files: Not needed - bug fix

Tests:

This fix was tested in the automatic SW tests. No deviations detected.

Related

Commit: [r383]

Discussion

  • Erik Hänel

    Erik Hänel - 2018-08-15
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1 +1,3 @@
    -If one uses a dollar sign in a string literal, which is used as procedure argument, NumeRe will transform it into `$thisfile~`.
    +If one uses a dollar sign in a string literal, which is used as procedure argument, NumeRe will transform it into `$thisfile~`. A Similar issue might be that this is not possible:
    +
    
    +    write "\subsection{" + $thisfile~camelize(replaceall((string(j, 2), "_", " "))) + "}" -set file=sTARGETPATH+"overallreport.tex" -mode=app -nq
    
     
  • Erik Hänel

    Erik Hänel - 2018-08-15
    • status: open --> accepted
     
  • Erik Hänel

    Erik Hänel - 2018-08-24
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,3 +1,20 @@
     If one uses a dollar sign in a string literal, which is used as procedure argument, NumeRe will transform it into `$thisfile~`. A Similar issue might be that this is not possible:
    
         write "\subsection{" + $thisfile~camelize(replaceall((string(j, 2), "_", " "))) + "}" -set file=sTARGETPATH+"overallreport.tex" -mode=app -nq
    
    +    
    +###Analysis:
    +(*Describe, what's the issue and which changes have to be made*)
    +
    +###Implementation:
    +* Implementation: (*Describe, what you've changed*) 
    +* Revision: [rXXX]
    +* Implementation test: (*Describe the type of test, which you performed, and if it was succesful*)
    +
    +###Documentation:
    +* ChangesLog: (*Have you updated the changes log?*)
    +* Comments: (*Have you written comments in the code, which describe your change?*)
    +* Documentation articles: (*Have you updated the documentation articles?*)
    +* Language files: (*Have you updated the language files?*)
    +
    +###Tests:
    +(*Describe, which tests you performed and their outcome*)
    
    • status: accepted --> analyzing
     
  • Erik Hänel

    Erik Hänel - 2018-08-24
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -3,7 +3,24 @@
         write "\subsection{" + $thisfile~camelize(replaceall((string(j, 2), "_", " "))) + "}" -set file=sTARGETPATH+"overallreport.tex" -mode=app -nq
    
     ###Analysis:
    -(*Describe, what's the issue and which changes have to be made*)
    +Actually, these are two different issues with different reasons
    +
    +* The reason for `$thisfile~` is related to using `namespace thisfile`. The algorithm, which searches for procedures in the argument list, doesn't consider quotation marks. This has to be changed. The issue can be found in `Procedure::execute` and `Procedure::procedureInterface`
    +* The second issue is a refactoring regression. In `parser_VectorToExpr` the below listed code snippet is wrong and has to be changed.
    +
    +This is wrong:
    +
    
    +    :::C++
    +    // Append the last scalar and a comma, if it is needed
    +    if (vScalars.size() > vVectors.size())
    +        sLine += vScalars.back();
    +
    +it has to be changed to:
    +
    +    :::C++
    +    // Append the last scalar and a comma, if it is needed
    +    if (vScalars.size() > vVectors.size())
    +        sLine += vScalars[vScalars.size()-2];
    
     ###Implementation:
    
     * Implementation: (*Describe, what you've changed*) 
    
    • status: analyzing --> implementing
     
  • Erik Hänel

    Erik Hänel - 2018-08-24
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -23,15 +23,15 @@
             sLine += vScalars[vScalars.size()-2];
    
     ###Implementation:
    -* Implementation: (*Describe, what you've changed*) 
    -* Revision: [rXXX]
    -* Implementation test: (*Describe the type of test, which you performed, and if it was succesful*)
    +* Implementation: The first issue was solved by introducing `!isInQuotes(__sVarList, nVarPos-1) &&` at the two relevant locations
    +* Revision: [r383]
    +* Implementation test: Expressions for both issues were created before fixing and were tested afterwards. No deviation occured.
    
     ###Documentation:
    -* ChangesLog: (*Have you updated the changes log?*)
    -* Comments: (*Have you written comments in the code, which describe your change?*)
    -* Documentation articles: (*Have you updated the documentation articles?*)
    -* Language files: (*Have you updated the language files?*)
    +* ChangesLog: updated
    +* Comments: the change was commented, more comments are not reasonable, because the whole file will be changed in the future
    +* Documentation articles: Not needed - bug fix
    +* Language files: Not needed - bug fix
    
     ###Tests:
     (*Describe, which tests you performed and their outcome*)
    
    • status: implementing --> testing
     

    Related

    Commit: [r383]

  • Erik Hänel

    Erik Hänel - 2018-08-24
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -23,7 +23,7 @@
             sLine += vScalars[vScalars.size()-2];
    
     ###Implementation:
    -* Implementation: The first issue was solved by introducing `!isInQuotes(__sVarList, nVarPos-1) &&` at the two relevant locations
    +* Implementation: The first issue was solved by introducing `!isInQuotes(__sVarList, nVarPos-1) &&` at the two relevant locations, the second as proposed by the analysis.
    
     * Revision: [r383]
     * Implementation test: Expressions for both issues were created before fixing and were tested afterwards. No deviation occured.
    
     

    Related

    Commit: [r383]

  • Erik Hänel

    Erik Hänel - 2018-11-11
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -34,4 +34,4 @@
    
     * Language files: Not needed - bug fix
    
     ###Tests:
    -(*Describe, which tests you performed and their outcome*)
    +This fix was tested in the automatic SW tests. No deviations detected.
    
    • status: testing --> fixed
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB