Unit names can include whitespace characters, such as spaces or line breaks.
These characters are eventually removed so that the unit name contains only alphanumeric characters.
This commit fixes an issue with the basic Ada parser, which previously did not
accept whitespace characters in unit names.
This change adds the new Ada parser and improves overall performance
of libgpr2.
With the new Ada parser usage, the name resolution of units is now properly
implemented.
What changes:
* the Ada parser is moved to the new Ada parser from master
* its use is now systematic for sources not having a naming exception
* in GPR2.Build.View_Tables, we should always use references to the table
and never manipulate the object directly (very costly with lots of sources).
* re-enable two tests: "runtime" and "source-interface"
* adapt various other tests.
Fixes eng/gpr/gpr-issues#130
The dependency is changed from Source_Reference.Identifier to a list
of Name_Type, as there's no real need to keep the source location
information (only use is the warning
'<source>: with unit "foo" not found' where the actual location is not
really useful).
This allows simplifying the low level Ada parser, removing the need for
a Token Handler.
Ref eng/gpr/gpr-issues#81, eng/gpr/gpr-issues#113
Main objective of the Ada parser is to determine the unit dependencies
(withed unit) of a unit, and if the unit if separate from another unit.
To do so, an Ada source code can be split in two separate parts:
- The context clause: clause containing withed units
- The library item or subunit: Both cases are processed during the same pass,
and contain the unit name, and the "separate from" unit name in
case of a subunit.
Other information are also provided by the parser:
- Is the unit generic
- Nature of a unit: package, subprogram, or no body (No body is not
implemented yet).
- The dependencies unit and unit source location.
This parser shall be faster than the current Ada parser, as it is based on a
lazy lexer, which means that we only read tokens the parser needs.
Test executable is built once, and is executed once for each file to
parse. Test prints the withed, separate and compilation units. The output
is then compared with the baseline test.out.
Issue: eng/gpr/gpr-issues/issues/81