5.3 Reconstructing Shrubbery Notation
(require shrubbery/print) | package: shrubbery-lib |
If max-length is a number, the returned string will contain no more than max-length characters. Internally, conversion to a string can take shortcuts once the first max-length characters have been determined.
When keep-suffix? are keep-suffix? are true and raw text mode is used to generate the result string, then 'raw-prefix and 'raw-suffix text on the immediate syntax object are included in the result. Otherwise, prefixes and suffixes are rendered only when they appear between 'raw text. If inner? is true, “inner” prefixes and suffixes are preserved on the immediate s form even if keep-suffix? and/or keep-suffix? are #false. If s is a group or multi-group form, then inner prefixes and suffixes are preserved in any case.
If infer-starting-indentation? is true, then a consistent amount of leading whitespace is removed from each line of the result string.
The register-stx-range and render-stx-hook arguments provide a hook to record or replace rendering of a syntax object within s. The register-stx-range procedure is called with each syntax object in s after printing, and the second and third arguments report the starting and ending locations in the string for the syntax object’s printed form. The render-stx-hook procedure is called before printing each syntax object, and if it returns a true value, then printing assumes that the syntax object has alerady been rendered to the given output port (which is ultimately delivered to a string), and it is not printed in the default way.
Raw text is consistently available when supplied by 'raw syntax properties on all atoms, except that 'raw-opaque-content and/or 'opaque-raw properties excuse nested atoms from needing 'raw properties. Also, a parsed form need not have raw text information.
procedure
(shrubbery-syntax->raw s [ #:use-raw? use-raw? #:keep-prefix? keep-prefix? #:keep-suffix? keep-suffix? #:inner? inner?])
→
any? any? any? s : syntax? use-raw? : any/c = #f keep-prefix? : any/c = #f keep-suffix? : any/c = #f inner? : any/c = #f