While the parser currently gathers some source location info (line and column
numbers) and associates it with parsed AST nodes, the information is currently
only accessible from within Java, not from within AmbientTalk.
It would be nice to expose this information via AmbientTalk's mirror system:
(reflect: ast).sourceLocation.lineNo
The source location info has some issues, however:
- the info is stored in ASTs as mutable state. This should become immutable
state (i.e. a final field set in the AST's constructor). This requires a
somewhat significant refactoring of the AGAbstractGrammar subclasses.
- how to deal with source location info for interned ASTs like symbols, which
are shared?
- should the source info be propagated to values that result from ASTs, like
messages and objects? This is not always possible, and sometimes it may be
confusing what the actual source line number is. For example:
def msg := <-foo();
o1 <+ msg;
o2 <+ msg;
What is the source location for 'msg'?
- the ANTLR parser should be modified to provide more accuracte line/column
info. Especially column info can be off in the current system.
Original issue reported on code.google.com by tvcut...@gmail.com on 12 Oct 2010 at 7:43
Original issue reported on code.google.com by
tvcut...@gmail.com
on 12 Oct 2010 at 7:43