A contiguous, line-aligned run of code in one language, classed by that
language so analyze_segment() can dispatch on it. An extract_segments()
method returns these.
Usage
new_segment(
language,
lines,
file_context,
context = NA_character_,
file_rule = NA_character_,
code_contexts = NULL,
guarded_lines = integer(0L)
)Arguments
- language
The language of the code, which selects the analyzer.
- lines
Character vector of the segment's lines, blank-padded to the line numbers they occupy in the file so a finding's line is the real one.
- file_context
Package-root-relative path of the file it came from.
- context
The segment's label, matched by a
kind: segmentcode-context rule, orNAwhere it has none. It is the only record of which part of a help file the code came from.- file_rule
The file-context rule that claimed the file.
- code_contexts
The code-context rules that can apply, from the source.
- guarded_lines
Integer vector of line numbers whose code ships but the lifecycle does not run – a
\dontrun{}block, or a chunk markedeval=FALSE. Phases still come from the context, so they are an upper bound.
See also
extract_segments(), whose methods return these.