52 const uint8_t flags =
size == 0 ? 0 : data[0];
53 const size_t length =
size == 0 ? 0 : std::min(
size - 1,
size_t{512});
54 const char *begin =
size == 0 ?
"" :
reinterpret_cast<const char *
>(data + 1);
55 const std::string source(begin, length);
64 const auto *
module = parser.parse_module();
66 if (module ==
nullptr or not module->span.is_valid()
67 or module->span.file_id != file_id
68 or module->span.end > source.size())
Recursive-descent parser for the compiler-support MVP grammar.
Arena-backed ownership context for AST nodes.
Recursive-descent parser that produces an AST in Compiler_Ast_Context.
Diagnostic accumulator and renderer.
Stores source files and resolves offsets into human-readable data.
Source_File_Id add_virtual_file(const std::string &name, const std::string &text)
Registers an in-memory source file.
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
Parse arbitrary bounded source text and validate the module span.
size_t size(Node *root) noexcept
See compute_cardinality_rec(Node * root).
static struct argp_option options[]
Parser configuration knobs for the MVP grammar.
bool allow_top_level_statements
If false, only top-level declarations are accepted.