21.3.1 Token scanning

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

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


GNU Autoconf, Automake and Libtool
GNU Autoconf, Automake, and Libtool
ISBN: 1578701902
EAN: 2147483647
Year: 2002
Pages: 290

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net