Skip to main content

Module diagnostics

Module diagnostics 

Source

Structsยง

ParseError
A structured parse error with human-friendly messages and source context.

Functionsยง

build_context ๐Ÿ”’
Build context string showing input up to the error, truncated to ~40 chars.
ceil_char_boundary ๐Ÿ”’
Smallest byte index >= pos that is a char boundary.
classify_token ๐Ÿ”’
Classify the token found at a byte offset in the source.
convert_pest_error ๐Ÿ”’
Convert a pest error into a human-friendly ParseError.
count_brackets ๐Ÿ”’
Count opening and closing brackets in source, respecting strings and comments. Returns ((parens, braces, brackets), (parens, braces, brackets))
detect_common_mistakes ๐Ÿ”’
Detect common R mistakes and return a tailored ParseError.
detect_unterminated_string ๐Ÿ”’
Detect unterminated strings in the source.
extract_for_parens ๐Ÿ”’
Extract the content inside for (...) parentheses, if present.
find_unmatched_open ๐Ÿ”’
Find the line and column of the first unmatched opening bracket.
floor_char_boundary ๐Ÿ”’
Largest byte index <= pos that is a char boundary.
humanize_rule ๐Ÿ”’
Map a pest grammar rule to a human-readable description.
is_inside_call_or_vector ๐Ÿ”’
Heuristic: is the error position inside a function call or c() vector?
line_col_to_byte_offset ๐Ÿ”’
Compute byte offset into source given 1-based line and 1-based column.
suggest_from_expected ๐Ÿ”’
Try to suggest a fix based on what was expected.
token_length_at ๐Ÿ”’
Compute the byte length of the token at the given offset for span highlighting.