NaturalDocs:: ConfigFile

A package to manage some of the shared functionality needed for Natural Docs’ configuration files.

Usage

  • StartingParseOf() must be called for each configuration file before using any other functions with that file.
Summary
A package to manage some of the shared functionality needed for Natural Docs’ configuration files.
The file handle used when annotating the configuration file with error comments.
The current configuration file being parsed.
An array of errors added by AddError().
Notifies the package that a new configuration file is about to be parsed.
Obscures the passed text so that it is not user editable and returns it.
Restores text encoded with Obscure() and returns it.
Stores an error for the current configuration file.
Returns how many errors the configuration file has.
Handles any errors that we’re found in the configuration file, which currently means printing them out in the GNU error format and annotating the configuration file with error comments.

Variables

CONFIG_FILEHANDLE

The file handle used when annotating the configuration file with error comments.

file

my $file

The current configuration file being parsed.

errors

my @errors

An array of errors added by AddError().  Every odd entry is the line number, and every even entry following is the error message.

Functions

StartingParseOf

sub StartingParseOf #(file)

Notifies the package that a new configuration file is about to be parsed.  You must call this function for each configuration file before using any other package functions with it.

Parameters

fileThe file about to be parsed.

Obscure

sub Obscure #(text)

Obscures the passed text so that it is not user editable and returns it.  The encoding method is not secure; it is just designed to be fast and to discourage user editing.

Unobscure

sub Unobscure #(text)

Restores text encoded with Obscure() and returns it.

Error Functions

AddError

sub AddError #(lineNumber,
message)

Stores an error for the current configuration file.

Parameters

lineNumberThe line number, with the first line being one, not zero.
messageThe error message.

ErrorCount

sub ErrorCount

Returns how many errors the configuration file has.

HandleErrors

sub HandleErrors

Handles any errors that we’re found in the configuration file, which currently means printing them out in the GNU error format and annotating the configuration file with error comments.  It does not end execution.

my $file
The current configuration file being parsed.
my @errors
An array of errors added by AddError().
sub AddError #(lineNumber,
message)
Stores an error for the current configuration file.
sub StartingParseOf #(file)
Notifies the package that a new configuration file is about to be parsed.
sub Obscure #(text)
Obscures the passed text so that it is not user editable and returns it.
sub Unobscure #(text)
Restores text encoded with Obscure() and returns it.
sub ErrorCount
Returns how many errors the configuration file has.
sub HandleErrors
Handles any errors that we’re found in the configuration file, which currently means printing them out in the GNU error format and annotating the configuration file with error comments.