6 Commits

Author SHA1 Message Date
Jerome Lambourg
c77b6a721e Adjust the basic-ada-parser test 2024-09-19 10:13:17 +00:00
Vincent Jicquel
d0923eae49 Handle whitespace characters in unit names with the Ada parser
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.
2024-08-29 12:50:08 +00:00
Jerome Lambourg
ba54406d43 Bump copyright notice to 2024
Also remove copyright from tests

no-issue-check
2024-01-10 11:11:21 +01:00
Jerome Lambourg
23c911093f Use the new Ada parser
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
2023-08-25 16:36:22 +02:00
Jerome Lambourg
0ac336886d Simplify dependencies lists generated by the Ada/Ali parsers
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
2023-08-18 09:53:23 +00:00
Vincent Jicquel
d5a39dfb4d Implement a fast Ada parser
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
2023-08-10 11:54:20 +00:00