Puzzling syntax error


Recommended Posts

I've written a protocol with input channels named "Ux" "Uy" "Uz" "Cs" and a few others. Data arrives and a function parses the string out but as it tries to add values into channels, it fails with "Ux" every single time. I had to comment out lines individually to narrow it down to the single statement commented out in this block:

Channel.AddValue(strDevice,0,"U",0,Ux)

//Channel.AddValue(strDevice,0,"Ux",0,Ux)

? "Ux "+Ux

Channel.AddValue(strDevice,0,"Uy",0,Uy)

Channel.AddValue(strDevice,0,"Uz",0,Uz)

Channel.AddValue(strDevice,0,"Cs",0,Cs)

Channel.AddValue(strDevice,0,"diag counter",0,counter)

The ? statement was to make sure Ux was a valid # - is it. None of the other statements ever failed oddly enough. Since Ux was the first input created, I tried shifting the ID numbers up by one. I deleted the "Ux" input from the protocol and recreated it. Checked for extra spaces or characters in the raw protocol file, etc. As long as I tried to save into "Ux" it produced the error:

Syntax Error, a single character line is not valid - Error compiling sequence , Line Number 1

My solution has been to change the names to "U" "V" "W" but I'd love to see closure to this puzzle. Any thoughts? Thanks

Link to comment
Share on other sites

That is pretty weird. That's a compilation error. I think the problem is corruption in the file, that you have a carriage return or line feed in there, but its not showing up in the editor. I'd probably just delete the line and the line before and after then retype (not cut/paste) those lines.

Link to comment
Share on other sites

Well, cleaning up my file after switching names around caused the same compilation error to show up - it does look like its a problem with some other nearby line of code, not a specific name. Perhaps because I trimmed down all I/O to 1 blank line? Later I made them a comment with a few blank lines - still problematic. I've also done a lot of raw protocol file editing with wordpad and made all the functions consistent so its still interesting it had issues with only a couple I/O's I made.

With longer names ("sonic U, sonic V...") everything is working right but I wish I knew what the exact problem was so it doesn't resurface later. Am I limited in this experience? Thanks everyone for the input

Link to comment
Share on other sites

If you put the same code into a sequence, does it compile? I still am going with an errant hidden control character introduced by your external editor.

If you edit in Wordpad, its entirely possible it inserted a carriage return or other control character in the middle. I'd edit with Notepad instead since it doesn't introduce any formatting.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.