Open masak opened 5 years ago
(Building an actual CST is always so much more tedious than an AST...)
@vendethiel Yes, although the tedium here seems to consist only of remembering to attach position information from a Match
to a Q
. More precisely, we can't mandate it (because synthetic Qnodes need to be constructible without such position information), but what we probably can do is make it very low-friction/attractive to just pass that information somehow from the Match
to the new Q
.
Guess it's also worth thinking about what the consequences are of some macro author forgetting. (At a guess, we can't track some macro back to where it was in the source; can't do analysis, replacements, syntax highlighting, etc.) Thirdly, maybe there are places where position information shouldn't or can't be given? I dunno.
Of possible interest: Racket's syntax objects, which keep source location & lexical context.
tbd example with
is parsed
hex numberstbd no need to do this for synthetic Qnodes (?)
tbd possible uses in other issues: Refactoring tools, that syntax highlighter