Skip to content

Commit 664dcc0

Browse files
committed
ParseXS: refactor: update field code comments
Update the code comments in calls to $build_subclass->() to indicate more consistently the 'type' of each field being declared.
1 parent 10adb09 commit 664dcc0

File tree

1 file changed

+66
-66
lines changed
  • dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS

1 file changed

+66
-66
lines changed

dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ BEGIN { $build_subclass->(parent => '',
238238

239239
'map_alias_name_to_value', # Hash: maps seen alias names to their value
240240

241-
'map_alias_value_to_name_seen_hash', # Hash of hash of bools:
241+
'map_alias_value_to_name_seen_hash', # Hash of Hash of Bools:
242242
# indicates which alias names have been
243243
# used for each value.
244244

@@ -251,15 +251,15 @@ BEGIN { $build_subclass->(parent => '',
251251
# name, map the short (PREFIX removed) name
252252
# to the original name.
253253

254-
'overload_name_seen', # Hash of bools: indicates overload method
254+
'overload_name_seen', # Hash of Bools: indicates overload method
255255
# names (such as '<=>') which have been
256256
# listed by OVERLOAD (for newXS boot code
257257
# emitting).
258258

259259
# Maintain the ATTRS parsing state across potentially multiple
260260
# ATTRS keywords and or lines:
261261

262-
'attributes', # Array of strings: all ATTRIBUTE keywords
262+
'attributes', # Array of Strs: all ATTRIBUTE keywords
263263
# (possibly multiple space-separated
264264
# keywords per string).
265265

@@ -278,7 +278,7 @@ BEGIN { $build_subclass->(parent => '',
278278
# "2": empty prototype
279279
# other: a specific prototype.
280280

281-
'SCOPE_enabled', # "SCOPE: ENABLE" seen, in either the
281+
'SCOPE_enabled', # Bool: "SCOPE: ENABLE" seen, in either the
282282
# file or XSUB part of the XS file
283283

284284
)};
@@ -789,10 +789,10 @@ package ExtUtils::ParseXS::Node::ReturnType;
789789
# extra keywords to process, such as NO_RETURN.
790790

791791
BEGIN { $build_subclass->(parent => '',
792-
'type', # Str: the XSUB's C return type
793-
'no_output', # bool: saw 'NO_OUTPUT'
794-
'extern_C', # bool: saw 'extern C'
795-
'static', # bool: saw 'static'
792+
'type', # Str: the XSUB's C return type
793+
'no_output', # Bool: saw 'NO_OUTPUT'
794+
'extern_C', # Bool: saw 'extern C'
795+
'static', # Bool: saw 'static'
796796
'use_early_targ', # Bool: emit an early dTARG for backcompat
797797
)};
798798

@@ -879,23 +879,24 @@ package ExtUtils::ParseXS::Node::Param;
879879

880880
BEGIN { $build_subclass->(parent => '',
881881
# values derived from the XSUB's signature
882-
'in_out', # The IN/OUT/OUTLIST etc value (if any)
883-
'var', # the name of the parameter
884-
'arg_num', # The arg number (starting at 1) mapped to this param
885-
'default', # default value (if any)
886-
'default_usage', # how to report default value in "usage:..." error
887-
'is_ansi', # param's type was specified in signature
888-
'is_length', # param is declared as 'length(foo)' in signature
889-
'has_length', # this param has a matching 'length(foo)' param in sig
890-
'len_name' , # the 'foo' in 'length(foo)' in signature
891-
'is_synthetic', # var like 'THIS' - we pretend it was in the sig
882+
'in_out', # Str: The IN/OUT/OUTLIST etc value (if any)
883+
'var', # Str: the name of the parameter
884+
'arg_num', # Int The arg number (starting at 1) mapped to this param
885+
'default', # Str: default value (if any)
886+
'default_usage', # Str: how to report default value in "usage:..." error
887+
'is_ansi', # Bool: param's type was specified in signature
888+
'is_length', # Bool: param is declared as 'length(foo)' in signature
889+
'has_length', # Bool: this param has a matching 'length(foo)'
890+
# parameter in the signature
891+
'len_name' , # Str: the 'foo' in 'length(foo)' in signature
892+
'is_synthetic', # Bool: var like 'THIS': we pretend it was in the sig
892893

893894
# values derived from both the XSUB's signature and/or INPUT line
894-
'type', # The C type of the parameter
895-
'no_init', # don't initialise the parameter
895+
'type', # Str: The C type of the parameter
896+
'no_init', # Bool: don't initialise the parameter
896897

897898
# derived values calculated later
898-
'proto', # overridden prototype char(s) (if any) from typemap
899+
'proto', # Str: overridden prototype char(s) (if any) from typemap
899900
)};
900901

901902

@@ -1101,18 +1102,18 @@ package ExtUtils::ParseXS::Node::IO_Param;
11011102
BEGIN { $build_subclass->(parent => 'Param',
11021103
# values derived from the XSUB's INPUT line
11031104

1104-
'init_op', # initialisation type: one of =/+/;
1105-
'init', # initialisation template code
1106-
'is_addr', # INPUT var declared as '&foo'
1107-
'is_alien', # var declared in INPUT line, but not in signature
1108-
'in_input', # the parameter has appeared in an INPUT statement
1109-
'defer', # deferred initialisation template code
1105+
'init_op', # Str: initialisation type: one of =/+/;
1106+
'init', # Str: initialisation template code
1107+
'is_addr', # Bool: INPUT var declared as '&foo'
1108+
'is_alien', # Bool: var declared in INPUT line, but not in signature
1109+
'in_input', # Bool: the parameter has appeared in an INPUT statement
1110+
'defer', # Str: deferred initialisation template code
11101111

11111112
# values derived from the XSUB's OUTPUT line
11121113
#
1113-
'in_output', # the parameter has appeared in an OUTPUT statement
1114-
'do_setmagic', # 'SETMAGIC: ENABLE' was active for this parameter
1115-
'output_code', # the optional setting-code for this parameter
1114+
'in_output', # Bool: the parameter has appeared in an OUTPUT statement
1115+
'do_setmagic', # Bool: 'SETMAGIC: ENABLE' was active for this parameter
1116+
'output_code', # Str: the optional setting-code for this parameter
11161117

11171118
# ArrayRefs: results of looking up typemaps (which are done in the
11181119
# parse phase, as the typemap definitions can in theory change
@@ -2140,15 +2141,15 @@ BEGIN { $build_subclass->(parent => '',
21402141
'names', # Hash ref mapping variable names to Node::Param
21412142
# or Node::IO_Param objects
21422143

2143-
'params_text', # The original text of the sig, e.g.
2144-
# 'param1, int param2 = 0'
2144+
'params_text', # Str: The original text of the sig, e.g.
2145+
# "param1, int param2 = 0"
21452146

21462147
'seen_ellipsis', # Bool: XSUB signature has ( ,...)
21472148

2148-
'nargs', # The number of args expected from caller
2149-
'min_args', # The minimum number of args allowed from caller
2149+
'nargs', # Int: The number of args expected from caller
2150+
'min_args', # Int: The minimum number of args allowed from caller
21502151

2151-
'auto_function_sig_override', # the C_ARGS value, if any
2152+
'auto_function_sig_override', # Str: the C_ARGS value, if any
21522153
)};
21532154

21542155

@@ -2461,12 +2462,11 @@ package ExtUtils::ParseXS::Node::xbody;
24612462
# higher-level node.
24622463

24632464
BEGIN { $build_subclass->(parent => '',
2464-
'ioparams', # per-body copy of params which accumulate extra
2465-
# info from any INPUT and OUTPUT sections (which can
2465+
'ioparams', # Params object: per-body copy of params which accumulate
2466+
# extra info from any INPUT and OUTPUT sections (which can
24662467
# vary between different CASEs)
24672468

2468-
2469-
# Objects representing the various parts of an xbody. These
2469+
# Node objects representing the various parts of an xbody. These
24702470
# are aliases of the same objects in @{$self->{kids}} for easier
24712471
# access.
24722472
'input_part',
@@ -2579,11 +2579,10 @@ package ExtUtils::ParseXS::Node::input_part;
25792579

25802580
BEGIN { $build_subclass->(parent => '',
25812581

2582-
# Used during code generation:
2582+
# Str: used during code generation:
25832583
# a multi-line string containing lines of code to be emitted *after*
25842584
# all INPUT and PREINIT keywords have been processed.
25852585
'deferred_code_lines',
2586-
25872586
)};
25882587

25892588

@@ -3055,7 +3054,7 @@ package ExtUtils::ParseXS::Node::oneline;
30553054
# follows the keyword.
30563055

30573056
BEGIN { $build_subclass->(parent => '',
3058-
'text', # any text following the keyword
3057+
'text', # Str: any text following the keyword
30593058
)};
30603059

30613060

@@ -3098,8 +3097,8 @@ package ExtUtils::ParseXS::Node::CASE;
30983097
# Process the 'CASE:' keyword
30993098

31003099
BEGIN { $build_subclass->(parent => 'oneline',
3101-
'cond', # the C code of the condition for the CASE, or ''
3102-
'num', # which CASE number this is (starting at 1)
3100+
'cond', # Str: the C code of the condition for the CASE, or ''
3101+
'num', # Int: which CASE number this is (starting at 1)
31033102
)};
31043103

31053104

@@ -3136,7 +3135,7 @@ package ExtUtils::ParseXS::Node::autocall;
31363135
# name
31373136

31383137
BEGIN { $build_subclass->(parent => '',
3139-
'args', # string to use for auto function call arguments
3138+
'args', # Str: text to use for auto function call arguments
31403139
)};
31413140

31423141

@@ -3232,7 +3231,7 @@ package ExtUtils::ParseXS::Node::enable;
32323231
# Base class for keywords which accept ENABLE/DISABLE as an argument
32333232

32343233
BEGIN { $build_subclass->(parent => 'oneline',
3235-
'enable', # bool
3234+
'enable', # Bool
32363235
)};
32373236

32383237

@@ -3393,7 +3392,7 @@ package ExtUtils::ParseXS::Node::multiline;
33933392
# follows the keyword.
33943393

33953394
BEGIN { $build_subclass->(parent => '',
3396-
'lines', # Array ref of all lines until the next keyword
3395+
'lines', # Array ref of all lines until the next keyword
33973396
)};
33983397

33993398

@@ -3431,7 +3430,7 @@ package ExtUtils::ParseXS::Node::multiline_merged;
34313430
# into a single line, 'text'.
34323431

34333432
BEGIN { $build_subclass->(parent => 'multiline',
3434-
'text', # singe string contained all concatenated lines
3433+
'text', # Str: singe string containing all concatenated lines
34353434
)};
34363435

34373436

@@ -3532,8 +3531,8 @@ package ExtUtils::ParseXS::Node::INTERFACE_MACRO;
35323531
# Handle INTERFACE_MACRO keyword
35333532

35343533
BEGIN { $build_subclass->(parent => 'multiline_merged',
3535-
'get_macro', # name of macro to get interface
3536-
'set_macro', # name of macro to set interface
3534+
'get_macro', # Str: name of macro to get interface
3535+
'set_macro', # Str: name of macro to set interface
35373536
)};
35383537

35393538

@@ -3572,7 +3571,7 @@ package ExtUtils::ParseXS::Node::OVERLOAD;
35723571
# Handle OVERLOAD keyword
35733572

35743573
BEGIN { $build_subclass->(parent => 'multiline_merged',
3575-
'ops', # has ref of overloaded op names
3574+
'ops', # Hash ref of seen overloaded op names
35763575
)};
35773576

35783577
# Add all overload method names, like 'cmp', '<=>', etc, (possibly
@@ -3634,7 +3633,7 @@ package ExtUtils::ParseXS::Node::PROTOTYPE;
36343633
# Handle PROTOTYPE keyword
36353634

36363635
BEGIN { $build_subclass->(parent => 'multiline',
3637-
'prototype', # 0 (disable), 1 (enable), 2 ("") or "$$@" etc
3636+
'prototype', # Str: 0 (disable), 1 (enable), 2 ("") or "$$@" etc
36383637
)};
36393638

36403639

@@ -3998,7 +3997,7 @@ package ExtUtils::ParseXS::Node::keyline;
39983997
# their parent.
39993998

40003999
BEGIN { $build_subclass->(parent => '',
4001-
'line', # text of current line
4000+
'line', # Str: text of current line
40024001
)};
40034002

40044003

@@ -4029,7 +4028,8 @@ package ExtUtils::ParseXS::Node::ALIAS;
40294028
# Handle ALIAS keyword
40304029

40314030
BEGIN { $build_subclass->(parent => 'keylines',
4032-
'aliases', # hashref of all alias => value pairs
4031+
'aliases', # hashref of all alias => value pairs.
4032+
# Populated by ALIAS_line::parse()
40334033
)};
40344034

40354035
sub parse {
@@ -4195,8 +4195,8 @@ package ExtUtils::ParseXS::Node::INPUT;
41954195
# block which can follow an xsub signature or CASE keyword.
41964196

41974197
BEGIN { $build_subclass->(parent => 'keylines',
4198-
'implicit', # bool: this is an INPUT section at the start of the
4199-
# XSUB without an explicit 'INPUT' keyword
4198+
'implicit', # Bool: this is an INPUT section at the start of the
4199+
# XSUB/CASE, without an explicit 'INPUT' keyword
42004200
)};
42014201

42024202
# The inherited parse() method will call INPUT_line->parse() for each line
@@ -4228,11 +4228,11 @@ BEGIN { $build_subclass->(parent => 'keyline',
42284228
'param', # The IO_Param object associated with this INPUT line.
42294229

42304230
# The parsed components of this INPUT line:
4231-
'type', # char *
4232-
'is_addr', # &
4233-
'name', # foo
4234-
'init_op', # =
4235-
'init', # SvIv($arg)
4231+
'type', # Str: char *
4232+
'is_addr', # Bool: &
4233+
'name', # Str: foo
4234+
'init_op', # Str: =
4235+
'init', # Str: SvIv($arg)
42364236
)};
42374237

42384238

@@ -4481,11 +4481,11 @@ package ExtUtils::ParseXS::Node::OUTPUT_line;
44814481
# Handle one line from an OUTPUT keyword block
44824482

44834483
BEGIN { $build_subclass->(parent => 'keyline',
4484-
'param', # the param object associated with this OUTPUT line.
4485-
'is_setmagic', # bool: the line is a SETMAGIC: line
4486-
'do_setmagic', # bool: the current SETMAGIC state
4487-
'name', # name of the parameter to output
4488-
'code', # optional setting code
4484+
'param', # the IO_Param object associated with this OUTPUT line.
4485+
'is_setmagic', # Bool: the line is a SETMAGIC: line
4486+
'do_setmagic', # Bool: the current SETMAGIC state
4487+
'name', # Str: name of the parameter to output
4488+
'code', # Str: optional setting code
44894489
)};
44904490

44914491

0 commit comments

Comments
 (0)