User Tools

A PCRE internal error occured. This might be caused by a faulty plugin

====== Function SET-MACRO-CHARACTER, GET-MACRO-CHARACTER ====== ====Syntax==== * **get-macro-character** //char// ''&optional'' //readtable// → //function//, //non-terminating-p// * **set-macro-character** //char// //new-function// ''&optional'' //non-terminating-p// //readtable// → **[[CL:Constant Variables:t]]** ====Arguments and Values==== * //char// - a //[[CL:Glossary:character]]//. * //non-terminating-p// - a //[[CL:Glossary:generalized boolean]]//. The default is //[[CL:Glossary:false]]//. * //readtable// - a //[[CL:Glossary:readtable designator]]//. The default is the //[[CL:Glossary:current readtable]]//. * //function// - **[[CL:Constant Variables:nil]]**, or a //[[CL:Glossary:designator]]// for a //[[CL:Glossary:function]]// of two //[[CL:Glossary:arguments]]//. * //new-function// - a //[[CL:Glossary:function designator]]//. ====Description==== **get-macro-character** returns as its //[[CL:Glossary:primary value]]//, //function//, the //[[CL:Glossary:reader macro function]]// associated with //char// in //readtable// (if any), or else **[[CL:Constant Variables:nil]]** if //char// is not a //[[CL:Glossary:macro character]]// in //readtable//. The //[[CL:Glossary:secondary value]]//, //non-terminating-p//, is //[[CL:Glossary:true]]// if //char// is a //[[CL:Glossary:non-terminating]]// //[[CL:Glossary:macro character]]//; otherwise, it is //[[CL:Glossary:false]]//. **set-macro-character** causes //char// to be a //[[CL:Glossary:macro character]]// associated with the //[[CL:Glossary:reader macro function]]// //new-function// (or the //[[CL:Glossary:designator]]// for //new-function//) in //readtable//. If //non-terminating-p// is //[[CL:Glossary:true]]//, //char// becomes a //[[CL:Glossary:non-terminating]]// //[[CL:Glossary:macro character]]//; otherwise it becomes a //[[CL:Glossary:terminating]]// //[[CL:Glossary:macro character]]//. ====Examples==== <blockquote> (get-macro-character #\[) → [[CL:Constant Variables:NIL]], //[[CL:Glossary:false]]// ([[CL:Functions:not]] (get-macro-character #\;)) → //[[CL:Glossary:false]]// </blockquote> The following is a possible definition for the //[[CL:Glossary:single-quote]]// //[[CL:Glossary:reader macro]]// in //[[CL:Glossary:standard syntax]]//: <blockquote> ([[CL:Macros:defun]] single-quote-reader (stream char) ([[CL:Symbols:declare]] ([[CL:Declarations:ignore]] char)) ([[CL:Functions:list]] 'quote ([[CL:Functions:read]] stream [[CL:Constant Variables:t]] [[CL:Constant Variables:nil]] [[CL:Constant Variables:t]]))) <r>SINGLE-QUOTE-READER </r> (set-macro-character #\' #'single-quote-reader) <r>[[CL:Constant Variables:T]] </r> </blockquote> Here ''single-quote-reader'' reads an //[[CL:Glossary:object]]// following the //[[CL:Glossary:single-quote]]// and returns a //[[CL:Glossary:list]]// of **[[CL:Special Operators:quote]]** and that //[[CL:Glossary:object]]//. The //char// argument is ignored. The following is a possible definition for the //[[CL:Glossary:semicolon]]// //[[CL:Glossary:reader macro]]// in //[[CL:Glossary:standard syntax]]//: <blockquote> ([[CL:Macros:defun]] semicolon-reader (stream char) ([[CL:Symbols:declare]] ([[CL:Declarations:ignore]] char)) ;; First swallow the rest of the current input line. ;; End-of-file is acceptable for terminating the comment. ([[CL:Macros:do]] () (([[CL:Functions:char-equal|char=]] ([[CL:Functions:read-char]] stream [[CL:Constant Variables:nil]] #\Newline [[CL:Constant Variables:t]]) #\Newline))) ;; Return zero values. ([[CL:Functions:values]])) <r>SEMICOLON-READER</r> (set-macro-character #\; #'semicolon-reader) <r>T</r> </blockquote> ====Side Effects==== The //readtable// is modified. ====Affected By==== None. ====Exceptional Situations==== None. ====See Also==== * **[[CL:Variables:star-readtable-star|Variable *READTABLE*]]** ====Notes==== None. \issue{GET-MACRO-CHARACTER-READTABLE:NIL-STANDARD}