xsharp.eu • Parser error when setting property of type logical in VO dialect
Page 1 of 1

Parser error when setting property of type logical in VO dialect

Posted: Fri Sep 04, 2020 1:36 pm
by chiwi
Hi everyone

I have an odd parser error when trying to set a property with type logical in XSharp. What's more unusual is it only occurs in VO and not with the core dialect.

EG

Code: Select all

oSentryOptions:Debug := TRUE
Results in the error: Parser: unexpected input ':='

I've made a quick demo solution illustrating the issue: https://github.com/ch-iwi/xsharp-parser-error

Am i missing something? Or is it a bug?

Cheers

Parser error when setting property of type logical in VO dialect

Posted: Fri Sep 04, 2020 1:43 pm
by robert
Duncan,

This is a common problem.
I am sure you have the "compatible preprocessor" option enabled. This makes the preprocessor case insensitive.
And the compiler automatically adds a define with the name "DEBUG" when compiling in debug mode with no value.
So the preprocessor changes this to:

Code: Select all

oSentryOptions:  := TRUE
There are 2 options:

1) Disable the compatible preprocessor compiler option (Project Properties, Dialect Tab, "All dialects" category)
2) Prefix the Debug word with @@ characters

Code: Select all

oSentryOptions:@@Debug := TRUE
The @@ tells the preprocessor to leave the symbol alone. The compiler will strip this. The @@ can also be used if you want to declare a variable name or class name that conflicts with a built-in keyword.


Robert

Parser error when setting property of type logical in VO dialect

Posted: Fri Sep 04, 2020 1:53 pm
by chiwi
Hi Robert

100% on the money. Thanks for the clear explanation.

Have a great weekend. Cheers