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

Make separate lexer/parser support relative paths #2260

Open
marcohu opened this issue Mar 25, 2018 · 0 comments
Open

Make separate lexer/parser support relative paths #2260

marcohu opened this issue Mar 25, 2018 · 0 comments

Comments

@marcohu
Copy link
Contributor

marcohu commented Mar 25, 2018

I'm currently writing an ANTLR rule for Bazel and I'm still running into the issue mentioned in #2065: processing of separated lexer/parser grammars in a subdirectory only works with absolute paths. Because even with -Xexact-output-dir it practically means you are forced to use -package and can't process different packages in a single run. Or you have to embed the package names into the grammars (and I have to analyze the created files to put them into the correct subdirectories). Workable, but not ideal.

Bottom line : I would prefer that the separated lexer/parser grammars use case will be fixed for relative paths.

Looking into the code, the problem seems to be that TokenVocabParser only looks in the root of the output directory, but the .tokens file has been written to a subdirectory. Now I don't know who is at fault here. Should the .tokens file be written to the root directory instead? Or should ANTLR look in the subdirectories for .tokens files as well?

I think the simplest thing to do would be to keep track of the directories that have been created below the output directory and have ANTLR not only check the explicit lib directory, but these implicit lib directories as well. Does this sound like a feasible approach? If so, I will send a PR. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant