Compiling errors after ported VO

This forum is meant for questions and discussions about the X# language and tools
Post Reply
boonnam
Posts: 88
Joined: Mon May 08, 2017 6:42 pm
Location: USA

Compiling errors after ported VO

Post by boonnam »

I am trying to convert our VO application to X# using XPorter. For most part XPorter works great! But I am getting some weird errors when I try to build in Visual Studio using VO dialect. Here are some example of the errors:

Here is a snippet of code section:

cAcctgRec := '"'+"H"+'",'+ ; // Header Record
'"'+cBank+'",'+ ; // Bank Code
'"Y",'+ ; // Print Check?
"0"+','+ ; // Check Number
'"'+cVendor+'",'+ ; // Vendor No.
line 1870 // '"'+PadR(RTrim(SELF:SwapName(oNetMstr:minsname)),30," ")+'",'+ ; // Vendor Name - replaced 08.21.06
line 1871 '"'+PadR(RTrim(cInsName),30," ")+'",'+ ; // Vendor Name
'"'+SubStr(DToS(dTranDate),3)+'",'+ ; // Date



Here is the error: "XS9002 Parser: mismatched input '(' expecting EOS". The error is for line 1871. The fix is to delete the commented out line 1870.

The issue I have is with the next compiler error. I hope I can explain it clearly.

Here is a sample codes:

line 2268 cAcctgRec += '"'+DToS(dTranDate)+'",'+ ;

The compiler error is: XS9002 Parser: mismatched input '(' expecting EOS for line 2268.

If you look at the actual line of code, there is nothing wrong with it. The parenthesis match up. The causes are several lines above it. We have lines of code that is similar to this one: IF (aAcctg[n,4]==15.and.aAcctg[n,3]>0.00).or.(aAcctg[n,4]==5.and.aAcctg[n,3]<0.00)

Notice there is no space before or after "==" ".or." ">" ".and.". Once I put space in, this error went away.

There are several hundreds error like this. There are some similar errors, which do not go away even after I make the same fix. Maybe there are more lines of code above that need to be fixed. I'm still going through each line.

Can the compiler be updated to report the actual line that is causing the error? Also, is this an error?

Hopefully this post is clear.

Thanks,
Boonnam
User avatar
Chris
Posts: 4936
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Compiling errors after ported VO

Post by Chris »

Hi Boonnam,

For the first error, you can just add a ";" in front of the "//" comment marker and it will be accepted. The reason is that in an expression like that:

c := ;
"abc" + ;
// empty line
"def"

the parser does not know that you intended the command to continue also after the comment line, or the line below is a new command.

As for the second error, unfortunately this is more complicated. The problem is that the "." operator is used in x# (and in c# and vulcan, generally in .Net) also in class names and for static members, so the following is a perfectly valid command:

Yes.And.No := 1

(namespace "Yes", class name "And", static field "No")

so the parser cannot translate ".And." without spaces around it to the and operator like VO does, so this code must be modified. Of course it would be better if the exporter tool did this, will add this feature in the todo list. Actually it should be pretty easy to implement this (because for VO code, the tool can ALWAYS assume that .AND. is the and operator), so we'll probably do that quickly enough.

About the error message itself, I absolutely agree, it should be a lot more helpful to locate the exact problem that what it currently is. Unfortunately this is more difficult to do than it sounds, because of the way parsers work, but we do have plans to make improvements also in this area.

Chris
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
boonnam
Posts: 88
Joined: Mon May 08, 2017 6:42 pm
Location: USA

Compiling errors after ported VO

Post by boonnam »

Chris, thank you for the quick reply.

Here are more compile errors. The error I'm getting is "XS9002 Parser: mismatched input '!='"

Here are the lines of code this error is pointing at:
IF dwIndex != 0
IF SELF:zPolicy != "All Policies"
IF SELF:cStoreFilter != cFilter

The error goes away if I change != to ==. But there are other lines with the exact same code that the compiler isn't treating as error. For example, there are two more if statements like "IF dwIndex != 0", that do not get compile error.

Here are sample lines of code that are similar but no compile error.
IF SELF:oNetUsrc:FIELDGET(#MCATEGORY)!="PPGX"
IF SELF:oNetDocs != NULL_OBJECT

Once again this with Visual Studio and VO dialect.

Thanks,
Boonnam
User avatar
Chris
Posts: 4936
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Compiling errors after ported VO

Post by Chris »

Hi Boonam,

Definitely the != is not a problem, there is something else in the code that the parser considers a syntax error and goes out of synch. Can you please post (or send me directly) one of the .prg files that shows such an error? It's not nesseccary t send the complete project, syntax errors are reproducible also with just the .prg.

thanks,
Chris
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Post Reply