This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: (PR11207) Macroprocessor discussion
- From: Serguei Makarov <smakarov at redhat dot com>
- To: Josh Stone <jistone at redhat dot com>
- Cc: "Frank Ch. Eigler" <fche at redhat dot com>, systemtap at sourceware dot org
- Date: Fri, 15 Jun 2012 10:36:42 -0400 (EDT)
- Subject: Re: (PR11207) Macroprocessor discussion
So, summarizing back the proposal when I've incorporated Josh's latest suggestions:
- token-based
- separate executable is produced for generating documentation (incorporating the stap lexer + macro processor + not much else)
- lexer gathers such things as temporary '\n' tokens for macroprocessing purposes
- flow of data is INPUT TEXT =(lexer)=> TOKEN STREAM WITH '\n' =(macroprocessor)=> (TOKEN STREAM FOR PARSER / TEXT OUTPUT FOR DOCUMENTATION)
- it may be possible/necessary to subsume kernel-doc into the macroprocessor functionality to avoid having to reconstruct output text from a token stream
Macroprocessor syntax
- single-line definition %define foo(...) ... \n
- multiple-line definition %define foo(...) %( ... %) -- so plain '()' parens in a definition need not balance
- macro invocation %foo(...) -- so plain '()' parens in an invocation have to balance
- of course, all of the above can also be zero-parameter (without the parens)
- delete a definition with %undef foo
- conditional expression %( ... %? ... %: ... %)
- /** ... */ doc comment
- /*** ... */ doc comment continuation
- $1, $2, ... command line arguments