Commit Graph

15 Commits

Author SHA1 Message Date
5bd533d40c parser: replace fprintf+longjmp with fail(), add forward declarations
Introduce a fail(p, "msg") inline function that stores the error message
in a buffer and longjmps, replacing ~52 fprintf(stderr,...)+longjmp pairs.
The error message is propagated through Ast.err_msg so callers can decide
whether/how to display it. Also add forward declarations for all static
functions and move PtrModifiers typedef to the type definitions section.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 14:40:33 +00:00
f5f54fcbe8 parser: propagate errors via setjmp/longjmp instead of exit(1)
Replace 32 parse-error exit(1) calls with longjmp to allow callers to
detect and handle parse failures. The OOM exit(1) in
astNodeListEnsureCapacity is kept as-is.

Add has_error flag to Ast, wrap parseRoot() with setjmp in astParse(),
and update test infrastructure to use the C parser for testError tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-11 14:40:31 +00:00
cb8d46b1ab fix tcc 2026-02-10 11:35:41 +00:00
aa0fab43e4 fmt 2025-01-08 19:04:40 +01:00
2a56ea9be2 No types, no fucking types. Just bugs 2025-01-07 22:22:05 +01:00
49c910b8b2 fix memleak; initialization boilerplate 2025-01-02 17:17:22 +02:00
3264d1747e replace TOKENIZER_TAG_ with TOKEN_ 2024-12-30 22:38:26 +02:00
6006a802e1 making tcc happier 2024-12-29 00:13:54 +02:00
6ae7d7320d adding more parser — starts breaking the build 2024-12-26 00:35:13 +02:00
ef3ef64abd more macros 2024-12-23 21:56:56 +02:00
a9c4b5c7ab macros 2024-12-23 00:01:42 +02:00
db35aa7722 rename types 2024-12-22 22:31:16 +02:00
228b215259 making parser 2024-12-20 00:24:51 +02:00
7361b6058d linters, some ast headers 2024-12-19 00:24:03 +02:00
c2915d2eaa start ast + fix type names in tokenizer 2024-12-15 22:11:45 +02:00