On this page:
variant?
make-variant
variant-allow-operator?
variant-indented-operator-continue?
default-variant
8.17.0.6

5.6 Shrubbery Variants🔗ℹ

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

(variant? v)  boolean?

  v : any/c
Returns #true if v is a shrubbery variant as produced by make-variant, #f otherwise.

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

(variant-indented-operator-continue? v)

  (string? . -> . any/c)
  v : variant?
Accessors for designations in a variant.

Represents the default shrubbery variant as specified in Shrubbery Specification.