[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | skaller <skaller@u...> |
| Subject: | Re: [Caml-list] Error messages with dypgen |
On Fri, 2007-05-18 at 08:20 +0100, Joel Reymont wrote: > I understand that dypgen throws an exception when a syntax error is > found. > > How do I get it to produce line/column numbers when that happens? > > It would be rather groovy if the the exception carried > symbol_start_pos, symbol_end_pos, rhs_start_pos, rhs_end_pos from the > dyp record since this information is available at the time that the > exception is raised. No it isn't. Dypgen uses lexbufs for compatibility with the broken Ocamlyacc interface. Dypgen lets you use ulex or other lexer as well. The type of the error thrown by the automaton should not be polluted by positional information that has no reasonable standard specification. If you want this information, you can look it up yourself in the lexbuf. The parser has no business at all examining the lexbuf, the lexbuf belongs to the lexer. > A simple error function built into dypgen could then take a message > and raise the syntax error exception with all the required info. An error function is a good idea, except the Ocamlyacc style interface is broken so there's no way to pass it so it would have to be global. -- John Skaller <skaller at users dot sf dot net> Felix, successor to C++: http://felix.sf.net