Conversation
Intro `scan_token` as the service actually retrieving the next token from the source file, and keep `get_token` as the service returning the token to the clients. `get_token` can then act as a refinement point to filter or alter the token stream. Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
The dependencies listed by `nitls -M` dropped any module with a parsing error. A broken file would then be missing from the dependencies of a Makefile, and make could see the binary as up to date. Without the rebuild the error is fully hidden from the user. Let's make this less likely by parsing only the part nitls actually needs to list dependencies. This way a syntax error after the import list doesn't affect nitls' behavior. Intro the module loader_header_only, imported by nitls only, which refines the Lexer to return EOF at the first token of the body. As a bonus, the reduced work speeds up nitls significantly, `nitls -M src/nitc.nit` is about 9x faster. Since it can run many time on every `make` invocation, it becomes noticeably more snappy in large projects. Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
With `nitls -M` a module that failed to parse was not listed in the output. This could have make think no rebuild was necessery which fully silenced the error. Let's list the files with the parse error to address this issue. To do so we keep a list of the parsing errors. An alternative would be to keep a list of the AModule parsed or the AError for the failed ones. Then `nitls` could list those in for the `-M` output instead of the type-checked MModules. Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
Test Results 67 files 337 suites 16m 3s ⏱️ Results for commit d59a234. ♻️ This comment has been updated with latest results. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improve the dependency listing mode
-Mof nitls to be more resilient to parsing errors. A parsing error in a source file used to make nitlis skip listing that file in its output and not parse its imports. Skipping a file in the dependency list could havemakenot trigger rebuilds of existing binaries as expected. Without a rebuild, the original parsing errors are simply not reported to the user and themakecommand succeeds on broken code without doing any work.Let's make
nitlsmuch more resilient to parsing errors with two new behaviors:In nitls, parse only the header of each source file: the module declaration and imports. Ignore all class and method definitions as well as top-level code. This prevents parsing errors later in the file to break the whole file.
The header information is enough for nitls’ use cases. As a bonus, the reduced work speeds up nitls significantly,
nitls -M src/nitc.nitis about 9x faster. Since it can run many time on everymakeinvocation, it becomes noticeably more snappy in large projects.In the case of a parse error in the header, we now correctly list that file in the
nitls -Moutput. It used to be skipped as we listed only type-checked MModules. Now we keep track of the parsing errors and use that information to list problematic files as well.