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

Add line numbers to AST nodes #252

Open
sdeal opened this issue Mar 26, 2019 · 1 comment
Open

Add line numbers to AST nodes #252

sdeal opened this issue Mar 26, 2019 · 1 comment

Comments

@sdeal
Copy link

sdeal commented Mar 26, 2019

I couldn’t find a way to access code comments or line numbers through BOA (I assume comments are simply ignored by the scanner and not even passed to the parser), because there are not part of the AST. Adding line numbers to each node (start line, end line) would help a lot, because then one could simply checkout the files from GitHub and access the code comments or any other information that is not included in the BOA dataset. Furthermore, line numbers would also facilitate to align information mined with BOA with information mined with other tools.

@psybers
Copy link
Member

psybers commented Jun 19, 2021

Just an FYI - Boa had support for positional information on the AST nodes from day one. However, we found that keeping that information made the dataset substantially larger (and at the time, too big for our servers to handle) and so we disabled this.

See:

message PositionInfo {

See:
public void preVisit(ASTNode node) {

See:
protected void buildPosition(final ASTNode node) {

Comments are actually in there too, but were stripped again for similar reasons.

See:

public boolean visit(BlockComment node) {

We might revisit these two points in the future and see if we are able to incorporate them now. We have picked up a few extra tricks over the years that might allow this.

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

2 participants