summaryrefslogtreecommitdiff
path: root/src/core/scanner.c
AgeCommit message (Collapse)Author
2026-02-28modify headersHEADmasterPaul Buetow
2026-02-28Fix function body literal mutation: make examples passPaul Buetow
Two bugs combined to break uber.fy and any function called more than once: 1. Scanner split identifiers at '_' boundaries (e.g. arr_sum → arr + _sum). Fixed by adding d != '_' to the token-splitting guard condition so underscores are treated as part of identifiers. 2. Dead keyword TT_ARR reserved the name 'arr' as a keyword token, preventing its use as a function parameter. Removed TT_ARR from the enum, keyword table, and name table. 3. (Root cause of the assert failure) _var_assign stored the symbol for a newly declared variable pointing directly at the literal token from the function body token list. incr/decr modify tokens in place via stack_top, so a loop like `my i = 0; while i < n { incr i; }` would corrupt the body's '0' literal — on the next call i starts at 10 instead of 0. Fixed by allocating a fresh token_new_integer / token_new_dummy for TT_INTEGER and TT_DOUBLE initialisers so body literals are never mutated. Arrays and strings retain reference semantics unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28Clean up scanner_run() and interpret_run(): narrow signatures, fix SoC [SoC/DIP]Paul Buetow
Three issues resolved: 1. scanner_run() no longer takes Fype*. New signature: scanner_run(List*, Tupel*, char **c_filename_out) Verbose-mode list_iterate() and basename extraction moved to fype_run() (the composition root), leaving scanner_run() as pure tokenizer: open source -> tokenize -> post-process -> return filename. 2. interpret_run() no longer takes Fype*. New signature: interpret_run(List *p_list_token, Hash *p_hash_syms) Fype* unpacking happens in fype_run(); interpret.h no longer includes fype.h. scanner.h no longer includes fype.h either. 3. _CODESTR_INDEX file-global (which made the scanner non-reentrant) moved into the Scanner struct as i_codestr_index, initialized to 0 in scanner_new(). _scanner_has_next_char() and _scanner_get_next_char() use p_scanner->i_codestr_index instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2021-11-02move to codebergPaul Buetow
2021-04-29update URIsPaul Buetow
2008-12-15modified headersPaul Buetow
2008-12-15say foo[1] worksPaul Buetow
2008-11-09changed the src headers.Paul Buetow
2008-11-04astylePaul Buetow
2008-11-01modified headersPaul Buetow
2008-10-28initial references support.Paul Buetow
run "make headers"
2008-10-25astyle.Paul Buetow
more BSD style in return (FOO);
2008-10-25make headersPaul Buetow
2008-10-20no lines longer than 80chars.Paul Buetow
2008-10-18backdowngradePaul Buetow
2008-10-14GC removed, temporalyPaul Buetow
2008-08-25bugs fixed, initial arrayPaul Buetow
2008-08-24some modsPaul Buetow
2008-08-24few modsPaul Buetow
2008-08-23changed headersPaul Buetow
2008-08-23some enhancementsPaul Buetow
2008-08-08changed header.Paul Buetow
2008-05-15Moved stuff into trunk.Paul Buetow