Charta Software
Back to the base
E-mail:
Wachtwoord:
Aangemaakt door op 2009-06-19 22:37:30
Laatst gewijzigd op 2009-06-19 22:52:53

ChartaPascal

At Charta Software we have developed our own Pascal parser. While currently not perfect it already has some features other Pascal parsers lack.

Currently the ChartaPascal parser has reached the state that it can be useful at Charta Software. In this section its features will be described. ChartaPascal is an application already present in the Charta project group and should be runnable right away. Currently it parses the entire code base at program startup, which can take a while, and then shows the detected problems.

Unit references

If one is not careful the list of units that are referenced can grow to be a mess. ChartaPascal performs a number of checks to keep the uses list orderly.

Unused unit references

The ChartaPascal parser detects when units mentioned in the uses list of the interface or implementation section of a unit are (still) used. It indicates when a unit is referenced in the interface section but it is only necessary in the implementation section. It also indicates when a unit is referenced in either the interface or implementation section and it is not necessary in either section.

Unit reference not in sorted order

The ChartaPascal parser detects when units mentioned in the uses list of the interface or implementation section of a unit not listed in alphabetical order. Keeping the uses sorted makes it easier to see at a glance which are the dependencies with other units.

Unit reference expected in column 3

Because the list of unit references is preferred to be sorted, a comfortable way to view this list is when every reference is listed left-aligned right below another. Taking into account a standard indentation relative to the uses keyword means that every reference should start in character column 3. ChartaPascal verifies whether this is true for all unit references.

Missing base class or interface

To make Pascal code as uniform as possible it is desirable to explicitly state a base class for every class and a base interface for every interface. The Pascal language allows to leave them out when the base class is TObject or the base interface is IInterface but it is more clear to explicitly state them. ChartaPascal will warn about missing base classes and interfaces.

Missing visibility scope specifier

It is always a good idea to be precise about the visibility of the members of a class or record. So one should always use the most restrictive of private, protected, public and published that fits the situation. If no scope is specified at all the visibility scope will default to the least restrictive which is not to be preferred. ChartaPascal will warn about missing visibility scope specifiers.

Missing semicolon

Pascal allows that the semicolon is omitted before the end keyword. However, the code is more uniform if these optional semicolons are included. ChartaPascal will warn about missing semicolons.