Added basic support for ML-Lex and ML-Yacc files to CM file parser #60
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.
Description
The parser for CM files has been extended to handle ML-Lex and ML-Yacc specification files and add their generated files to the library sources.
Motivation
ML-Lex and ML-Yacc are SML/NJ's standard lexer and parser generators, respectively, and so have special integration with the CM build system. For source files with the extension ".l" or ".lex", CM automatically runs ML-Lex, which generates a file with the same filename as the ".lex" file with an additional ".sml" extension at the end. For files with ".y" or ".grm" extensions, CM runs ML-Yacc, generating both a ".sig" and ".sml" file in a similar way. All of the generated files are then treated as if they were explicitly listed in the .cm file and regenerated as needed.
Before this change, Millet showed an error ("unknown class") in CM files containing filenames with these extensions. Since the generated files were not being added to Millet's list of source files, completion and other analysis wasn't being done for these files. This limited my ability to use Millet with ML-Yacc and ML-Lex.
Tests
I have added tests to show that Millet can now parse CM files containing filenames with these extensions. I was not able to find existing tests that verify what actually ends up being added to Millet's sources list after parsing so I did not add any to verify that the generated files are added properly, but I may have missed them.