Closed mewmew closed 8 years ago
Closing for now, having settled for the minimal Node
representation needed for good error reporting.
type Node interface {
// Start returns the start position of the node within the input stream.
Start() int
}
The current
Node
representation is defined as follows.The start position of a token is useful for error reporting (e.g.
error at line:col, expected identifier got ";"
), while the end position is useful for tools operating on the original input such as refactoring tools, which may reposition nodes (as defined by their start-end ranges) within the input.For now, the main use of positional information will be for error reporting. Therefore, information about the end position of tokens is not recorded. This may be revisited in the future, once there are potential users who may benefit from having access to the end position of tokens.