Back: Fundamentals of M4 processing
Forward: Macros and macro expansion
 
FastBack: Features of M4
Up: Fundamentals of M4 processing
FastForward: Features of M4
Top: Autoconf, Automake, and Libtool
Contents: Table of Contents
Index: Index
About: About this document

21.3.1 Token scanning

m4 scans its input stream, generating (often, just copying) text to the output stream. The first step that m4 performs in processing is to recognize tokens. There are three kinds of tokens:

Names
A name is a sequence of characters that starts with a letter or an underscore and may be followed by additional letters, characters and underscores. The end of a name is recognized by the occurrence a character which is not any of the permitted characters--for example, a period. A name is always a candidate for macro expansion (21.3.2 Macros and macro expansion), whereby the name will be replaced in the output by a macro definition of the same name.

Quoted strings
A sequence of characters may be quoted (21.3.3 Quoting) with a starting quote at the beginning of the string and a terminating quote at the end. The default M4 quote characters are ``' and `'', however Autoconf reassigns them to `[' and `]', respectively. Suffice to say, M4 will remove the quote characters and pass the inner string to the output (21.3.3 Quoting).

Other tokens
All other tokens are those single characters which are not recognized as belonging to any of the other token types. They are passed through to the output unaltered.

Like most programming languages, M4 allows you to write comments in the input which will be ignored. Comments are delimited by the `#' character and by the end of a line. Comments in M4 differ from most languages, though, in that the text within the comment, including delimiters, is passed through to the output unaltered. Although the comment delimiting characters can be reassigned by the user, this is highly discouraged, as it may break GNU Autotools macros which rely on this fact to pass Bourne shell comment lines--which share the same comment delimiters--through to the output unaffected.


This document was generated by Gary V. Vaughan on May, 24 2001 using texi2html