NAME

XML::Axk::Preparse - preparser for axk

SPECIFYING THE AXK LANGUAGE

An axk script can include a -Ln pragma that specifies the axk language in use. For example, -L1 (or, -L 1, -L01, -L001, ...) calls for language 1 (defined in XML::Axk::L::L1).

Similarly, a -Bn pragma specifies the axk backend to use.

An axk script on disk without a -Ln pragma is an error. This means that the language version must be specified in the -Ln form, not as a direct use ...::Ln; statement. This is so that -Ln can expand to something different depending on the language version, if necessary. However, you can say `use...Ln` manually _in addition to_ the pragma (e.g., in a different package).

Multiple -Ln pragmas are allowed in a file. This is so you can use different language versions in different packages if you want to. However, you do so at your own risk!

Command-line scripts without a -Ln pragma use the latest version automatically. That is, the behaviour is like perl's -E rather than perl's -e. That risks breakage of inline scripts, but makes it easier to use axk from the command line. If you are using axk in a shell script, specify the -Ln pragma at the beginning of your script or on the axk command line. This is consistent with the requirement to list the version in your source files.

Language formats

Languages can either be:

[0-9]+

A numeric language has leading 0s stripped from its name. E.g., -L012 tries to use language 12.

Languages 1-9 are reserved for axk's use.

[a-zA-Z][a-zA-Z0-9\.]*

An alphabetic language name is used as is, except that . characters are converted to :: module separators.

Language names that are all upper case, and that have no . characters, are reserved for axk's use.

ROUTINES

pieces

Split the given source text into language-specific pieces. Usage:

my $lrPieces = pieces(\$source_text[, $hrInitialPragmas]);
my ($lrPieces, $hasLang) = pieces(\$source_text[, $hrInitialPragmas]);

In the second form, it also tells you whether any Ln pragma is present in the source text.

If you specify a $hrInitialPragma, it will govern any lines before the first pragma in the source text.

assemble

Assemble a script for eval based on the results of a call to pieces(). Usage:

my $srNewText = assemble($filename, $lrPieces);

preparse

Invokes pieces() and assemble(). Usage:

my $srTextOut = preparse($filename, $textIn);

textIn can be a string or a string ref.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 71:

You forgot a '=back' before '=head1'