View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Parser Gagged Error

nwj781 wrote on Jul 14, 2009

I'm writing a script to help automate image reduction. However, I'm getting a "parser gagged" error on the last line after "end" . Does this mean I opened a brace and forgot to close it or something? It makes very little sense to me.

I'd post the code but it's about a thousand lines long.

Thanks,
Neil

Mike Fitzpatrick wrote on Jul 14, 2009

If you use emacs as an editor, the most common cause is that there is no EOF or a newline ('\n') following the 'end' statement. I believe a missing brace should trigger a 'syntax error' but if it's not the above you should double check. Write back if you still have problems.

-Mike

nwj781 wrote on Jul 14, 2009

Thanks Mike. I'm using gedit as an editor. There is no newline after end. I noticed IRAF has a tendency of placing almost every error on the last line, regardless of where the problem is in the code. Still not sure where the error is coming from.

Mike Fitzpatrick wrote on Jul 14, 2009

The newline following the 'end' is required otherwise the input is terminated prematurely. The default ECL should print correct line numbers in the case of syntax errors and script crashes but this is a different case where the input stream terminates prematurely. Note if you're still running v2.12 the ECL is an add-on you can get and the old CL will always print the number of lines regardless of where the error happened.

-Mike

nwj781 wrote on Jul 14, 2009

I added a newline following end to no avail... Still not sure what's wrong here.

Mike Fitzpatrick wrote on Jul 14, 2009

Well, could be a control character in the file, some kind of CR/NL mapping problem, really bad syntax, or something else entirely. Feel free to email me the script (fitz at iraf.net) or else try removing parts of the script until to narrow down where the problem is.

-Mike

nwj781 wrote on Jul 14, 2009

I'll just run through it a few more times comparing it to the last working configuration of the script, see if I can't trap it that way.

Thanks for your help,
-Neil

nwj781 wrote on Jul 14, 2009

I just found out something that REALLY didn't help my cause :?

I was saving the script after each modification, then running it to see if the changes worked. However, it really helps to run the updated script and not a version of it saved in another folder. Hence me getting the same error message no matter what I did to the script.

In short, I am dumb haha.

Thanks for your help, it's running fine now. It was the newline after end thing you were talking about.

Last post on Jul 14, 2009