Skip to main content

Module parser

Module parser 

Source
Expand description

JSONParser: recursive-descent parser driving JSLexer.

Value nesting is depth-limited, matching C++ JSONParser (lib/Parser/ JSONParser.cpp:202-211, JSONParser.h:636-659): parse_value checks MAX_RECURSION_DEPTH and reports “Too many nested JSON values” instead of overflowing the native stack. Historically NEITHER side had a limit (parity by absence, and both died on e.g. 100000 [); upstream added one in 304c1533c (“Add a recursion limit to compiler JSONParser”) and this is the mirror of that fix. The limit is NOT the JS parser’s: off Windows upstream set it to 4x JSParserImpl::MAX_RECURSION_DEPTH, because a JSON nesting level costs far less native stack than a JS one.

Structs§

JSONParser
Port of JSONParser (JSONParser.h:630). Drives JSLexer; errors go through the lexer’s single &mut SourceErrorManager.