| Cobra | Interactive Query Language | pre | ||
|---|---|---|---|---|
| NAMEpre — show preprocessed source code context for marked tokensSYNTAXp[re] p[re] number number p[re] * number DESCRIPTIONThe pre command works the same as the display command, except the text that is printed is the preprocessed version of the source code, rather than the source code itself, and the matched token is highlighted. This can be useful when, for instance, a token matches in the expanded version of macros, but the match is not clear from the un-preprocessed code itself. The same options as used for the display command can be used.The command is also useful if no preprocessing was done, by highlighting marked tokens and indicating token ranges set in the .jmp field or .bound field of the tokens (Cobra version 4.7 and later).. 
 EXAMPLES: p # displays the preprocessed source lines for all matches : p 4 # displays only the match for th 4th match : p 4 2 # adds 2 lines of context before and after the match : p * 2 # adds 2 lines for all matches : p 1 +2 # adds 2 lines after the first matched line : p 1 -2 # adds 2 lines before the first matched lineConsider the following HTML formatted input, and running Cobra in html mode. $ cat html_example <a href="index.html">Return to index</a><br> $ cobra -html html_example 1 core, 1 files, 20 tokens : m @tag # mark all tokens marked as an html tag : m & a # restrict to those named 'a' : pre # show markings and the range bound to 'a' html_example:1<->html_example:1 1: 1 a href = " index . html " > Return to index < / a > < br > 1: . ---- - - ----- - ---- - - ------ -- ----- - - . : # the opening html tag <a> is linked to the matching closing tag </a> in the .bound field : back # move the mark point back one token : m & < # drop the closing tag, which has a / here : pre # show the markings and the range set in the .jmp field html_example:1: 1: 1 < a href = " index . html " > Return to index < / a > < br > 1: . ^ ^^^^ ^ ^ ^^^^^ ^ ^^^^ ^ ^ : # the opening < token is linked to the matching > token of the html tag in the .jmp field : q $ NOTESThis command is most useful if preprocessing is enabled, either on the command line or interactively with the cpp command. But can help highlight token markings and range settings also without preprocessing enabled.SEE ALSOcpp, display, json, list | ||||
| Return to index Manual Tutorial | (Last Updated: 7 February 2024) | |||