From 075bc33d15b4d11fa03f381c3e03437d9f759c22 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 28 Feb 2026 16:01:10 +0200 Subject: Refactor _process() by extracting per-operator handler functions [SRP] _process() was a 510-line function with a nested switch(operator) x switch(type) structure. Extracted 17 static helper functions: - _resolve_composite_op(): maps two-token operator pairs (!=, ==, <=, >=, <<, >>) to their canonical single TokenType - _op_assign(): handles variable and array-element assignment - _op_add(), _op_sub(), _op_mult(), _op_div(): arithmetic operators - _op_eq(), _op_neq(), _op_lt(), _op_gt(), _op_le(), _op_ge(): comparison operators (result always TT_INTEGER) - _op_and(), _op_or(), _op_xor(), _op_lshift(), _op_rshift(): bitwise operators (doubles/strings coerced to int) _process() is now a ~70-line dispatcher. Assignment is guarded by `else if` so it only fires when p_token_op2 == NULL, preserving the original semantics exactly. Co-Authored-By: Claude Sonnet 4.6 --- docs/help.txt | 2 +- docs/stats.txt | 4 ++-- docs/version.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/help.txt b/docs/help.txt index 06b1017..f4a8e65 100644 --- a/docs/help.txt +++ b/docs/help.txt @@ -1,4 +1,4 @@ -Fype Superalpha Build 9686 +Fype Superalpha Build 9691 (c) Paul C. Buetow (2005 - 2008) -e Executes given code string (see synopses) -h Prints this help diff --git a/docs/stats.txt b/docs/stats.txt index 190942c..fdb7486 100644 --- a/docs/stats.txt +++ b/docs/stats.txt @@ -1,6 +1,6 @@ make[1]: Entering directory '/home/paul/git/fype' ===> Num of C source files : 46 -===> Num of C source lines : 8602 +===> Num of C source lines : 8686 ===> Num of Fype source examples : 19 -===> Num of Fype source lines : 822 +===> Num of Fype source lines : 883 make[1]: Leaving directory '/home/paul/git/fype' diff --git a/docs/version.txt b/docs/version.txt index 0087354..e0f6705 100644 --- a/docs/version.txt +++ b/docs/version.txt @@ -1 +1 @@ -Fype Superalpha Build 9686 +Fype Superalpha Build 9691 -- cgit v1.2.3