On this page:
explode-module-path-index
phase-of-enclosing-module
format-unique-id
syntax-within?
syntax-length
8.12

29 Syntax🔗ℹ

Ryan Culpepper <ryanc@racket-lang.org>

NOTE: This library is deprecated; use syntax/location or syntax/transformer, instead. The contents of this module, with the exceptions below, have been merged with syntax/location and syntax/transformer.

This library is unstable; compatibility will not be maintained. See Unstable: May Change Without Warning for more information.

 (require unstable/syntax) package: unstable-lib

Unfolds mpi using module-path-index-split, returning a list of the relative module paths together with the terminal resolved module path or #f for the “self” module.

Examples:
> (explode-module-path-index (car (identifier-binding #'lambda)))

'("kw.rkt" "pre-base.rkt" "private/base.rkt" racket/base #f)

> (explode-module-path-index (caddr (identifier-binding #'lambda)))

'(racket/base #f)

> (explode-module-path-index (car (identifier-binding #'define-values)))

'('#%core #f)

Returns the phase level of the module in which the form occurs (and for the instantiation of the module in which the form is executed). For example, if a module is required directly by the “main” module (or the top level), its phase level is 0. If a module is required for-syntax by the “main” module (or the top level), its phase level is 1.

Examples:
> (module helper racket
    (require unstable/syntax)
    (displayln (phase-of-enclosing-module)))
> (require 'helper)

0

> (require (for-meta 1 'helper))

The subsequent bindings were added by Vincent St-Amour <stamourv@racket-lang.org>.

procedure

(format-unique-id lctx    
  fmt    
  v ...    
  [#:source src    
  #:props props    
  #:cert cert])  identifier?
  lctx : (or/c syntax? #f)
  fmt : string?
  v : (or/c string? symbol? identifier? keyword? char? number?)
  src : (or/c syntax? #f) = #f
  props : (or/c syntax? #f) = #f
  cert : (or/c syntax? #f) = #f
Like format-id, but returned identifiers are guaranteed to be unique.

procedure

(syntax-within? a b)  boolean?

  a : syntax?
  b : syntax?
Returns true is syntax a is within syntax b in the source. Bounds are inclusive.

The subsequent bindings were added by Eric Dobson <eric.n.dobson@gmail.com>.

procedure

(syntax-length stx)  exact-nonnegative-integer?

  stx : syntax?
Performs (length (syntax->list stx)).

Example:
> (syntax-length #'(d e f))

1

3