solve-engine 2.1.0
A focused release: three fixes so a category tag is recognised the same way everywhere, whatever it is named and wherever the # sits.
A tag glued to a word or number is no longer half-recognised
The lexer tagged any # followed by a letter, ignoring the character before it, while the aggregate scanner only counts a tag at a word boundary. So 100#food was stripped from its own line as if tagged, yet left out of total of #food: a line that looked tagged but did not count.
| line | before | now |
|---|---|---|
100#food |
stripped to 100, but excluded from the total |
left whole (#food reads as a comment), and excluded |
100 #food |
tagged and counted | tagged and counted |
A # glued to the end of a word or number is now not a tag in either half, so 100#food and a#food stay whole and only 100 #food, with a space, tags the line.
A tag named after a grammar word is no longer swallowed
The phrase trie fuses multi-word phrases by their written value, ahead of the tag rules, so a tag whose name completed a phrase was consumed as the bare word. total of #column errored ("expected a column name"), and 1200 #assuming errored ("unexpected token"), instead of tagging the line.
expression result
40 #column = 40 (tagged #column)
55 #column = 55
total of #column = 95
1200 #assuming = 1,200
The trie now skips a tag token, so a typed #tag never starts or completes a phrase, and a category can be named after a word wherever that word appears in the grammar.
An aggregate of a keyword-named tag no longer errors
total of #tag fuses to an internal aggregate token whose value is the tag name. When that name was also a lexer keyword, the trie re-read the fused token's value on the next pass and turned it back into the keyword, so total of #assuming (with assuming a finance keyword) collapsed to a bare ASSUMING and errored, while total of #column and a data-line 1200 #assuming were fine.
1200 #assuming = 1,200
800 #assuming = 800
total of #assuming = 2,000
The trie's guard now covers the fused aggregate tokens as well as the raw tag, so a tag name is never re-interpreted as a keyword once the aggregate has claimed it.
Verification
- Three regression specs pin the fixes:
Issue197(a tag named after a phrase word survives, with a property test over every built-in phrase word),Issue198(the lexer now agrees with the scanner on every boundary case, and a glued tag is neither shown as tagged nor counted), andIssue213(an aggregate of a keyword-named tag sums through total / sum / count / average, and fuses to aTAG_SUMrather than the bare keyword). - 7,803 tests across 345 suites, no failures.
npm run verify(typecheck,test:ci, build, smoke, the bundled-consumer contract) is green, and the publish job runsassert-release-tag,verifyandtest:consumeragainst the packed tarball before anything reaches the registry.