📄 concise.html
字号:
<h2><a name="options_controlling_sequence_numbering">Options controlling sequence numbering</a></h2>
<dl>
<dt><strong><a name="item__2dbasen"><strong>-base</strong><em>n</em></a></strong>
<dd>
<p>Print OP sequence numbers in base <em>n</em>. If <em>n</em> is greater than 10, the
digit for 11 will be 'a', and so on. If <em>n</em> is greater than 36, the digit
for 37 will be 'A', and so on until 62. Values greater than 62 are not
currently supported. The default is 36.</p>
</dd>
</li>
<dt><strong><a name="item__2dbigendian"><strong>-bigendian</strong></a></strong>
<dd>
<p>Print sequence numbers with the most significant digit first. This is the
usual convention for Arabic numerals, and the default.</p>
</dd>
</li>
<dt><strong><a name="item__2dlittleendian"><strong>-littleendian</strong></a></strong>
<dd>
<p>Print seqence numbers with the least significant digit first. This is
obviously mutually exclusive with bigendian.</p>
</dd>
</li>
</dl>
<p>
</p>
<h2><a name="other_options">Other options</a></h2>
<p>These are pairwise exclusive.</p>
<dl>
<dt><strong><a name="item__2dmain"><strong>-main</strong></a></strong>
<dd>
<p>Include the main program in the output, even if subroutines were also
specified. This rendering is normally suppressed when a subroutine
name or reference is given.</p>
</dd>
</li>
<dt><strong><a name="item__2dnomain"><strong>-nomain</strong></a></strong>
<dd>
<p>This restores the default behavior after you've changed it with '-main'
(it's not normally needed). If no subroutine name/ref is given, main is
rendered, regardless of this flag.</p>
</dd>
</li>
<dt><strong><a name="item__2dnobanner"><strong>-nobanner</strong></a></strong>
<dd>
<p>Renderings usually include a banner line identifying the function name
or stringified subref. This suppresses the printing of the banner.</p>
</dd>
<dd>
<p>TBC: Remove the stringified coderef; while it provides a 'cookie' for
each function rendered, the cookies used should be 1,2,3.. not a
random hex-address. It also complicates string comparison of two
different trees.</p>
</dd>
</li>
<dt><strong><a name="item__2dbanner"><strong>-banner</strong></a></strong>
<dd>
<p>restores default banner behavior.</p>
</dd>
</li>
<dt><strong><a name="item__2dbanneris__3d_3e_subref"><strong>-banneris</strong> => subref</a></strong>
<dd>
<p>TBC: a hookpoint (and an option to set it) for a user-supplied
function to produce a banner appropriate for users needs. It's not
ideal, because the rendering-state variables, which are a natural
candidate for use in concise.t, are unavailable to the user.</p>
</dd>
</li>
</dl>
<p>
</p>
<h2><a name="option_stickiness">Option Stickiness</a></h2>
<p>If you invoke Concise more than once in a program, you should know that
the options are 'sticky'. This means that the options you provide in
the first call will be remembered for the 2nd call, unless you
re-specify or change them.</p>
<p>
</p>
<hr />
<h1><a name="abbreviations">ABBREVIATIONS</a></h1>
<p>The concise style uses symbols to convey maximum info with minimal
clutter (like hex addresses). With just a little practice, you can
start to see the flowers, not just the branches, in the trees.</p>
<p>
</p>
<h2><a name="op_class_abbreviations">OP class abbreviations</a></h2>
<p>These symbols appear before the op-name, and indicate the
B:: namespace that represents the ops in your Perl code.</p>
<pre>
0 OP (aka BASEOP) An OP with no children
1 UNOP An OP with one child
2 BINOP An OP with two children
| LOGOP A control branch OP
@ LISTOP An OP that could have lots of children
/ PMOP An OP with a regular expression
$ SVOP An OP with an SV
" PVOP An OP with a string
{ LOOP An OP that holds pointers for a loop
; COP An OP that marks the start of a statement
# PADOP An OP with a GV on the pad</pre>
<p>
</p>
<h2><a name="op_flags_abbreviations">OP flags abbreviations</a></h2>
<p>OP flags are either public or private. The public flags alter the
behavior of each opcode in consistent ways, and are represented by 0
or more single characters.</p>
<pre>
v OPf_WANT_VOID Want nothing (void context)
s OPf_WANT_SCALAR Want single value (scalar context)
l OPf_WANT_LIST Want list of any length (list context)
Want is unknown
K OPf_KIDS There is a firstborn child.
P OPf_PARENS This operator was parenthesized.
(Or block needs explicit scope entry.)
R OPf_REF Certified reference.
(Return container, not containee).
M OPf_MOD Will modify (lvalue).
S OPf_STACKED Some arg is arriving on the stack.
* OPf_SPECIAL Do something weird for this op (see op.h)</pre>
<p>Private flags, if any are set for an opcode, are displayed after a '/'</p>
<pre>
8 <@> leave[1 ref] vKP/REFC ->(end)
7 <2> sassign vKS/2 ->8</pre>
<p>They're opcode specific, and occur less often than the public ones, so
they're represented by short mnemonics instead of single-chars; see
<em>op.h</em> for gory details, or try this quick 2-liner:</p>
<pre>
$> perl -MB::Concise -de 1
DB<1> |x \%B::Concise::priv</pre>
<p>
</p>
<hr />
<h1><a name="formatting_specifications">FORMATTING SPECIFICATIONS</a></h1>
<p>For each line-style ('concise', 'terse', 'linenoise', etc.) there are
3 format-specs which control how OPs are rendered.</p>
<p>The first is the 'default' format, which is used in both basic and exec
modes to print all opcodes. The 2nd, goto-format, is used in exec
mode when branches are encountered. They're not real opcodes, and are
inserted to look like a closing curly brace. The tree-format is tree
specific.</p>
<p>When a line is rendered, the correct format-spec is copied and scanned
for the following items; data is substituted in, and other
manipulations like basic indenting are done, for each opcode rendered.</p>
<p>There are 3 kinds of items that may be populated; special patterns,
#vars, and literal text, which is copied verbatim. (Yes, it's a set
of s///g steps.)</p>
<p>
</p>
<h2><a name="special_patterns">Special Patterns</a></h2>
<p>These items are the primitives used to perform indenting, and to
select text from amongst alternatives.</p>
<dl>
<dt><strong><a name="item_x"><strong>(x(</strong><em>exec_text</em><strong>;</strong><em>basic_text</em><strong>)x)</strong></a></strong>
<dd>
<p>Generates <em>exec_text</em> in exec mode, or <em>basic_text</em> in basic mode.</p>
</dd>
</li>
<dt><strong><a name="item__28_2a_28text_29_2a_29"><strong>(*(</strong><em>text</em><strong>)*)</strong></a></strong>
<dd>
<p>Generates one copy of <em>text</em> for each indentation level.</p>
</dd>
</li>
<dt><strong><a name="item__28_2a_28text1_3btext2_29_2a_29"><strong>(*(</strong><em>text1</em><strong>;</strong><em>text2</em><strong>)*)</strong></a></strong>
<dd>
<p>Generates one fewer copies of <em>text1</em> than the indentation level, followed
by one copy of <em>text2</em> if the indentation level is more than 0.</p>
</dd>
</li>
<dt><strong><a name="item__28_3f_28text1_23vartext2_29_3f_29"><strong>(?(</strong><em>text1</em><strong>#</strong><em>var</em><em>Text2</em><strong>)?)</strong></a></strong>
<dd>
<p>If the value of <em>var</em> is true (not empty or zero), generates the
value of <em>var</em> surrounded by <em>text1</em> and <em>Text2</em>, otherwise
nothing.</p>
</dd>
</li>
<dt><strong><a name="item__7e"><strong>~</strong></a></strong>
<dd>
<p>Any number of tildes and surrounding whitespace will be collapsed to
a single space.</p>
</dd>
</li>
</dl>
<p>
</p>
<h2><a name="__variables"># Variables</a></h2>
<p>These #vars represent opcode properties that you may want as part of
your rendering. The '#' is intended as a private sigil; a #var's
value is interpolated into the style-line, much like "read $this".</p>
<p>These vars take 3 forms:</p>
<dl>
<dt><strong><a name="item__23var"><strong>#</strong><em>var</em></a></strong>
<dd>
<p>A property named 'var' is assumed to exist for the opcodes, and is
interpolated into the rendering.</p>
</dd>
</li>
<dt><strong><a name="item__23varn"><strong>#</strong><em>var</em><em>N</em></a></strong>
<dd>
<p>Generates the value of <em>var</em>, left justified to fill <em>N</em> spaces.
Note that this means while you can have properties 'foo' and 'foo2',
you cannot render 'foo2', but you could with 'foo2a'. You would be
wise not to rely on this behavior going forward ;-)</p>
</dd>
</li>
<dt><strong><a name="item__23var"><strong>#</strong><em>Var</em></a></strong>
<dd>
<p>This ucfirst form of #var generates a tag-value form of itself for
display; it converts '#Var' into a 'Var => #var' style, which is then
handled as described above. (Imp-note: #Vars cannot be used for
conditional-fills, because the => #var transform is done after the check
for #Var's value).</p>
</dd>
</li>
</dl>
<p>The following variables are 'defined' by B::Concise; when they are
used in a style, their respective values are plugged into the
rendering of each opcode.</p>
<p>Only some of these are used by the standard styles, the others are
provided for you to delve into optree mechanics, should you wish to
add a new style (see <a href="#add_style">add_style</a> below) that uses them. You can
also add new ones using <a href="#add_callback">add_callback</a>.</p>
<dl>
<dt><strong><a name="item__23addr"><strong>#addr</strong></a></strong>
<dd>
<p>The address of the OP, in hexadecimal.</p>
</dd>
</li>
<dt><strong><a name="item__23arg"><strong>#arg</strong></a></strong>
<dd>
<p>The OP-specific information of the OP (such as the SV for an SVOP, the
non-local exit pointers for a LOOP, etc.) enclosed in parentheses.</p>
</dd>
</li>
<dt><strong><a name="item__23class"><strong>#class</strong></a></strong>
<dd>
<p>The B-determined class of the OP, in all caps.</p>
</dd>
</li>
<dt><strong><a name="item__23classsym"><strong>#classsym</strong></a></strong>
<dd>
<p>A single symbol abbreviating the class of the OP.</p>
</dd>
</li>
<dt><strong><a name="item__23coplabel"><strong>#coplabel</strong></a></strong>
<dd>
<p>The label of the statement or block the OP is the start of, if any.</p>
</dd>
</li>
<dt><strong><a name="item__23exname"><strong>#exname</strong></a></strong>
<dd>
<p>The name of the OP, or 'ex-foo' if the OP is a null that used to be a foo.</p>
</dd>
</li>
<dt><strong><a name="item__23extarg"><strong>#extarg</strong></a></strong>
<dd>
<p>The target of the OP, or nothing for a nulled OP.</p>
</dd>
</li>
<dt><strong><a name="item__23firstaddr"><strong>#firstaddr</strong></a></strong>
<dd>
<p>The address of the OP's first child, in hexadecimal.</p>
</dd>
</li>
<dt><strong><a name="item__23flags"><strong>#flags</strong></a></strong>
<dd>
<p>The OP's flags, abbreviated as a series of symbols.</p>
</dd>
</li>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -