Quote:
Originally Posted by chaley
I rewrote the formatter to build and save an interpretable tree instead of always interpreting while parsing.
Other changes: it - inlines raw_field
- automatically converts test() to if-then-else, avoiding interpreting the non-used expression (branch).
- improves syntax checking. For example, now that errant semicolon will be signaled regardless of the value of the conditional expression
These changes dramatically improve performance of composite columns and icon/color rules.
|
That sounds very good. Unfortunately, once I updated my source, I got:
Code:
Traceback (most recent call last):
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 633, in safe_format
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 598, in evaluate
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 522, in _eval_program
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 319, in program
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 324, in expression_list
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 424, in expr
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 422, in expr
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 348, in do_node_if
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 424, in expr
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 422, in expr
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 365, in do_node_func
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 424, in expr
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 422, in expr
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 400, in do_node_raw_field
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 392, in do_node_raw_field
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 311, in error
ValueError: Interpreter: Unknown field #pages
Error evaluating column named: #pages1777625035779470211
This appears to be for some column colouring rules using my "Pages" column which has the lookup name "#pages". These re just comparisons to a value. And I have other rules using the column 'Words'/#words. The errors are identical except that the number after the lookup name changes.
And for a test column, using the templates:
Code:
{:'raw_field('#pages')'}
Code:
program:
raw_field('#words')
The latter gives:
Code:
Traceback (most recent call last):
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 633, in safe_format
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 598, in evaluate
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 522, in _eval_program
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 319, in program
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 324, in expression_list
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 424, in expr
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 422, in expr
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 400, in do_node_raw_field
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 392, in do_node_raw_field
File "E:\Development\GitHub\calibre\src\calibre\utils\formatter.py", line 311, in error
ValueError: Interpreter: Unknown field #pages
Error evaluating column named: #story_length