Skip to main content

Module perl

Module perl 

Source
Expand description

Perl: telling the and and not operators, the file tests, the unary minus and bareword calls from an auto-quoted key that the grammar lexes as one of them; and reading the POD in the data section after __END__, which the grammar leaves as one leaf.

Enums§

PerlDataSectionRows
One classified run of rows in a Perl data section, as reported by perl_data_section_rows.

Functions§

perl_and_is_operator
Whether and, a Perl and token whose parent is parent, is the low-precedence logical operator.
perl_bareword_is_call
Whether word, a Perl call_expression_with_bareword whose ancestor chain is ancestors, is a call site of its own.
perl_bareword_is_key
Whether word, a Perl call_expression_with_bareword whose ancestor chain is ancestors, is an auto-quoted hash key rather than a call.
perl_dash_signs_keyword_key
Whether dash, a Perl - token whose ancestor chain is ancestors, is the sign of an auto-quoted -and or -not key ($h{-not}, (-and => 1)), which the grammar splits into the - and the keyword token. perl_and_is_operator and perl_not_is_key decide whether the keyword is a key, and a key’s sign is part of the string whether or not a space separates the two.
perl_data_section_rows
Classifies the rows of a data_not_for_compiler node — the text after __END__ or __DATA__, which the grammar holds as one opaque leaf — in one pass over section, its bytes. start_row is the marker’s row, where the node starts; the rest of that row is never reported, since the marker makes the row code and no line there starts with =.
perl_is_and_key_misparse
Whether expr is the unary_expression tree-sitter-perl builds around an auto-quoted and key ((and => 1)): its first child, comments aside, is the and token itself. See perl_and_is_operator.
perl_key_is_signed
Whether key, an and / not key token whose ancestor chain is ancestors, is signed by a - ($h{-not}, (- and => 1)), read off the tree as perl_dash_signs_keyword_key reads it: the - sits beside the key, or is the operator of the expression the key leads. The bytes cannot say it: an infix - ($x - and => 2) or a comment ending in one also precedes a key, and a comment can sit between a sign and its key.
perl_not_is_key
Whether not, a Perl not token whose parent is parent, is an auto-quoted hash key rather than the prefix operator.