Closed jpohhhh closed 2 months ago
Thanks for the analysis. Which version of Dart do you use? Strange, there should be no differences between platforms; it looks like a Dart issue. I'll try to check this on both the 3.0.0, stable and dev versions.
Fixed by fbc53e6 in 0.6.0
.
I found a really interesting issue that looks more like a Dart problem than a package problem.
TL;DR: the
(rule case MultiTokenRule rule)
and(rule case SingleTokenRule rule)
lines in lexer.dart never return true on web. Replacing them with(rule is MultiTokenRule)
and(rule is SingleTokenRule)
work properly.I looked into this from every angle, logging all the steps along
Lexer.scan
. I assumed it must be a regex difference between web and native. Tried a bunch of stuff. I then added print()'s to every branch entry in the while loop, and then to every data mutation. That made it clear everything was the same, until it ran thoseif (rule case ...)
statements. Changing them toif (rule is ...)
worked, surprising me. I'm not sure why thecase
version doesn't work butis
does. It almost seems like it must be a Dart issue. But, I'm confident it's the cause, not only from debugging, but also because the last commit I had in my fork from ~May was the commit before theif (rule case...)
statements were added, which also explains why it worked in May, but not now.Test case
Method
Arguments
jinjaContext
{prompt: how old is barack, datetime: 12:20 PM EST on Thursday, December 14, 2023.}
both values areString
text