On Wed Nov 22 14:26:29 2023 +0000, eric pouech wrote:
if I get this right:
- 'if foo bar == other' generates a syntax error
- 'if %VAR%==other' will get the same syntax error when VAR contains a space
- 'if "%VAR%"=="other"' doesn't get syntax error as strings are delimited
- but 'if !WINE_FOO!==other' doesn't get syntax error even if WINE_FOO
contains a space this looks to me as if:
- %VAR% is replaced by its value, and then the command is parsed
- while !WINE_FOO! is kept as is, command is parsed, which gives
!WINE_FOO! as a token, and which is then evaluated IOW, this looks to me to be only a matter of ordering of operations, and has nothing to do with being inside a IF or not but this requires to have a decent tokenizer (for which when delay expansion is enabled just transforms !VAR! into its value)
Your description of those four cases is correct, and Wine handles all four of them correctly with this patch. I'm not understanding what would be different if we had a "decent" tokenizer. Can you give me an example of a statement that would not be evaluated correctly by the code I am proposing, but that would be evaluated correctly by such a tokenizer?