GNU Info

Info Node: (groff)Identifiers

(groff)Identifiers


Next: Embedded Commands Prev: Expressions Up: gtroff Reference
Enter node , (file) or (file)node

Identifiers
===========

   Like any other language, `gtroff' has rules for properly formed
"identifiers".  In `gtroff', an identifier can be made up of almost any
printable character, with the exception of the following characters:

   * Whitespace characters (spaces, tabs, and newlines).

   * Backspace (ASCII `0x08' or EBCDIC `0x16') and character code
     `0x01'.

   * The following input characters are invalid and are ignored if
     `groff' runs on a machine based on ASCII, causing a warning
     message of type `input' (see Note: Debugging, for more details):
     `0x00', `0x0B', `0x0D'-`0x1F', `0x80'-`0x9F'.

     And here are the invalid input characters if `groff' runs on an
     EBCDIC host: `0x00', `0x08', `0x09', `0x0B', `0x0D'-`0x14',
     `0x17'-`0x1F', `0x30'-`0x3F'.

     Currently, some of these reserved codepoints are used internally,
     thus making it non-trivial to extend `gtroff' to cover Unicode or
     other character sets and encodings which use characters of these
     ranges.

     Note that invalid characters are removed before parsing; an
     identifier `foo', followed by an invalid character, followed by
     `bar' is treated as `foobar'.

   For example, any of the following is valid.


     br
     PP
     (l
     end-list
     @_

Note that identifiers longer than two characters with a closing bracket
(`]') in its name can't be accessed with escape sequences which expect
an identifier as a parameter.  For example, `\[foo]]' accesses the
glyph `foo', followed by `]', whereas `\C'foo]'' really asks for glyph
`foo]'.

 - Escape: \A'IDENT'
     Test whether an identifier IDENT is valid in `gtroff'.  It expands
     to the character 1 or 0 according to whether its argument (usually
     delimited by quotes) is or is not acceptable as the name of a
     string, macro, diversion, number register, environment, or font.
     It returns 0 if no argument is given.  This is useful for looking
     up user input in some sort of associative table.


          \A'end-list'
              => 1


   Note: Escapes, for details on parameter delimiting characters.

   Identifiers in `gtroff' can be any length, but, in some contexts,
`gtroff' needs to be told where identifiers end and text begins (and in
different ways depending on their length):

   * Single character.

   * Two characters.  Must be prefixed with `(' in some situations.

   * Arbitrary length (`gtroff' only).  Must be bracketed with `['
     and `]' in some situations.  Any length identifier can be put in
     brackets.

   Unlike many other programming languages, undefined identifiers are
silently ignored or expanded to nothing.  When `gtroff' finds an
undefined identifier, it emits a warning then:

   * If the identifier is a string, macro, or diversion, `gtroff'
     defines it as empty.

   * If the identifier is a number register, `gtroff' defines it with a
     value of 0.

   Note: Warnings.

   Note: Interpolating Registers, and Note: Strings.


automatically generated by info2www version 1.2.2.9