4.2 The Definition section

The second type of secion type is the definitions section. It provides a convenient way to define often-used patterns. It is started with the word definitions followed by a colon and a newline. Each line in the definitions file specifies a pattern name and a pattern seperated by an arbitrary number of spaces. Patterns are always regular expressions enclosed in quotes in PyLly [Regular expressions will be discussed more fully later]. For example:

definitions:
    ID      "[A-Za-z_][A-Za-z0-9_]*"
    IDPAIR  "{ID} {ID}"

This example defines the pattern named ID as a letter or underscore followed by zero or more letters, numbers or underscores. This pattern can be used latter in other regular expressions by enclosing them in braces as illustrated in the definition of IDPAIR as two identifiers seperated by a space. All named patterns are self contained; there is never a need to enclose a named pattern within parenthesis to avoid unusual effects.

There may be multiple definitions sections within the spec file. Definitions may be used in any patterns following the definition.

See the PyGgy Home Page.