module

Noir::PerlCalleeExtractor

Inherits Noir::CalleeExtractorBase

Constants

BARE_CALL_REGEX = /(?<![A-Za-z0-9_:>$])([A-Za-z_][A-Za-z0-9_]*)\s*(?:\(|(?=\s+(?:[A-Za-z_$'"]|\{|\[)))/
METHOD_CALL_REGEX = /(\$?[A-Za-z_][A-Za-z0-9_]*(?:::[A-Za-z_][A-Za-z0-9_]*)*)\s*->\s*([A-Za-z_][A-Za-z0-9_]*)(?![A-Za-z0-9_])\s*(?:\(|(?=\s*(?:[A-Za-z_$'"]|\{|\[|;|,|\)|\}|$)))/
QUALIFIED_CALL_REGEX = /(?<![A-Za-z0-9_:])([A-Za-z_][A-Za-z0-9_]*(?:::[A-Za-z_][A-Za-z0-9_]*)+)\s*(?:\(|(?=\s+(?:[A-Za-z_$'"]|\{|\[)))/
RESERVED = Set {"and", "cmp", "continue", "do", "else", "elsif", "eq", "eval", "for", "foreach", "ge", "given", "gt", "if", "last", "le", "lt", "my", "ne", "next", "no", "not", "our", "package", "return", "state", "sub", "unless", "until", "use", "when", "while", "bless", "caller", "chomp", "chop", "close", "defined", "delete", "die", "each", "exists", "grep", "join", "keys", "length", "map", "open", "pop", "print", "push", "qw", "q", "qq", "qr", "ref", "scalar", "shift", "sort", "split", "sprintf", "undef", "unshift", "values", "wantarray", "warn"}
STANDARD_MODULES = Set {"Carp", "Data::Dumper", "Encode", "File::Spec", "JSON", "List::Util", "Mojo::Base", "Mojolicious::Lite", "strict", "warnings"}

Instance methods

callees_for_body(body : String, file_path : String, start_line : Int32) : Array(Entry)
Source
controller_action_callees(source : String, file_path : String) : Hash(String, Array(Entry))
Source
extract_sub_after(source : String, start_index : Int32, search_limit : Int32 = source.size, body_limit : Int32 = source.size) : Tuple(String, Int32) | Nil
Source
extract_sub_at(source : String, sub_index : Int32, limit : Int32 = source.size) : Tuple(String, Int32) | Nil

Public String overload kept for callers outside this module.

Source
extract_sub_at(chars : Array(Char), sub_index : Int32, limit : Int32 = chars.size) : Tuple(String, Int32) | Nil
Source
find_matching_delimiter(source : String, open_index : Int32, open_char : Char, close_char : Char, limit : Int32 = source.size) : Int32 | Nil

Public String overload kept for callers outside this module.

Source
find_matching_delimiter(chars : Array(Char), open_index : Int32, open_char : Char, close_char : Char, limit : Int32 = chars.size) : Int32 | Nil
Source
line_number_for(source : String, index : Int32) : Int32

Public String overload kept for callers outside this module. Walk characters up to index counting newlines — the previous source[0...limit].count('\n') allocated a full substring on every call (handler body extraction, named-sub indexing). index is a character offset (matches source.chars / String#size indexing), not a UTF-8 byte offset.

Source
line_number_for(chars : Array(Char), index : Int32) : Int32
Source
named_sub_bodies(source : String, file_path : String) : Hash(String, SubBody)
Source
strip_non_code(source : String) : String

Public String overload kept for callers outside this module.

Source
strip_non_code(chars : Array(Char)) : String
Source

Nested types