Feature/node source location
I went ahead and implemented support for MathJS on ASTExplorer (see PR here) but was unable to implement the source code highlighting feature since MathJS doesn't store positional information on nodes yet.
Took a crack at trying to implement that here, however wasn't able to figure out how to calculate the correct start/end positions, @josdejong could you possibly give me some pointers on how to do that?
Thanks Matt, that looks good already.
About the correct start and end positions: I see you're indeed already using state.index and state.token, that's indeed the positioning information that the parser has right now. You will need to keep track of the location of the index at the moment the parser starts parsing a specific type of node. I'm not sure what will be the handiest approach in that regard. Maybe you can create a variable indexAtStart = ... at the beginning of all parse* functions. Or maybe it works better to create a new state variable holding a stack with start indexes of all the nested operations (a bit similar to keeping track of the nestingLevel).