8.17.0.6
5.6 Shrubbery Variants
(require shrubbery/variant) | package: shrubbery-lib |
Shrubbery notation is intended to support multiple languages that all
share a shrubbery-level specification. In some contexts, however,
adjusting choices in the design of shrubbery notation can avoid
surprising interactions and reduce confusion, especially in a
pedagogic context. The shrubbery/variant module
enables certain shrubbery variations that can be selected by calling
make-variant, and shrubbery API functions like
parse-all accept a variant as an argument.
procedure
(make-variant [ #:allow-operator? allow-operator? #:indented-operator-continue? indented-operator-continue?]) → variant? allow-operator? : (string? . -> . any/c) = (lambda (str) #t)
indented-operator-continue? : (string? . -> . any/c) = (lambda (str) #t)
Creates a representaion of a shrubbery variant, where supplying no
arguments represents the same variant as default-variant:
If allow-operator? returns #f for a string representing a shrubbery operator, then it is treated as a syntax error instead of an operator.
If indented-operator-continue? returns #f for an operator string, then a group cannot be continued on a new line by starting the new line with an operator and indentation greater than the line to continue.
procedure
(variant-allow-operator? v) → (string? . -> . any/c)
v : variant?
procedure
→ (string? . -> . any/c) v : variant?
Accessors for designations in a variant.
value
Represents the default shrubbery variant as specified in Shrubbery Specification.