Skip to main contentModule diagnostics
Source - ParseError
- A structured parse error with human-friendly messages and source context.
- 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.