Module
core
Version
0.1.1
Environment
OS: macOS 15.5
Rust: 1.77.2
Description
not is reserved as KwNot in the lexer keyword table, which means it cannot be used as a variable name. However, it only works in two specific positions: is not and not in. Using not as a unary boolean negation (e.g., {#if not loop.last}) produces Parse error: Expected expression, got KwNot.
The keyword occupies namespace without being functional in the expected position. Users coming from Jinja2/Tera will write not x instinctively and get a confusing parse error. The fix is either:
- Allow
not as a unary operator synonym for ! in parse_unary()
- Or remove
not from the keyword list and handle it contextually inside is / in parsing only
Code Sample
Template: {#if not loop.last}, {/if}
`Error: Parse error at 1:5: Expected expression, got KwNot`
Workaround:
{#if !loop.last}, {/if}
Module
core
Version
0.1.1
Environment
Description
notis reserved asKwNotin the lexer keyword table, which means it cannot be used as a variable name. However, it only works in two specific positions:is notandnot in. Usingnotas a unary boolean negation (e.g.,{#if not loop.last}) producesParse error: Expected expression, got KwNot.The keyword occupies namespace without being functional in the expected position. Users coming from Jinja2/Tera will write
not xinstinctively and get a confusing parse error. The fix is either:notas a unary operator synonym for!inparse_unary()notfrom the keyword list and handle it contextually insideis/inparsing onlyCode Sample
Template: {#if not loop.last}, {/if} `Error: Parse error at 1:5: Expected expression, got KwNot` Workaround: {#if !loop.last}, {/if}