Based on my analysis, here are the 19 out of 23 functions from Documents 1 & 2 that actually apply to the new Elixir layered architecture and should be considered for implementation:
Functions That Should Be Considered for the New Architecture
High Priority (9 functions) - Essential for core functionality:
- ARRAY - Context enum value needed for Layer 2 state machine
- ContextValues - Enum/type for parsing contexts needed for Layer 2 state tracking
- JsonContext - Context tracking needed for Layer 2 structural repairs and Layer 3 syntax fixes
- OBJECT_KEY - Context enum value needed for Layer 2 and Layer 3 context-aware parsing
- OBJECT_VALUE - Context enum value needed for Layer 2 and Layer 3 context-aware parsing
- missing_quotes - State flag for quote repair needed in Layer 3 for adding missing quotes
- parse_boolean_or_null - Boolean/null parsing needed for Layer 3 literal normalization
- rstring_delimiter_missing - State flag for missing closing quotes needed in Layer 3
- unmatched_delimiter - State flag for quote parity tracking needed in Layer 3
Medium Priority (8 functions) - Would enhance existing functionality:
- STRING_DELIMITERS - Constant for supported quote types needed in Layer 3 for quote normalization
- doubled_quotes - State flag for tracking doubled quotes useful in Layer 3 quote normalization
- get_char_at - Safe character access utility useful across all layers for bounds checking
- parse_array - Array-specific parsing logic could enhance Layer 2 structural repairs
- parse_number - Number parsing with fallback useful for Layer 3 number normalization
- parse_object - Object-specific parsing logic could enhance Layer 2 structural repairs
- skip_to_character - Character search utility useful for lookahead operations in all layers
- skip_whitespaces_at - Whitespace handling utility useful across all layers
Low Priority (2 functions) - Nice to have improvements:
- parse_comment - Comment parsing logic (already partially implemented in Layer 1, could be enhanced)
- stream_stable - Flag for streaming/incomplete JSON handling useful for Layer 3
Summary by Layer:
- Layer 1 (Content Cleaning): 1 function - enhanced comment parsing
- Layer 2 (Structural Repair): 4 functions - context enums and specialized parsing logic
- Layer 2 & 3 (Shared): 3 functions - core context tracking types
- Layer 3 (Syntax Normalization): 8 functions - state flags and parsing utilities
- All Layers (Utilities): 3 functions - character navigation and bounds checking
Functions NOT Relevant (4 out of 23):
- JSONParser - Monolithic parser class replaced by layered pipeline
- parse - Main orchestrator replaced by pipeline process/2 functions
- parse_json - Central dispatcher replaced by layer-specific processing
- init - Constructor method (Elixir uses different initialization patterns)
The high-priority functions focus on context tracking and state flags that are essential for the sophisticated repair logic described in the original analysis, while the medium-priority functions provide utility functions and specialized parsing logic that would enhance the current implementation.