/usr/share/doc/racket/parser-tools/Lexers.html is in racket-doc 6.7-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>1 Lexers</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="../local-redirect/local-redirect.js"></script><script type="text/javascript" src="../local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_0");">▼</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x">Parser Tools:<span class="mywbr"> </span> <span class="stt">lex</span> and <span class="stt">yacc</span>-<wbr></wbr>style Parsing</a></td></tr></table></div><div class="tocviewsublisttop" style="display: block;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">Lexers</a></td></tr><tr><td align="right">2 </td><td><a href="LALR_1__Parsers.html" class="tocviewlink" data-pltdoc="x">LALR(1) Parsers</a></td></tr><tr><td align="right">3 </td><td><a href="Context-Free_Parsers.html" class="tocviewlink" data-pltdoc="x">Context-<wbr></wbr>Free Parsers</a></td></tr><tr><td align="right">4 </td><td><a href="Converting_yacc_or_bison_Grammars.html" class="tocviewlink" data-pltdoc="x">Converting <span class="stt">yacc</span> or <span class="stt">bison</span> Grammars</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_1");">►</a></td><td>1 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">Lexers</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">1.1 </td><td><a href="#%28part._.Creating_a_.Lexer%29" class="tocviewlink" data-pltdoc="x">Creating a Lexer</a></td></tr><tr><td align="right">1.2 </td><td><a href="#%28part._.Lexer_.Abbreviations_and_.Macros%29" class="tocviewlink" data-pltdoc="x">Lexer Abbreviations and Macros</a></td></tr><tr><td align="right">1.3 </td><td><a href="#%28part._.Lexer_.S.R.E_.Operators%29" class="tocviewlink" data-pltdoc="x">Lexer SRE Operators</a></td></tr><tr><td align="right">1.4 </td><td><a href="#%28part._.Lexer_.Legacy_.Operators%29" class="tocviewlink" data-pltdoc="x">Lexer Legacy Operators</a></td></tr><tr><td align="right">1.5 </td><td><a href="#%28part._.Tokens%29" class="tocviewlink" data-pltdoc="x">Tokens</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><span class="tocsublinknumber">1.1<tt> </tt></span><a href="#%28part._.Creating_a_.Lexer%29" class="tocsubseclink" data-pltdoc="x">Creating a Lexer</a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._lexer%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">lexer</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._lexer-src-pos%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">lexer-<wbr></wbr>src-<wbr></wbr>pos</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._start-pos%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">start-<wbr></wbr>pos</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._end-pos%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">end-<wbr></wbr>pos</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._lexeme%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">lexeme</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._input-port%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">input-<wbr></wbr>port</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._return-without-pos%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">return-<wbr></wbr>without-<wbr></wbr>pos</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._position%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">position</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._position-token%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">position-<wbr></wbr>token</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._file-path%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">file-<wbr></wbr>path</span></span></a></td></tr><tr><td><span class="tocsublinknumber">1.2<tt> </tt></span><a href="#%28part._.Lexer_.Abbreviations_and_.Macros%29" class="tocsubseclink" data-pltdoc="x">Lexer Abbreviations and Macros</a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._char-set%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">char-<wbr></wbr>set</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._any-char%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">any-<wbr></wbr>char</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._any-string%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">any-<wbr></wbr>string</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._nothing%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">nothing</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._alphabetic%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">alphabetic</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._lower-case%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">lower-<wbr></wbr>case</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._upper-case%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">upper-<wbr></wbr>case</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._title-case%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">title-<wbr></wbr>case</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._numeric%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">numeric</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._symbolic%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">symbolic</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._punctuation%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">punctuation</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._graphic%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">graphic</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._whitespace%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">whitespace</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._blank%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">blank</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._iso-control%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">iso-<wbr></wbr>control</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._define-lex-abbrev%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">define-<wbr></wbr>lex-<wbr></wbr>abbrev</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._define-lex-abbrevs%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">define-<wbr></wbr>lex-<wbr></wbr>abbrevs</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._define-lex-trans%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">define-<wbr></wbr>lex-<wbr></wbr>trans</span></span></a></td></tr><tr><td><span class="tocsublinknumber">1.3<tt> </tt></span><a href="#%28part._.Lexer_.S.R.E_.Operators%29" class="tocsubseclink" data-pltdoc="x">Lexer SRE Operators</a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._%2A%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">*</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._%2B%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">+</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">?</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~3d%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">=</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~3e~3d%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">>=</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._%2A%2A%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">**</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._or%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">or</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~3a%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">:</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._seq%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">seq</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~26%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">&</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._-%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink"><span class="nobreak">-</span></span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~7e%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">~</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._%2F%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">/</span></span></a></td></tr><tr><td><span class="tocsublinknumber">1.4<tt> </tt></span><a href="#%28part._.Lexer_.Legacy_.Operators%29" class="tocsubseclink" data-pltdoc="x">Lexer Legacy Operators</a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex-plt-v200..rkt%29._epsilon%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">epsilon</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex-plt-v200..rkt%29._~7e%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">~</span></span></a></td></tr><tr><td><span class="tocsublinknumber">1.5<tt> </tt></span><a href="#%28part._.Tokens%29" class="tocsubseclink" data-pltdoc="x">Tokens</a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._define-tokens%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">define-<wbr></wbr>tokens</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._define-empty-tokens%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">define-<wbr></wbr>empty-<wbr></wbr>tokens</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._token-name%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">token-<wbr></wbr>name</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._token-value%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">token-<wbr></wbr>value</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._token~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">token?</span></span></a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.7", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.7");">top</a></span><span class="navright"> <a href="index.html" title="backward to "Parser Tools: lex and yacc-style Parsing"" data-pltdoc="x">← prev</a> <a href="index.html" title="up to "Parser Tools: lex and yacc-style Parsing"" data-pltdoc="x">up</a> <a href="LALR_1__Parsers.html" title="forward to "2 LALR(1) Parsers"" data-pltdoc="x">next →</a></span> </div><h3 x-source-module="(lib "parser-tools/parser-tools.scrbl")" x-source-pkg="parser-tools-doc" x-part-tag=""Lexers"">1<tt> </tt><a name="(part._.Lexers)"></a><a name="(mod-path._parser-tools/lex)"></a><a name="(idx._(gentag._0._(lib._parser-tools/parser-tools..scrbl)))"></a><a name="(idx._(gentag._1._(lib._parser-tools/parser-tools..scrbl)))"></a><a name="(idx._(gentag._2._(lib._parser-tools/parser-tools..scrbl)))"></a>Lexers</h3><p><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">parser-tools/lex</span></a><span class="RktPn">)</span></td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">parser-tools-lib</span></span></td></tr></table></p><h4 x-source-module="(lib "parser-tools/parser-tools.scrbl")" x-source-pkg="parser-tools-doc" x-part-tag=""Creating_a_Lexer"">1.1<tt> </tt><a name="(part._.Creating_a_.Lexer)"></a>Creating a Lexer</h4><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._parser-tools/lex..rkt)._lexer))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._lexer%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">lexer</a></span></span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktVar">trigger</span><span class="hspace"> </span><span class="RktVar">action-expr</span><span class="RktPn">]</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="stt"> </span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="specgrammar"><tr><td align="right" valign="baseline"><span class="RktVar">trigger</span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktVar">re</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=port-ops.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._eof%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">eof</a></span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym">special</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym">special-comment</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td></tr><tr><td align="right" valign="baseline"><span class="RktVar">re</span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktVar">id</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktVar">string</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktVar">character</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym">repetition</span><span class="hspace"> </span><span class="RktVar">lo</span><span class="hspace"> </span><span class="RktVar">hi</span><span class="hspace"> </span><span class="RktVar">re</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym">union</span><span class="hspace"> </span><span class="RktVar">re</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym">intersection</span><span class="hspace"> </span><span class="RktVar">re</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym">complement</span><span class="hspace"> </span><span class="RktVar">re</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym">concatenation</span><span class="hspace"> </span><span class="RktVar">re</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym">char-range</span><span class="hspace"> </span><span class="RktVar">char</span><span class="hspace"> </span><span class="RktVar">char</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym">char-complement</span><span class="hspace"> </span><span class="RktVar">re</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktVar">datum</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">Produces a function that takes an input-port, matches the
<span class="RktVar">re</span> patterns against the buffer, and returns the result of
executing the corresponding <span class="RktVar">action-expr</span>. When multiple
patterns match, a lexer will choose the longest match, breaking
ties in favor of the rule appearing first.</div></p><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p>The implementation of <a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=syntax-color&rel=index.html%23%2528mod-path._syntax-color%252Fracket-lexer%2529&version=6.7" class="RktModLink Sq" data-pltdoc="x"><span class="RktSym">syntax-color/racket-lexer</span></a>
contains a lexer for the <a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=index.html&version=6.7" class="RktModLink Sq" data-pltdoc="x"><span class="RktSym">racket</span></a> language.
In addition, files in the <span class="stt">"examples"</span> sub-directory
of the <span class="stt">"parser-tools"</span> collection contain
simpler example lexers.</p></blockquote></blockquote></blockquote><p>An <span class="RktVar">re</span> is matched as follows:</p><ul><li><p><span class="RktVar">id</span> —<wbr></wbr> expands to the named <a name="(tech._lexer._abbreviation)"></a><span style="font-style: italic">lexer abbreviation</span>;
abbreviations are defined via <span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._define-lex-abbrev%29%29" class="RktStxLink" data-pltdoc="x">define-lex-abbrev</a></span> or supplied by modules
like <a href="#%28mod-path._parser-tools%2Flex-sre%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">parser-tools/lex-sre</span></a>.</p></li><li><p><span class="RktVar">string</span> —<wbr></wbr> matches the sequence of characters in <span class="RktVar">string</span>.</p></li><li><p><span class="RktVar">character</span> —<wbr></wbr> matches a literal <span class="RktVar">character</span>.</p></li><li><p><span class="RktPn">(</span><span class="RktSym">repetition</span><span class="stt"> </span><span class="RktVar">lo</span><span class="stt"> </span><span class="RktVar">hi</span><span class="stt"> </span><span class="RktVar">re</span><span class="RktPn">)</span> —<wbr></wbr> matches <span class="RktVar">re</span> repeated between <span class="RktVar">lo</span>
and <span class="RktVar">hi</span> times, inclusive; <span class="RktVar">hi</span> can be <span class="RktVal">+inf.0</span> for unbounded repetitions.</p></li><li><p><span class="RktPn">(</span><span class="RktSym">union</span><span class="stt"> </span><span class="RktVar">re</span><span class="stt"> </span><span class="RktMeta"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span> —<wbr></wbr> matches if any of the sub-expressions match</p></li><li><p><span class="RktPn">(</span><span class="RktSym">intersection</span><span class="stt"> </span><span class="RktVar">re</span><span class="stt"> </span><span class="RktMeta"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span> —<wbr></wbr> matches if all of the <span class="RktVar">re</span>s match.</p></li><li><p><span class="RktPn">(</span><span class="RktSym">complement</span><span class="stt"> </span><span class="RktVar">re</span><span class="RktPn">)</span> —<wbr></wbr> matches anything that <span class="RktVar">re</span> does not.</p></li><li><p><span class="RktPn">(</span><span class="RktSym">concatenation</span><span class="stt"> </span><span class="RktVar">re</span><span class="stt"> </span><span class="RktMeta"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span> —<wbr></wbr> matches each <span class="RktVar">re</span> in succession.</p></li><li><p><span class="RktPn">(</span><span class="RktSym">char-range</span><span class="stt"> </span><span class="RktVar">char</span><span class="stt"> </span><span class="RktVar">char</span><span class="RktPn">)</span> —<wbr></wbr> matches any character between the two (inclusive);
a single character string can be used as a <span class="RktVar">char</span>.</p></li><li><p><span class="RktPn">(</span><span class="RktSym">char-complement</span><span class="stt"> </span><span class="RktVar">re</span><span class="RktPn">)</span> —<wbr></wbr> matches any character not matched by <span class="RktVar">re</span>.
The sub-expression must be a set of characters <span class="RktVar">re</span>.</p></li><li><p><span class="RktPn">(</span><span class="RktVar">id</span><span class="stt"> </span><span class="RktVar">datum</span><span class="stt"> </span><span class="RktMeta"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span> —<wbr></wbr> expands the <a name="(tech._lexer._macro)"></a><span style="font-style: italic">lexer macro</span> named <span class="RktVar">id</span>; macros
are defined via <span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._define-lex-trans%29%29" class="RktStxLink" data-pltdoc="x">define-lex-trans</a></span>.</p></li></ul><p>Note that both <span class="RktPn">(</span><span class="RktSym">concatenation</span><span class="RktPn">)</span> and <span class="RktVal">""</span> match the
empty string, <span class="RktPn">(</span><span class="RktSym">union</span><span class="RktPn">)</span> matches nothing,
<span class="RktPn">(</span><span class="RktSym">intersection</span><span class="RktPn">)</span> matches any string, and
<span class="RktPn">(</span><span class="RktSym">char-complement</span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym">union</span><span class="RktPn">)</span><span class="RktPn">)</span> matches any single character.</p><p>The regular expression language is not designed to be used directly,
but rather as a basis for a user-friendly notation written with
regular expression macros. For example,
<a href="#%28mod-path._parser-tools%2Flex-sre%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">parser-tools/lex-sre</span></a> supplies operators from Olin
Shivers’s SREs, and <a href="#%28mod-path._parser-tools%2Flex-plt-v200%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">parser-tools/lex-plt-v200</span></a> supplies
(deprecated) operators from the previous version of this library.
Since those libraries provide operators whose names match other Racket
bindings, such as <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._%252A%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">*</a></span> and <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._%252B%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">+</a></span>, they normally must be
imported using a prefix:</p><blockquote class="SCodeFlow"><p><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._prefix-in%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">prefix-in</a></span><span class="hspace"> </span><span class="RktSym">:</span><span class="hspace"> </span><span class="RktSym">parser-tools/lex-sre</span><span class="RktPn">)</span><span class="RktPn">)</span></p></blockquote><p>The suggested prefix is <span class="RktSym">:</span>, so that <span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._%2A%29%29" class="RktStxLink" data-pltdoc="x">:*</a></span> and
<span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._%2B%29%29" class="RktStxLink" data-pltdoc="x">:+</a></span> are imported. Of course, a prefix other than <span class="RktSym">:</span>
(such as <span class="RktSym">re-</span>) will work too.</p><p>Since negation is not a common operator on regular expressions, here
are a few examples, using <span class="RktSym">:</span> prefixed SRE syntax:</p><ul><li><p><span class="RktPn">(</span><span class="RktSym">complement</span><span class="hspace"> </span><span class="RktVal">"1"</span><span class="RktPn">)</span></p><p>Matches all strings except the string <span class="RktVal">"1"</span>, including
<span class="RktVal">"11"</span>, <span class="RktVal">"111"</span>, <span class="RktVal">"0"</span>, <span class="RktVal">"01"</span>,
<span class="RktVal">""</span>, and so on.</p></li><li><p><span class="RktPn">(</span><span class="RktSym">complement</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._%2A%29%29" class="RktStxLink" data-pltdoc="x">:*</a></span><span class="hspace"> </span><span class="RktVal">"1"</span><span class="RktPn">)</span><span class="RktPn">)</span></p><p>Matches all strings that are not sequences of <span class="RktVal">"1"</span>,
including <span class="RktVal">"0"</span>, <span class="RktVal">"00"</span>, <span class="RktVal">"11110"</span>,
<span class="RktVal">"0111"</span>, <span class="RktVal">"11001010"</span> and so on.</p></li><li><p><table cellspacing="0" cellpadding="0" class="RktBlk" style="display: inline-table; vertical-align: text-top; margin-top: 0;"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~26%29%29" class="RktStxLink" data-pltdoc="x">:&</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~3a%29%29" class="RktStxLink" data-pltdoc="x">::</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._any-string%29%29" class="RktStxLink" data-pltdoc="x">any-string</a></span><span class="hspace"> </span><span class="RktVal">"111"</span><span class="hspace"> </span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._any-string%29%29" class="RktStxLink" data-pltdoc="x">any-string</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">complement</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._or%29%29" class="RktStxLink" data-pltdoc="x">:or</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~3a%29%29" class="RktStxLink" data-pltdoc="x">::</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._any-string%29%29" class="RktStxLink" data-pltdoc="x">any-string</a></span><span class="hspace"> </span><span class="RktVal">"01"</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._%2B%29%29" class="RktStxLink" data-pltdoc="x">:+</a></span><span class="hspace"> </span><span class="RktVal">"1"</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></p><p>Matches all strings that have 3 consecutive ones, but not those that
end in <span class="RktVal">"01"</span> and not those that are ones only. These
include <span class="RktVal">"1110"</span>, <span class="RktVal">"0001000111"</span> and <span class="RktVal">"0111"</span>
but not <span class="RktVal">""</span>, <span class="RktVal">"11"</span>, <span class="RktVal">"11101"</span>, <span class="RktVal">"111"</span>
and <span class="RktVal">"11111"</span>.</p></li><li><p><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~3a%29%29" class="RktStxLink" data-pltdoc="x">::</a></span><span class="hspace"> </span><span class="RktVal">"/*"</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">complement</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~3a%29%29" class="RktStxLink" data-pltdoc="x">::</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._any-string%29%29" class="RktStxLink" data-pltdoc="x">any-string</a></span><span class="hspace"> </span><span class="RktVal">"*/"</span><span class="hspace"> </span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._any-string%29%29" class="RktStxLink" data-pltdoc="x">any-string</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVal">"*/"</span><span class="RktPn">)</span></p><p>Matches Java/C block comments. <span class="RktVal">"/**/"</span>,
<span class="RktVal">"/******/"</span>, <span class="RktVal">"/*////*/"</span>, <span class="RktVal">"/*asg4*/"</span> and so
on. It does not match <span class="RktVal">"/**/*/"</span>, <span class="RktVal">"/* */ */"</span> and so
on. <span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~3a%29%29" class="RktStxLink" data-pltdoc="x">::</a></span><span class="stt"> </span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._any-string%29%29" class="RktStxLink" data-pltdoc="x">any-string</a></span><span class="stt"> </span><span class="RktVal">"*/"</span><span class="stt"> </span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._any-string%29%29" class="RktStxLink" data-pltdoc="x">any-string</a></span><span class="RktPn">)</span> matches any string
that has a <span class="RktVal">"*/"</span> in is, so <span class="RktPn">(</span><span class="RktSym">complement</span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~3a%29%29" class="RktStxLink" data-pltdoc="x">::</a></span><span class="stt"> </span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._any-string%29%29" class="RktStxLink" data-pltdoc="x">any-string</a></span><span class="stt"> </span><span class="RktVal">"*/"</span><span class="stt"> </span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._any-string%29%29" class="RktStxLink" data-pltdoc="x">any-string</a></span><span class="RktPn">)</span><span class="RktPn">)</span> matches any string without a <span class="RktVal">"*/"</span> in it.</p></li><li><p><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~3a%29%29" class="RktStxLink" data-pltdoc="x">::</a></span><span class="hspace"> </span><span class="RktVal">"/*"</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._%2A%29%29" class="RktStxLink" data-pltdoc="x">:*</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">complement</span><span class="hspace"> </span><span class="RktVal">"*/"</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVal">"*/"</span><span class="RktPn">)</span></p><p>Matches any string that starts with <span class="RktVal">"/*"</span> and ends with
<span class="RktVal">"*/"</span>, including <span class="RktVal">"/* */ */ */"</span>.
<span class="RktPn">(</span><span class="RktSym">complement</span><span class="stt"> </span><span class="RktVal">"*/"</span><span class="RktPn">)</span> matches any string except <span class="RktVal">"*/"</span>.
This includes <span class="RktVal">"*"</span> and <span class="RktVal">"/"</span> separately. Thus
<span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._%2A%29%29" class="RktStxLink" data-pltdoc="x">:*</a></span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym">complement</span><span class="stt"> </span><span class="RktVal">"*/"</span><span class="RktPn">)</span><span class="RktPn">)</span> matches <span class="RktVal">"*/"</span> by first
matching <span class="RktVal">"*"</span> and then matching <span class="RktVal">"/"</span>. Any other
string is matched directly by <span class="RktPn">(</span><span class="RktSym">complement</span><span class="stt"> </span><span class="RktVal">"*/"</span><span class="RktPn">)</span>. In other
words, <span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._%2A%29%29" class="RktStxLink" data-pltdoc="x">:*</a></span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym">complement</span><span class="stt"> </span><span class="RktVal">"xx"</span><span class="RktPn">)</span><span class="RktPn">)</span> = <span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._any-string%29%29" class="RktStxLink" data-pltdoc="x">any-string</a></span>. It is
usually not correct to place a <span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._%2A%29%29" class="RktStxLink" data-pltdoc="x">:*</a></span> around a
<span class="RktSym">complement</span>.</p></li></ul><p>The following binding have special meaning inside of a lexer
action:</p><ul><li><p><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._start-pos%29%29" class="RktStxLink" data-pltdoc="x">start-pos</a></span> —<wbr></wbr> a <span class="RktSym"><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._position%29%29" class="RktValLink" data-pltdoc="x">position</a></span> struct for the first character matched.</p></li><li><p><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._end-pos%29%29" class="RktStxLink" data-pltdoc="x">end-pos</a></span> —<wbr></wbr> a <span class="RktSym"><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._position%29%29" class="RktValLink" data-pltdoc="x">position</a></span> struct for the character after the last character in the match.</p></li><li><p><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._lexeme%29%29" class="RktStxLink" data-pltdoc="x">lexeme</a></span> —<wbr></wbr> the matched string.</p></li><li><p><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._input-port%29%29" class="RktStxLink" data-pltdoc="x">input-port</a></span> —<wbr></wbr> the input-port being
processed (this is useful for matching input with multiple
lexers).</p></li><li><p><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._return-without-pos%29%29" class="RktStxLink" data-pltdoc="x">return-without-pos</a></span><span class="stt"> </span><span class="RktSym">x</span><span class="RktPn">)</span> is a function (continuation) that
immediately returns the value of <span class="RktSym">x</span> from the lexer. This useful
in a src-pos lexer to prevent the lexer from adding source
information. For example:</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">get-token</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._lexer-src-pos%29%29" class="RktStxLink" data-pltdoc="x">lexer-src-pos</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktMeta"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">...</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">(</span><span class="RktSym">comment</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">get-token</span><span class="hspace"> </span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._input-port%29%29" class="RktStxLink" data-pltdoc="x">input-port</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktMeta"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>would wrap the source location information for the comment around
the value of the recursive call. Using
<span class="RktPn">(</span><span class="RktPn">(</span><span class="RktSym">comment</span><span class="RktPn">)</span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._return-without-pos%29%29" class="RktStxLink" data-pltdoc="x">return-without-pos</a></span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym">get-token</span><span class="stt"> </span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._input-port%29%29" class="RktStxLink" data-pltdoc="x">input-port</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span>
will cause the value of the recursive call to be returned without
wrapping position around it.</p></li></ul><p>The lexer raises an exception <span class="RktPn">(</span><span class="RktSym">exn:read</span><span class="RktPn">)</span> if none of the
regular expressions match the input. Hint: If <span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._any-char%29%29" class="RktStxLink" data-pltdoc="x">any-char</a></span><span class="stt"> </span><span class="RktVar">custom-error-behavior</span><span class="RktPn">)</span> is the last rule, then there will always
be a match, and <span class="RktVar">custom-error-behavior</span> is executed to
handle the error situation as desired, only consuming the first
character from the input buffer.</p><p>In addition to returning characters, input
ports can return <span class="RktSym">eof-object</span>s. Custom input ports can
also return a <span class="RktSym">special-comment</span> value to indicate a
non-textual comment, or return another arbitrary value (a
special). The non-<span class="RktVar">re</span> <span class="RktVar">trigger</span> forms handle these
cases:</p><ul><li><p>The <span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=port-ops.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._eof%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">eof</a></span><span class="RktPn">)</span> rule is matched when the input port
returns an <span class="RktSym">eof-object</span> value. If no <span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=port-ops.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._eof%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">eof</a></span><span class="RktPn">)</span>
rule is present, the lexer returns the symbol <span class="RktVal">'</span><span class="RktVal">eof</span>
when the port returns an <span class="RktSym">eof-object</span> value.</p></li><li><p>The <span class="RktPn">(</span><span class="RktSym">special-comment</span><span class="RktPn">)</span> rule is matched when the
input port returns a <span class="RktSym">special-comment</span> structure. If no
<span class="RktSym">special-comment</span> rule is present, the lexer
automatically tries to return the next token from the input
port.</p></li><li><p>The <span class="RktPn">(</span><span class="RktSym">special</span><span class="RktPn">)</span> rule is matched when the input
port returns a value other than a character,
<span class="RktSym">eof-object</span>, or <span class="RktSym">special-comment</span> structure. If
no <span class="RktPn">(</span><span class="RktSym">special</span><span class="RktPn">)</span> rule is present, the lexer returns
<span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">void</a></span><span class="RktPn">)</span>.</p></li></ul><p>End-of-files, specials, special-comments and special-errors cannot
be parsed via a rule using an ordinary regular expression
(but dropping down and manipulating the port to handle them
is possible in some situations).</p><p>Since the lexer gets its source information from the port, use
<span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=linecol.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._port-count-lines%2521%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">port-count-lines!</a></span> to enable the tracking of line and
column information. Otherwise, the line and column information
will return <span class="RktVal">#f</span>.</p><p>When peeking from the input port raises an exception (such as by
an embedded XML editor with malformed syntax), the exception can
be raised before all tokens preceding the exception have been
returned.</p><p>Each time the racket code for a lexer is compiled (e.g. when a
<span class="stt">".rkt"</span> file containing a <span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._lexer%29%29" class="RktStxLink" data-pltdoc="x">lexer</a></span> form is loaded),
the lexer generator is run. To avoid this overhead place the
lexer into a module and compile the module to a <span class="stt">".zo"</span>
bytecode file.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._parser-tools/lex..rkt)._lexer-src-pos))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._lexer-src-pos%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">lexer-src-pos</a></span></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktVar">trigger</span><span class="hspace"> </span><span class="RktVar">action-expr</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Like <span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._lexer%29%29" class="RktStxLink" data-pltdoc="x">lexer</a></span>, but for each <span class="RktVar">action-result</span> produced by
an <span class="RktVar">action-expr</span>, returns <span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._make-position-token%29%29" class="RktValLink" data-pltdoc="x">make-position-token</a></span><span class="stt"> </span><span class="RktVar">action-result</span><span class="stt"> </span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._start-pos%29%29" class="RktStxLink" data-pltdoc="x">start-pos</a></span><span class="stt"> </span><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._end-pos%29%29" class="RktStxLink" data-pltdoc="x">end-pos</a></span><span class="RktPn">)</span> instead of simply
<span class="RktVar">action-result</span>.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><a name="(form._((lib._parser-tools/lex..rkt)._start-pos))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._start-pos%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">start-pos</a></span></span></p></blockquote></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><a name="(form._((lib._parser-tools/lex..rkt)._end-pos))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._end-pos%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">end-pos</a></span></span></p></blockquote></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><a name="(form._((lib._parser-tools/lex..rkt)._lexeme))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._lexeme%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">lexeme</a></span></span></p></blockquote></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><a name="(form._((lib._parser-tools/lex..rkt)._input-port))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._input-port%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">input-port</a></span></span></p></blockquote></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><a name="(form._((lib._parser-tools/lex..rkt)._return-without-pos))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._return-without-pos%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">return-without-pos</a></span></span></p></blockquote></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">Use of these names outside of a <span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._lexer%29%29" class="RktStxLink" data-pltdoc="x">lexer</a></span> action is a syntax
error.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>struct</p></div></div><table cellspacing="0" cellpadding="0" class="RForeground"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=define-struct.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._struct%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">struct</a></span></td><td><span class="hspace"> </span></td><td><a name="(def._((lib._parser-tools/lex..rkt)._position-col))"></a><a name="(def._((lib._parser-tools/lex..rkt)._position-line))"></a><a name="(def._((lib._parser-tools/lex..rkt)._position-offset))"></a><a name="(def._((lib._parser-tools/lex..rkt)._make-position))"></a><a name="(def._((lib._parser-tools/lex..rkt)._position~3f))"></a><a name="(def._((lib._parser-tools/lex..rkt)._struct~3aposition))"></a><a name="(def._((lib._parser-tools/lex..rkt)._position))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._position%29%29" class="RktValDef RktValLink" data-pltdoc="x">position</a></span></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">offset</span><span class="stt"> </span><span class="RktSym">line</span><span class="stt"> </span><span class="RktSym">col</span><span class="RktPn">)</span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:extra-constructor-name</span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._make-position%29%29" class="RktValLink" data-pltdoc="x">make-position</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">offset</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exact-positive-integer%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">exact-positive-integer?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">line</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exact-positive-integer%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">exact-positive-integer?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">col</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exact-nonnegative-integer%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">exact-nonnegative-integer?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Instances of <span class="RktSym"><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._position%29%29" class="RktValLink" data-pltdoc="x">position</a></span> are bound to <span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._start-pos%29%29" class="RktStxLink" data-pltdoc="x">start-pos</a></span> and
<span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._end-pos%29%29" class="RktStxLink" data-pltdoc="x">end-pos</a></span>. The <span class="RktSym">offset</span> field contains the offset of
the character in the input. The <span class="RktSym">line</span> field contains the
line number of the character. The <span class="RktSym">col</span> field contains the
offset in the current line.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>struct</p></div></div><table cellspacing="0" cellpadding="0" class="RForeground"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=define-struct.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._struct%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">struct</a></span></td><td><span class="hspace"> </span></td><td><a name="(def._((lib._parser-tools/lex..rkt)._position-token-end-pos))"></a><a name="(def._((lib._parser-tools/lex..rkt)._position-token-start-pos))"></a><a name="(def._((lib._parser-tools/lex..rkt)._position-token-token))"></a><a name="(def._((lib._parser-tools/lex..rkt)._make-position-token))"></a><a name="(def._((lib._parser-tools/lex..rkt)._position-token~3f))"></a><a name="(def._((lib._parser-tools/lex..rkt)._struct~3aposition-token))"></a><a name="(def._((lib._parser-tools/lex..rkt)._position-token))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._position-token%29%29" class="RktValDef RktValLink" data-pltdoc="x">position-token</a></span></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">token</span><span class="stt"> </span><span class="RktSym">start-pos</span><span class="stt"> </span><span class="RktSym">end-pos</span><span class="RktPn">)</span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:extra-constructor-name</span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._make-position-token%29%29" class="RktValLink" data-pltdoc="x">make-position-token</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">token</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">any/c</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">start-pos</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._position~3f%29%29" class="RktValLink" data-pltdoc="x">position?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">end-pos</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._position~3f%29%29" class="RktValLink" data-pltdoc="x">position?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Lexers created with <span class="RktSym">src-pos-lexers</span> return instances of <span class="RktSym"><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._position-token%29%29" class="RktValLink" data-pltdoc="x">position-token</a></span>.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>parameter</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._parser-tools/lex..rkt)._file-path))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._file-path%29%29" class="RktValDef RktValLink" data-pltdoc="x">file-path</a></span></span><span class="RktPn"></span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">any/c</a></span></p></blockquote></td></tr><tr><td><span class="RktPn">(</span><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._file-path%29%29" class="RktValDef RktValLink" data-pltdoc="x">file-path</a></span></span><span class="hspace"> </span><span class="RktVar">source</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">void?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">source</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">A parameter that the lexer uses as the source location if it
raises a <span class="RktSym">exn:fail:rad</span> error. Setting this parameter allows
DrRacket, for example, to open the file containing the error.</div></p><h4 x-source-module="(lib "parser-tools/parser-tools.scrbl")" x-source-pkg="parser-tools-doc" x-part-tag=""Lexer_Abbreviations_and_Macros"">1.2<tt> </tt><a name="(part._.Lexer_.Abbreviations_and_.Macros)"></a>Lexer Abbreviations and Macros</h4><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._parser-tools/lex..rkt)._char-set))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._char-set%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">char-set</a></span></span><span class="hspace"> </span><span class="RktVar">string</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">A <a href="#%28tech._lexer._macro%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexer macro</span></a> that matches any character in <span class="RktVar">string</span>.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><a name="(form._((lib._parser-tools/lex..rkt)._any-char))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._any-char%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">any-char</a></span></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">A <a href="#%28tech._lexer._abbreviation%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexer abbreviation</span></a> that matches any character.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><a name="(form._((lib._parser-tools/lex..rkt)._any-string))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._any-string%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">any-string</a></span></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">A <a href="#%28tech._lexer._abbreviation%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexer abbreviation</span></a> that matches any string.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><a name="(form._((lib._parser-tools/lex..rkt)._nothing))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._nothing%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">nothing</a></span></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">A <a href="#%28tech._lexer._abbreviation%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexer abbreviation</span></a> that matches no string.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><a name="(form._((lib._parser-tools/lex..rkt)._alphabetic))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._alphabetic%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">alphabetic</a></span></span></p></blockquote></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><a name="(form._((lib._parser-tools/lex..rkt)._lower-case))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._lower-case%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">lower-case</a></span></span></p></blockquote></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><a name="(form._((lib._parser-tools/lex..rkt)._upper-case))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._upper-case%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">upper-case</a></span></span></p></blockquote></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><a name="(form._((lib._parser-tools/lex..rkt)._title-case))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._title-case%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">title-case</a></span></span></p></blockquote></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><a name="(form._((lib._parser-tools/lex..rkt)._numeric))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._numeric%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">numeric</a></span></span></p></blockquote></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><a name="(form._((lib._parser-tools/lex..rkt)._symbolic))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._symbolic%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">symbolic</a></span></span></p></blockquote></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><a name="(form._((lib._parser-tools/lex..rkt)._punctuation))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._punctuation%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">punctuation</a></span></span></p></blockquote></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><a name="(form._((lib._parser-tools/lex..rkt)._graphic))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._graphic%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">graphic</a></span></span></p></blockquote></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><a name="(form._((lib._parser-tools/lex..rkt)._whitespace))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._whitespace%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">whitespace</a></span></span></p></blockquote></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><a name="(form._((lib._parser-tools/lex..rkt)._blank))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._blank%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">blank</a></span></span></p></blockquote></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><a name="(form._((lib._parser-tools/lex..rkt)._iso-control))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._iso-control%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">iso-control</a></span></span></p></blockquote></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara"><a href="#%28tech._lexer._abbreviation%29" class="techoutside" data-pltdoc="x"><span class="techinside">Lexer abbreviations</span></a> that match <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=characters.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._char-alphabetic%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">char-alphabetic?</a></span>
characters, <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=characters.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._char-lower-case%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">char-lower-case?</a></span> characters, etc.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._parser-tools/lex..rkt)._define-lex-abbrev))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._define-lex-abbrev%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">define-lex-abbrev</a></span></span><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktVar">re</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Defines a <a href="#%28tech._lexer._abbreviation%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexer abbreviation</span></a> by associating a regular
expression to be used in place of the <span class="RktVar">id</span> in other
regular expression. The definition of name has the same scoping
properties as a other syntactic binding (e.g., it can be exported
from a module).</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._parser-tools/lex..rkt)._define-lex-abbrevs))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._define-lex-abbrevs%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">define-lex-abbrevs</a></span></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktVar">re</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Like <span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._define-lex-abbrev%29%29" class="RktStxLink" data-pltdoc="x">define-lex-abbrev</a></span>, but defines several <a href="#%28tech._lexer._abbreviation%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexer
abbreviations</span></a>.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._parser-tools/lex..rkt)._define-lex-trans))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._define-lex-trans%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">define-lex-trans</a></span></span><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktVar">trans-expr</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Defines a <a href="#%28tech._lexer._macro%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexer macro</span></a>, where <span class="RktVar">trans-expr</span> produces a
transformer procedure that takes one argument. When <span class="RktPn">(</span><span class="RktVar">id</span><span class="stt"> </span><span class="RktVar">datum</span><span class="stt"> </span><span class="RktMeta"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span> appears as a regular expression, it is replaced with
the result of applying the transformer to the expression.</div></p><h4 x-source-module="(lib "parser-tools/parser-tools.scrbl")" x-source-pkg="parser-tools-doc" x-part-tag=""Lexer_SRE_Operators"">1.3<tt> </tt><a name="(part._.Lexer_.S.R.E_.Operators)"></a><a name="(mod-path._parser-tools/lex-sre)"></a>Lexer SRE Operators</h4><p><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._parser-tools%2Flex-sre%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">parser-tools/lex-sre</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">parser-tools-lib</span></span></td></tr></table></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._parser-tools/lex-sre..rkt)._*))"></a><span title="Provided from: parser-tools/lex-sre | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._%2A%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">*</a></span></span><span class="hspace"> </span><span class="RktVar">re</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Repetition of <span class="RktVar">re</span> sequence 0 or more times.</div><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._parser-tools/lex-sre..rkt)._+))"></a><span title="Provided from: parser-tools/lex-sre | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._%2B%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">+</a></span></span><span class="hspace"> </span><span class="RktVar">re</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Repetition of <span class="RktVar">re</span> sequence 1 or more times.</div><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._parser-tools/lex-sre..rkt)._~3f))"></a><span title="Provided from: parser-tools/lex-sre | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~3f%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">?</a></span></span><span class="hspace"> </span><span class="RktVar">re</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Zero or one occurrence of <span class="RktVar">re</span> sequence.</div><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._parser-tools/lex-sre..rkt)._~3d))"></a><span title="Provided from: parser-tools/lex-sre | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~3d%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">=</a></span></span><span class="hspace"> </span><span class="RktVar">n</span><span class="hspace"> </span><span class="RktVar">re</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Exactly <span class="RktVar">n</span> occurrences of <span class="RktVar">re</span> sequence, where
<span class="RktVar">n</span> must be a literal exact, non-negative number.</div><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._parser-tools/lex-sre..rkt)._~3e~3d))"></a><span title="Provided from: parser-tools/lex-sre | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~3e~3d%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">>=</a></span></span><span class="hspace"> </span><span class="RktVar">n</span><span class="hspace"> </span><span class="RktVar">re</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">At least <span class="RktVar">n</span> occurrences of <span class="RktVar">re</span> sequence, where
<span class="RktVar">n</span> must be a literal exact, non-negative number.</div><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._parser-tools/lex-sre..rkt)._**))"></a><span title="Provided from: parser-tools/lex-sre | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._%2A%2A%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">**</a></span></span><span class="hspace"> </span><span class="RktVar">n</span><span class="hspace"> </span><span class="RktVar">m</span><span class="hspace"> </span><span class="RktVar">re</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Between <span class="RktVar">n</span> and <span class="RktVar">m</span> (inclusive) occurrences of
<span class="RktVar">re</span> sequence, where <span class="RktVar">n</span> must be a literal exact,
non-negative number, and <span class="RktVar">m</span> must be literally either
<span class="RktVal">#f</span>, <span class="RktVal">+inf.0</span>, or an exact, non-negative number; a
<span class="RktVal">#f</span> value for <span class="RktVar">m</span> is the same as <span class="RktVal">+inf.0</span>.</div><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._parser-tools/lex-sre..rkt)._or))"></a><span title="Provided from: parser-tools/lex-sre | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._or%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">or</a></span></span><span class="hspace"> </span><span class="RktVar">re</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Same as <span class="RktPn">(</span><span class="RktSym">union</span><span class="stt"> </span><span class="RktVar">re</span><span class="stt"> </span><span class="RktMeta"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span>.</div><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._parser-tools/lex-sre..rkt)._~3a))"></a><span title="Provided from: parser-tools/lex-sre | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~3a%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">:</a></span></span><span class="hspace"> </span><span class="RktVar">re</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._parser-tools/lex-sre..rkt)._seq))"></a><span title="Provided from: parser-tools/lex-sre | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._seq%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">seq</a></span></span><span class="hspace"> </span><span class="RktVar">re</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">Both forms concatenate the <span class="RktVar">re</span>s.</div><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._parser-tools/lex-sre..rkt)._~26))"></a><span title="Provided from: parser-tools/lex-sre | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~26%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">&</a></span></span><span class="hspace"> </span><span class="RktVar">re</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Intersects the <span class="RktVar">re</span>s.</div><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._parser-tools/lex-sre..rkt)._-))"></a><span title="Provided from: parser-tools/lex-sre | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._-%29%29" class="RktStxDef RktStxLink" data-pltdoc="x"><span class="nobreak">-</span></a></span></span><span class="hspace"> </span><span class="RktVar">re</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">The set difference of the <span class="RktVar">re</span>s.</div><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._parser-tools/lex-sre..rkt)._~7e))"></a><span title="Provided from: parser-tools/lex-sre | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~7e%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">~</a></span></span><span class="hspace"> </span><span class="RktVar">re</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Character-set complement, which each <span class="RktVar">re</span> must match exactly
one character.</div><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._parser-tools/lex-sre..rkt)._/))"></a><span title="Provided from: parser-tools/lex-sre | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._%2F%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">/</a></span></span><span class="hspace"> </span><span class="RktVar">char-or-string</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Character ranges, matching characters between successive pairs of
characters.</div></p><h4 x-source-module="(lib "parser-tools/parser-tools.scrbl")" x-source-pkg="parser-tools-doc" x-part-tag=""Lexer_Legacy_Operators"">1.4<tt> </tt><a name="(part._.Lexer_.Legacy_.Operators)"></a><a name="(mod-path._parser-tools/lex-plt-v200)"></a>Lexer Legacy Operators</h4><p><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._parser-tools%2Flex-plt-v200%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">parser-tools/lex-plt-v200</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">parser-tools-lib</span></span></td></tr></table></p><p><div class="SIntrapara">The <a href="#%28mod-path._parser-tools%2Flex-plt-v200%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">parser-tools/lex-plt-v200</span></a> module re-exports
<span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._%2A%29%29" class="RktStxLink" data-pltdoc="x">*</a></span>, <span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._%2B%29%29" class="RktStxLink" data-pltdoc="x">+</a></span>, <span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~3f%29%29" class="RktStxLink" data-pltdoc="x">?</a></span>, and <span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~26%29%29" class="RktStxLink" data-pltdoc="x">&</a></span> from
<a href="#%28mod-path._parser-tools%2Flex-sre%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">parser-tools/lex-sre</span></a>. It also re-exports
<span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._or%29%29" class="RktStxLink" data-pltdoc="x">:or</a></span> as <span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._or%29%29" class="RktStxLink" data-pltdoc="x">:</a></span>, <span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~3a%29%29" class="RktStxLink" data-pltdoc="x">::</a></span> as <span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~3a%29%29" class="RktStxLink" data-pltdoc="x">@</a></span>, <span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~7e%29%29" class="RktStxLink" data-pltdoc="x">:~</a></span>
as <span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._~7e%29%29" class="RktStxLink" data-pltdoc="x">^</a></span>, and <span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._%2F%29%29" class="RktStxLink" data-pltdoc="x">:/</a></span> as <span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-sre..rkt%29._%2F%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-</span></a></span>.</div><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._parser-tools/lex-plt-v200..rkt)._epsilon))"></a><span title="Provided from: parser-tools/lex-plt-v200 | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-plt-v200..rkt%29._epsilon%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">epsilon</a></span></span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">A <a href="#%28tech._lexer._macro%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexer macro</span></a> that matches an empty sequence.</div><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._parser-tools/lex-plt-v200..rkt)._~7e))"></a><span title="Provided from: parser-tools/lex-plt-v200 | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex-plt-v200..rkt%29._~7e%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">~</a></span></span><span class="hspace"> </span><span class="RktVar">re</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">The same as <span class="RktPn">(</span><span class="RktSym">complement</span><span class="stt"> </span><span class="RktVar">re</span><span class="stt"> </span><span class="RktMeta"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span>.</div></p><h4 x-source-module="(lib "parser-tools/parser-tools.scrbl")" x-source-pkg="parser-tools-doc" x-part-tag=""Tokens"">1.5<tt> </tt><a name="(part._.Tokens)"></a>Tokens</h4><p>Each <span class="RktVar">action-expr</span> in a <span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._lexer%29%29" class="RktStxLink" data-pltdoc="x">lexer</a></span> form can produce any
kind of value, but for many purposes, producing a <a name="(tech._token)"></a><span style="font-style: italic">token</span>
value is useful. Tokens are usually necessary for inter-operating with
a parser generated by <span class="RktSym">parser-tools/parser</span>, but tokens may not
be the right choice when using <span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._lexer%29%29" class="RktStxLink" data-pltdoc="x">lexer</a></span> in other situations.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._parser-tools/lex..rkt)._define-tokens))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._define-tokens%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">define-tokens</a></span></span><span class="hspace"> </span><span class="RktVar">group-id</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktVar">token-id</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Binds <span class="RktVar">group-id</span> to the group of tokens being defined. For
each <span class="RktVar">token-id</span>, a function
<span class="RktSym">token-</span><span class="RktVar">token-id</span> is created that takes any
value and puts it in a token record specific to <span class="RktVar">token-id</span>.
The token value is inspected using <span class="RktVar">token-id</span> and
<span class="RktSym"><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._token-value%29%29" class="RktValLink" data-pltdoc="x">token-value</a></span>.</div></p><p>A token cannot be named <span class="RktSym">error</span>, since
<span class="RktSym">error</span> it has special use in the parser.</p><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._parser-tools/lex..rkt)._define-empty-tokens))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._define-empty-tokens%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">define-empty-tokens</a></span></span><span class="hspace"> </span><span class="RktVar">group-id</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktVar">token-id</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote><p>Like <span class="RktSym"><a href="#%28form._%28%28lib._parser-tools%2Flex..rkt%29._define-tokens%29%29" class="RktStxLink" data-pltdoc="x">define-tokens</a></span>, except a each token constructor
<span class="RktSym">token-</span><span class="RktVar">token-id</span> takes no arguments and returns
<span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=quote.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._quote%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">quote</a></span><span class="stt"> </span><span class="RktVar">token-id</span><span class="RktPn">)</span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._parser-tools/lex..rkt)._token-name))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._token-name%29%29" class="RktValDef RktValLink" data-pltdoc="x">token-name</a></span></span><span class="hspace"> </span><span class="RktVar">t</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">t</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._token~3f%29%29" class="RktValLink" data-pltdoc="x">token?</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Returns the name of a token that is represented either by a symbol
or a token structure.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._parser-tools/lex..rkt)._token-value))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._token-value%29%29" class="RktValDef RktValLink" data-pltdoc="x">token-value</a></span></span><span class="hspace"> </span><span class="RktVar">t</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">any/c</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">t</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._token~3f%29%29" class="RktValLink" data-pltdoc="x">token?</a></span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._symbol%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">symbol?</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Returns the value of a token that is represented either by a symbol
or a token structure, returning <span class="RktVal">#f</span> for a symbol token.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._parser-tools/lex..rkt)._token~3f))"></a><span title="Provided from: parser-tools/lex | Package: parser-tools-lib"><span class="RktSym"><a href="#%28def._%28%28lib._parser-tools%2Flex..rkt%29._token~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">token?</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns <span class="RktVal">#t</span> if <span class="RktSym">val</span> is a
token structure, <span class="RktVal">#f</span> otherwise.</div></p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.7", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.7");">top</a></span><span class="navright"> <a href="index.html" title="backward to "Parser Tools: lex and yacc-style Parsing"" data-pltdoc="x">← prev</a> <a href="index.html" title="up to "Parser Tools: lex and yacc-style Parsing"" data-pltdoc="x">up</a> <a href="LALR_1__Parsers.html" title="forward to "2 LALR(1) Parsers"" data-pltdoc="x">next →</a></span> </div></div></div><div id="contextindicator"> </div></body></html>
|