FreshMarker and ⊻, ¬, ≠, ≤, ≥, ∨, ∧

“Programs must be written for people to read, and only incidentally for machines to execute.”

Harold Abelson

Sometimes a new feature also needs to be a bit of fun. When updating the FreshMarker Grammar, I noticed that the operators lt, gt, gte and lte were still present. These are variants of the usual <, >, <= and >= operators and are reminiscent of the opcodes of a long-forgotten era when assembler languages still roamed the steppes of programming.

Those who remember the literate programming approaches may also remember that in the nicely formatted descriptions there was no != comparison operator but, thanks to \TeX, a nice .

Since FreshMarker was given its Unicode capabilities by CongoCC, the question arose as to why not allow and other operator characters in the template. The only obstacle in practical use is of course the editor used in modern IDEs, which rarely has other characters available than the first version of vi.

Thanks to CongoCC, customization in the FreshMarker grammar is done quickly.

<NOT_EQUALS : "≠" | "!=">

Now the NOT_EQUALS token is not only recognized by != but also . With FreshMarker 1.6.2, a template can now be made even more readable.

<#if ¬feature ∧ size ≠ 42>this is literate</#if>

Leave a Comment