Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AST Node Coordinates #67

Open
71104 opened this issue Aug 28, 2015 · 0 comments
Open

AST Node Coordinates #67

71104 opened this issue Aug 28, 2015 · 0 comments

Comments

@71104
Copy link
Owner

71104 commented Aug 28, 2015

Store coordinates in each AST node. Coordinates are indications on how to find the corresponding source code in the original source stream.

Each AST node is associated to a span of text in the source stream. Therefore, each AST node shall be associated the following coordinates:

  • start offset (index of the first character of the corresponding piece of code in the source stream);
  • end offset (past-the-end index, i.e. index of the first character not belonging to the corresponding piece of code in the source stream);
  • start line number (line number of the character at the start offset);
  • start line offset (offset of the first character of the corresponding piece of code within the start line);
  • end line number (line number of the last character of the corresponding piece of code, note that this is not the same character at the end offset);
  • end line offset (offset of the last character of the corresponding piece of code within the end line).

This feature will be exposed by the AST API and will allow for:

  • more detailed error messages that include line numbers and offsets,
  • source maps,
  • step-by-step debugging,
  • possibly more.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant