JsonRemedy.Layer3.SyntaxDetectors (json_remedy v0.1.3)

View Source

Syntax detection and validation functions for Layer 3 syntax normalization.

Contains functions to detect various syntax issues like unquoted keys, trailing commas, missing commas/colons, and other JSON syntax problems.

Summary

Functions

Look for colon after identifier to detect unquoted keys.

Check for missing colons.

Check for missing commas (simplified detection).

Simple heuristic to detect if content has syntax issues (no regex).

Check for trailing commas.

Check for unquoted keys using string analysis.

Functions

find_colon_after_identifier(content, start_pos)

@spec find_colon_after_identifier(String.t(), non_neg_integer()) ::
  {:found, non_neg_integer()} | :not_found

Look for colon after identifier to detect unquoted keys.

has_missing_colons?(content)

@spec has_missing_colons?(String.t()) :: boolean()

Check for missing colons.

has_missing_commas?(content)

@spec has_missing_commas?(String.t()) :: boolean()

Check for missing commas (simplified detection).

has_syntax_issues?(content)

@spec has_syntax_issues?(String.t()) :: boolean()

Simple heuristic to detect if content has syntax issues (no regex).

has_trailing_commas?(content)

@spec has_trailing_commas?(String.t()) :: boolean()

Check for trailing commas.

has_unquoted_keys?(content)

@spec has_unquoted_keys?(String.t()) :: boolean()

Check for unquoted keys using string analysis.