1
0
Fork 0
cl-sites/novaspec.org/cl/f_set-syntax-from-char.html

364 lines
7.8 KiB
HTML
Raw Normal View History

2025-02-05 18:52:26 +01:00
<!DOCTYPE HTML>
<HTML LANG="en-us"
><HEAD
><TITLE
>set-syntax-from-char | Common Lisp Nova Spec</TITLE
><META CHARSET="US-ASCII"
><LINK REL="canonical" HREF="f_set-syntax-from-char.html"
><LINK REL="next" HREF="f_with-standard-io-syntax.html" TYPE="text/html" TITLE="with-standard-io-syntax"
><LINK REL="prev" HREF="f_set-macro-character.html" TYPE="text/html" TITLE="set-macro-character, get-macro-character"
><LINK REL="up" HREF="23_2_Reader_Dictionary.html" TYPE="text/html" TITLE="23.2 Reader Dictionary"
><LINK REL="start" HREF="index.html" TYPE="text/html" TITLE="Common Lisp Nova Spec"
><META NAME="VIEWPORT" CONTENT="width=device-width, initial-scale=1.0"
><LINK REL="STYLESHEET" HREF="dpans.css%3F3909942064.css"
><SCRIPT SRC="dpans.js%3F3909942064"
></SCRIPT
><SCRIPT SRC="apropos.js%3F3909942064"
></SCRIPT
></HEAD
><BODY
><DIV
><DIV CLASS="topnav"
><DIV CLASS="breadcrumb"
><SPAN CLASS="breadcrumb-item"
><A HREF="index.html"
>Common Lisp Nova Spec</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="23_Reader.html"
>23. Reader</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="23_2_Reader_Dictionary.html"
>23.2 Reader Dictionary</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="f_set-syntax-from-char.html"
>set-syntax-from-char</A
></SPAN
></DIV
><DIV CLASS="apropos"
><DIV CLASS="apropos-io"
><A HREF="f_set-macro-character.html" CLASS="prev"
>&#8592;</A
><SPAN ID="apropos-label"
>Apropos </SPAN
><INPUT ID="apropos" AUTOFOCUS="AUTOFOCUS" PLACEHOLDER="Type here to search" ONINPUT="aproposInput(this);" ONKEYUP="aproposKeyup(event);" ONCHANGE="aproposChange(this);" ONFOCUS="aproposFocus(this);" ONFOCUSOUT="aproposFocusout(this);"
><A HREF="f_with-standard-io-syntax.html" CLASS="next"
>&#8594;</A
></DIV
><DIV ID="apropos-res"
></DIV
></DIV
></DIV
><DIV CLASS="matter"
><DIV CLASS="com"
><DIV CLASS="begincom"
><HR
><TABLE WIDTH="100%" CELLSPACING="0" CELLPADDING="0"
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" WIDTH="100%" CLASS="name"
><SPAN CLASS="idx" DATA-KIND="idxref" DATA-TERM="set-syntax-from-char"
></SPAN
><B
>set-syntax-from-char</B
></TD
><TD ALIGN="RIGHT" VALIGN="BASELINE" WIDTH="0" NOWRAP="NOWRAP" CLASS="ftype"
><I
>Function</I
></TD
></TR
></TABLE
><HR
></DIV
><UL CLASS="subtoc"
></UL
><DL
><DT
><B
>Syntax</B
></DT
><DD
><P CLASS="j"
><B
>set-syntax-from-char</B
> <SPAN CLASS="cmssi"
>to-char</SPAN
> <SPAN CLASS="cmssi"
>from-char</SPAN
> <SPAN CLASS="cmtt"
>&amp;optional</SPAN
> <SPAN CLASS="cmssi"
>to-readtable</SPAN
> <SPAN CLASS="cmssi"
>from-readtable</SPAN
> <SPAN CLASS="arrow"
>&#8594;</SPAN
> <SPAN CLASS="misc"
><B
>t</B
></SPAN
></P
></DD
><DT
><B
>Arguments and Values</B
></DT
><DD
><P CLASS="j"
><VAR CLASS="param"
>to-char</VAR
> &#8212; a <A HREF="26_1_Glossary.html#character"
><EM CLASS="term"
>character</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>from-char</VAR
> &#8212; a <A HREF="26_1_Glossary.html#character"
><EM CLASS="term"
>character</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>to-readtable</VAR
> &#8212; a <A HREF="26_1_Glossary.html#readtable"
><EM CLASS="term"
>readtable</EM
></A
>. The default is the <A HREF="26_1_Glossary.html#current_readtable"
><EM CLASS="term"
>current readtable</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>from-readtable</VAR
> &#8212; a <A HREF="26_1_Glossary.html#readtable_designator"
><EM CLASS="term"
>readtable designator</EM
></A
>. The default is the <A HREF="26_1_Glossary.html#standard_readtable"
><EM CLASS="term"
>standard readtable</EM
></A
>.</P
></DD
><DT
><B
>Description</B
></DT
><DD
><P CLASS="j"
><A HREF="f_set-syntax-from-char.html" CLASS="funref"
><B
>set-syntax-from-char</B
></A
> makes the syntax of <VAR CLASS="param"
>to-char</VAR
> in <VAR CLASS="param"
>to-readtable</VAR
> be the same as the syntax of <VAR CLASS="param"
>from-char</VAR
> in <VAR CLASS="param"
>from-readtable</VAR
>. </P
><P CLASS="j"
><A HREF="f_set-syntax-from-char.html" CLASS="funref"
><B
>set-syntax-from-char</B
></A
> copies the <A HREF="26_1_Glossary.html#syntax_type"
><EM CLASS="term"
>syntax types</EM
></A
> of <VAR CLASS="param"
>from-char</VAR
>. If <VAR CLASS="param"
>from-char</VAR
> is a <A HREF="26_1_Glossary.html#macro_character"
><EM CLASS="term"
>macro character</EM
></A
>, its <A HREF="26_1_Glossary.html#reader_macro_function"
><EM CLASS="term"
>reader macro function</EM
></A
> is copied also. If the character is a <A HREF="26_1_Glossary.html#dispatching_macro_character"
><EM CLASS="term"
>dispatching macro character</EM
></A
>, its entire dispatch table of <A HREF="26_1_Glossary.html#reader_macro_function"
><EM CLASS="term"
>reader macro functions</EM
></A
> is copied. The <A HREF="26_1_Glossary.html#constituent_trait"
><EM CLASS="term"
>constituent traits</EM
></A
> of <VAR CLASS="param"
>from-char</VAR
> are not copied. </P
><P CLASS="j"
>A macro definition from a character such as <CODE CLASS="f"
>"</CODE
> can be copied to another character; the standard definition for <CODE CLASS="f"
>"</CODE
> looks for another character that is the same as the character that invoked it. The definition of <CODE CLASS="f"
>(</CODE
> can not be meaningfully copied to <CODE CLASS="f"
>{</CODE
>, on the other hand. The result is that <A HREF="26_1_Glossary.html#list"
><EM CLASS="term"
>lists</EM
></A
> are of the form <CODE CLASS="f"
>{a b c)</CODE
>, not <CODE CLASS="f"
>{a b c}</CODE
>, because the definition always looks for a closing parenthesis, not a closing brace.</P
></DD
><DT
><B
>Examples</B
></DT
><DD
><PRE CLASS="screen"
>(set-syntax-from-char #\7 #\;) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> T
123579 <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> 1235</PRE
></DD
><DT
><B
>Side Effects</B
></DT
><DD
><P CLASS="j"
>The <VAR CLASS="param"
>to-readtable</VAR
> is modified.</P
></DD
><DT
><B
>Affected By</B
></DT
><DD
><P CLASS="j"
>The existing values in the <VAR CLASS="param"
>from-readtable</VAR
>.</P
></DD
><DT
><B
>See Also</B
></DT
><DD
><P CLASS="j"
><A HREF="f_set-macro-character.html" CLASS="funref"
><B
>set-macro-character</B
></A
>, <A HREF="f_make-dispatch-macro-character.html" CLASS="funref"
><B
>make-dispatch-macro-character</B
></A
>, <A HREF="2_1_Character_Syntax.html#sec_2_1_4" CLASS="secref"
><SPAN CLASS="cmr"
>Section</SPAN
> <SPAN CLASS="cmr"
>2.1.4</SPAN
> <SPAN CLASS="cmr"
>(Character</SPAN
> <SPAN CLASS="cmr"
>Syntax</SPAN
> <SPAN CLASS="cmr"
>Types)</SPAN
></A
></P
></DD
><DT
><B
>Notes</B
></DT
><DD
><P CLASS="j"
>The <A HREF="26_1_Glossary.html#constituent_trait"
><EM CLASS="term"
>constituent traits</EM
></A
> of a <A HREF="26_1_Glossary.html#character"
><EM CLASS="term"
>character</EM
></A
> are &#8220;hard wired&#8221; into the parser for extended <A HREF="26_1_Glossary.html#token"
><EM CLASS="term"
>tokens</EM
></A
>. For example, if the definition of <CODE CLASS="f"
>S</CODE
> is copied to <CODE CLASS="f"
>*</CODE
>, then <CODE CLASS="f"
>*</CODE
> will become a <A HREF="26_1_Glossary.html#constituent"
><EM CLASS="term"
>constituent</EM
></A
> that is <A HREF="26_1_Glossary.html#alphabetic"
><EM CLASS="term"
>alphabetic</EM
></A
><SPAN CLASS="meaning"
><SUB CLASS="sub"
><SPAN CLASS="cmr"
>2</SPAN
></SUB
></SPAN
> but that cannot be used as a <A HREF="26_1_Glossary.html#short_float"
><EM CLASS="term"
>short float</EM
></A
> <A HREF="26_1_Glossary.html#exponent_marker"
><EM CLASS="term"
>exponent marker</EM
></A
>. For further information, see <A HREF="2_1_Character_Syntax.html#sec_2_1_4_2" CLASS="secref"
><SPAN CLASS="cmr"
>Section</SPAN
> <SPAN CLASS="cmr"
>2.1.4.2</SPAN
> <SPAN CLASS="cmr"
>(Constituent</SPAN
> <SPAN CLASS="cmr"
>Traits)</SPAN
></A
>.</P
></DD
></DL
></DIV
></DIV
><DIV CLASS="footer"
><DIV CLASS="btmnav"
><A HREF="f_set-macro-character.html" CLASS="prev"
>&#8592;</A
><A HREF="f_with-standard-io-syntax.html" CLASS="next"
>&#8594;</A
></DIV
><DIV CLASS="trail"
>Conversion to HTML copyright 2023 by Gilbert Baumann</DIV
></DIV
></DIV
><SCRIPT
>domReady();</SCRIPT
></BODY
></HTML
>