Commented-out code gives a syntax error


#1

This code snippet

/*
ProcInfo = "/*" + tagdata(ProcWhole,"/*","*/",1) + "*/"
*/

throws a syntax error when I try to compile it. Remove the /* and */ operators and it compiles. Remove the line of code and it compiles. This happens in two different databases on two machines. Why?


#2

OK, the penny dropped - it’s the other comment operators (is that their correct generic name?) that are unmatched.


#3

I don’t understand the code you wrote, but I do know that you cannot nest /* …/ comments. Jim wrote in June:
"As Dave mentioned, Panorama X does not support nesting of /
*/ comments, as illustrated here:

/*
this is a comment
/* this is still a comment */
this portion is a comment in Panorama 6 but not X
*/
This may change eventually but it is pretty low priority – most programming languages that support /**/"


#4

As Tom mentioned, Panorama X does not allow nested /* ... */ comments. The end of Tom’s post was cut off, but I think he was going to say that most languages that use the /* ... */ don’t allow them to be nested. I know C does not allow that.

When Panorama X encounters a /* symbol, it stops regular parsing and just scans ahead looking for the next */. So in your original code, the comment will be.

/*
ProcInfo = "/*" + tagdata(ProcWhole,"/*","*/

So what’s after the end of the comment? This:

",1) + "*/"
*/

I think you can see why this results in a syntax error.