Changeset 35525 in project for wiki/man/5/Extensions to the standard


Ignore:
Timestamp:
05/06/18 17:49:44 (3 months ago)
Author:
felix
Message:

man/5: restructuring, fixed links, added csi module, simplification

File:
1 moved

Legend:

Unmodified
Added
Removed
  • wiki/man/5/Extensions to the standard

    r35520 r35525  
    5555The {{exit}} procedure exits a program right away and does ''not'' invoke pending {{dynamic-wind}} thunks.
    5656
     57
     58== Non-standard read syntax
     59
     60=== Escapes in symbols
     61
     62{{| ... |}} may be used to escape a sequence of characters when reading a symbol.
     63{{\X}} escapes a single character in a symbols name:
     64
     65  (symbol->string '|abc def|)       =>   "abc def"
     66  (symbol->string '|abc||def|)      =>   "abcdef"
     67  (symbol->string '|abc|xyz|def|)   =>   "abcxyzdef"
     68  (symbol->string '|abc\|def|)      =>   "abc|def"
     69  (symbol->string 'abc\ def)        =>   "abc def"
     70
     71=== Multiline Block Comment
     72
     73<read>#|</read>
     74
     75 #| ... |#
     76
     77A multiline ''block'' comment. May be nested. Implements [[http://srfi.schemers.org/srfi-30/srfi-30.html|SRFI-30]].
     78
     79=== Expression Comment
     80
     81<read>#;</read>
     82
     83 #;EXPRESSION
     84
     85Treats {{EXPRESSION}} as a comment.  That is, the comment runs through the whole S-expression, regardless of newlines, which saves you from having to comment out every line, or add a newline in the middle of your parens to make the commenting of the last line work, or other things like that. Implements [[http://srfi.schemers.org/srfi-62/srfi-62.html|SRFI-62]].
     86
     87=== External Representation
     88
     89<read>#,</read>
     90
     91 #,(CONSTRUCTORNAME DATUM ...)
     92
     93Allows user-defined extension of external representations. (For more information see the documentation for
     94[[http://srfi.schemers.org/srfi-10/srfi-10.html|SRFI-10]])
     95
     96=== Location Expression
     97
     98 #$EXPRESSION
     99
     100An abbreviation for {{(location EXPRESSION)}}.
     101
     102=== Blob literals
     103
     104<read>#${</read>
     105
     106  #${ HEX ... }
     107
     108Syntax for literal "blobs" (byte-sequences). Expects hexadecimal digits and ignores
     109any whitespace characters:
     110
     111  #;1> ,d '#${deadbee f}
     112  blob of size 4:
     113     0: de ad be ef                                     ....
     114
     115=== Keyword
     116
     117<read>#:</read>
     118
     119 #:SYMBOL
     120 SYMBOL:
     121 :SYMBOL
     122
     123Syntax for keywords. Keywords are symbols that evaluate to themselves, and as such don't have to be quoted.  Either {{SYMBOL:}} or {{:SYMBOL}} is accepted, depending on the setting of the {{keyword-style}} parameter, but never both.  {{#:SYMBOL}} is always accepted.
     124
     125=== Multiline String Constant
     126
     127<read>#<<</read>
     128
     129 #<<TAG
     130
     131Specifies a multiline string constant. Anything up to a line equal to {{TAG}} (or end of file) will be returned as a single string:
     132
     133 (define msg #<<END
     134  "Hello, world!", she said.
     135 END
     136 )
     137
     138is equivalent to
     139
     140 (define msg "\"Hello, world!\", she said.")
     141
     142=== Multiline String Constant with Embedded Expressions
     143
     144<read>#<#</read>
     145
     146 #<#TAG
     147
     148Similar to {{#<<}}, but allows substitution of embedded Scheme expressions prefixed with {{#}} and optionally enclosed in curly brackets. Two consecutive {{#}}s are translated to a single {{#}}:
     149
     150 (define three 3)
     151 (display #<#EOF
     152 This is a simple string with an embedded `##' character
     153 and substituted expressions: (+ three 99) ==> #(+ three 99)
     154 (three is "#{three}")
     155 EOF
     156 )
     157
     158prints
     159
     160 This is a simple string with an embedded `#' character
     161 and substituted expressions: (+ three 99) ==> 102
     162 (three is "3")
     163
     164=== Foreign Declare
     165
     166<read>#></read>
     167
     168 #> ... <#
     169
     170Abbreviation for {{(foreign-declare " ... ")}}.
     171
     172=== String escape sequences
     173
     174String-literals may contain the following escape sequences:
     175
     176<table style="margin-top: 1em; max-width: 40em">
     177<tr><th>Escape sequence</th><th>Character</th></tr>
     178<tr><td>{{\n}}</td><td>line feed / newline</td></tr>
     179<tr><td>{{\t}}</td><td>tab</td></tr>
     180<tr><td>{{\r}}</td><td>carriage return</td></tr>
     181<tr><td>{{\b}}</td><td>backspace</td></tr>
     182<tr><td>{{\a}}</td><td>bell</td></tr>
     183<tr><td>{{\v}}</td><td>vertical tab</td></tr>
     184<tr><td>{{\f}}</td><td>form feed</td></tr>
     185<tr><td>{{\x}}''XX''</td><td>hexadecimal 8-bit character code</td></tr>
     186<tr><td>{{\u}}''XXXX''</td><td>hexadecimal 16-bit Unicode character code</td></tr>
     187<tr><td>{{\U}}''XXXXXXXX''</td><td>hexadecimal 32-bit Unicode character code</td></tr>
     188<tr><td>{{\}}''OOO''</td><td>octal 8-bit character code</td></tr>
     189<tr><td>{{\|}}   {{\"}}    {{\\}}    {{\'}}</td><td>the escaped character</td></tr>
     190</table>
     191
     192
     193=== Sharp Prefixed Symbol
     194
     195<read>#%</read>
     196
     197 #%...
     198
     199Reads like a normal symbol.
     200
     201=== Bang
     202
     203<read>#!</read>
     204
     205 #!...
     206
     207Interpretation depends on the directly following characters. Only the following are recognized. Any other case results in a read error.
     208
     209; Line Comment : If followed by whitespace or a slash, then everything up the end of the current line is ignored
     210
     211; Eof Object : If followed by the character sequence {{eof}}, then the (self-evaluating) end-of-file object is returned
     212
     213; DSSSL Formal Parameter List Annotation : If followed by any of the character sequences {{optional}}, {{rest}} or {{key}}, then a symbol with the same name (and prefixed with {{#!}}) is returned
     214
     215; Read Mark Invocation : If a ''read mark'' with the same name as the token is registered, then its procedure is called and the result of the read-mark procedure will be returned
     216
     217=== Case Sensitive Expression
     218
     219<read>#cs</read>
     220
     221 #cs...
     222
     223Read the next expression in case-sensitive mode (regardless of the current global setting).
     224
     225=== Case Insensitive Expression
     226
     227<read>#ci</read>
     228
     229 #ci...
     230
     231Read the next expression in case-insensitive mode (regardless of the current global setting).
     232
     233=== Conditional Expansion
     234
     235<read>#+</read>
     236
     237 #+FEATURE EXPR
     238
     239Rewrites to
     240
     241 (cond-expand (FEATURE EXPR) (else))
     242
     243and performs the feature test at macroexpansion time.  Therefore, it may not
     244work as expected when used within a macro form.
     245
    57246---
    58247Previous: [[Deviations from the standard]]
    59248
    60 Next: [[Non-standard macros and special forms]]
     249Next: [[Included modules]]
Note: See TracChangeset for help on using the changeset viewer.