Modula-2: Add spell-checking hints for constant aggregates
Introduces spell-checking hints in Modula-2's PCBuild pass for constant aggregate construction, improving error reporting.
This patch enhances the Modula-2 compiler by adding spell-checking capabilities to the PCBuild pass, which handles the construction of constant aggregates. It also incorporates spell-checking for type names and adds missing production statements for the FORWARD keyword. A new test case verifies these improvements.
In Details
The Modula-2 compiler's PCBuild pass (gcc/m2/PCBuild.bnf, gcc/m2/PCSymBuild.mod, gcc/m2/M2Quads.mod) is updated to include spell-checking for identifiers within constant aggregates and type names. This addresses PR modula2/127554 by adding a SpellHint mechanism in M2MetaError.mod and generating spelling hint errors in BuildConstructor. The handling of the FORWARD keyword is also improved.
- PCBuild pass
- A pass in the Modula-2 compiler responsible for building abstract syntax trees and associated symbol information, particularly for constant aggregates.
- Constant aggregate
- A composite data structure (like an array or record) initialized with constant values.
- Spell-checking hint
- A compiler-generated suggestion for a likely misspelling of an identifier or keyword.
- FORWARD keyword
- In Modula-2, used to declare a procedure or module before its full definition, allowing forward references.