diff options
author | fche <fche> | 2007-04-04 21:18:23 +0000 |
---|---|---|
committer | fche <fche> | 2007-04-04 21:18:23 +0000 |
commit | 5811366a62325d2cacf5509c25ee564ae3269f9b (patch) | |
tree | 655f7d1b88d1901b7121151951b671cd9c940105 /stap.1.in | |
parent | 3b5793932ec33f897433bc513b49f35bd8b35b2f (diff) | |
download | systemtap-steved-5811366a62325d2cacf5509c25ee564ae3269f9b.tar.gz systemtap-steved-5811366a62325d2cacf5509c25ee564ae3269f9b.tar.xz systemtap-steved-5811366a62325d2cacf5509c25ee564ae3269f9b.zip |
2007-04-03 Pierre Peiffer <pierre.peiffer@bull.net>
* parse.cxx, parse.h (lexer::scan): Add $# and @# identifiers.
(eval_pp_conditional, scan_pp): Allow the use of $x and @x identifiers.
Produce more accurate error messages.
* stap.1.in: Document $# and @# identifiers.
2007-04-04 Pierre Peiffer <pierre.peiffer@bull.net>
* parseok/fourteen.stp: Add test about $# and @# usage during
the preprocessing.
* parseko/preprocess10.stp: New test.
* parseko/preprocess11.stp: New test.
* parseko/preprocess12.stp: New test.
Diffstat (limited to 'stap.1.in')
-rw-r--r-- | stap.1.in | 23 |
1 files changed, 17 insertions, 6 deletions
@@ -185,10 +185,16 @@ be expanded as literals. Use .B $1 ... $<NN> for casting as a numeric literal and .B @1 ... @<NN> -for casting as string literal. These may be used in all contexts -where literals are accepted. Reference to an argument number beyond -what was actually given is an error. -.PP +for casting as string literal. The number of arguments may be accessed +through +.B $# +(as a numeric literal) or through +.B @# +(as a string literal). These may be used in all contexts where literals +are accepted, including preprocessing stage. Reference to an argument +number beyond what was actually given is an error. + +.SS PREPROCESSING A simple conditional preprocessing stage is run as a part of parsing. The general form is similar to the .RB cond " ? " exp1 " : " exp2 @@ -197,8 +203,9 @@ ternary operator: .BR %( " CONDITION " %? " TRUE-TOKENS " %) .BR %( " CONDITION " %? " TRUE-TOKENS " %: " FALSE-TOKENS " %) .ESAMPLE -The CONDITION is a very limited expression whose format is determined -by its first keyword. +The CONDITION is either an expression whose format is determined by its +first keyword, or a string literals comparison or a numeric literals +comparison. .PP If the first part is the identifier .BR kernel_vr " or " kernel_v @@ -222,6 +229,10 @@ then the second part is one of the two string comparison operators and the third part is a string literal for matching it. This comparison is simple string (in)equality. .PP +Otherwise, the CONDITION is expected to be a comparison between two string +literals or two numeric literals. In this case, the arguments are the only +variables usable. +.PP The TRUE-TOKENS and FALSE-TOKENS are zero or more general parser tokens (possibly including nested preprocessor conditionals), and are pasted into the input stream if the condition is true or false. For |