Open mcheshkov opened 10 years ago
Or implement parse tree generation in hxparse.
I'm not sure if it's worth deviating from the Haxe AST for this. I acknowledge the problem though. In fact I've come across it even in core Haxe where sometimes I was missing some position information.
For what it's worth I have added positions to a lot of constructs in Haxe itself. The problem is that this isn't exposed to the macro API because doing that would be a breaking change.
I've find that it's really awkward to work with position-related stuff on everything other that
Expr
. I.e. check style forA->B->C
notation ofComplexType
, but there's no position information. So one have to infer all that from some higher level position, forEVar
i.e. And, sinceComplexType
is recursive it really means to parse again some part of source.My proposition is to add Position to more parts of AST. But that means to break compatibility with haxe.macro types and with ocaml AST. I can implement this, in a case.