Hi Anthony, Sorry for taking a while to reply but life's quite busy! =) As for the new parser, having good error reporting is definitely a goal, but as of yet it has not been worked on in the sleightest. (When there is an error now in the parser, you get a segfault...). I was planning to do proper error handling later, and line numbering should be a part of that. I see you're already working on things with the older parser. Regardless of old or new, what we need to handle better line numbering I think is a stack of linenumber structs that just have filename and line number. That way when we're in an included file, we'd get something like: In file xxx.csd line 80: In included file yyy.inc line 3: Error: something went horribly awry! Or any number of levels deep. We could also have an offset field so that those can handle the offset lines when reading a CSD. I would imagine adding some functions to encapsulate all of this too, to push and pop linenumber structs. Thoughts on this? steven On Nov 28, 2007 10:34 PM, Anthony Kozar wrote: > Hello everyone, > > I have been looking into adding a command-line flag like > "--check-syntax-only" at the request of Joakim Verona. This is fairly > trivial but also fairly useless for his purposes since Csound frequently > reports the wrong line numbers for syntax errors. > > I have identified at least six causes for incorrect line numbers: > > 1. Using a CSD. (Csound reports the line # in the temporary .orc). > 2. Including another file with #include. > 3. #include-ing a non-existent file. (That line is not counted). > 4. Defining a macro. (All lines in the definition count as one line). > 5. Invoking a macro. (Counts as the number of lines in the macro). > 6. Using a backslash \ to continue a statement on the next line. > (All lines in the continuation count as one line). > > I am interested in trying to correct at least some of these issues. My > question is how worthwhile is it to invest time on them? (For example, I > think a solution to #1 may not be too difficult). > > Steven has been making progress on the new parser. Will the new parser be > able to report correct line numbers (and files for #includes) for errors? > > I am very interested to hear your thoughts. > > Anthony Kozar > anthonykozar AT sbcglobal DOT net > http://anthonykozar.net/ > > PS. I've included a CSD below that shows all of these issues -- the > comments indicate how Csound is reporting line numbers. > > Istvan Varga wrote on 4/13/06 11:45 AM: > > > it is a well > > known and long existing problem that line numbers are often not printed > > correctly in syntax errors. Even worse, fixing the line numbers is > > probably not easy without major code changes. > > > > > #include "error-lines.inc" ; lines 1-3 > #include "dummyfile" ; not counted > > instr 1 ; line 5 > oscili 15000, \ ; line 6 > 440.0, \ ; line 6 > 1 ; line 6 > out aoscleft, \ ; line 7 > aoscright ; line 7 > ; endin > > #define MACRO # aconst init 0.707 ; line 10 > out aconst, abogus ; line 10 > # ; line 10 > > instr 2 ; line 12 > $MACRO ; lines 13-14 > ; line 15 > > > f1 0 4096 10 1 > > i1 0 2 > e > > > > > ----------------------------------- > file "error-lines.inc" has 3 lines: > ----------------------------------- > instr 3 > out adummy > endin > > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: The Future of Linux Business White Paper > from Novell. From the desktop to the data center, Linux is going > mainstream. Let it simplify your IT future. > http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 > > _______________________________________________ > Csound-devel mailing list > Csound-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/csound-devel > ------------------------------------------------------------------------- SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net