Next: Bound literals, Previous: Guards, Up: Top [Contents][Index]
A third type of guard is available in pacc: the semantic guard. It is written ‘&{ e }’, where e is an arbitrary C expression of integer type. The expression e is evaluated whilst parsing, with variables bound in the current sequence and to the left of the guard in scope. A semantic guard succeeds if the expression evaluates true (i.e. non-zero), and fails if the expression is false.
For example, suppose you want to match an alphabetic character in a
locale-aware way. Pacc doesn’t know anything about locales, but you can use the
standard isalpha() predicate in a semantic guard:
Alpha <- c:. &{ isalpha(c) }
See Memory management.
Last updated: 2016-08-03 21:39:50 UTC
One thing pacc needs is more users. And, perhaps, one way to get more users is to reduce the friction in getting started with pacc. An obvious lubricant is packaging. Read More...
Looking at _pacc_coords(), I noticed that it seemed to have the same realloc() bug that I'd just fixed in _pacc_result(). However, the "list of arrays" trick really wasn't going to work here. Read More...