Parser error when setting property of type logical in VO dialect

This forum is meant for questions and discussions about the X# language and tools
Post Reply
User avatar
chiwi
Posts: 8
Joined: Tue Dec 17, 2019 7:45 am

Parser error when setting property of type logical in VO dialect

Post 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
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Parser error when setting property of type logical in VO dialect

Post 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
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
chiwi
Posts: 8
Joined: Tue Dec 17, 2019 7:45 am

Parser error when setting property of type logical in VO dialect

Post by chiwi »

Hi Robert

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

Have a great weekend. Cheers
Post Reply