Isn't Bug 31561 just a matter of unescaped quotes?

Author: ulrichmerkel@web.de (ulrich-merkel)

http://unifaceinfo.com/fixes/issuelist/31561.php:

Reproduction scenario:
 1. Create a component or entity.
 2. Add the next code to a trigger/entry/operation:
   putmess "%%$scan("hel;lo", "l")"
 3. Compile

I think the error:

(OSCR)      1           putmess "%%$scan("hel

is just a matter of unescaped quotes inside the string   should read:

putmess "%%$scan(%%"hel;lo%%", %%"l%%")"

7 Comments

  1. Well one certainly doesn't currently have to escape the quotes in  putmess "Problem with %%$item("ERROR", outputlist)%%% " Or, in fact,  putmess "%%$scan("Hello","l")%%%" And, putting the escapes in :- putmess "%%scan(%%"Hel;lo%%",%%"l%%")%%%" still doesn't compile. 


    Author: Iain Sharp (i.sharp@pcisystems.co.uk)
  2. Hi Iain, thanks for the verification, let's give it another try: especially version 3 which just use single-quotes instead of double-quotes is confusing because this works putmess "%%$scan(%%"hel;lo%%", %%"l%%")%%%" results in a compile error, but the error message shows at least the complete line: (ABC1) 4 putmess "%%$scan(%%"hel;lo%%", %%"l%%")%%%" (ABC1) error: 1000 - Syntax error (Argument not valid) can't test it in 9.7, but in 9604, the following 3 versions compile without errors: putmess $concat("",$scan("hel;lo", "l")) putmess '%%$scan("hel;lo", "l")%%%' putmess "%%$scan('hel;lo', 'l')%%%" but only version 1 and 3 returns "3", the second one doesn't do the job writing %%$scan("hel;lo", "l")%%%


    Author: ulrich-merkel (ulrichmerkel@web.de)
  3. In 9.7 it's the same. I would prefer Version 3  :  putmess "%%$scan('hel;lo', 'l')"   If there is no other text for Output you can also use : putmess $scan("hel;lo", "l")   The Problem is the ; which is interpreted als the beginning of a comment, so the rest of the line is ignored!


    Author: Lauterbach (norbert.lauterbach@infraserv.com)
  4. For me, the problem is the violation of the documented grammar. It says putmess accepts (optional) a single argument which is either a string, a variable, ... But what is this putmess "%%$scan("hel;lo", "l")" seen from a parser:

    putmess 
    "%%$scan("
    hel;lo
    ", "
    l
    ")"
    
    the keyword putmess followed by 3 strings with something else in between which violates the "one optional string".
    
    The semicolon OUTSIDE of a string denotes that the rest of the line will be comment which is correct behaviour.
    
    
    
    The problem with version 3 is the abuse that single quotes enclose a SYNTAX string
    where "a.c" is something completely different from 'a.c'.
    
    So $concat will be the better way (unfortunately restricted to 5 arguments so we may need $concats in $concat).

    Author: ulrich-merkel (ulrichmerkel@web.de)
  5. It is a single string, but with substition in it.  "This is a message telling you the status %%$status%%%"  is a single string.  Ditto "This is a string with some data in it %%$item("JIM",v_variable)%%%" And "Character L found at position %%$scan("Hello","l")%%% of %%"Hello%%"." The parser needs to recognise it is in a string parameter to a substituted function, and not call ; a comment. 


    Author: Iain Sharp (i.sharp@pcisystems.co.uk)
  6. Hi Iain, as I see it, we got one error if putmess has more than one argument or missing closing parenteses etc and another one because of the masked quotes can not be handled in $scan, $concat and $item (ABC1) 6 putmess "%%$concat(%%"abc%%",$componentname)%%%" (ABC1) error: 1000 - Syntax error (Argument not valid) (ABC1) 7 putmess "Problem with %%$item("ER;ROR", outputlist)%%% " (ABC1) error: 1000 - Syntax error (String not valid) (ABC1) error: 1000 - Syntax error (String not valid) in argument 1. (ABC1) 8 putmess "Problem with %%$item(%%"ER;ROR%%", outputlist)%%% " (ABC1) error: 1000 - Syntax error (Argument not valid) I think we aree that this is a more general problem of the parser/validator; one would expect in the content of a string escaped quotes are converted to normal ones and the parser uses this one for furter parsing (or the grammar allows escaped quotes around arguments).


    Author: ulrich-merkel (ulrichmerkel@web.de)
  7. Hi all, I feel Uli is right about unescaped quotes or the parser could be improved to recognize string params in a function... but why break the barrel if you can walk around? I've often found issues in the situation you are describing...To avoid to spend time to find the real reason I've taken the habit to use some dummy variables to support my needs. Re-using one of your examples: - Instead of writing: “This is a string with some data in it %%$item(“JIM”,v_variable)%%%” - I am using: v_dummyVar = "JIM" “This is a string with some data in it %%$item(v_dummyVar,v_variable)%%%” I know it's a workaround...but it works! :-) Gianni


    Author: gianni (gianni.sandigliano@unifacesolutions.com)