DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(m4.info.gz) Changecom

Info Catalog (m4.info.gz) Changequote (m4.info.gz) Input Control (m4.info.gz) Changeword
 
 7.3 Changing the comment delimiters
 ===================================
 
 The default comment delimiters can be changed with the builtin macro
 `changecom':
 
  -- Builtin: changecom ([START], [END])
      This sets START as the new begin-comment delimiter and END as the
      new end-comment delimiter.  If only one argument is provided,
      newline becomes the new end-comment delimiter.  The comment
      delimiters can be of any length.  Omitting the first argument, or
      using the empty string as the first argument, disables comments.
 
      The expansion of `changecom' is void.
 
      define(`comment', `COMMENT')
      =>
      # A normal comment
      =># A normal comment
      changecom(`/*', `*/')
      =>
      # Not a comment anymore
      =># Not a COMMENT anymore
      But: /* this is a comment now */ while this is not a comment
      =>But: /* this is a comment now */ while this is not a COMMENT
 
    Note how comments are copied to the output, much as if they were
 quoted strings.  If you want the text inside a comment expanded, quote
 the begin-comment delimiter.
 
    Calling `changecom' without any arguments, or with an empty string
 for the first argument, disables the commenting mechanism completely.
 To restore the original comment start of `#', you must explicitly ask
 for it.
 
      define(`comment', `COMMENT')
      =>
      changecom
      =>
      # Not a comment anymore
      =># Not a COMMENT anymore
      changecom(`#')
      =>
      # comment again
      =># comment again
 
    The comment strings can safely contain eight-bit characters.
 
    Comments are recognized in preference to macros.  However, this is
 not compatible with other implementations, where macros and even quoting
 takes precedence over comments, so it may change in a future release.
 For portability, this means that START should not begin with a letter
 or `_' (underscore), and that neither the start-quote nor the
 start-comment string should be a prefix of the other.
 
      define(`hi', `HI')
      =>
      changecom(`q', `Q')
      =>
      q hi Q hi
      =>q hi Q HI
 
    Comments are recognized in preference to argument collection.  In
 particular, if START is a single `(', then argument collection is
 effectively disabled.  For portability with other implementations, it
 is a good idea to avoid `(', `,', and `)' as the first character in
 START.
 
      define(`echo', `$#:$@:')
      =>
      define(`hi', `HI')
      =>
      changecom(`(',`)')
      =>
      echo(hi)
      =>0::(hi)
      changecom
      =>
      changecom(`((', `))')
      =>
      echo(hi)
      =>1:HI:
      echo((hi))
      =>0::((hi))
      changecom(`,', `)')
      =>
      echo(hi,hi)bye)
      =>1:HI,hi)bye:
 
    It is an error if the end of file occurs within a comment.
 
      changecom(`/*', `*/')
      =>
      /*dangling comment
      ^D
      error-->m4:stdin:1: ERROR: end of file in comment
 
Info Catalog (m4.info.gz) Changequote (m4.info.gz) Input Control (m4.info.gz) Changeword
automatically generated byinfo2html