summaryrefslogtreecommitdiff
path: root/src/resolver.rs
Commit message (Collapse)AuthorAge
* Prevent duplicate parent and child entries for source unitsBen Bridle2025-03-11
| | | | | | | | | The parent and child collections for hierarchical source units were previously vecs, and would receive one entry for every symbol matched. This was easily leading to many dozens of duplicate entries per unit, which, while not impacting performance, seemed wasteful. The collection types were changed to HashSets to prevent the collection of duplicate entries.
* Ignore source units that have already been includedBen Bridle2025-03-08
| | | | | | | | There is the possibility that the same source file could be discovered twice, if the same folder is included multiple times as a library folder or if symbolic links are used that link to already-included files. These duplicate source files are now ignored, to prevent erroneous 'duplicate definition' errors from being generated.
* Show an error when a source file fails to parseBen Bridle2025-03-08
| | | | | | | | | | | | | | | | | Previously, if a source file failed to parse, no symbols would be returned and symbol resolution would continue as normal. This would obscure the source of any errors, as well as the fact that any error had occurred at all. We don't want all errors in all source files to be printed at symbol resolution time, because this could bury any errors in the actual program being assembled with potentially irrelevant library errors, and errors in the program being assembled will be printed all over again once a merged source file has been produced. Instead, we allow the parser function to return a None value if the file could not be parsed, and a single line is printed as a warning for every library file that failed to parse.
* Fix compilation on rust nightly 1.87.0Ben Bridle2025-03-01
| | | | The API of the extract_if method has changed to also take a range.
* Correctly record references resolved by each definitionBen Bridle2025-02-13
| | | | | Definitions were incorrectly not having resolved references associated with them.
* Create struct for reporting unused definitionsBen Bridle2025-02-13
|
* Report redefinition errorsBen Bridle2025-02-13
| | | | | Previously, the Resolver::error method was only checking for undefined symbols, and not also checking for redefined symbols.
* Create struct for reporting in detail the symbols in a resolverBen Bridle2025-02-10
| | | | This is used for debugging symbol definition and resolution issues.
* Track related symbols in resolverBen Bridle2025-02-10
| | | | | | | | As well as the already-implemented tracking of the existing definition of redefinitions, the resolver will now also track the definition that resolves each reference, and the references resolved by each definition. Instead of using tuples to hold this information, named wrapper structs have been created for each category.
* Log when a source file is merged into the resolverBen Bridle2025-02-08
|
* Support namespaces when resolving symbolsBen Bridle2025-02-08
| | | | | | A definition can resolve a reference in the same or a deeper namespace, allowing for proper scoping and shadowing. Multiple definitions in the same namespace cannot share a name.
* Implement source unit compilation, symbol resolution, error reportingBen Bridle2025-02-05
This library can now carry out all stages of assembly from collecting source fragments to resolving symbols to pruning unused libraries to generating a single compiled source file. Pretty-printing of state has also been implemented in this library. The source tree hierarchy, symbol resolution errors, and file read errors can all be printed in a tidy format.