lisp.py 154 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146
  1. """
  2. pygments.lexers.lisp
  3. ~~~~~~~~~~~~~~~~~~~~
  4. Lexers for Lispy languages.
  5. :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
  6. :license: BSD, see LICENSE for details.
  7. """
  8. import re
  9. from pygments.lexer import RegexLexer, include, bygroups, words, default
  10. from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
  11. Number, Punctuation, Literal, Error, Whitespace
  12. from pygments.lexers.python import PythonLexer
  13. from pygments.lexers._scheme_builtins import scheme_keywords, scheme_builtins
  14. __all__ = ['SchemeLexer', 'CommonLispLexer', 'HyLexer', 'RacketLexer',
  15. 'NewLispLexer', 'EmacsLispLexer', 'ShenLexer', 'CPSALexer',
  16. 'XtlangLexer', 'FennelLexer', 'JanetLexer']
  17. class SchemeLexer(RegexLexer):
  18. """
  19. A Scheme lexer.
  20. This parser is checked with pastes from the LISP pastebin
  21. at http://paste.lisp.org/ to cover as much syntax as possible.
  22. It supports the full Scheme syntax as defined in R5RS.
  23. """
  24. name = 'Scheme'
  25. url = 'http://www.scheme-reports.org/'
  26. aliases = ['scheme', 'scm']
  27. filenames = ['*.scm', '*.ss']
  28. mimetypes = ['text/x-scheme', 'application/x-scheme']
  29. version_added = '0.6'
  30. flags = re.DOTALL | re.MULTILINE
  31. # valid names for identifiers
  32. # well, names can only not consist fully of numbers
  33. # but this should be good enough for now
  34. valid_name = r'[\w!$%&*+,/:<=>?@^~|-]+'
  35. # Use within verbose regexes
  36. token_end = r'''
  37. (?=
  38. \s # whitespace
  39. | ; # comment
  40. | \#[;|!] # fancy comments
  41. | [)\]] # end delimiters
  42. | $ # end of file
  43. )
  44. '''
  45. # Recognizing builtins.
  46. def get_tokens_unprocessed(self, text):
  47. for index, token, value in super().get_tokens_unprocessed(text):
  48. if token is Name.Function or token is Name.Variable:
  49. if value in scheme_keywords:
  50. yield index, Keyword, value
  51. elif value in scheme_builtins:
  52. yield index, Name.Builtin, value
  53. else:
  54. yield index, token, value
  55. else:
  56. yield index, token, value
  57. # Scheme has funky syntactic rules for numbers. These are all
  58. # valid number literals: 5.0e55|14, 14/13, -1+5j, +1@5, #b110,
  59. # #o#Iinf.0-nan.0i. This is adapted from the formal grammar given
  60. # in http://www.r6rs.org/final/r6rs.pdf, section 4.2.1. Take a
  61. # deep breath ...
  62. # It would be simpler if we could just not bother about invalid
  63. # numbers like #b35. But we cannot parse 'abcdef' without #x as a
  64. # number.
  65. number_rules = {}
  66. for base in (2, 8, 10, 16):
  67. if base == 2:
  68. digit = r'[01]'
  69. radix = r'( \#[bB] )'
  70. elif base == 8:
  71. digit = r'[0-7]'
  72. radix = r'( \#[oO] )'
  73. elif base == 10:
  74. digit = r'[0-9]'
  75. radix = r'( (\#[dD])? )'
  76. elif base == 16:
  77. digit = r'[0-9a-fA-F]'
  78. radix = r'( \#[xX] )'
  79. # Radix, optional exactness indicator.
  80. prefix = rf'''
  81. (
  82. {radix} (\#[iIeE])?
  83. | \#[iIeE] {radix}
  84. )
  85. '''
  86. # Simple unsigned number or fraction.
  87. ureal = rf'''
  88. (
  89. {digit}+
  90. ( / {digit}+ )?
  91. )
  92. '''
  93. # Add decimal numbers.
  94. if base == 10:
  95. decimal = r'''
  96. (
  97. # Decimal part
  98. (
  99. [0-9]+ ([.][0-9]*)?
  100. | [.][0-9]+
  101. )
  102. # Optional exponent
  103. (
  104. [eEsSfFdDlL] [+-]? [0-9]+
  105. )?
  106. # Optional mantissa width
  107. (
  108. \|[0-9]+
  109. )?
  110. )
  111. '''
  112. ureal = rf'''
  113. (
  114. {decimal} (?!/)
  115. | {ureal}
  116. )
  117. '''
  118. naninf = r'(nan.0|inf.0)'
  119. real = rf'''
  120. (
  121. [+-] {naninf} # Sign mandatory
  122. | [+-]? {ureal} # Sign optional
  123. )
  124. '''
  125. complex_ = rf'''
  126. (
  127. {real}? [+-] ({naninf}|{ureal})? i
  128. | {real} (@ {real})?
  129. )
  130. '''
  131. num = rf'''(?x)
  132. (
  133. {prefix}
  134. {complex_}
  135. )
  136. # Need to ensure we have a full token. 1+ is not a
  137. # number followed by something else, but a function
  138. # name.
  139. {token_end}
  140. '''
  141. number_rules[base] = num
  142. # If you have a headache now, say thanks to RnRS editors.
  143. # Doing it this way is simpler than splitting the number(10)
  144. # regex in a floating-point and a no-floating-point version.
  145. def decimal_cb(self, match):
  146. if '.' in match.group():
  147. token_type = Number.Float # includes [+-](inf|nan).0
  148. else:
  149. token_type = Number.Integer
  150. yield match.start(), token_type, match.group()
  151. # --
  152. # The 'scheme-root' state parses as many expressions as needed, always
  153. # delegating to the 'scheme-value' state. The latter parses one complete
  154. # expression and immediately pops back. This is needed for the LilyPondLexer.
  155. # When LilyPond encounters a #, it starts parsing embedded Scheme code, and
  156. # returns to normal syntax after one expression. We implement this
  157. # by letting the LilyPondLexer subclass the SchemeLexer. When it finds
  158. # the #, the LilyPondLexer goes to the 'value' state, which then pops back
  159. # to LilyPondLexer. The 'root' state of the SchemeLexer merely delegates the
  160. # work to 'scheme-root'; this is so that LilyPondLexer can inherit
  161. # 'scheme-root' and redefine 'root'.
  162. tokens = {
  163. 'root': [
  164. default('scheme-root'),
  165. ],
  166. 'scheme-root': [
  167. default('value'),
  168. ],
  169. 'value': [
  170. # the comments
  171. # and going to the end of the line
  172. (r';.*?$', Comment.Single),
  173. # multi-line comment
  174. (r'#\|', Comment.Multiline, 'multiline-comment'),
  175. # commented form (entire sexpr following)
  176. (r'#;[([]', Comment, 'commented-form'),
  177. # commented datum
  178. (r'#;', Comment, 'commented-datum'),
  179. # signifies that the program text that follows is written with the
  180. # lexical and datum syntax described in r6rs
  181. (r'#!r6rs', Comment),
  182. # whitespaces - usually not relevant
  183. (r'\s+', Whitespace),
  184. # numbers
  185. (number_rules[2], Number.Bin, '#pop'),
  186. (number_rules[8], Number.Oct, '#pop'),
  187. (number_rules[10], decimal_cb, '#pop'),
  188. (number_rules[16], Number.Hex, '#pop'),
  189. # strings, symbols, keywords and characters
  190. (r'"', String, 'string'),
  191. (r"'" + valid_name, String.Symbol, "#pop"),
  192. (r'#:' + valid_name, Keyword.Declaration, '#pop'),
  193. (r"#\\([()/'\"._!§$%& ?=+-]|[a-zA-Z0-9]+)", String.Char, "#pop"),
  194. # constants
  195. (r'(#t|#f)', Name.Constant, '#pop'),
  196. # special operators
  197. (r"('|#|`|,@|,|\.)", Operator),
  198. # first variable in a quoted string like
  199. # '(this is syntactic sugar)
  200. (r"(?<='\()" + valid_name, Name.Variable, '#pop'),
  201. (r"(?<=#\()" + valid_name, Name.Variable, '#pop'),
  202. # Functions -- note that this also catches variables
  203. # defined in let/let*, but there is little that can
  204. # be done about it.
  205. (r'(?<=\()' + valid_name, Name.Function, '#pop'),
  206. # find the remaining variables
  207. (valid_name, Name.Variable, '#pop'),
  208. # the famous parentheses!
  209. # Push scheme-root to enter a state that will parse as many things
  210. # as needed in the parentheses.
  211. (r'[([]', Punctuation, 'scheme-root'),
  212. # Pop one 'value', one 'scheme-root', and yet another 'value', so
  213. # we get back to a state parsing expressions as needed in the
  214. # enclosing context.
  215. (r'[)\]]', Punctuation, '#pop:3'),
  216. ],
  217. 'multiline-comment': [
  218. (r'#\|', Comment.Multiline, '#push'),
  219. (r'\|#', Comment.Multiline, '#pop'),
  220. (r'[^|#]+', Comment.Multiline),
  221. (r'[|#]', Comment.Multiline),
  222. ],
  223. 'commented-form': [
  224. (r'[([]', Comment, '#push'),
  225. (r'[)\]]', Comment, '#pop'),
  226. (r'[^()[\]]+', Comment),
  227. ],
  228. 'commented-datum': [
  229. (rf'(?x).*?{token_end}', Comment, '#pop'),
  230. ],
  231. 'string': [
  232. # Pops back from 'string', and pops 'value' as well.
  233. ('"', String, '#pop:2'),
  234. # Hex escape sequences, R6RS-style.
  235. (r'\\x[0-9a-fA-F]+;', String.Escape),
  236. # We try R6RS style first, but fall back to Guile-style.
  237. (r'\\x[0-9a-fA-F]{2}', String.Escape),
  238. # Other special escape sequences implemented by Guile.
  239. (r'\\u[0-9a-fA-F]{4}', String.Escape),
  240. (r'\\U[0-9a-fA-F]{6}', String.Escape),
  241. # Escape sequences are not overly standardized. Recognizing
  242. # a single character after the backslash should be good enough.
  243. # NB: we have DOTALL.
  244. (r'\\.', String.Escape),
  245. # The rest
  246. (r'[^\\"]+', String),
  247. ]
  248. }
  249. class CommonLispLexer(RegexLexer):
  250. """
  251. A Common Lisp lexer.
  252. """
  253. name = 'Common Lisp'
  254. url = 'https://lisp-lang.org/'
  255. aliases = ['common-lisp', 'cl', 'lisp']
  256. filenames = ['*.cl', '*.lisp']
  257. mimetypes = ['text/x-common-lisp']
  258. version_added = '0.9'
  259. flags = re.IGNORECASE | re.MULTILINE
  260. # couple of useful regexes
  261. # characters that are not macro-characters and can be used to begin a symbol
  262. nonmacro = r'\\.|[\w!$%&*+-/<=>?@\[\]^{}~]'
  263. constituent = nonmacro + '|[#.:]'
  264. terminated = r'(?=[ "()\'\n,;`])' # whitespace or terminating macro characters
  265. # symbol token, reverse-engineered from hyperspec
  266. # Take a deep breath...
  267. symbol = rf'(\|[^|]+\||(?:{nonmacro})(?:{constituent})*)'
  268. def __init__(self, **options):
  269. from pygments.lexers._cl_builtins import BUILTIN_FUNCTIONS, \
  270. SPECIAL_FORMS, MACROS, LAMBDA_LIST_KEYWORDS, DECLARATIONS, \
  271. BUILTIN_TYPES, BUILTIN_CLASSES
  272. self.builtin_function = BUILTIN_FUNCTIONS
  273. self.special_forms = SPECIAL_FORMS
  274. self.macros = MACROS
  275. self.lambda_list_keywords = LAMBDA_LIST_KEYWORDS
  276. self.declarations = DECLARATIONS
  277. self.builtin_types = BUILTIN_TYPES
  278. self.builtin_classes = BUILTIN_CLASSES
  279. RegexLexer.__init__(self, **options)
  280. def get_tokens_unprocessed(self, text):
  281. stack = ['root']
  282. for index, token, value in RegexLexer.get_tokens_unprocessed(self, text, stack):
  283. if token is Name.Variable:
  284. if value in self.builtin_function:
  285. yield index, Name.Builtin, value
  286. continue
  287. if value in self.special_forms:
  288. yield index, Keyword, value
  289. continue
  290. if value in self.macros:
  291. yield index, Name.Builtin, value
  292. continue
  293. if value in self.lambda_list_keywords:
  294. yield index, Keyword, value
  295. continue
  296. if value in self.declarations:
  297. yield index, Keyword, value
  298. continue
  299. if value in self.builtin_types:
  300. yield index, Keyword.Type, value
  301. continue
  302. if value in self.builtin_classes:
  303. yield index, Name.Class, value
  304. continue
  305. yield index, token, value
  306. tokens = {
  307. 'root': [
  308. default('body'),
  309. ],
  310. 'multiline-comment': [
  311. (r'#\|', Comment.Multiline, '#push'), # (cf. Hyperspec 2.4.8.19)
  312. (r'\|#', Comment.Multiline, '#pop'),
  313. (r'[^|#]+', Comment.Multiline),
  314. (r'[|#]', Comment.Multiline),
  315. ],
  316. 'commented-form': [
  317. (r'\(', Comment.Preproc, '#push'),
  318. (r'\)', Comment.Preproc, '#pop'),
  319. (r'[^()]+', Comment.Preproc),
  320. ],
  321. 'body': [
  322. # whitespace
  323. (r'\s+', Whitespace),
  324. # single-line comment
  325. (r';.*$', Comment.Single),
  326. # multi-line comment
  327. (r'#\|', Comment.Multiline, 'multiline-comment'),
  328. # encoding comment (?)
  329. (r'#\d*Y.*$', Comment.Special),
  330. # strings and characters
  331. (r'"(\\.|\\\n|[^"\\])*"', String),
  332. # quoting
  333. (r":" + symbol, String.Symbol),
  334. (r"::" + symbol, String.Symbol),
  335. (r":#" + symbol, String.Symbol),
  336. (r"'" + symbol, String.Symbol),
  337. (r"'", Operator),
  338. (r"`", Operator),
  339. # decimal numbers
  340. (r'[-+]?\d+\.?' + terminated, Number.Integer),
  341. (r'[-+]?\d+/\d+' + terminated, Number),
  342. (r'[-+]?(\d*\.\d+([defls][-+]?\d+)?|\d+(\.\d*)?[defls][-+]?\d+)' +
  343. terminated, Number.Float),
  344. # sharpsign strings and characters
  345. (r"#\\." + terminated, String.Char),
  346. (r"#\\" + symbol, String.Char),
  347. # vector
  348. (r'#\(', Operator, 'body'),
  349. # bitstring
  350. (r'#\d*\*[01]*', Literal.Other),
  351. # uninterned symbol
  352. (r'#:' + symbol, String.Symbol),
  353. # read-time and load-time evaluation
  354. (r'#[.,]', Operator),
  355. # function shorthand
  356. (r'#\'', Name.Function),
  357. # binary rational
  358. (r'#b[+-]?[01]+(/[01]+)?', Number.Bin),
  359. # octal rational
  360. (r'#o[+-]?[0-7]+(/[0-7]+)?', Number.Oct),
  361. # hex rational
  362. (r'#x[+-]?[0-9a-f]+(/[0-9a-f]+)?', Number.Hex),
  363. # radix rational
  364. (r'#\d+r[+-]?[0-9a-z]+(/[0-9a-z]+)?', Number),
  365. # complex
  366. (r'(#c)(\()', bygroups(Number, Punctuation), 'body'),
  367. # array
  368. (r'(#\d+a)(\()', bygroups(Literal.Other, Punctuation), 'body'),
  369. # structure
  370. (r'(#s)(\()', bygroups(Literal.Other, Punctuation), 'body'),
  371. # path
  372. (r'#p?"(\\.|[^"])*"', Literal.Other),
  373. # reference
  374. (r'#\d+=', Operator),
  375. (r'#\d+#', Operator),
  376. # read-time comment
  377. (r'#+nil' + terminated + r'\s*\(', Comment.Preproc, 'commented-form'),
  378. # read-time conditional
  379. (r'#[+-]', Operator),
  380. # special operators that should have been parsed already
  381. (r'(,@|,|\.)', Operator),
  382. # special constants
  383. (r'(t|nil)' + terminated, Name.Constant),
  384. # functions and variables
  385. (r'\*' + symbol + r'\*', Name.Variable.Global),
  386. (symbol, Name.Variable),
  387. # parentheses
  388. (r'\(', Punctuation, 'body'),
  389. (r'\)', Punctuation, '#pop'),
  390. ],
  391. }
  392. def analyse_text(text):
  393. """Competes with Visual Prolog on *.cl"""
  394. # This is a *really* good indicator (and not conflicting with Visual Prolog)
  395. # '(defun ' first on a line
  396. # section keyword alone on line e.g. 'clauses'
  397. if re.search(r'^\s*\(defun\s', text):
  398. return 0.8
  399. else:
  400. return 0
  401. class HyLexer(RegexLexer):
  402. """
  403. Lexer for Hy source code.
  404. """
  405. name = 'Hy'
  406. url = 'http://hylang.org/'
  407. aliases = ['hylang', 'hy']
  408. filenames = ['*.hy']
  409. mimetypes = ['text/x-hy', 'application/x-hy']
  410. version_added = '2.0'
  411. special_forms = (
  412. 'cond', 'for', '->', '->>', 'car',
  413. 'cdr', 'first', 'rest', 'let', 'when', 'unless',
  414. 'import', 'do', 'progn', 'get', 'slice', 'assoc', 'with-decorator',
  415. ',', 'list_comp', 'kwapply', '~', 'is', 'in', 'is-not', 'not-in',
  416. 'quasiquote', 'unquote', 'unquote-splice', 'quote', '|', '<<=', '>>=',
  417. 'foreach', 'while',
  418. 'eval-and-compile', 'eval-when-compile'
  419. )
  420. declarations = (
  421. 'def', 'defn', 'defun', 'defmacro', 'defclass', 'lambda', 'fn', 'setv'
  422. )
  423. hy_builtins = ()
  424. hy_core = (
  425. 'cycle', 'dec', 'distinct', 'drop', 'even?', 'filter', 'inc',
  426. 'instance?', 'iterable?', 'iterate', 'iterator?', 'neg?',
  427. 'none?', 'nth', 'numeric?', 'odd?', 'pos?', 'remove', 'repeat',
  428. 'repeatedly', 'take', 'take_nth', 'take_while', 'zero?'
  429. )
  430. builtins = hy_builtins + hy_core
  431. # valid names for identifiers
  432. # well, names can only not consist fully of numbers
  433. # but this should be good enough for now
  434. valid_name = r"[^ \t\n\r\f\v()[\]{};\"'`~]+"
  435. def _multi_escape(entries):
  436. return words(entries, suffix=' ')
  437. tokens = {
  438. 'root': [
  439. # the comments - always starting with semicolon
  440. # and going to the end of the line
  441. (r';.*$', Comment.Single),
  442. # whitespaces - usually not relevant
  443. (r'[ \t\n\r\f\v]+', Whitespace),
  444. # numbers
  445. (r'-?\d+\.\d+', Number.Float),
  446. (r'-?\d+', Number.Integer),
  447. (r'0[0-7]+j?', Number.Oct),
  448. (r'0[xX][a-fA-F0-9]+', Number.Hex),
  449. # strings, symbols and characters
  450. (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
  451. (r"'" + valid_name, String.Symbol),
  452. (r"\\(.|[a-z]+)", String.Char),
  453. (r'^(\s*)([rRuU]{,2}"""(?:.|\n)*?""")', bygroups(Text, String.Doc)),
  454. (r"^(\s*)([rRuU]{,2}'''(?:.|\n)*?''')", bygroups(Text, String.Doc)),
  455. # keywords
  456. (r'::?' + valid_name, String.Symbol),
  457. # special operators
  458. (r'~@|[`\'#^~&@]', Operator),
  459. include('py-keywords'),
  460. include('py-builtins'),
  461. # highlight the special forms
  462. (_multi_escape(special_forms), Keyword),
  463. # Technically, only the special forms are 'keywords'. The problem
  464. # is that only treating them as keywords means that things like
  465. # 'defn' and 'ns' need to be highlighted as builtins. This is ugly
  466. # and weird for most styles. So, as a compromise we're going to
  467. # highlight them as Keyword.Declarations.
  468. (_multi_escape(declarations), Keyword.Declaration),
  469. # highlight the builtins
  470. (_multi_escape(builtins), Name.Builtin),
  471. # the remaining functions
  472. (r'(?<=\()' + valid_name, Name.Function),
  473. # find the remaining variables
  474. (valid_name, Name.Variable),
  475. # Hy accepts vector notation
  476. (r'(\[|\])', Punctuation),
  477. # Hy accepts map notation
  478. (r'(\{|\})', Punctuation),
  479. # the famous parentheses!
  480. (r'(\(|\))', Punctuation),
  481. ],
  482. 'py-keywords': PythonLexer.tokens['keywords'],
  483. 'py-builtins': PythonLexer.tokens['builtins'],
  484. }
  485. def analyse_text(text):
  486. if '(import ' in text or '(defn ' in text:
  487. return 0.9
  488. class RacketLexer(RegexLexer):
  489. """
  490. Lexer for Racket source code (formerly
  491. known as PLT Scheme).
  492. """
  493. name = 'Racket'
  494. url = 'http://racket-lang.org/'
  495. aliases = ['racket', 'rkt']
  496. filenames = ['*.rkt', '*.rktd', '*.rktl']
  497. mimetypes = ['text/x-racket', 'application/x-racket']
  498. version_added = '1.6'
  499. # Generated by example.rkt
  500. _keywords = (
  501. '#%app', '#%datum', '#%declare', '#%expression', '#%module-begin',
  502. '#%plain-app', '#%plain-lambda', '#%plain-module-begin',
  503. '#%printing-module-begin', '#%provide', '#%require',
  504. '#%stratified-body', '#%top', '#%top-interaction',
  505. '#%variable-reference', '->', '->*', '->*m', '->d', '->dm', '->i',
  506. '->m', '...', ':do-in', '==', '=>', '_', 'absent', 'abstract',
  507. 'all-defined-out', 'all-from-out', 'and', 'any', 'augment', 'augment*',
  508. 'augment-final', 'augment-final*', 'augride', 'augride*', 'begin',
  509. 'begin-for-syntax', 'begin0', 'case', 'case->', 'case->m',
  510. 'case-lambda', 'class', 'class*', 'class-field-accessor',
  511. 'class-field-mutator', 'class/c', 'class/derived', 'combine-in',
  512. 'combine-out', 'command-line', 'compound-unit', 'compound-unit/infer',
  513. 'cond', 'cons/dc', 'contract', 'contract-out', 'contract-struct',
  514. 'contracted', 'define', 'define-compound-unit',
  515. 'define-compound-unit/infer', 'define-contract-struct',
  516. 'define-custom-hash-types', 'define-custom-set-types',
  517. 'define-for-syntax', 'define-local-member-name', 'define-logger',
  518. 'define-match-expander', 'define-member-name',
  519. 'define-module-boundary-contract', 'define-namespace-anchor',
  520. 'define-opt/c', 'define-sequence-syntax', 'define-serializable-class',
  521. 'define-serializable-class*', 'define-signature',
  522. 'define-signature-form', 'define-struct', 'define-struct/contract',
  523. 'define-struct/derived', 'define-syntax', 'define-syntax-rule',
  524. 'define-syntaxes', 'define-unit', 'define-unit-binding',
  525. 'define-unit-from-context', 'define-unit/contract',
  526. 'define-unit/new-import-export', 'define-unit/s', 'define-values',
  527. 'define-values-for-export', 'define-values-for-syntax',
  528. 'define-values/invoke-unit', 'define-values/invoke-unit/infer',
  529. 'define/augment', 'define/augment-final', 'define/augride',
  530. 'define/contract', 'define/final-prop', 'define/match',
  531. 'define/overment', 'define/override', 'define/override-final',
  532. 'define/private', 'define/public', 'define/public-final',
  533. 'define/pubment', 'define/subexpression-pos-prop',
  534. 'define/subexpression-pos-prop/name', 'delay', 'delay/idle',
  535. 'delay/name', 'delay/strict', 'delay/sync', 'delay/thread', 'do',
  536. 'else', 'except', 'except-in', 'except-out', 'export', 'extends',
  537. 'failure-cont', 'false', 'false/c', 'field', 'field-bound?', 'file',
  538. 'flat-murec-contract', 'flat-rec-contract', 'for', 'for*', 'for*/and',
  539. 'for*/async', 'for*/first', 'for*/fold', 'for*/fold/derived',
  540. 'for*/hash', 'for*/hasheq', 'for*/hasheqv', 'for*/last', 'for*/list',
  541. 'for*/lists', 'for*/mutable-set', 'for*/mutable-seteq',
  542. 'for*/mutable-seteqv', 'for*/or', 'for*/product', 'for*/set',
  543. 'for*/seteq', 'for*/seteqv', 'for*/stream', 'for*/sum', 'for*/vector',
  544. 'for*/weak-set', 'for*/weak-seteq', 'for*/weak-seteqv', 'for-label',
  545. 'for-meta', 'for-syntax', 'for-template', 'for/and', 'for/async',
  546. 'for/first', 'for/fold', 'for/fold/derived', 'for/hash', 'for/hasheq',
  547. 'for/hasheqv', 'for/last', 'for/list', 'for/lists', 'for/mutable-set',
  548. 'for/mutable-seteq', 'for/mutable-seteqv', 'for/or', 'for/product',
  549. 'for/set', 'for/seteq', 'for/seteqv', 'for/stream', 'for/sum',
  550. 'for/vector', 'for/weak-set', 'for/weak-seteq', 'for/weak-seteqv',
  551. 'gen:custom-write', 'gen:dict', 'gen:equal+hash', 'gen:set',
  552. 'gen:stream', 'generic', 'get-field', 'hash/dc', 'if', 'implies',
  553. 'import', 'include', 'include-at/relative-to',
  554. 'include-at/relative-to/reader', 'include/reader', 'inherit',
  555. 'inherit-field', 'inherit/inner', 'inherit/super', 'init',
  556. 'init-depend', 'init-field', 'init-rest', 'inner', 'inspect',
  557. 'instantiate', 'interface', 'interface*', 'invariant-assertion',
  558. 'invoke-unit', 'invoke-unit/infer', 'lambda', 'lazy', 'let', 'let*',
  559. 'let*-values', 'let-syntax', 'let-syntaxes', 'let-values', 'let/cc',
  560. 'let/ec', 'letrec', 'letrec-syntax', 'letrec-syntaxes',
  561. 'letrec-syntaxes+values', 'letrec-values', 'lib', 'link', 'local',
  562. 'local-require', 'log-debug', 'log-error', 'log-fatal', 'log-info',
  563. 'log-warning', 'match', 'match*', 'match*/derived', 'match-define',
  564. 'match-define-values', 'match-lambda', 'match-lambda*',
  565. 'match-lambda**', 'match-let', 'match-let*', 'match-let*-values',
  566. 'match-let-values', 'match-letrec', 'match-letrec-values',
  567. 'match/derived', 'match/values', 'member-name-key', 'mixin', 'module',
  568. 'module*', 'module+', 'nand', 'new', 'nor', 'object-contract',
  569. 'object/c', 'only', 'only-in', 'only-meta-in', 'open', 'opt/c', 'or',
  570. 'overment', 'overment*', 'override', 'override*', 'override-final',
  571. 'override-final*', 'parameterize', 'parameterize*',
  572. 'parameterize-break', 'parametric->/c', 'place', 'place*',
  573. 'place/context', 'planet', 'prefix', 'prefix-in', 'prefix-out',
  574. 'private', 'private*', 'prompt-tag/c', 'protect-out', 'provide',
  575. 'provide-signature-elements', 'provide/contract', 'public', 'public*',
  576. 'public-final', 'public-final*', 'pubment', 'pubment*', 'quasiquote',
  577. 'quasisyntax', 'quasisyntax/loc', 'quote', 'quote-syntax',
  578. 'quote-syntax/prune', 'recontract-out', 'recursive-contract',
  579. 'relative-in', 'rename', 'rename-in', 'rename-inner', 'rename-out',
  580. 'rename-super', 'require', 'send', 'send*', 'send+', 'send-generic',
  581. 'send/apply', 'send/keyword-apply', 'set!', 'set!-values',
  582. 'set-field!', 'shared', 'stream', 'stream*', 'stream-cons', 'struct',
  583. 'struct*', 'struct-copy', 'struct-field-index', 'struct-out',
  584. 'struct/c', 'struct/ctc', 'struct/dc', 'submod', 'super',
  585. 'super-instantiate', 'super-make-object', 'super-new', 'syntax',
  586. 'syntax-case', 'syntax-case*', 'syntax-id-rules', 'syntax-rules',
  587. 'syntax/loc', 'tag', 'this', 'this%', 'thunk', 'thunk*', 'time',
  588. 'unconstrained-domain->', 'unit', 'unit-from-context', 'unit/c',
  589. 'unit/new-import-export', 'unit/s', 'unless', 'unquote',
  590. 'unquote-splicing', 'unsyntax', 'unsyntax-splicing', 'values/drop',
  591. 'when', 'with-continuation-mark', 'with-contract',
  592. 'with-contract-continuation-mark', 'with-handlers', 'with-handlers*',
  593. 'with-method', 'with-syntax', 'λ'
  594. )
  595. # Generated by example.rkt
  596. _builtins = (
  597. '*', '*list/c', '+', '-', '/', '<', '</c', '<=', '<=/c', '=', '=/c',
  598. '>', '>/c', '>=', '>=/c', 'abort-current-continuation', 'abs',
  599. 'absolute-path?', 'acos', 'add-between', 'add1', 'alarm-evt',
  600. 'always-evt', 'and/c', 'andmap', 'angle', 'any/c', 'append', 'append*',
  601. 'append-map', 'apply', 'argmax', 'argmin', 'arithmetic-shift',
  602. 'arity-at-least', 'arity-at-least-value', 'arity-at-least?',
  603. 'arity-checking-wrapper', 'arity-includes?', 'arity=?',
  604. 'arrow-contract-info', 'arrow-contract-info-accepts-arglist',
  605. 'arrow-contract-info-chaperone-procedure',
  606. 'arrow-contract-info-check-first-order', 'arrow-contract-info?',
  607. 'asin', 'assf', 'assoc', 'assq', 'assv', 'atan',
  608. 'bad-number-of-results', 'banner', 'base->-doms/c', 'base->-rngs/c',
  609. 'base->?', 'between/c', 'bitwise-and', 'bitwise-bit-field',
  610. 'bitwise-bit-set?', 'bitwise-ior', 'bitwise-not', 'bitwise-xor',
  611. 'blame-add-car-context', 'blame-add-cdr-context', 'blame-add-context',
  612. 'blame-add-missing-party', 'blame-add-nth-arg-context',
  613. 'blame-add-range-context', 'blame-add-unknown-context',
  614. 'blame-context', 'blame-contract', 'blame-fmt->-string',
  615. 'blame-missing-party?', 'blame-negative', 'blame-original?',
  616. 'blame-positive', 'blame-replace-negative', 'blame-source',
  617. 'blame-swap', 'blame-swapped?', 'blame-update', 'blame-value',
  618. 'blame?', 'boolean=?', 'boolean?', 'bound-identifier=?', 'box',
  619. 'box-cas!', 'box-immutable', 'box-immutable/c', 'box/c', 'box?',
  620. 'break-enabled', 'break-parameterization?', 'break-thread',
  621. 'build-chaperone-contract-property', 'build-compound-type-name',
  622. 'build-contract-property', 'build-flat-contract-property',
  623. 'build-list', 'build-path', 'build-path/convention-type',
  624. 'build-string', 'build-vector', 'byte-pregexp', 'byte-pregexp?',
  625. 'byte-ready?', 'byte-regexp', 'byte-regexp?', 'byte?', 'bytes',
  626. 'bytes->immutable-bytes', 'bytes->list', 'bytes->path',
  627. 'bytes->path-element', 'bytes->string/latin-1', 'bytes->string/locale',
  628. 'bytes->string/utf-8', 'bytes-append', 'bytes-append*',
  629. 'bytes-close-converter', 'bytes-convert', 'bytes-convert-end',
  630. 'bytes-converter?', 'bytes-copy', 'bytes-copy!',
  631. 'bytes-environment-variable-name?', 'bytes-fill!', 'bytes-join',
  632. 'bytes-length', 'bytes-no-nuls?', 'bytes-open-converter', 'bytes-ref',
  633. 'bytes-set!', 'bytes-utf-8-index', 'bytes-utf-8-length',
  634. 'bytes-utf-8-ref', 'bytes<?', 'bytes=?', 'bytes>?', 'bytes?', 'caaaar',
  635. 'caaadr', 'caaar', 'caadar', 'caaddr', 'caadr', 'caar', 'cadaar',
  636. 'cadadr', 'cadar', 'caddar', 'cadddr', 'caddr', 'cadr',
  637. 'call-in-nested-thread', 'call-with-atomic-output-file',
  638. 'call-with-break-parameterization',
  639. 'call-with-composable-continuation', 'call-with-continuation-barrier',
  640. 'call-with-continuation-prompt', 'call-with-current-continuation',
  641. 'call-with-default-reading-parameterization',
  642. 'call-with-escape-continuation', 'call-with-exception-handler',
  643. 'call-with-file-lock/timeout', 'call-with-immediate-continuation-mark',
  644. 'call-with-input-bytes', 'call-with-input-file',
  645. 'call-with-input-file*', 'call-with-input-string',
  646. 'call-with-output-bytes', 'call-with-output-file',
  647. 'call-with-output-file*', 'call-with-output-string',
  648. 'call-with-parameterization', 'call-with-semaphore',
  649. 'call-with-semaphore/enable-break', 'call-with-values', 'call/cc',
  650. 'call/ec', 'car', 'cartesian-product', 'cdaaar', 'cdaadr', 'cdaar',
  651. 'cdadar', 'cdaddr', 'cdadr', 'cdar', 'cddaar', 'cddadr', 'cddar',
  652. 'cdddar', 'cddddr', 'cdddr', 'cddr', 'cdr', 'ceiling', 'channel-get',
  653. 'channel-put', 'channel-put-evt', 'channel-put-evt?',
  654. 'channel-try-get', 'channel/c', 'channel?', 'chaperone-box',
  655. 'chaperone-channel', 'chaperone-continuation-mark-key',
  656. 'chaperone-contract-property?', 'chaperone-contract?', 'chaperone-evt',
  657. 'chaperone-hash', 'chaperone-hash-set', 'chaperone-of?',
  658. 'chaperone-procedure', 'chaperone-procedure*', 'chaperone-prompt-tag',
  659. 'chaperone-struct', 'chaperone-struct-type', 'chaperone-vector',
  660. 'chaperone?', 'char->integer', 'char-alphabetic?', 'char-blank?',
  661. 'char-ci<=?', 'char-ci<?', 'char-ci=?', 'char-ci>=?', 'char-ci>?',
  662. 'char-downcase', 'char-foldcase', 'char-general-category',
  663. 'char-graphic?', 'char-in', 'char-in/c', 'char-iso-control?',
  664. 'char-lower-case?', 'char-numeric?', 'char-punctuation?',
  665. 'char-ready?', 'char-symbolic?', 'char-title-case?', 'char-titlecase',
  666. 'char-upcase', 'char-upper-case?', 'char-utf-8-length',
  667. 'char-whitespace?', 'char<=?', 'char<?', 'char=?', 'char>=?', 'char>?',
  668. 'char?', 'check-duplicate-identifier', 'check-duplicates',
  669. 'checked-procedure-check-and-extract', 'choice-evt',
  670. 'class->interface', 'class-info', 'class-seal', 'class-unseal',
  671. 'class?', 'cleanse-path', 'close-input-port', 'close-output-port',
  672. 'coerce-chaperone-contract', 'coerce-chaperone-contracts',
  673. 'coerce-contract', 'coerce-contract/f', 'coerce-contracts',
  674. 'coerce-flat-contract', 'coerce-flat-contracts', 'collect-garbage',
  675. 'collection-file-path', 'collection-path', 'combinations', 'compile',
  676. 'compile-allow-set!-undefined', 'compile-context-preservation-enabled',
  677. 'compile-enforce-module-constants', 'compile-syntax',
  678. 'compiled-expression-recompile', 'compiled-expression?',
  679. 'compiled-module-expression?', 'complete-path?', 'complex?', 'compose',
  680. 'compose1', 'conjoin', 'conjugate', 'cons', 'cons/c', 'cons?', 'const',
  681. 'continuation-mark-key/c', 'continuation-mark-key?',
  682. 'continuation-mark-set->context', 'continuation-mark-set->list',
  683. 'continuation-mark-set->list*', 'continuation-mark-set-first',
  684. 'continuation-mark-set?', 'continuation-marks',
  685. 'continuation-prompt-available?', 'continuation-prompt-tag?',
  686. 'continuation?', 'contract-continuation-mark-key',
  687. 'contract-custom-write-property-proc', 'contract-exercise',
  688. 'contract-first-order', 'contract-first-order-passes?',
  689. 'contract-late-neg-projection', 'contract-name', 'contract-proc',
  690. 'contract-projection', 'contract-property?',
  691. 'contract-random-generate', 'contract-random-generate-fail',
  692. 'contract-random-generate-fail?',
  693. 'contract-random-generate-get-current-environment',
  694. 'contract-random-generate-stash', 'contract-random-generate/choose',
  695. 'contract-stronger?', 'contract-struct-exercise',
  696. 'contract-struct-generate', 'contract-struct-late-neg-projection',
  697. 'contract-struct-list-contract?', 'contract-val-first-projection',
  698. 'contract?', 'convert-stream', 'copy-directory/files', 'copy-file',
  699. 'copy-port', 'cos', 'cosh', 'count', 'current-blame-format',
  700. 'current-break-parameterization', 'current-code-inspector',
  701. 'current-command-line-arguments', 'current-compile',
  702. 'current-compiled-file-roots', 'current-continuation-marks',
  703. 'current-contract-region', 'current-custodian', 'current-directory',
  704. 'current-directory-for-user', 'current-drive',
  705. 'current-environment-variables', 'current-error-port', 'current-eval',
  706. 'current-evt-pseudo-random-generator',
  707. 'current-force-delete-permissions', 'current-future',
  708. 'current-gc-milliseconds', 'current-get-interaction-input-port',
  709. 'current-inexact-milliseconds', 'current-input-port',
  710. 'current-inspector', 'current-library-collection-links',
  711. 'current-library-collection-paths', 'current-load',
  712. 'current-load-extension', 'current-load-relative-directory',
  713. 'current-load/use-compiled', 'current-locale', 'current-logger',
  714. 'current-memory-use', 'current-milliseconds',
  715. 'current-module-declare-name', 'current-module-declare-source',
  716. 'current-module-name-resolver', 'current-module-path-for-load',
  717. 'current-namespace', 'current-output-port', 'current-parameterization',
  718. 'current-plumber', 'current-preserved-thread-cell-values',
  719. 'current-print', 'current-process-milliseconds', 'current-prompt-read',
  720. 'current-pseudo-random-generator', 'current-read-interaction',
  721. 'current-reader-guard', 'current-readtable', 'current-seconds',
  722. 'current-security-guard', 'current-subprocess-custodian-mode',
  723. 'current-thread', 'current-thread-group',
  724. 'current-thread-initial-stack-size',
  725. 'current-write-relative-directory', 'curry', 'curryr',
  726. 'custodian-box-value', 'custodian-box?', 'custodian-limit-memory',
  727. 'custodian-managed-list', 'custodian-memory-accounting-available?',
  728. 'custodian-require-memory', 'custodian-shutdown-all', 'custodian?',
  729. 'custom-print-quotable-accessor', 'custom-print-quotable?',
  730. 'custom-write-accessor', 'custom-write-property-proc', 'custom-write?',
  731. 'date', 'date*', 'date*-nanosecond', 'date*-time-zone-name', 'date*?',
  732. 'date-day', 'date-dst?', 'date-hour', 'date-minute', 'date-month',
  733. 'date-second', 'date-time-zone-offset', 'date-week-day', 'date-year',
  734. 'date-year-day', 'date?', 'datum->syntax', 'datum-intern-literal',
  735. 'default-continuation-prompt-tag', 'degrees->radians',
  736. 'delete-directory', 'delete-directory/files', 'delete-file',
  737. 'denominator', 'dict->list', 'dict-can-functional-set?',
  738. 'dict-can-remove-keys?', 'dict-clear', 'dict-clear!', 'dict-copy',
  739. 'dict-count', 'dict-empty?', 'dict-for-each', 'dict-has-key?',
  740. 'dict-implements/c', 'dict-implements?', 'dict-iter-contract',
  741. 'dict-iterate-first', 'dict-iterate-key', 'dict-iterate-next',
  742. 'dict-iterate-value', 'dict-key-contract', 'dict-keys', 'dict-map',
  743. 'dict-mutable?', 'dict-ref', 'dict-ref!', 'dict-remove',
  744. 'dict-remove!', 'dict-set', 'dict-set!', 'dict-set*', 'dict-set*!',
  745. 'dict-update', 'dict-update!', 'dict-value-contract', 'dict-values',
  746. 'dict?', 'directory-exists?', 'directory-list', 'disjoin', 'display',
  747. 'display-lines', 'display-lines-to-file', 'display-to-file',
  748. 'displayln', 'double-flonum?', 'drop', 'drop-common-prefix',
  749. 'drop-right', 'dropf', 'dropf-right', 'dump-memory-stats',
  750. 'dup-input-port', 'dup-output-port', 'dynamic->*', 'dynamic-get-field',
  751. 'dynamic-object/c', 'dynamic-place', 'dynamic-place*',
  752. 'dynamic-require', 'dynamic-require-for-syntax', 'dynamic-send',
  753. 'dynamic-set-field!', 'dynamic-wind', 'eighth', 'empty',
  754. 'empty-sequence', 'empty-stream', 'empty?',
  755. 'environment-variables-copy', 'environment-variables-names',
  756. 'environment-variables-ref', 'environment-variables-set!',
  757. 'environment-variables?', 'eof', 'eof-evt', 'eof-object?',
  758. 'ephemeron-value', 'ephemeron?', 'eprintf', 'eq-contract-val',
  759. 'eq-contract?', 'eq-hash-code', 'eq?', 'equal-contract-val',
  760. 'equal-contract?', 'equal-hash-code', 'equal-secondary-hash-code',
  761. 'equal<%>', 'equal?', 'equal?/recur', 'eqv-hash-code', 'eqv?', 'error',
  762. 'error-display-handler', 'error-escape-handler',
  763. 'error-print-context-length', 'error-print-source-location',
  764. 'error-print-width', 'error-value->string-handler', 'eval',
  765. 'eval-jit-enabled', 'eval-syntax', 'even?', 'evt/c', 'evt?',
  766. 'exact->inexact', 'exact-ceiling', 'exact-floor', 'exact-integer?',
  767. 'exact-nonnegative-integer?', 'exact-positive-integer?', 'exact-round',
  768. 'exact-truncate', 'exact?', 'executable-yield-handler', 'exit',
  769. 'exit-handler', 'exn', 'exn-continuation-marks', 'exn-message',
  770. 'exn:break', 'exn:break-continuation', 'exn:break:hang-up',
  771. 'exn:break:hang-up?', 'exn:break:terminate', 'exn:break:terminate?',
  772. 'exn:break?', 'exn:fail', 'exn:fail:contract',
  773. 'exn:fail:contract:arity', 'exn:fail:contract:arity?',
  774. 'exn:fail:contract:blame', 'exn:fail:contract:blame-object',
  775. 'exn:fail:contract:blame?', 'exn:fail:contract:continuation',
  776. 'exn:fail:contract:continuation?', 'exn:fail:contract:divide-by-zero',
  777. 'exn:fail:contract:divide-by-zero?',
  778. 'exn:fail:contract:non-fixnum-result',
  779. 'exn:fail:contract:non-fixnum-result?', 'exn:fail:contract:variable',
  780. 'exn:fail:contract:variable-id', 'exn:fail:contract:variable?',
  781. 'exn:fail:contract?', 'exn:fail:filesystem',
  782. 'exn:fail:filesystem:errno', 'exn:fail:filesystem:errno-errno',
  783. 'exn:fail:filesystem:errno?', 'exn:fail:filesystem:exists',
  784. 'exn:fail:filesystem:exists?', 'exn:fail:filesystem:missing-module',
  785. 'exn:fail:filesystem:missing-module-path',
  786. 'exn:fail:filesystem:missing-module?', 'exn:fail:filesystem:version',
  787. 'exn:fail:filesystem:version?', 'exn:fail:filesystem?',
  788. 'exn:fail:network', 'exn:fail:network:errno',
  789. 'exn:fail:network:errno-errno', 'exn:fail:network:errno?',
  790. 'exn:fail:network?', 'exn:fail:object', 'exn:fail:object?',
  791. 'exn:fail:out-of-memory', 'exn:fail:out-of-memory?', 'exn:fail:read',
  792. 'exn:fail:read-srclocs', 'exn:fail:read:eof', 'exn:fail:read:eof?',
  793. 'exn:fail:read:non-char', 'exn:fail:read:non-char?', 'exn:fail:read?',
  794. 'exn:fail:syntax', 'exn:fail:syntax-exprs',
  795. 'exn:fail:syntax:missing-module',
  796. 'exn:fail:syntax:missing-module-path',
  797. 'exn:fail:syntax:missing-module?', 'exn:fail:syntax:unbound',
  798. 'exn:fail:syntax:unbound?', 'exn:fail:syntax?', 'exn:fail:unsupported',
  799. 'exn:fail:unsupported?', 'exn:fail:user', 'exn:fail:user?',
  800. 'exn:fail?', 'exn:misc:match?', 'exn:missing-module-accessor',
  801. 'exn:missing-module?', 'exn:srclocs-accessor', 'exn:srclocs?', 'exn?',
  802. 'exp', 'expand', 'expand-once', 'expand-syntax', 'expand-syntax-once',
  803. 'expand-syntax-to-top-form', 'expand-to-top-form', 'expand-user-path',
  804. 'explode-path', 'expt', 'externalizable<%>', 'failure-result/c',
  805. 'false?', 'field-names', 'fifth', 'file->bytes', 'file->bytes-lines',
  806. 'file->lines', 'file->list', 'file->string', 'file->value',
  807. 'file-exists?', 'file-name-from-path', 'file-or-directory-identity',
  808. 'file-or-directory-modify-seconds', 'file-or-directory-permissions',
  809. 'file-position', 'file-position*', 'file-size',
  810. 'file-stream-buffer-mode', 'file-stream-port?', 'file-truncate',
  811. 'filename-extension', 'filesystem-change-evt',
  812. 'filesystem-change-evt-cancel', 'filesystem-change-evt?',
  813. 'filesystem-root-list', 'filter', 'filter-map', 'filter-not',
  814. 'filter-read-input-port', 'find-executable-path', 'find-files',
  815. 'find-library-collection-links', 'find-library-collection-paths',
  816. 'find-relative-path', 'find-system-path', 'findf', 'first',
  817. 'first-or/c', 'fixnum?', 'flat-contract', 'flat-contract-predicate',
  818. 'flat-contract-property?', 'flat-contract?', 'flat-named-contract',
  819. 'flatten', 'floating-point-bytes->real', 'flonum?', 'floor',
  820. 'flush-output', 'fold-files', 'foldl', 'foldr', 'for-each', 'force',
  821. 'format', 'fourth', 'fprintf', 'free-identifier=?',
  822. 'free-label-identifier=?', 'free-template-identifier=?',
  823. 'free-transformer-identifier=?', 'fsemaphore-count', 'fsemaphore-post',
  824. 'fsemaphore-try-wait?', 'fsemaphore-wait', 'fsemaphore?', 'future',
  825. 'future?', 'futures-enabled?', 'gcd', 'generate-member-key',
  826. 'generate-temporaries', 'generic-set?', 'generic?', 'gensym',
  827. 'get-output-bytes', 'get-output-string', 'get-preference',
  828. 'get/build-late-neg-projection', 'get/build-val-first-projection',
  829. 'getenv', 'global-port-print-handler', 'group-by', 'group-execute-bit',
  830. 'group-read-bit', 'group-write-bit', 'guard-evt', 'handle-evt',
  831. 'handle-evt?', 'has-blame?', 'has-contract?', 'hash', 'hash->list',
  832. 'hash-clear', 'hash-clear!', 'hash-copy', 'hash-copy-clear',
  833. 'hash-count', 'hash-empty?', 'hash-eq?', 'hash-equal?', 'hash-eqv?',
  834. 'hash-for-each', 'hash-has-key?', 'hash-iterate-first',
  835. 'hash-iterate-key', 'hash-iterate-key+value', 'hash-iterate-next',
  836. 'hash-iterate-pair', 'hash-iterate-value', 'hash-keys', 'hash-map',
  837. 'hash-placeholder?', 'hash-ref', 'hash-ref!', 'hash-remove',
  838. 'hash-remove!', 'hash-set', 'hash-set!', 'hash-set*', 'hash-set*!',
  839. 'hash-update', 'hash-update!', 'hash-values', 'hash-weak?', 'hash/c',
  840. 'hash?', 'hasheq', 'hasheqv', 'identifier-binding',
  841. 'identifier-binding-symbol', 'identifier-label-binding',
  842. 'identifier-prune-lexical-context',
  843. 'identifier-prune-to-source-module',
  844. 'identifier-remove-from-definition-context',
  845. 'identifier-template-binding', 'identifier-transformer-binding',
  846. 'identifier?', 'identity', 'if/c', 'imag-part', 'immutable?',
  847. 'impersonate-box', 'impersonate-channel',
  848. 'impersonate-continuation-mark-key', 'impersonate-hash',
  849. 'impersonate-hash-set', 'impersonate-procedure',
  850. 'impersonate-procedure*', 'impersonate-prompt-tag',
  851. 'impersonate-struct', 'impersonate-vector', 'impersonator-contract?',
  852. 'impersonator-ephemeron', 'impersonator-of?',
  853. 'impersonator-prop:application-mark', 'impersonator-prop:blame',
  854. 'impersonator-prop:contracted',
  855. 'impersonator-property-accessor-procedure?', 'impersonator-property?',
  856. 'impersonator?', 'implementation?', 'implementation?/c', 'in-bytes',
  857. 'in-bytes-lines', 'in-combinations', 'in-cycle', 'in-dict',
  858. 'in-dict-keys', 'in-dict-pairs', 'in-dict-values', 'in-directory',
  859. 'in-hash', 'in-hash-keys', 'in-hash-pairs', 'in-hash-values',
  860. 'in-immutable-hash', 'in-immutable-hash-keys',
  861. 'in-immutable-hash-pairs', 'in-immutable-hash-values',
  862. 'in-immutable-set', 'in-indexed', 'in-input-port-bytes',
  863. 'in-input-port-chars', 'in-lines', 'in-list', 'in-mlist',
  864. 'in-mutable-hash', 'in-mutable-hash-keys', 'in-mutable-hash-pairs',
  865. 'in-mutable-hash-values', 'in-mutable-set', 'in-naturals',
  866. 'in-parallel', 'in-permutations', 'in-port', 'in-producer', 'in-range',
  867. 'in-sequences', 'in-set', 'in-slice', 'in-stream', 'in-string',
  868. 'in-syntax', 'in-value', 'in-values*-sequence', 'in-values-sequence',
  869. 'in-vector', 'in-weak-hash', 'in-weak-hash-keys', 'in-weak-hash-pairs',
  870. 'in-weak-hash-values', 'in-weak-set', 'inexact->exact',
  871. 'inexact-real?', 'inexact?', 'infinite?', 'input-port-append',
  872. 'input-port?', 'inspector?', 'instanceof/c', 'integer->char',
  873. 'integer->integer-bytes', 'integer-bytes->integer', 'integer-in',
  874. 'integer-length', 'integer-sqrt', 'integer-sqrt/remainder', 'integer?',
  875. 'interface->method-names', 'interface-extension?', 'interface?',
  876. 'internal-definition-context-binding-identifiers',
  877. 'internal-definition-context-introduce',
  878. 'internal-definition-context-seal', 'internal-definition-context?',
  879. 'is-a?', 'is-a?/c', 'keyword->string', 'keyword-apply', 'keyword<?',
  880. 'keyword?', 'keywords-match', 'kill-thread', 'last', 'last-pair',
  881. 'lcm', 'length', 'liberal-define-context?', 'link-exists?', 'list',
  882. 'list*', 'list*of', 'list->bytes', 'list->mutable-set',
  883. 'list->mutable-seteq', 'list->mutable-seteqv', 'list->set',
  884. 'list->seteq', 'list->seteqv', 'list->string', 'list->vector',
  885. 'list->weak-set', 'list->weak-seteq', 'list->weak-seteqv',
  886. 'list-contract?', 'list-prefix?', 'list-ref', 'list-set', 'list-tail',
  887. 'list-update', 'list/c', 'list?', 'listen-port-number?', 'listof',
  888. 'load', 'load-extension', 'load-on-demand-enabled', 'load-relative',
  889. 'load-relative-extension', 'load/cd', 'load/use-compiled',
  890. 'local-expand', 'local-expand/capture-lifts',
  891. 'local-transformer-expand', 'local-transformer-expand/capture-lifts',
  892. 'locale-string-encoding', 'log', 'log-all-levels', 'log-level-evt',
  893. 'log-level?', 'log-max-level', 'log-message', 'log-receiver?',
  894. 'logger-name', 'logger?', 'magnitude', 'make-arity-at-least',
  895. 'make-base-empty-namespace', 'make-base-namespace', 'make-bytes',
  896. 'make-channel', 'make-chaperone-contract',
  897. 'make-continuation-mark-key', 'make-continuation-prompt-tag',
  898. 'make-contract', 'make-custodian', 'make-custodian-box',
  899. 'make-custom-hash', 'make-custom-hash-types', 'make-custom-set',
  900. 'make-custom-set-types', 'make-date', 'make-date*',
  901. 'make-derived-parameter', 'make-directory', 'make-directory*',
  902. 'make-do-sequence', 'make-empty-namespace',
  903. 'make-environment-variables', 'make-ephemeron', 'make-exn',
  904. 'make-exn:break', 'make-exn:break:hang-up', 'make-exn:break:terminate',
  905. 'make-exn:fail', 'make-exn:fail:contract',
  906. 'make-exn:fail:contract:arity', 'make-exn:fail:contract:blame',
  907. 'make-exn:fail:contract:continuation',
  908. 'make-exn:fail:contract:divide-by-zero',
  909. 'make-exn:fail:contract:non-fixnum-result',
  910. 'make-exn:fail:contract:variable', 'make-exn:fail:filesystem',
  911. 'make-exn:fail:filesystem:errno', 'make-exn:fail:filesystem:exists',
  912. 'make-exn:fail:filesystem:missing-module',
  913. 'make-exn:fail:filesystem:version', 'make-exn:fail:network',
  914. 'make-exn:fail:network:errno', 'make-exn:fail:object',
  915. 'make-exn:fail:out-of-memory', 'make-exn:fail:read',
  916. 'make-exn:fail:read:eof', 'make-exn:fail:read:non-char',
  917. 'make-exn:fail:syntax', 'make-exn:fail:syntax:missing-module',
  918. 'make-exn:fail:syntax:unbound', 'make-exn:fail:unsupported',
  919. 'make-exn:fail:user', 'make-file-or-directory-link',
  920. 'make-flat-contract', 'make-fsemaphore', 'make-generic',
  921. 'make-handle-get-preference-locked', 'make-hash',
  922. 'make-hash-placeholder', 'make-hasheq', 'make-hasheq-placeholder',
  923. 'make-hasheqv', 'make-hasheqv-placeholder',
  924. 'make-immutable-custom-hash', 'make-immutable-hash',
  925. 'make-immutable-hasheq', 'make-immutable-hasheqv',
  926. 'make-impersonator-property', 'make-input-port',
  927. 'make-input-port/read-to-peek', 'make-inspector',
  928. 'make-keyword-procedure', 'make-known-char-range-list',
  929. 'make-limited-input-port', 'make-list', 'make-lock-file-name',
  930. 'make-log-receiver', 'make-logger', 'make-mixin-contract',
  931. 'make-mutable-custom-set', 'make-none/c', 'make-object',
  932. 'make-output-port', 'make-parameter', 'make-parent-directory*',
  933. 'make-phantom-bytes', 'make-pipe', 'make-pipe-with-specials',
  934. 'make-placeholder', 'make-plumber', 'make-polar', 'make-prefab-struct',
  935. 'make-primitive-class', 'make-proj-contract',
  936. 'make-pseudo-random-generator', 'make-reader-graph', 'make-readtable',
  937. 'make-rectangular', 'make-rename-transformer',
  938. 'make-resolved-module-path', 'make-security-guard', 'make-semaphore',
  939. 'make-set!-transformer', 'make-shared-bytes', 'make-sibling-inspector',
  940. 'make-special-comment', 'make-srcloc', 'make-string',
  941. 'make-struct-field-accessor', 'make-struct-field-mutator',
  942. 'make-struct-type', 'make-struct-type-property',
  943. 'make-syntax-delta-introducer', 'make-syntax-introducer',
  944. 'make-temporary-file', 'make-tentative-pretty-print-output-port',
  945. 'make-thread-cell', 'make-thread-group', 'make-vector',
  946. 'make-weak-box', 'make-weak-custom-hash', 'make-weak-custom-set',
  947. 'make-weak-hash', 'make-weak-hasheq', 'make-weak-hasheqv',
  948. 'make-will-executor', 'map', 'match-equality-test',
  949. 'matches-arity-exactly?', 'max', 'mcar', 'mcdr', 'mcons', 'member',
  950. 'member-name-key-hash-code', 'member-name-key=?', 'member-name-key?',
  951. 'memf', 'memq', 'memv', 'merge-input', 'method-in-interface?', 'min',
  952. 'mixin-contract', 'module->exports', 'module->imports',
  953. 'module->language-info', 'module->namespace',
  954. 'module-compiled-cross-phase-persistent?', 'module-compiled-exports',
  955. 'module-compiled-imports', 'module-compiled-language-info',
  956. 'module-compiled-name', 'module-compiled-submodules',
  957. 'module-declared?', 'module-path-index-join',
  958. 'module-path-index-resolve', 'module-path-index-split',
  959. 'module-path-index-submodule', 'module-path-index?', 'module-path?',
  960. 'module-predefined?', 'module-provide-protected?', 'modulo', 'mpair?',
  961. 'mutable-set', 'mutable-seteq', 'mutable-seteqv', 'n->th',
  962. 'nack-guard-evt', 'namespace-anchor->empty-namespace',
  963. 'namespace-anchor->namespace', 'namespace-anchor?',
  964. 'namespace-attach-module', 'namespace-attach-module-declaration',
  965. 'namespace-base-phase', 'namespace-mapped-symbols',
  966. 'namespace-module-identifier', 'namespace-module-registry',
  967. 'namespace-require', 'namespace-require/constant',
  968. 'namespace-require/copy', 'namespace-require/expansion-time',
  969. 'namespace-set-variable-value!', 'namespace-symbol->identifier',
  970. 'namespace-syntax-introduce', 'namespace-undefine-variable!',
  971. 'namespace-unprotect-module', 'namespace-variable-value', 'namespace?',
  972. 'nan?', 'natural-number/c', 'negate', 'negative?', 'never-evt',
  973. 'new-∀/c', 'new-∃/c', 'newline', 'ninth', 'non-empty-listof',
  974. 'non-empty-string?', 'none/c', 'normal-case-path', 'normalize-arity',
  975. 'normalize-path', 'normalized-arity?', 'not', 'not/c', 'null', 'null?',
  976. 'number->string', 'number?', 'numerator', 'object%', 'object->vector',
  977. 'object-info', 'object-interface', 'object-method-arity-includes?',
  978. 'object-name', 'object-or-false=?', 'object=?', 'object?', 'odd?',
  979. 'one-of/c', 'open-input-bytes', 'open-input-file',
  980. 'open-input-output-file', 'open-input-string', 'open-output-bytes',
  981. 'open-output-file', 'open-output-nowhere', 'open-output-string',
  982. 'or/c', 'order-of-magnitude', 'ormap', 'other-execute-bit',
  983. 'other-read-bit', 'other-write-bit', 'output-port?', 'pair?',
  984. 'parameter-procedure=?', 'parameter/c', 'parameter?',
  985. 'parameterization?', 'parse-command-line', 'partition', 'path->bytes',
  986. 'path->complete-path', 'path->directory-path', 'path->string',
  987. 'path-add-suffix', 'path-convention-type', 'path-element->bytes',
  988. 'path-element->string', 'path-element?', 'path-for-some-system?',
  989. 'path-list-string->path-list', 'path-only', 'path-replace-suffix',
  990. 'path-string?', 'path<?', 'path?', 'pathlist-closure', 'peek-byte',
  991. 'peek-byte-or-special', 'peek-bytes', 'peek-bytes!', 'peek-bytes!-evt',
  992. 'peek-bytes-avail!', 'peek-bytes-avail!*', 'peek-bytes-avail!-evt',
  993. 'peek-bytes-avail!/enable-break', 'peek-bytes-evt', 'peek-char',
  994. 'peek-char-or-special', 'peek-string', 'peek-string!',
  995. 'peek-string!-evt', 'peek-string-evt', 'peeking-input-port',
  996. 'permutations', 'phantom-bytes?', 'pi', 'pi.f', 'pipe-content-length',
  997. 'place-break', 'place-channel', 'place-channel-get',
  998. 'place-channel-put', 'place-channel-put/get', 'place-channel?',
  999. 'place-dead-evt', 'place-enabled?', 'place-kill', 'place-location?',
  1000. 'place-message-allowed?', 'place-sleep', 'place-wait', 'place?',
  1001. 'placeholder-get', 'placeholder-set!', 'placeholder?',
  1002. 'plumber-add-flush!', 'plumber-flush-all',
  1003. 'plumber-flush-handle-remove!', 'plumber-flush-handle?', 'plumber?',
  1004. 'poll-guard-evt', 'port->bytes', 'port->bytes-lines', 'port->lines',
  1005. 'port->list', 'port->string', 'port-closed-evt', 'port-closed?',
  1006. 'port-commit-peeked', 'port-count-lines!', 'port-count-lines-enabled',
  1007. 'port-counts-lines?', 'port-display-handler', 'port-file-identity',
  1008. 'port-file-unlock', 'port-next-location', 'port-number?',
  1009. 'port-print-handler', 'port-progress-evt',
  1010. 'port-provides-progress-evts?', 'port-read-handler',
  1011. 'port-try-file-lock?', 'port-write-handler', 'port-writes-atomic?',
  1012. 'port-writes-special?', 'port?', 'positive?', 'predicate/c',
  1013. 'prefab-key->struct-type', 'prefab-key?', 'prefab-struct-key',
  1014. 'preferences-lock-file-mode', 'pregexp', 'pregexp?', 'pretty-display',
  1015. 'pretty-format', 'pretty-print', 'pretty-print-.-symbol-without-bars',
  1016. 'pretty-print-abbreviate-read-macros', 'pretty-print-columns',
  1017. 'pretty-print-current-style-table', 'pretty-print-depth',
  1018. 'pretty-print-exact-as-decimal', 'pretty-print-extend-style-table',
  1019. 'pretty-print-handler', 'pretty-print-newline',
  1020. 'pretty-print-post-print-hook', 'pretty-print-pre-print-hook',
  1021. 'pretty-print-print-hook', 'pretty-print-print-line',
  1022. 'pretty-print-remap-stylable', 'pretty-print-show-inexactness',
  1023. 'pretty-print-size-hook', 'pretty-print-style-table?',
  1024. 'pretty-printing', 'pretty-write', 'primitive-closure?',
  1025. 'primitive-result-arity', 'primitive?', 'print', 'print-as-expression',
  1026. 'print-boolean-long-form', 'print-box', 'print-graph',
  1027. 'print-hash-table', 'print-mpair-curly-braces',
  1028. 'print-pair-curly-braces', 'print-reader-abbreviations',
  1029. 'print-struct', 'print-syntax-width', 'print-unreadable',
  1030. 'print-vector-length', 'printable/c', 'printable<%>', 'printf',
  1031. 'println', 'procedure->method', 'procedure-arity',
  1032. 'procedure-arity-includes/c', 'procedure-arity-includes?',
  1033. 'procedure-arity?', 'procedure-closure-contents-eq?',
  1034. 'procedure-extract-target', 'procedure-keywords',
  1035. 'procedure-reduce-arity', 'procedure-reduce-keyword-arity',
  1036. 'procedure-rename', 'procedure-result-arity', 'procedure-specialize',
  1037. 'procedure-struct-type?', 'procedure?', 'process', 'process*',
  1038. 'process*/ports', 'process/ports', 'processor-count', 'progress-evt?',
  1039. 'promise-forced?', 'promise-running?', 'promise/c', 'promise/name?',
  1040. 'promise?', 'prop:arity-string', 'prop:arrow-contract',
  1041. 'prop:arrow-contract-get-info', 'prop:arrow-contract?', 'prop:blame',
  1042. 'prop:chaperone-contract', 'prop:checked-procedure', 'prop:contract',
  1043. 'prop:contracted', 'prop:custom-print-quotable', 'prop:custom-write',
  1044. 'prop:dict', 'prop:dict/contract', 'prop:equal+hash', 'prop:evt',
  1045. 'prop:exn:missing-module', 'prop:exn:srclocs',
  1046. 'prop:expansion-contexts', 'prop:flat-contract',
  1047. 'prop:impersonator-of', 'prop:input-port',
  1048. 'prop:liberal-define-context', 'prop:object-name',
  1049. 'prop:opt-chaperone-contract', 'prop:opt-chaperone-contract-get-test',
  1050. 'prop:opt-chaperone-contract?', 'prop:orc-contract',
  1051. 'prop:orc-contract-get-subcontracts', 'prop:orc-contract?',
  1052. 'prop:output-port', 'prop:place-location', 'prop:procedure',
  1053. 'prop:recursive-contract', 'prop:recursive-contract-unroll',
  1054. 'prop:recursive-contract?', 'prop:rename-transformer', 'prop:sequence',
  1055. 'prop:set!-transformer', 'prop:stream', 'proper-subset?',
  1056. 'pseudo-random-generator->vector', 'pseudo-random-generator-vector?',
  1057. 'pseudo-random-generator?', 'put-preferences', 'putenv', 'quotient',
  1058. 'quotient/remainder', 'radians->degrees', 'raise',
  1059. 'raise-argument-error', 'raise-arguments-error', 'raise-arity-error',
  1060. 'raise-blame-error', 'raise-contract-error', 'raise-mismatch-error',
  1061. 'raise-not-cons-blame-error', 'raise-range-error',
  1062. 'raise-result-error', 'raise-syntax-error', 'raise-type-error',
  1063. 'raise-user-error', 'random', 'random-seed', 'range', 'rational?',
  1064. 'rationalize', 'read', 'read-accept-bar-quote', 'read-accept-box',
  1065. 'read-accept-compiled', 'read-accept-dot', 'read-accept-graph',
  1066. 'read-accept-infix-dot', 'read-accept-lang', 'read-accept-quasiquote',
  1067. 'read-accept-reader', 'read-byte', 'read-byte-or-special',
  1068. 'read-bytes', 'read-bytes!', 'read-bytes!-evt', 'read-bytes-avail!',
  1069. 'read-bytes-avail!*', 'read-bytes-avail!-evt',
  1070. 'read-bytes-avail!/enable-break', 'read-bytes-evt', 'read-bytes-line',
  1071. 'read-bytes-line-evt', 'read-case-sensitive', 'read-cdot', 'read-char',
  1072. 'read-char-or-special', 'read-curly-brace-as-paren',
  1073. 'read-curly-brace-with-tag', 'read-decimal-as-inexact',
  1074. 'read-eval-print-loop', 'read-language', 'read-line', 'read-line-evt',
  1075. 'read-on-demand-source', 'read-square-bracket-as-paren',
  1076. 'read-square-bracket-with-tag', 'read-string', 'read-string!',
  1077. 'read-string!-evt', 'read-string-evt', 'read-syntax',
  1078. 'read-syntax/recursive', 'read/recursive', 'readtable-mapping',
  1079. 'readtable?', 'real->decimal-string', 'real->double-flonum',
  1080. 'real->floating-point-bytes', 'real->single-flonum', 'real-in',
  1081. 'real-part', 'real?', 'reencode-input-port', 'reencode-output-port',
  1082. 'regexp', 'regexp-match', 'regexp-match*', 'regexp-match-evt',
  1083. 'regexp-match-exact?', 'regexp-match-peek',
  1084. 'regexp-match-peek-immediate', 'regexp-match-peek-positions',
  1085. 'regexp-match-peek-positions*',
  1086. 'regexp-match-peek-positions-immediate',
  1087. 'regexp-match-peek-positions-immediate/end',
  1088. 'regexp-match-peek-positions/end', 'regexp-match-positions',
  1089. 'regexp-match-positions*', 'regexp-match-positions/end',
  1090. 'regexp-match/end', 'regexp-match?', 'regexp-max-lookbehind',
  1091. 'regexp-quote', 'regexp-replace', 'regexp-replace*',
  1092. 'regexp-replace-quote', 'regexp-replaces', 'regexp-split',
  1093. 'regexp-try-match', 'regexp?', 'relative-path?', 'relocate-input-port',
  1094. 'relocate-output-port', 'remainder', 'remf', 'remf*', 'remove',
  1095. 'remove*', 'remove-duplicates', 'remq', 'remq*', 'remv', 'remv*',
  1096. 'rename-contract', 'rename-file-or-directory',
  1097. 'rename-transformer-target', 'rename-transformer?', 'replace-evt',
  1098. 'reroot-path', 'resolve-path', 'resolved-module-path-name',
  1099. 'resolved-module-path?', 'rest', 'reverse', 'round', 'second',
  1100. 'seconds->date', 'security-guard?', 'semaphore-peek-evt',
  1101. 'semaphore-peek-evt?', 'semaphore-post', 'semaphore-try-wait?',
  1102. 'semaphore-wait', 'semaphore-wait/enable-break', 'semaphore?',
  1103. 'sequence->list', 'sequence->stream', 'sequence-add-between',
  1104. 'sequence-andmap', 'sequence-append', 'sequence-count',
  1105. 'sequence-filter', 'sequence-fold', 'sequence-for-each',
  1106. 'sequence-generate', 'sequence-generate*', 'sequence-length',
  1107. 'sequence-map', 'sequence-ormap', 'sequence-ref', 'sequence-tail',
  1108. 'sequence/c', 'sequence?', 'set', 'set!-transformer-procedure',
  1109. 'set!-transformer?', 'set->list', 'set->stream', 'set-add', 'set-add!',
  1110. 'set-box!', 'set-clear', 'set-clear!', 'set-copy', 'set-copy-clear',
  1111. 'set-count', 'set-empty?', 'set-eq?', 'set-equal?', 'set-eqv?',
  1112. 'set-first', 'set-for-each', 'set-implements/c', 'set-implements?',
  1113. 'set-intersect', 'set-intersect!', 'set-map', 'set-mcar!', 'set-mcdr!',
  1114. 'set-member?', 'set-mutable?', 'set-phantom-bytes!',
  1115. 'set-port-next-location!', 'set-remove', 'set-remove!', 'set-rest',
  1116. 'set-some-basic-contracts!', 'set-subtract', 'set-subtract!',
  1117. 'set-symmetric-difference', 'set-symmetric-difference!', 'set-union',
  1118. 'set-union!', 'set-weak?', 'set/c', 'set=?', 'set?', 'seteq', 'seteqv',
  1119. 'seventh', 'sgn', 'shared-bytes', 'shell-execute', 'shrink-path-wrt',
  1120. 'shuffle', 'simple-form-path', 'simplify-path', 'sin',
  1121. 'single-flonum?', 'sinh', 'sixth', 'skip-projection-wrapper?', 'sleep',
  1122. 'some-system-path->string', 'sort', 'special-comment-value',
  1123. 'special-comment?', 'special-filter-input-port', 'split-at',
  1124. 'split-at-right', 'split-common-prefix', 'split-path', 'splitf-at',
  1125. 'splitf-at-right', 'sqr', 'sqrt', 'srcloc', 'srcloc->string',
  1126. 'srcloc-column', 'srcloc-line', 'srcloc-position', 'srcloc-source',
  1127. 'srcloc-span', 'srcloc?', 'stop-after', 'stop-before', 'stream->list',
  1128. 'stream-add-between', 'stream-andmap', 'stream-append', 'stream-count',
  1129. 'stream-empty?', 'stream-filter', 'stream-first', 'stream-fold',
  1130. 'stream-for-each', 'stream-length', 'stream-map', 'stream-ormap',
  1131. 'stream-ref', 'stream-rest', 'stream-tail', 'stream/c', 'stream?',
  1132. 'string', 'string->bytes/latin-1', 'string->bytes/locale',
  1133. 'string->bytes/utf-8', 'string->immutable-string', 'string->keyword',
  1134. 'string->list', 'string->number', 'string->path',
  1135. 'string->path-element', 'string->some-system-path', 'string->symbol',
  1136. 'string->uninterned-symbol', 'string->unreadable-symbol',
  1137. 'string-append', 'string-append*', 'string-ci<=?', 'string-ci<?',
  1138. 'string-ci=?', 'string-ci>=?', 'string-ci>?', 'string-contains?',
  1139. 'string-copy', 'string-copy!', 'string-downcase',
  1140. 'string-environment-variable-name?', 'string-fill!', 'string-foldcase',
  1141. 'string-join', 'string-len/c', 'string-length', 'string-locale-ci<?',
  1142. 'string-locale-ci=?', 'string-locale-ci>?', 'string-locale-downcase',
  1143. 'string-locale-upcase', 'string-locale<?', 'string-locale=?',
  1144. 'string-locale>?', 'string-no-nuls?', 'string-normalize-nfc',
  1145. 'string-normalize-nfd', 'string-normalize-nfkc',
  1146. 'string-normalize-nfkd', 'string-normalize-spaces', 'string-port?',
  1147. 'string-prefix?', 'string-ref', 'string-replace', 'string-set!',
  1148. 'string-split', 'string-suffix?', 'string-titlecase', 'string-trim',
  1149. 'string-upcase', 'string-utf-8-length', 'string<=?', 'string<?',
  1150. 'string=?', 'string>=?', 'string>?', 'string?', 'struct->vector',
  1151. 'struct-accessor-procedure?', 'struct-constructor-procedure?',
  1152. 'struct-info', 'struct-mutator-procedure?',
  1153. 'struct-predicate-procedure?', 'struct-type-info',
  1154. 'struct-type-make-constructor', 'struct-type-make-predicate',
  1155. 'struct-type-property-accessor-procedure?', 'struct-type-property/c',
  1156. 'struct-type-property?', 'struct-type?', 'struct:arity-at-least',
  1157. 'struct:arrow-contract-info', 'struct:date', 'struct:date*',
  1158. 'struct:exn', 'struct:exn:break', 'struct:exn:break:hang-up',
  1159. 'struct:exn:break:terminate', 'struct:exn:fail',
  1160. 'struct:exn:fail:contract', 'struct:exn:fail:contract:arity',
  1161. 'struct:exn:fail:contract:blame',
  1162. 'struct:exn:fail:contract:continuation',
  1163. 'struct:exn:fail:contract:divide-by-zero',
  1164. 'struct:exn:fail:contract:non-fixnum-result',
  1165. 'struct:exn:fail:contract:variable', 'struct:exn:fail:filesystem',
  1166. 'struct:exn:fail:filesystem:errno',
  1167. 'struct:exn:fail:filesystem:exists',
  1168. 'struct:exn:fail:filesystem:missing-module',
  1169. 'struct:exn:fail:filesystem:version', 'struct:exn:fail:network',
  1170. 'struct:exn:fail:network:errno', 'struct:exn:fail:object',
  1171. 'struct:exn:fail:out-of-memory', 'struct:exn:fail:read',
  1172. 'struct:exn:fail:read:eof', 'struct:exn:fail:read:non-char',
  1173. 'struct:exn:fail:syntax', 'struct:exn:fail:syntax:missing-module',
  1174. 'struct:exn:fail:syntax:unbound', 'struct:exn:fail:unsupported',
  1175. 'struct:exn:fail:user', 'struct:srcloc',
  1176. 'struct:wrapped-extra-arg-arrow', 'struct?', 'sub1', 'subbytes',
  1177. 'subclass?', 'subclass?/c', 'subprocess', 'subprocess-group-enabled',
  1178. 'subprocess-kill', 'subprocess-pid', 'subprocess-status',
  1179. 'subprocess-wait', 'subprocess?', 'subset?', 'substring', 'suggest/c',
  1180. 'symbol->string', 'symbol-interned?', 'symbol-unreadable?', 'symbol<?',
  1181. 'symbol=?', 'symbol?', 'symbols', 'sync', 'sync/enable-break',
  1182. 'sync/timeout', 'sync/timeout/enable-break', 'syntax->datum',
  1183. 'syntax->list', 'syntax-arm', 'syntax-column', 'syntax-debug-info',
  1184. 'syntax-disarm', 'syntax-e', 'syntax-line',
  1185. 'syntax-local-bind-syntaxes', 'syntax-local-certifier',
  1186. 'syntax-local-context', 'syntax-local-expand-expression',
  1187. 'syntax-local-get-shadower', 'syntax-local-identifier-as-binding',
  1188. 'syntax-local-introduce', 'syntax-local-lift-context',
  1189. 'syntax-local-lift-expression', 'syntax-local-lift-module',
  1190. 'syntax-local-lift-module-end-declaration',
  1191. 'syntax-local-lift-provide', 'syntax-local-lift-require',
  1192. 'syntax-local-lift-values-expression',
  1193. 'syntax-local-make-definition-context',
  1194. 'syntax-local-make-delta-introducer',
  1195. 'syntax-local-module-defined-identifiers',
  1196. 'syntax-local-module-exports',
  1197. 'syntax-local-module-required-identifiers', 'syntax-local-name',
  1198. 'syntax-local-phase-level', 'syntax-local-submodules',
  1199. 'syntax-local-transforming-module-provides?', 'syntax-local-value',
  1200. 'syntax-local-value/immediate', 'syntax-original?', 'syntax-position',
  1201. 'syntax-property', 'syntax-property-preserved?',
  1202. 'syntax-property-symbol-keys', 'syntax-protect', 'syntax-rearm',
  1203. 'syntax-recertify', 'syntax-shift-phase-level', 'syntax-source',
  1204. 'syntax-source-module', 'syntax-span', 'syntax-taint',
  1205. 'syntax-tainted?', 'syntax-track-origin',
  1206. 'syntax-transforming-module-expression?',
  1207. 'syntax-transforming-with-lifts?', 'syntax-transforming?', 'syntax/c',
  1208. 'syntax?', 'system', 'system*', 'system*/exit-code',
  1209. 'system-big-endian?', 'system-idle-evt', 'system-language+country',
  1210. 'system-library-subpath', 'system-path-convention-type', 'system-type',
  1211. 'system/exit-code', 'tail-marks-match?', 'take', 'take-common-prefix',
  1212. 'take-right', 'takef', 'takef-right', 'tan', 'tanh',
  1213. 'tcp-abandon-port', 'tcp-accept', 'tcp-accept-evt',
  1214. 'tcp-accept-ready?', 'tcp-accept/enable-break', 'tcp-addresses',
  1215. 'tcp-close', 'tcp-connect', 'tcp-connect/enable-break', 'tcp-listen',
  1216. 'tcp-listener?', 'tcp-port?', 'tentative-pretty-print-port-cancel',
  1217. 'tentative-pretty-print-port-transfer', 'tenth', 'terminal-port?',
  1218. 'the-unsupplied-arg', 'third', 'thread', 'thread-cell-ref',
  1219. 'thread-cell-set!', 'thread-cell-values?', 'thread-cell?',
  1220. 'thread-dead-evt', 'thread-dead?', 'thread-group?', 'thread-receive',
  1221. 'thread-receive-evt', 'thread-resume', 'thread-resume-evt',
  1222. 'thread-rewind-receive', 'thread-running?', 'thread-send',
  1223. 'thread-suspend', 'thread-suspend-evt', 'thread-try-receive',
  1224. 'thread-wait', 'thread/suspend-to-kill', 'thread?', 'time-apply',
  1225. 'touch', 'transplant-input-port', 'transplant-output-port', 'true',
  1226. 'truncate', 'udp-addresses', 'udp-bind!', 'udp-bound?', 'udp-close',
  1227. 'udp-connect!', 'udp-connected?', 'udp-multicast-interface',
  1228. 'udp-multicast-join-group!', 'udp-multicast-leave-group!',
  1229. 'udp-multicast-loopback?', 'udp-multicast-set-interface!',
  1230. 'udp-multicast-set-loopback!', 'udp-multicast-set-ttl!',
  1231. 'udp-multicast-ttl', 'udp-open-socket', 'udp-receive!',
  1232. 'udp-receive!*', 'udp-receive!-evt', 'udp-receive!/enable-break',
  1233. 'udp-receive-ready-evt', 'udp-send', 'udp-send*', 'udp-send-evt',
  1234. 'udp-send-ready-evt', 'udp-send-to', 'udp-send-to*', 'udp-send-to-evt',
  1235. 'udp-send-to/enable-break', 'udp-send/enable-break', 'udp?', 'unbox',
  1236. 'uncaught-exception-handler', 'unit?', 'unspecified-dom',
  1237. 'unsupplied-arg?', 'use-collection-link-paths',
  1238. 'use-compiled-file-paths', 'use-user-specific-search-paths',
  1239. 'user-execute-bit', 'user-read-bit', 'user-write-bit', 'value-blame',
  1240. 'value-contract', 'values', 'variable-reference->empty-namespace',
  1241. 'variable-reference->module-base-phase',
  1242. 'variable-reference->module-declaration-inspector',
  1243. 'variable-reference->module-path-index',
  1244. 'variable-reference->module-source', 'variable-reference->namespace',
  1245. 'variable-reference->phase',
  1246. 'variable-reference->resolved-module-path',
  1247. 'variable-reference-constant?', 'variable-reference?', 'vector',
  1248. 'vector->immutable-vector', 'vector->list',
  1249. 'vector->pseudo-random-generator', 'vector->pseudo-random-generator!',
  1250. 'vector->values', 'vector-append', 'vector-argmax', 'vector-argmin',
  1251. 'vector-copy', 'vector-copy!', 'vector-count', 'vector-drop',
  1252. 'vector-drop-right', 'vector-fill!', 'vector-filter',
  1253. 'vector-filter-not', 'vector-immutable', 'vector-immutable/c',
  1254. 'vector-immutableof', 'vector-length', 'vector-map', 'vector-map!',
  1255. 'vector-member', 'vector-memq', 'vector-memv', 'vector-ref',
  1256. 'vector-set!', 'vector-set*!', 'vector-set-performance-stats!',
  1257. 'vector-split-at', 'vector-split-at-right', 'vector-take',
  1258. 'vector-take-right', 'vector/c', 'vector?', 'vectorof', 'version',
  1259. 'void', 'void?', 'weak-box-value', 'weak-box?', 'weak-set',
  1260. 'weak-seteq', 'weak-seteqv', 'will-execute', 'will-executor?',
  1261. 'will-register', 'will-try-execute', 'with-input-from-bytes',
  1262. 'with-input-from-file', 'with-input-from-string',
  1263. 'with-output-to-bytes', 'with-output-to-file', 'with-output-to-string',
  1264. 'would-be-future', 'wrap-evt', 'wrapped-extra-arg-arrow',
  1265. 'wrapped-extra-arg-arrow-extra-neg-party-argument',
  1266. 'wrapped-extra-arg-arrow-real-func', 'wrapped-extra-arg-arrow?',
  1267. 'writable<%>', 'write', 'write-byte', 'write-bytes',
  1268. 'write-bytes-avail', 'write-bytes-avail*', 'write-bytes-avail-evt',
  1269. 'write-bytes-avail/enable-break', 'write-char', 'write-special',
  1270. 'write-special-avail*', 'write-special-evt', 'write-string',
  1271. 'write-to-file', 'writeln', 'xor', 'zero?', '~.a', '~.s', '~.v', '~a',
  1272. '~e', '~r', '~s', '~v'
  1273. )
  1274. _opening_parenthesis = r'[([{]'
  1275. _closing_parenthesis = r'[)\]}]'
  1276. _delimiters = r'()[\]{}",\'`;\s'
  1277. _symbol = rf'(?:\|[^|]*\||\\[\w\W]|[^|\\{_delimiters}]+)+'
  1278. _exact_decimal_prefix = r'(?:#e)?(?:#d)?(?:#e)?'
  1279. _exponent = r'(?:[defls][-+]?\d+)'
  1280. _inexact_simple_no_hashes = r'(?:\d+(?:/\d+|\.\d*)?|\.\d+)'
  1281. _inexact_simple = (rf'(?:{_inexact_simple_no_hashes}|(?:\d+#+(?:\.#*|/\d+#*)?|\.\d+#+|'
  1282. r'\d+(?:\.\d*#+|/\d+#+)))')
  1283. _inexact_normal_no_hashes = rf'(?:{_inexact_simple_no_hashes}{_exponent}?)'
  1284. _inexact_normal = rf'(?:{_inexact_simple}{_exponent}?)'
  1285. _inexact_special = r'(?:(?:inf|nan)\.[0f])'
  1286. _inexact_real = rf'(?:[-+]?{_inexact_normal}|[-+]{_inexact_special})'
  1287. _inexact_unsigned = rf'(?:{_inexact_normal}|{_inexact_special})'
  1288. tokens = {
  1289. 'root': [
  1290. (_closing_parenthesis, Error),
  1291. (r'(?!\Z)', Text, 'unquoted-datum')
  1292. ],
  1293. 'datum': [
  1294. (r'(?s)#;|#![ /]([^\\\n]|\\.)*', Comment),
  1295. (r';[^\n\r\x85\u2028\u2029]*', Comment.Single),
  1296. (r'#\|', Comment.Multiline, 'block-comment'),
  1297. # Whitespaces
  1298. (r'(?u)\s+', Whitespace),
  1299. # Numbers: Keep in mind Racket reader hash prefixes, which
  1300. # can denote the base or the type. These don't map neatly
  1301. # onto Pygments token types; some judgment calls here.
  1302. # #d or no prefix
  1303. (rf'(?i){_exact_decimal_prefix}[-+]?\d+(?=[{_delimiters}])',
  1304. Number.Integer, '#pop'),
  1305. (rf'(?i){_exact_decimal_prefix}[-+]?(\d+(\.\d*)?|\.\d+)([deflst][-+]?\d+)?(?=[{_delimiters}])', Number.Float, '#pop'),
  1306. (rf'(?i){_exact_decimal_prefix}[-+]?({_inexact_normal_no_hashes}([-+]{_inexact_normal_no_hashes}?i)?|[-+]{_inexact_normal_no_hashes}?i)(?=[{_delimiters}])', Number, '#pop'),
  1307. # Inexact without explicit #i
  1308. (rf'(?i)(#d)?({_inexact_real}([-+]{_inexact_unsigned}?i)?|[-+]{_inexact_unsigned}?i|{_inexact_real}@{_inexact_real})(?=[{_delimiters}])', Number.Float,
  1309. '#pop'),
  1310. # The remaining extflonums
  1311. (rf'(?i)(([-+]?{_inexact_simple}t[-+]?\d+)|[-+](inf|nan)\.t)(?=[{_delimiters}])', Number.Float, '#pop'),
  1312. # #b
  1313. (rf'(?iu)(#[ei])?#b{_symbol}', Number.Bin, '#pop'),
  1314. # #o
  1315. (rf'(?iu)(#[ei])?#o{_symbol}', Number.Oct, '#pop'),
  1316. # #x
  1317. (rf'(?iu)(#[ei])?#x{_symbol}', Number.Hex, '#pop'),
  1318. # #i is always inexact, i.e. float
  1319. (rf'(?iu)(#d)?#i{_symbol}', Number.Float, '#pop'),
  1320. # Strings and characters
  1321. (r'#?"', String.Double, ('#pop', 'string')),
  1322. (r'#<<(.+)\n(^(?!\1$).*$\n)*^\1$', String.Heredoc, '#pop'),
  1323. (r'#\\(u[\da-fA-F]{1,4}|U[\da-fA-F]{1,8})', String.Char, '#pop'),
  1324. (r'(?is)#\\([0-7]{3}|[a-z]+|.)', String.Char, '#pop'),
  1325. (r'(?s)#[pr]x#?"(\\?.)*?"', String.Regex, '#pop'),
  1326. # Constants
  1327. (r'#(true|false|[tTfF])', Name.Constant, '#pop'),
  1328. # Keyword argument names (e.g. #:keyword)
  1329. (rf'#:{_symbol}', Keyword.Declaration, '#pop'),
  1330. # Reader extensions
  1331. (r'(#lang |#!)(\S+)',
  1332. bygroups(Keyword.Namespace, Name.Namespace)),
  1333. (r'#reader', Keyword.Namespace, 'quoted-datum'),
  1334. # Other syntax
  1335. (rf"(?i)\.(?=[{_delimiters}])|#c[is]|#['`]|#,@?", Operator),
  1336. (rf"'|#[s&]|#hash(eqv?)?|#\d*(?={_opening_parenthesis})",
  1337. Operator, ('#pop', 'quoted-datum'))
  1338. ],
  1339. 'datum*': [
  1340. (r'`|,@?', Operator),
  1341. (_symbol, String.Symbol, '#pop'),
  1342. (r'[|\\]', Error),
  1343. default('#pop')
  1344. ],
  1345. 'list': [
  1346. (_closing_parenthesis, Punctuation, '#pop')
  1347. ],
  1348. 'unquoted-datum': [
  1349. include('datum'),
  1350. (rf'quote(?=[{_delimiters}])', Keyword,
  1351. ('#pop', 'quoted-datum')),
  1352. (r'`', Operator, ('#pop', 'quasiquoted-datum')),
  1353. (rf'quasiquote(?=[{_delimiters}])', Keyword,
  1354. ('#pop', 'quasiquoted-datum')),
  1355. (_opening_parenthesis, Punctuation, ('#pop', 'unquoted-list')),
  1356. (words(_keywords, suffix=f'(?=[{_delimiters}])'),
  1357. Keyword, '#pop'),
  1358. (words(_builtins, suffix=f'(?=[{_delimiters}])'),
  1359. Name.Builtin, '#pop'),
  1360. (_symbol, Name, '#pop'),
  1361. include('datum*')
  1362. ],
  1363. 'unquoted-list': [
  1364. include('list'),
  1365. (r'(?!\Z)', Text, 'unquoted-datum')
  1366. ],
  1367. 'quasiquoted-datum': [
  1368. include('datum'),
  1369. (r',@?', Operator, ('#pop', 'unquoted-datum')),
  1370. (rf'unquote(-splicing)?(?=[{_delimiters}])', Keyword,
  1371. ('#pop', 'unquoted-datum')),
  1372. (_opening_parenthesis, Punctuation, ('#pop', 'quasiquoted-list')),
  1373. include('datum*')
  1374. ],
  1375. 'quasiquoted-list': [
  1376. include('list'),
  1377. (r'(?!\Z)', Text, 'quasiquoted-datum')
  1378. ],
  1379. 'quoted-datum': [
  1380. include('datum'),
  1381. (_opening_parenthesis, Punctuation, ('#pop', 'quoted-list')),
  1382. include('datum*')
  1383. ],
  1384. 'quoted-list': [
  1385. include('list'),
  1386. (r'(?!\Z)', Text, 'quoted-datum')
  1387. ],
  1388. 'block-comment': [
  1389. (r'#\|', Comment.Multiline, '#push'),
  1390. (r'\|#', Comment.Multiline, '#pop'),
  1391. (r'[^#|]+|.', Comment.Multiline)
  1392. ],
  1393. 'string': [
  1394. (r'"', String.Double, '#pop'),
  1395. (r'(?s)\\([0-7]{1,3}|x[\da-fA-F]{1,2}|u[\da-fA-F]{1,4}|'
  1396. r'U[\da-fA-F]{1,8}|.)', String.Escape),
  1397. (r'[^\\"]+', String.Double)
  1398. ]
  1399. }
  1400. class NewLispLexer(RegexLexer):
  1401. """
  1402. For newLISP source code (version 10.3.0).
  1403. """
  1404. name = 'NewLisp'
  1405. url = 'http://www.newlisp.org/'
  1406. aliases = ['newlisp']
  1407. filenames = ['*.lsp', '*.nl', '*.kif']
  1408. mimetypes = ['text/x-newlisp', 'application/x-newlisp']
  1409. version_added = '1.5'
  1410. flags = re.IGNORECASE | re.MULTILINE
  1411. # list of built-in functions for newLISP version 10.3
  1412. builtins = (
  1413. '^', '--', '-', ':', '!', '!=', '?', '@', '*', '/', '&', '%', '+', '++',
  1414. '<', '<<', '<=', '=', '>', '>=', '>>', '|', '~', '$', '$0', '$1', '$10',
  1415. '$11', '$12', '$13', '$14', '$15', '$2', '$3', '$4', '$5', '$6', '$7',
  1416. '$8', '$9', '$args', '$idx', '$it', '$main-args', 'abort', 'abs',
  1417. 'acos', 'acosh', 'add', 'address', 'amb', 'and', 'append-file',
  1418. 'append', 'apply', 'args', 'array-list', 'array?', 'array', 'asin',
  1419. 'asinh', 'assoc', 'atan', 'atan2', 'atanh', 'atom?', 'base64-dec',
  1420. 'base64-enc', 'bayes-query', 'bayes-train', 'begin',
  1421. 'beta', 'betai', 'bind', 'binomial', 'bits', 'callback',
  1422. 'case', 'catch', 'ceil', 'change-dir', 'char', 'chop', 'Class', 'clean',
  1423. 'close', 'command-event', 'cond', 'cons', 'constant',
  1424. 'context?', 'context', 'copy-file', 'copy', 'cos', 'cosh', 'count',
  1425. 'cpymem', 'crc32', 'crit-chi2', 'crit-z', 'current-line', 'curry',
  1426. 'date-list', 'date-parse', 'date-value', 'date', 'debug', 'dec',
  1427. 'def-new', 'default', 'define-macro', 'define',
  1428. 'delete-file', 'delete-url', 'delete', 'destroy', 'det', 'device',
  1429. 'difference', 'directory?', 'directory', 'div', 'do-until', 'do-while',
  1430. 'doargs', 'dolist', 'dostring', 'dotimes', 'dotree', 'dump', 'dup',
  1431. 'empty?', 'encrypt', 'ends-with', 'env', 'erf', 'error-event',
  1432. 'eval-string', 'eval', 'exec', 'exists', 'exit', 'exp', 'expand',
  1433. 'explode', 'extend', 'factor', 'fft', 'file-info', 'file?', 'filter',
  1434. 'find-all', 'find', 'first', 'flat', 'float?', 'float', 'floor', 'flt',
  1435. 'fn', 'for-all', 'for', 'fork', 'format', 'fv', 'gammai', 'gammaln',
  1436. 'gcd', 'get-char', 'get-float', 'get-int', 'get-long', 'get-string',
  1437. 'get-url', 'global?', 'global', 'if-not', 'if', 'ifft', 'import', 'inc',
  1438. 'index', 'inf?', 'int', 'integer?', 'integer', 'intersect', 'invert',
  1439. 'irr', 'join', 'lambda-macro', 'lambda?', 'lambda', 'last-error',
  1440. 'last', 'legal?', 'length', 'let', 'letex', 'letn',
  1441. 'list?', 'list', 'load', 'local', 'log', 'lookup',
  1442. 'lower-case', 'macro?', 'main-args', 'MAIN', 'make-dir', 'map', 'mat',
  1443. 'match', 'max', 'member', 'min', 'mod', 'module', 'mul', 'multiply',
  1444. 'NaN?', 'net-accept', 'net-close', 'net-connect', 'net-error',
  1445. 'net-eval', 'net-interface', 'net-ipv', 'net-listen', 'net-local',
  1446. 'net-lookup', 'net-packet', 'net-peek', 'net-peer', 'net-ping',
  1447. 'net-receive-from', 'net-receive-udp', 'net-receive', 'net-select',
  1448. 'net-send-to', 'net-send-udp', 'net-send', 'net-service',
  1449. 'net-sessions', 'new', 'nil?', 'nil', 'normal', 'not', 'now', 'nper',
  1450. 'npv', 'nth', 'null?', 'number?', 'open', 'or', 'ostype', 'pack',
  1451. 'parse-date', 'parse', 'peek', 'pipe', 'pmt', 'pop-assoc', 'pop',
  1452. 'post-url', 'pow', 'prefix', 'pretty-print', 'primitive?', 'print',
  1453. 'println', 'prob-chi2', 'prob-z', 'process', 'prompt-event',
  1454. 'protected?', 'push', 'put-url', 'pv', 'quote?', 'quote', 'rand',
  1455. 'random', 'randomize', 'read', 'read-char', 'read-expr', 'read-file',
  1456. 'read-key', 'read-line', 'read-utf8', 'reader-event',
  1457. 'real-path', 'receive', 'ref-all', 'ref', 'regex-comp', 'regex',
  1458. 'remove-dir', 'rename-file', 'replace', 'reset', 'rest', 'reverse',
  1459. 'rotate', 'round', 'save', 'search', 'seed', 'seek', 'select', 'self',
  1460. 'semaphore', 'send', 'sequence', 'series', 'set-locale', 'set-ref-all',
  1461. 'set-ref', 'set', 'setf', 'setq', 'sgn', 'share', 'signal', 'silent',
  1462. 'sin', 'sinh', 'sleep', 'slice', 'sort', 'source', 'spawn', 'sqrt',
  1463. 'starts-with', 'string?', 'string', 'sub', 'swap', 'sym', 'symbol?',
  1464. 'symbols', 'sync', 'sys-error', 'sys-info', 'tan', 'tanh', 'term',
  1465. 'throw-error', 'throw', 'time-of-day', 'time', 'timer', 'title-case',
  1466. 'trace-highlight', 'trace', 'transpose', 'Tree', 'trim', 'true?',
  1467. 'true', 'unicode', 'unify', 'unique', 'unless', 'unpack', 'until',
  1468. 'upper-case', 'utf8', 'utf8len', 'uuid', 'wait-pid', 'when', 'while',
  1469. 'write', 'write-char', 'write-file', 'write-line',
  1470. 'xfer-event', 'xml-error', 'xml-parse', 'xml-type-tags', 'zero?',
  1471. )
  1472. # valid names
  1473. valid_name = r'([\w!$%&*+.,/<=>?@^~|-])+|(\[.*?\])+'
  1474. tokens = {
  1475. 'root': [
  1476. # shebang
  1477. (r'#!(.*?)$', Comment.Preproc),
  1478. # comments starting with semicolon
  1479. (r';.*$', Comment.Single),
  1480. # comments starting with #
  1481. (r'#.*$', Comment.Single),
  1482. # whitespace
  1483. (r'\s+', Whitespace),
  1484. # strings, symbols and characters
  1485. (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
  1486. # braces
  1487. (r'\{', String, "bracestring"),
  1488. # [text] ... [/text] delimited strings
  1489. (r'\[text\]*', String, "tagstring"),
  1490. # 'special' operators...
  1491. (r"('|:)", Operator),
  1492. # highlight the builtins
  1493. (words(builtins, suffix=r'\b'),
  1494. Keyword),
  1495. # the remaining functions
  1496. (r'(?<=\()' + valid_name, Name.Variable),
  1497. # the remaining variables
  1498. (valid_name, String.Symbol),
  1499. # parentheses
  1500. (r'(\(|\))', Punctuation),
  1501. ],
  1502. # braced strings...
  1503. 'bracestring': [
  1504. (r'\{', String, "#push"),
  1505. (r'\}', String, "#pop"),
  1506. ('[^{}]+', String),
  1507. ],
  1508. # tagged [text]...[/text] delimited strings...
  1509. 'tagstring': [
  1510. (r'(?s)(.*?)(\[/text\])', String, '#pop'),
  1511. ],
  1512. }
  1513. class EmacsLispLexer(RegexLexer):
  1514. """
  1515. An ELisp lexer, parsing a stream and outputting the tokens
  1516. needed to highlight elisp code.
  1517. """
  1518. name = 'EmacsLisp'
  1519. aliases = ['emacs-lisp', 'elisp', 'emacs']
  1520. filenames = ['*.el']
  1521. mimetypes = ['text/x-elisp', 'application/x-elisp']
  1522. url = 'https://www.gnu.org/software/emacs'
  1523. version_added = '2.1'
  1524. flags = re.MULTILINE
  1525. # couple of useful regexes
  1526. # characters that are not macro-characters and can be used to begin a symbol
  1527. nonmacro = r'\\.|[\w!$%&*+-/<=>?@^{}~|]'
  1528. constituent = nonmacro + '|[#.:]'
  1529. terminated = r'(?=[ "()\]\'\n,;`])' # whitespace or terminating macro characters
  1530. # symbol token, reverse-engineered from hyperspec
  1531. # Take a deep breath...
  1532. symbol = rf'((?:{nonmacro})(?:{constituent})*)'
  1533. macros = {
  1534. 'atomic-change-group', 'case', 'block', 'cl-block', 'cl-callf', 'cl-callf2',
  1535. 'cl-case', 'cl-decf', 'cl-declaim', 'cl-declare',
  1536. 'cl-define-compiler-macro', 'cl-defmacro', 'cl-defstruct',
  1537. 'cl-defsubst', 'cl-deftype', 'cl-defun', 'cl-destructuring-bind',
  1538. 'cl-do', 'cl-do*', 'cl-do-all-symbols', 'cl-do-symbols', 'cl-dolist',
  1539. 'cl-dotimes', 'cl-ecase', 'cl-etypecase', 'eval-when', 'cl-eval-when', 'cl-flet',
  1540. 'cl-flet*', 'cl-function', 'cl-incf', 'cl-labels', 'cl-letf',
  1541. 'cl-letf*', 'cl-load-time-value', 'cl-locally', 'cl-loop',
  1542. 'cl-macrolet', 'cl-multiple-value-bind', 'cl-multiple-value-setq',
  1543. 'cl-progv', 'cl-psetf', 'cl-psetq', 'cl-pushnew', 'cl-remf',
  1544. 'cl-return', 'cl-return-from', 'cl-rotatef', 'cl-shiftf',
  1545. 'cl-symbol-macrolet', 'cl-tagbody', 'cl-the', 'cl-typecase',
  1546. 'combine-after-change-calls', 'condition-case-unless-debug', 'decf',
  1547. 'declaim', 'declare', 'declare-function', 'def-edebug-spec',
  1548. 'defadvice', 'defclass', 'defcustom', 'defface', 'defgeneric',
  1549. 'defgroup', 'define-advice', 'define-alternatives',
  1550. 'define-compiler-macro', 'define-derived-mode', 'define-generic-mode',
  1551. 'define-global-minor-mode', 'define-globalized-minor-mode',
  1552. 'define-minor-mode', 'define-modify-macro',
  1553. 'define-obsolete-face-alias', 'define-obsolete-function-alias',
  1554. 'define-obsolete-variable-alias', 'define-setf-expander',
  1555. 'define-skeleton', 'defmacro', 'defmethod', 'defsetf', 'defstruct',
  1556. 'defsubst', 'deftheme', 'deftype', 'defun', 'defvar-local',
  1557. 'delay-mode-hooks', 'destructuring-bind', 'do', 'do*',
  1558. 'do-all-symbols', 'do-symbols', 'dolist', 'dont-compile', 'dotimes',
  1559. 'dotimes-with-progress-reporter', 'ecase', 'ert-deftest', 'etypecase',
  1560. 'eval-and-compile', 'eval-when-compile', 'flet', 'ignore-errors',
  1561. 'incf', 'labels', 'lambda', 'letrec', 'lexical-let', 'lexical-let*',
  1562. 'loop', 'multiple-value-bind', 'multiple-value-setq', 'noreturn',
  1563. 'oref', 'oref-default', 'oset', 'oset-default', 'pcase',
  1564. 'pcase-defmacro', 'pcase-dolist', 'pcase-exhaustive', 'pcase-let',
  1565. 'pcase-let*', 'pop', 'psetf', 'psetq', 'push', 'pushnew', 'remf',
  1566. 'return', 'rotatef', 'rx', 'save-match-data', 'save-selected-window',
  1567. 'save-window-excursion', 'setf', 'setq-local', 'shiftf',
  1568. 'track-mouse', 'typecase', 'unless', 'use-package', 'when',
  1569. 'while-no-input', 'with-case-table', 'with-category-table',
  1570. 'with-coding-priority', 'with-current-buffer', 'with-demoted-errors',
  1571. 'with-eval-after-load', 'with-file-modes', 'with-local-quit',
  1572. 'with-output-to-string', 'with-output-to-temp-buffer',
  1573. 'with-parsed-tramp-file-name', 'with-selected-frame',
  1574. 'with-selected-window', 'with-silent-modifications', 'with-slots',
  1575. 'with-syntax-table', 'with-temp-buffer', 'with-temp-file',
  1576. 'with-temp-message', 'with-timeout', 'with-tramp-connection-property',
  1577. 'with-tramp-file-property', 'with-tramp-progress-reporter',
  1578. 'with-wrapper-hook', 'load-time-value', 'locally', 'macrolet', 'progv',
  1579. 'return-from',
  1580. }
  1581. special_forms = {
  1582. 'and', 'catch', 'cond', 'condition-case', 'defconst', 'defvar',
  1583. 'function', 'if', 'interactive', 'let', 'let*', 'or', 'prog1',
  1584. 'prog2', 'progn', 'quote', 'save-current-buffer', 'save-excursion',
  1585. 'save-restriction', 'setq', 'setq-default', 'subr-arity',
  1586. 'unwind-protect', 'while',
  1587. }
  1588. builtin_function = {
  1589. '%', '*', '+', '-', '/', '/=', '1+', '1-', '<', '<=', '=', '>', '>=',
  1590. 'Snarf-documentation', 'abort-recursive-edit', 'abs',
  1591. 'accept-process-output', 'access-file', 'accessible-keymaps', 'acos',
  1592. 'active-minibuffer-window', 'add-face-text-property',
  1593. 'add-name-to-file', 'add-text-properties', 'all-completions',
  1594. 'append', 'apply', 'apropos-internal', 'aref', 'arrayp', 'aset',
  1595. 'ash', 'asin', 'assoc', 'assoc-string', 'assq', 'atan', 'atom',
  1596. 'autoload', 'autoload-do-load', 'backtrace', 'backtrace--locals',
  1597. 'backtrace-debug', 'backtrace-eval', 'backtrace-frame',
  1598. 'backward-char', 'backward-prefix-chars', 'barf-if-buffer-read-only',
  1599. 'base64-decode-region', 'base64-decode-string',
  1600. 'base64-encode-region', 'base64-encode-string', 'beginning-of-line',
  1601. 'bidi-find-overridden-directionality', 'bidi-resolved-levels',
  1602. 'bitmap-spec-p', 'bobp', 'bolp', 'bool-vector',
  1603. 'bool-vector-count-consecutive', 'bool-vector-count-population',
  1604. 'bool-vector-exclusive-or', 'bool-vector-intersection',
  1605. 'bool-vector-not', 'bool-vector-p', 'bool-vector-set-difference',
  1606. 'bool-vector-subsetp', 'bool-vector-union', 'boundp',
  1607. 'buffer-base-buffer', 'buffer-chars-modified-tick',
  1608. 'buffer-enable-undo', 'buffer-file-name', 'buffer-has-markers-at',
  1609. 'buffer-list', 'buffer-live-p', 'buffer-local-value',
  1610. 'buffer-local-variables', 'buffer-modified-p', 'buffer-modified-tick',
  1611. 'buffer-name', 'buffer-size', 'buffer-string', 'buffer-substring',
  1612. 'buffer-substring-no-properties', 'buffer-swap-text', 'bufferp',
  1613. 'bury-buffer-internal', 'byte-code', 'byte-code-function-p',
  1614. 'byte-to-position', 'byte-to-string', 'byteorder',
  1615. 'call-interactively', 'call-last-kbd-macro', 'call-process',
  1616. 'call-process-region', 'cancel-kbd-macro-events', 'capitalize',
  1617. 'capitalize-region', 'capitalize-word', 'car', 'car-less-than-car',
  1618. 'car-safe', 'case-table-p', 'category-docstring',
  1619. 'category-set-mnemonics', 'category-table', 'category-table-p',
  1620. 'ccl-execute', 'ccl-execute-on-string', 'ccl-program-p', 'cdr',
  1621. 'cdr-safe', 'ceiling', 'char-after', 'char-before',
  1622. 'char-category-set', 'char-charset', 'char-equal', 'char-or-string-p',
  1623. 'char-resolve-modifiers', 'char-syntax', 'char-table-extra-slot',
  1624. 'char-table-p', 'char-table-parent', 'char-table-range',
  1625. 'char-table-subtype', 'char-to-string', 'char-width', 'characterp',
  1626. 'charset-after', 'charset-id-internal', 'charset-plist',
  1627. 'charset-priority-list', 'charsetp', 'check-coding-system',
  1628. 'check-coding-systems-region', 'clear-buffer-auto-save-failure',
  1629. 'clear-charset-maps', 'clear-face-cache', 'clear-font-cache',
  1630. 'clear-image-cache', 'clear-string', 'clear-this-command-keys',
  1631. 'close-font', 'clrhash', 'coding-system-aliases',
  1632. 'coding-system-base', 'coding-system-eol-type', 'coding-system-p',
  1633. 'coding-system-plist', 'coding-system-priority-list',
  1634. 'coding-system-put', 'color-distance', 'color-gray-p',
  1635. 'color-supported-p', 'combine-after-change-execute',
  1636. 'command-error-default-function', 'command-remapping', 'commandp',
  1637. 'compare-buffer-substrings', 'compare-strings',
  1638. 'compare-window-configurations', 'completing-read',
  1639. 'compose-region-internal', 'compose-string-internal',
  1640. 'composition-get-gstring', 'compute-motion', 'concat', 'cons',
  1641. 'consp', 'constrain-to-field', 'continue-process',
  1642. 'controlling-tty-p', 'coordinates-in-window-p', 'copy-alist',
  1643. 'copy-category-table', 'copy-file', 'copy-hash-table', 'copy-keymap',
  1644. 'copy-marker', 'copy-sequence', 'copy-syntax-table', 'copysign',
  1645. 'cos', 'current-active-maps', 'current-bidi-paragraph-direction',
  1646. 'current-buffer', 'current-case-table', 'current-column',
  1647. 'current-global-map', 'current-idle-time', 'current-indentation',
  1648. 'current-input-mode', 'current-local-map', 'current-message',
  1649. 'current-minor-mode-maps', 'current-time', 'current-time-string',
  1650. 'current-time-zone', 'current-window-configuration',
  1651. 'cygwin-convert-file-name-from-windows',
  1652. 'cygwin-convert-file-name-to-windows', 'daemon-initialized',
  1653. 'daemonp', 'dbus--init-bus', 'dbus-get-unique-name',
  1654. 'dbus-message-internal', 'debug-timer-check', 'declare-equiv-charset',
  1655. 'decode-big5-char', 'decode-char', 'decode-coding-region',
  1656. 'decode-coding-string', 'decode-sjis-char', 'decode-time',
  1657. 'default-boundp', 'default-file-modes', 'default-printer-name',
  1658. 'default-toplevel-value', 'default-value', 'define-category',
  1659. 'define-charset-alias', 'define-charset-internal',
  1660. 'define-coding-system-alias', 'define-coding-system-internal',
  1661. 'define-fringe-bitmap', 'define-hash-table-test', 'define-key',
  1662. 'define-prefix-command', 'delete',
  1663. 'delete-all-overlays', 'delete-and-extract-region', 'delete-char',
  1664. 'delete-directory-internal', 'delete-field', 'delete-file',
  1665. 'delete-frame', 'delete-other-windows-internal', 'delete-overlay',
  1666. 'delete-process', 'delete-region', 'delete-terminal',
  1667. 'delete-window-internal', 'delq', 'describe-buffer-bindings',
  1668. 'describe-vector', 'destroy-fringe-bitmap', 'detect-coding-region',
  1669. 'detect-coding-string', 'ding', 'directory-file-name',
  1670. 'directory-files', 'directory-files-and-attributes', 'discard-input',
  1671. 'display-supports-face-attributes-p', 'do-auto-save', 'documentation',
  1672. 'documentation-property', 'downcase', 'downcase-region',
  1673. 'downcase-word', 'draw-string', 'dump-colors', 'dump-emacs',
  1674. 'dump-face', 'dump-frame-glyph-matrix', 'dump-glyph-matrix',
  1675. 'dump-glyph-row', 'dump-redisplay-history', 'dump-tool-bar-row',
  1676. 'elt', 'emacs-pid', 'encode-big5-char', 'encode-char',
  1677. 'encode-coding-region', 'encode-coding-string', 'encode-sjis-char',
  1678. 'encode-time', 'end-kbd-macro', 'end-of-line', 'eobp', 'eolp', 'eq',
  1679. 'eql', 'equal', 'equal-including-properties', 'erase-buffer',
  1680. 'error-message-string', 'eval', 'eval-buffer', 'eval-region',
  1681. 'event-convert-list', 'execute-kbd-macro', 'exit-recursive-edit',
  1682. 'exp', 'expand-file-name', 'expt', 'external-debugging-output',
  1683. 'face-attribute-relative-p', 'face-attributes-as-vector', 'face-font',
  1684. 'fboundp', 'fceiling', 'fetch-bytecode', 'ffloor',
  1685. 'field-beginning', 'field-end', 'field-string',
  1686. 'field-string-no-properties', 'file-accessible-directory-p',
  1687. 'file-acl', 'file-attributes', 'file-attributes-lessp',
  1688. 'file-directory-p', 'file-executable-p', 'file-exists-p',
  1689. 'file-locked-p', 'file-modes', 'file-name-absolute-p',
  1690. 'file-name-all-completions', 'file-name-as-directory',
  1691. 'file-name-completion', 'file-name-directory',
  1692. 'file-name-nondirectory', 'file-newer-than-file-p', 'file-readable-p',
  1693. 'file-regular-p', 'file-selinux-context', 'file-symlink-p',
  1694. 'file-system-info', 'file-system-info', 'file-writable-p',
  1695. 'fillarray', 'find-charset-region', 'find-charset-string',
  1696. 'find-coding-systems-region-internal', 'find-composition-internal',
  1697. 'find-file-name-handler', 'find-font', 'find-operation-coding-system',
  1698. 'float', 'float-time', 'floatp', 'floor', 'fmakunbound',
  1699. 'following-char', 'font-at', 'font-drive-otf', 'font-face-attributes',
  1700. 'font-family-list', 'font-get', 'font-get-glyphs',
  1701. 'font-get-system-font', 'font-get-system-normal-font', 'font-info',
  1702. 'font-match-p', 'font-otf-alternates', 'font-put',
  1703. 'font-shape-gstring', 'font-spec', 'font-variation-glyphs',
  1704. 'font-xlfd-name', 'fontp', 'fontset-font', 'fontset-info',
  1705. 'fontset-list', 'fontset-list-all', 'force-mode-line-update',
  1706. 'force-window-update', 'format', 'format-mode-line',
  1707. 'format-network-address', 'format-time-string', 'forward-char',
  1708. 'forward-comment', 'forward-line', 'forward-word',
  1709. 'frame-border-width', 'frame-bottom-divider-width',
  1710. 'frame-can-run-window-configuration-change-hook', 'frame-char-height',
  1711. 'frame-char-width', 'frame-face-alist', 'frame-first-window',
  1712. 'frame-focus', 'frame-font-cache', 'frame-fringe-width', 'frame-list',
  1713. 'frame-live-p', 'frame-or-buffer-changed-p', 'frame-parameter',
  1714. 'frame-parameters', 'frame-pixel-height', 'frame-pixel-width',
  1715. 'frame-pointer-visible-p', 'frame-right-divider-width',
  1716. 'frame-root-window', 'frame-scroll-bar-height',
  1717. 'frame-scroll-bar-width', 'frame-selected-window', 'frame-terminal',
  1718. 'frame-text-cols', 'frame-text-height', 'frame-text-lines',
  1719. 'frame-text-width', 'frame-total-cols', 'frame-total-lines',
  1720. 'frame-visible-p', 'framep', 'frexp', 'fringe-bitmaps-at-pos',
  1721. 'fround', 'fset', 'ftruncate', 'funcall', 'funcall-interactively',
  1722. 'function-equal', 'functionp', 'gap-position', 'gap-size',
  1723. 'garbage-collect', 'gc-status', 'generate-new-buffer-name', 'get',
  1724. 'get-buffer', 'get-buffer-create', 'get-buffer-process',
  1725. 'get-buffer-window', 'get-byte', 'get-char-property',
  1726. 'get-char-property-and-overlay', 'get-file-buffer', 'get-file-char',
  1727. 'get-internal-run-time', 'get-load-suffixes', 'get-pos-property',
  1728. 'get-process', 'get-screen-color', 'get-text-property',
  1729. 'get-unicode-property-internal', 'get-unused-category',
  1730. 'get-unused-iso-final-char', 'getenv-internal', 'gethash',
  1731. 'gfile-add-watch', 'gfile-rm-watch', 'global-key-binding',
  1732. 'gnutls-available-p', 'gnutls-boot', 'gnutls-bye', 'gnutls-deinit',
  1733. 'gnutls-error-fatalp', 'gnutls-error-string', 'gnutls-errorp',
  1734. 'gnutls-get-initstage', 'gnutls-peer-status',
  1735. 'gnutls-peer-status-warning-describe', 'goto-char', 'gpm-mouse-start',
  1736. 'gpm-mouse-stop', 'group-gid', 'group-real-gid',
  1737. 'handle-save-session', 'handle-switch-frame', 'hash-table-count',
  1738. 'hash-table-p', 'hash-table-rehash-size',
  1739. 'hash-table-rehash-threshold', 'hash-table-size', 'hash-table-test',
  1740. 'hash-table-weakness', 'iconify-frame', 'identity', 'image-flush',
  1741. 'image-mask-p', 'image-metadata', 'image-size', 'imagemagick-types',
  1742. 'imagep', 'indent-to', 'indirect-function', 'indirect-variable',
  1743. 'init-image-library', 'inotify-add-watch', 'inotify-rm-watch',
  1744. 'input-pending-p', 'insert', 'insert-and-inherit',
  1745. 'insert-before-markers', 'insert-before-markers-and-inherit',
  1746. 'insert-buffer-substring', 'insert-byte', 'insert-char',
  1747. 'insert-file-contents', 'insert-startup-screen', 'int86',
  1748. 'integer-or-marker-p', 'integerp', 'interactive-form', 'intern',
  1749. 'intern-soft', 'internal--track-mouse', 'internal-char-font',
  1750. 'internal-complete-buffer', 'internal-copy-lisp-face',
  1751. 'internal-default-process-filter',
  1752. 'internal-default-process-sentinel', 'internal-describe-syntax-value',
  1753. 'internal-event-symbol-parse-modifiers',
  1754. 'internal-face-x-get-resource', 'internal-get-lisp-face-attribute',
  1755. 'internal-lisp-face-attribute-values', 'internal-lisp-face-empty-p',
  1756. 'internal-lisp-face-equal-p', 'internal-lisp-face-p',
  1757. 'internal-make-lisp-face', 'internal-make-var-non-special',
  1758. 'internal-merge-in-global-face',
  1759. 'internal-set-alternative-font-family-alist',
  1760. 'internal-set-alternative-font-registry-alist',
  1761. 'internal-set-font-selection-order',
  1762. 'internal-set-lisp-face-attribute',
  1763. 'internal-set-lisp-face-attribute-from-resource',
  1764. 'internal-show-cursor', 'internal-show-cursor-p', 'interrupt-process',
  1765. 'invisible-p', 'invocation-directory', 'invocation-name', 'isnan',
  1766. 'iso-charset', 'key-binding', 'key-description',
  1767. 'keyboard-coding-system', 'keymap-parent', 'keymap-prompt', 'keymapp',
  1768. 'keywordp', 'kill-all-local-variables', 'kill-buffer', 'kill-emacs',
  1769. 'kill-local-variable', 'kill-process', 'last-nonminibuffer-frame',
  1770. 'lax-plist-get', 'lax-plist-put', 'ldexp', 'length',
  1771. 'libxml-parse-html-region', 'libxml-parse-xml-region',
  1772. 'line-beginning-position', 'line-end-position', 'line-pixel-height',
  1773. 'list', 'list-fonts', 'list-system-processes', 'listp', 'load',
  1774. 'load-average', 'local-key-binding', 'local-variable-if-set-p',
  1775. 'local-variable-p', 'locale-info', 'locate-file-internal',
  1776. 'lock-buffer', 'log', 'logand', 'logb', 'logior', 'lognot', 'logxor',
  1777. 'looking-at', 'lookup-image', 'lookup-image-map', 'lookup-key',
  1778. 'lower-frame', 'lsh', 'macroexpand', 'make-bool-vector',
  1779. 'make-byte-code', 'make-category-set', 'make-category-table',
  1780. 'make-char', 'make-char-table', 'make-directory-internal',
  1781. 'make-frame-invisible', 'make-frame-visible', 'make-hash-table',
  1782. 'make-indirect-buffer', 'make-keymap', 'make-list',
  1783. 'make-local-variable', 'make-marker', 'make-network-process',
  1784. 'make-overlay', 'make-serial-process', 'make-sparse-keymap',
  1785. 'make-string', 'make-symbol', 'make-symbolic-link', 'make-temp-name',
  1786. 'make-terminal-frame', 'make-variable-buffer-local',
  1787. 'make-variable-frame-local', 'make-vector', 'makunbound',
  1788. 'map-char-table', 'map-charset-chars', 'map-keymap',
  1789. 'map-keymap-internal', 'mapatoms', 'mapc', 'mapcar', 'mapconcat',
  1790. 'maphash', 'mark-marker', 'marker-buffer', 'marker-insertion-type',
  1791. 'marker-position', 'markerp', 'match-beginning', 'match-data',
  1792. 'match-end', 'matching-paren', 'max', 'max-char', 'md5', 'member',
  1793. 'memory-info', 'memory-limit', 'memory-use-counts', 'memq', 'memql',
  1794. 'menu-bar-menu-at-x-y', 'menu-or-popup-active-p',
  1795. 'menu-or-popup-active-p', 'merge-face-attribute', 'message',
  1796. 'message-box', 'message-or-box', 'min',
  1797. 'minibuffer-completion-contents', 'minibuffer-contents',
  1798. 'minibuffer-contents-no-properties', 'minibuffer-depth',
  1799. 'minibuffer-prompt', 'minibuffer-prompt-end',
  1800. 'minibuffer-selected-window', 'minibuffer-window', 'minibufferp',
  1801. 'minor-mode-key-binding', 'mod', 'modify-category-entry',
  1802. 'modify-frame-parameters', 'modify-syntax-entry',
  1803. 'mouse-pixel-position', 'mouse-position', 'move-overlay',
  1804. 'move-point-visually', 'move-to-column', 'move-to-window-line',
  1805. 'msdos-downcase-filename', 'msdos-long-file-names', 'msdos-memget',
  1806. 'msdos-memput', 'msdos-mouse-disable', 'msdos-mouse-enable',
  1807. 'msdos-mouse-init', 'msdos-mouse-p', 'msdos-remember-default-colors',
  1808. 'msdos-set-keyboard', 'msdos-set-mouse-buttons',
  1809. 'multibyte-char-to-unibyte', 'multibyte-string-p', 'narrow-to-region',
  1810. 'natnump', 'nconc', 'network-interface-info',
  1811. 'network-interface-list', 'new-fontset', 'newline-cache-check',
  1812. 'next-char-property-change', 'next-frame', 'next-overlay-change',
  1813. 'next-property-change', 'next-read-file-uses-dialog-p',
  1814. 'next-single-char-property-change', 'next-single-property-change',
  1815. 'next-window', 'nlistp', 'nreverse', 'nth', 'nthcdr', 'null',
  1816. 'number-or-marker-p', 'number-to-string', 'numberp',
  1817. 'open-dribble-file', 'open-font', 'open-termscript',
  1818. 'optimize-char-table', 'other-buffer', 'other-window-for-scrolling',
  1819. 'overlay-buffer', 'overlay-end', 'overlay-get', 'overlay-lists',
  1820. 'overlay-properties', 'overlay-put', 'overlay-recenter',
  1821. 'overlay-start', 'overlayp', 'overlays-at', 'overlays-in',
  1822. 'parse-partial-sexp', 'play-sound-internal', 'plist-get',
  1823. 'plist-member', 'plist-put', 'point', 'point-marker', 'point-max',
  1824. 'point-max-marker', 'point-min', 'point-min-marker',
  1825. 'pos-visible-in-window-p', 'position-bytes', 'posix-looking-at',
  1826. 'posix-search-backward', 'posix-search-forward', 'posix-string-match',
  1827. 'posn-at-point', 'posn-at-x-y', 'preceding-char',
  1828. 'prefix-numeric-value', 'previous-char-property-change',
  1829. 'previous-frame', 'previous-overlay-change',
  1830. 'previous-property-change', 'previous-single-char-property-change',
  1831. 'previous-single-property-change', 'previous-window', 'prin1',
  1832. 'prin1-to-string', 'princ', 'print', 'process-attributes',
  1833. 'process-buffer', 'process-coding-system', 'process-command',
  1834. 'process-connection', 'process-contact', 'process-datagram-address',
  1835. 'process-exit-status', 'process-filter', 'process-filter-multibyte-p',
  1836. 'process-id', 'process-inherit-coding-system-flag', 'process-list',
  1837. 'process-mark', 'process-name', 'process-plist',
  1838. 'process-query-on-exit-flag', 'process-running-child-p',
  1839. 'process-send-eof', 'process-send-region', 'process-send-string',
  1840. 'process-sentinel', 'process-status', 'process-tty-name',
  1841. 'process-type', 'processp', 'profiler-cpu-log',
  1842. 'profiler-cpu-running-p', 'profiler-cpu-start', 'profiler-cpu-stop',
  1843. 'profiler-memory-log', 'profiler-memory-running-p',
  1844. 'profiler-memory-start', 'profiler-memory-stop', 'propertize',
  1845. 'purecopy', 'put', 'put-text-property',
  1846. 'put-unicode-property-internal', 'puthash', 'query-font',
  1847. 'query-fontset', 'quit-process', 'raise-frame', 'random', 'rassoc',
  1848. 'rassq', 're-search-backward', 're-search-forward', 'read',
  1849. 'read-buffer', 'read-char', 'read-char-exclusive',
  1850. 'read-coding-system', 'read-command', 'read-event',
  1851. 'read-from-minibuffer', 'read-from-string', 'read-function',
  1852. 'read-key-sequence', 'read-key-sequence-vector',
  1853. 'read-no-blanks-input', 'read-non-nil-coding-system', 'read-string',
  1854. 'read-variable', 'recent-auto-save-p', 'recent-doskeys',
  1855. 'recent-keys', 'recenter', 'recursion-depth', 'recursive-edit',
  1856. 'redirect-debugging-output', 'redirect-frame-focus', 'redisplay',
  1857. 'redraw-display', 'redraw-frame', 'regexp-quote', 'region-beginning',
  1858. 'region-end', 'register-ccl-program', 'register-code-conversion-map',
  1859. 'remhash', 'remove-list-of-text-properties', 'remove-text-properties',
  1860. 'rename-buffer', 'rename-file', 'replace-match',
  1861. 'reset-this-command-lengths', 'resize-mini-window-internal',
  1862. 'restore-buffer-modified-p', 'resume-tty', 'reverse', 'round',
  1863. 'run-hook-with-args', 'run-hook-with-args-until-failure',
  1864. 'run-hook-with-args-until-success', 'run-hook-wrapped', 'run-hooks',
  1865. 'run-window-configuration-change-hook', 'run-window-scroll-functions',
  1866. 'safe-length', 'scan-lists', 'scan-sexps', 'scroll-down',
  1867. 'scroll-left', 'scroll-other-window', 'scroll-right', 'scroll-up',
  1868. 'search-backward', 'search-forward', 'secure-hash', 'select-frame',
  1869. 'select-window', 'selected-frame', 'selected-window',
  1870. 'self-insert-command', 'send-string-to-terminal', 'sequencep',
  1871. 'serial-process-configure', 'set', 'set-buffer',
  1872. 'set-buffer-auto-saved', 'set-buffer-major-mode',
  1873. 'set-buffer-modified-p', 'set-buffer-multibyte', 'set-case-table',
  1874. 'set-category-table', 'set-char-table-extra-slot',
  1875. 'set-char-table-parent', 'set-char-table-range', 'set-charset-plist',
  1876. 'set-charset-priority', 'set-coding-system-priority',
  1877. 'set-cursor-size', 'set-default', 'set-default-file-modes',
  1878. 'set-default-toplevel-value', 'set-file-acl', 'set-file-modes',
  1879. 'set-file-selinux-context', 'set-file-times', 'set-fontset-font',
  1880. 'set-frame-height', 'set-frame-position', 'set-frame-selected-window',
  1881. 'set-frame-size', 'set-frame-width', 'set-fringe-bitmap-face',
  1882. 'set-input-interrupt-mode', 'set-input-meta-mode', 'set-input-mode',
  1883. 'set-keyboard-coding-system-internal', 'set-keymap-parent',
  1884. 'set-marker', 'set-marker-insertion-type', 'set-match-data',
  1885. 'set-message-beep', 'set-minibuffer-window',
  1886. 'set-mouse-pixel-position', 'set-mouse-position',
  1887. 'set-network-process-option', 'set-output-flow-control',
  1888. 'set-process-buffer', 'set-process-coding-system',
  1889. 'set-process-datagram-address', 'set-process-filter',
  1890. 'set-process-filter-multibyte',
  1891. 'set-process-inherit-coding-system-flag', 'set-process-plist',
  1892. 'set-process-query-on-exit-flag', 'set-process-sentinel',
  1893. 'set-process-window-size', 'set-quit-char',
  1894. 'set-safe-terminal-coding-system-internal', 'set-screen-color',
  1895. 'set-standard-case-table', 'set-syntax-table',
  1896. 'set-terminal-coding-system-internal', 'set-terminal-local-value',
  1897. 'set-terminal-parameter', 'set-text-properties', 'set-time-zone-rule',
  1898. 'set-visited-file-modtime', 'set-window-buffer',
  1899. 'set-window-combination-limit', 'set-window-configuration',
  1900. 'set-window-dedicated-p', 'set-window-display-table',
  1901. 'set-window-fringes', 'set-window-hscroll', 'set-window-margins',
  1902. 'set-window-new-normal', 'set-window-new-pixel',
  1903. 'set-window-new-total', 'set-window-next-buffers',
  1904. 'set-window-parameter', 'set-window-point', 'set-window-prev-buffers',
  1905. 'set-window-redisplay-end-trigger', 'set-window-scroll-bars',
  1906. 'set-window-start', 'set-window-vscroll', 'setcar', 'setcdr',
  1907. 'setplist', 'show-face-resources', 'signal', 'signal-process', 'sin',
  1908. 'single-key-description', 'skip-chars-backward', 'skip-chars-forward',
  1909. 'skip-syntax-backward', 'skip-syntax-forward', 'sleep-for', 'sort',
  1910. 'sort-charsets', 'special-variable-p', 'split-char',
  1911. 'split-window-internal', 'sqrt', 'standard-case-table',
  1912. 'standard-category-table', 'standard-syntax-table', 'start-kbd-macro',
  1913. 'start-process', 'stop-process', 'store-kbd-macro-event', 'string',
  1914. 'string=', 'string<', 'string>', 'string-as-multibyte',
  1915. 'string-as-unibyte', 'string-bytes', 'string-collate-equalp',
  1916. 'string-collate-lessp', 'string-equal', 'string-greaterp',
  1917. 'string-lessp', 'string-make-multibyte', 'string-make-unibyte',
  1918. 'string-match', 'string-to-char', 'string-to-multibyte',
  1919. 'string-to-number', 'string-to-syntax', 'string-to-unibyte',
  1920. 'string-width', 'stringp', 'subr-name', 'subrp',
  1921. 'subst-char-in-region', 'substitute-command-keys',
  1922. 'substitute-in-file-name', 'substring', 'substring-no-properties',
  1923. 'suspend-emacs', 'suspend-tty', 'suspicious-object', 'sxhash',
  1924. 'symbol-function', 'symbol-name', 'symbol-plist', 'symbol-value',
  1925. 'symbolp', 'syntax-table', 'syntax-table-p', 'system-groups',
  1926. 'system-move-file-to-trash', 'system-name', 'system-users', 'tan',
  1927. 'terminal-coding-system', 'terminal-list', 'terminal-live-p',
  1928. 'terminal-local-value', 'terminal-name', 'terminal-parameter',
  1929. 'terminal-parameters', 'terpri', 'test-completion',
  1930. 'text-char-description', 'text-properties-at', 'text-property-any',
  1931. 'text-property-not-all', 'this-command-keys',
  1932. 'this-command-keys-vector', 'this-single-command-keys',
  1933. 'this-single-command-raw-keys', 'time-add', 'time-less-p',
  1934. 'time-subtract', 'tool-bar-get-system-style', 'tool-bar-height',
  1935. 'tool-bar-pixel-width', 'top-level', 'trace-redisplay',
  1936. 'trace-to-stderr', 'translate-region-internal', 'transpose-regions',
  1937. 'truncate', 'try-completion', 'tty-display-color-cells',
  1938. 'tty-display-color-p', 'tty-no-underline',
  1939. 'tty-suppress-bold-inverse-default-colors', 'tty-top-frame',
  1940. 'tty-type', 'type-of', 'undo-boundary', 'unencodable-char-position',
  1941. 'unhandled-file-name-directory', 'unibyte-char-to-multibyte',
  1942. 'unibyte-string', 'unicode-property-table-internal', 'unify-charset',
  1943. 'unintern', 'unix-sync', 'unlock-buffer', 'upcase', 'upcase-initials',
  1944. 'upcase-initials-region', 'upcase-region', 'upcase-word',
  1945. 'use-global-map', 'use-local-map', 'user-full-name',
  1946. 'user-login-name', 'user-real-login-name', 'user-real-uid',
  1947. 'user-uid', 'variable-binding-locus', 'vconcat', 'vector',
  1948. 'vector-or-char-table-p', 'vectorp', 'verify-visited-file-modtime',
  1949. 'vertical-motion', 'visible-frame-list', 'visited-file-modtime',
  1950. 'w16-get-clipboard-data', 'w16-selection-exists-p',
  1951. 'w16-set-clipboard-data', 'w32-battery-status',
  1952. 'w32-default-color-map', 'w32-define-rgb-color',
  1953. 'w32-display-monitor-attributes-list', 'w32-frame-menu-bar-size',
  1954. 'w32-frame-rect', 'w32-get-clipboard-data',
  1955. 'w32-get-codepage-charset', 'w32-get-console-codepage',
  1956. 'w32-get-console-output-codepage', 'w32-get-current-locale-id',
  1957. 'w32-get-default-locale-id', 'w32-get-keyboard-layout',
  1958. 'w32-get-locale-info', 'w32-get-valid-codepages',
  1959. 'w32-get-valid-keyboard-layouts', 'w32-get-valid-locale-ids',
  1960. 'w32-has-winsock', 'w32-long-file-name', 'w32-reconstruct-hot-key',
  1961. 'w32-register-hot-key', 'w32-registered-hot-keys',
  1962. 'w32-selection-exists-p', 'w32-send-sys-command',
  1963. 'w32-set-clipboard-data', 'w32-set-console-codepage',
  1964. 'w32-set-console-output-codepage', 'w32-set-current-locale',
  1965. 'w32-set-keyboard-layout', 'w32-set-process-priority',
  1966. 'w32-shell-execute', 'w32-short-file-name', 'w32-toggle-lock-key',
  1967. 'w32-unload-winsock', 'w32-unregister-hot-key', 'w32-window-exists-p',
  1968. 'w32notify-add-watch', 'w32notify-rm-watch',
  1969. 'waiting-for-user-input-p', 'where-is-internal', 'widen',
  1970. 'widget-apply', 'widget-get', 'widget-put',
  1971. 'window-absolute-pixel-edges', 'window-at', 'window-body-height',
  1972. 'window-body-width', 'window-bottom-divider-width', 'window-buffer',
  1973. 'window-combination-limit', 'window-configuration-frame',
  1974. 'window-configuration-p', 'window-dedicated-p',
  1975. 'window-display-table', 'window-edges', 'window-end', 'window-frame',
  1976. 'window-fringes', 'window-header-line-height', 'window-hscroll',
  1977. 'window-inside-absolute-pixel-edges', 'window-inside-edges',
  1978. 'window-inside-pixel-edges', 'window-left-child',
  1979. 'window-left-column', 'window-line-height', 'window-list',
  1980. 'window-list-1', 'window-live-p', 'window-margins',
  1981. 'window-minibuffer-p', 'window-mode-line-height', 'window-new-normal',
  1982. 'window-new-pixel', 'window-new-total', 'window-next-buffers',
  1983. 'window-next-sibling', 'window-normal-size', 'window-old-point',
  1984. 'window-parameter', 'window-parameters', 'window-parent',
  1985. 'window-pixel-edges', 'window-pixel-height', 'window-pixel-left',
  1986. 'window-pixel-top', 'window-pixel-width', 'window-point',
  1987. 'window-prev-buffers', 'window-prev-sibling',
  1988. 'window-redisplay-end-trigger', 'window-resize-apply',
  1989. 'window-resize-apply-total', 'window-right-divider-width',
  1990. 'window-scroll-bar-height', 'window-scroll-bar-width',
  1991. 'window-scroll-bars', 'window-start', 'window-system',
  1992. 'window-text-height', 'window-text-pixel-size', 'window-text-width',
  1993. 'window-top-child', 'window-top-line', 'window-total-height',
  1994. 'window-total-width', 'window-use-time', 'window-valid-p',
  1995. 'window-vscroll', 'windowp', 'write-char', 'write-region',
  1996. 'x-backspace-delete-keys-p', 'x-change-window-property',
  1997. 'x-change-window-property', 'x-close-connection',
  1998. 'x-close-connection', 'x-create-frame', 'x-create-frame',
  1999. 'x-delete-window-property', 'x-delete-window-property',
  2000. 'x-disown-selection-internal', 'x-display-backing-store',
  2001. 'x-display-backing-store', 'x-display-color-cells',
  2002. 'x-display-color-cells', 'x-display-grayscale-p',
  2003. 'x-display-grayscale-p', 'x-display-list', 'x-display-list',
  2004. 'x-display-mm-height', 'x-display-mm-height', 'x-display-mm-width',
  2005. 'x-display-mm-width', 'x-display-monitor-attributes-list',
  2006. 'x-display-pixel-height', 'x-display-pixel-height',
  2007. 'x-display-pixel-width', 'x-display-pixel-width', 'x-display-planes',
  2008. 'x-display-planes', 'x-display-save-under', 'x-display-save-under',
  2009. 'x-display-screens', 'x-display-screens', 'x-display-visual-class',
  2010. 'x-display-visual-class', 'x-family-fonts', 'x-file-dialog',
  2011. 'x-file-dialog', 'x-file-dialog', 'x-focus-frame', 'x-frame-geometry',
  2012. 'x-frame-geometry', 'x-get-atom-name', 'x-get-resource',
  2013. 'x-get-selection-internal', 'x-hide-tip', 'x-hide-tip',
  2014. 'x-list-fonts', 'x-load-color-file', 'x-menu-bar-open-internal',
  2015. 'x-menu-bar-open-internal', 'x-open-connection', 'x-open-connection',
  2016. 'x-own-selection-internal', 'x-parse-geometry', 'x-popup-dialog',
  2017. 'x-popup-menu', 'x-register-dnd-atom', 'x-select-font',
  2018. 'x-select-font', 'x-selection-exists-p', 'x-selection-owner-p',
  2019. 'x-send-client-message', 'x-server-max-request-size',
  2020. 'x-server-max-request-size', 'x-server-vendor', 'x-server-vendor',
  2021. 'x-server-version', 'x-server-version', 'x-show-tip', 'x-show-tip',
  2022. 'x-synchronize', 'x-synchronize', 'x-uses-old-gtk-dialog',
  2023. 'x-window-property', 'x-window-property', 'x-wm-set-size-hint',
  2024. 'xw-color-defined-p', 'xw-color-defined-p', 'xw-color-values',
  2025. 'xw-color-values', 'xw-display-color-p', 'xw-display-color-p',
  2026. 'yes-or-no-p', 'zlib-available-p', 'zlib-decompress-region',
  2027. 'forward-point',
  2028. }
  2029. builtin_function_highlighted = {
  2030. 'defvaralias', 'provide', 'require',
  2031. 'with-no-warnings', 'define-widget', 'with-electric-help',
  2032. 'throw', 'defalias', 'featurep'
  2033. }
  2034. lambda_list_keywords = {
  2035. '&allow-other-keys', '&aux', '&body', '&environment', '&key', '&optional',
  2036. '&rest', '&whole',
  2037. }
  2038. error_keywords = {
  2039. 'cl-assert', 'cl-check-type', 'error', 'signal',
  2040. 'user-error', 'warn',
  2041. }
  2042. def get_tokens_unprocessed(self, text):
  2043. stack = ['root']
  2044. for index, token, value in RegexLexer.get_tokens_unprocessed(self, text, stack):
  2045. if token is Name.Variable:
  2046. if value in EmacsLispLexer.builtin_function:
  2047. yield index, Name.Function, value
  2048. continue
  2049. if value in EmacsLispLexer.special_forms:
  2050. yield index, Keyword, value
  2051. continue
  2052. if value in EmacsLispLexer.error_keywords:
  2053. yield index, Name.Exception, value
  2054. continue
  2055. if value in EmacsLispLexer.builtin_function_highlighted:
  2056. yield index, Name.Builtin, value
  2057. continue
  2058. if value in EmacsLispLexer.macros:
  2059. yield index, Name.Builtin, value
  2060. continue
  2061. if value in EmacsLispLexer.lambda_list_keywords:
  2062. yield index, Keyword.Pseudo, value
  2063. continue
  2064. yield index, token, value
  2065. tokens = {
  2066. 'root': [
  2067. default('body'),
  2068. ],
  2069. 'body': [
  2070. # whitespace
  2071. (r'\s+', Whitespace),
  2072. # single-line comment
  2073. (r';.*$', Comment.Single),
  2074. # strings and characters
  2075. (r'"', String, 'string'),
  2076. (r'\?([^\\]|\\.)', String.Char),
  2077. # quoting
  2078. (r":" + symbol, Name.Builtin),
  2079. (r"::" + symbol, String.Symbol),
  2080. (r"'" + symbol, String.Symbol),
  2081. (r"'", Operator),
  2082. (r"`", Operator),
  2083. # decimal numbers
  2084. (r'[-+]?\d+\.?' + terminated, Number.Integer),
  2085. (r'[-+]?\d+/\d+' + terminated, Number),
  2086. (r'[-+]?(\d*\.\d+([defls][-+]?\d+)?|\d+(\.\d*)?[defls][-+]?\d+)' +
  2087. terminated, Number.Float),
  2088. # vectors
  2089. (r'\[|\]', Punctuation),
  2090. # uninterned symbol
  2091. (r'#:' + symbol, String.Symbol),
  2092. # read syntax for char tables
  2093. (r'#\^\^?', Operator),
  2094. # function shorthand
  2095. (r'#\'', Name.Function),
  2096. # binary rational
  2097. (r'#[bB][+-]?[01]+(/[01]+)?', Number.Bin),
  2098. # octal rational
  2099. (r'#[oO][+-]?[0-7]+(/[0-7]+)?', Number.Oct),
  2100. # hex rational
  2101. (r'#[xX][+-]?[0-9a-fA-F]+(/[0-9a-fA-F]+)?', Number.Hex),
  2102. # radix rational
  2103. (r'#\d+r[+-]?[0-9a-zA-Z]+(/[0-9a-zA-Z]+)?', Number),
  2104. # reference
  2105. (r'#\d+=', Operator),
  2106. (r'#\d+#', Operator),
  2107. # special operators that should have been parsed already
  2108. (r'(,@|,|\.|:)', Operator),
  2109. # special constants
  2110. (r'(t|nil)' + terminated, Name.Constant),
  2111. # functions and variables
  2112. (r'\*' + symbol + r'\*', Name.Variable.Global),
  2113. (symbol, Name.Variable),
  2114. # parentheses
  2115. (r'#\(', Operator, 'body'),
  2116. (r'\(', Punctuation, 'body'),
  2117. (r'\)', Punctuation, '#pop'),
  2118. ],
  2119. 'string': [
  2120. (r'[^"\\`]+', String),
  2121. (rf'`{symbol}\'', String.Symbol),
  2122. (r'`', String),
  2123. (r'\\.', String),
  2124. (r'\\\n', String),
  2125. (r'"', String, '#pop'),
  2126. ],
  2127. }
  2128. class ShenLexer(RegexLexer):
  2129. """
  2130. Lexer for Shen source code.
  2131. """
  2132. name = 'Shen'
  2133. url = 'http://shenlanguage.org/'
  2134. aliases = ['shen']
  2135. filenames = ['*.shen']
  2136. mimetypes = ['text/x-shen', 'application/x-shen']
  2137. version_added = '2.1'
  2138. DECLARATIONS = (
  2139. 'datatype', 'define', 'defmacro', 'defprolog', 'defcc',
  2140. 'synonyms', 'declare', 'package', 'type', 'function',
  2141. )
  2142. SPECIAL_FORMS = (
  2143. 'lambda', 'get', 'let', 'if', 'cases', 'cond', 'put', 'time', 'freeze',
  2144. 'value', 'load', '$', 'protect', 'or', 'and', 'not', 'do', 'output',
  2145. 'prolog?', 'trap-error', 'error', 'make-string', '/.', 'set', '@p',
  2146. '@s', '@v',
  2147. )
  2148. BUILTINS = (
  2149. '==', '=', '*', '+', '-', '/', '<', '>', '>=', '<=', '<-address',
  2150. '<-vector', 'abort', 'absvector', 'absvector?', 'address->', 'adjoin',
  2151. 'append', 'arity', 'assoc', 'bind', 'boolean?', 'bound?', 'call', 'cd',
  2152. 'close', 'cn', 'compile', 'concat', 'cons', 'cons?', 'cut', 'destroy',
  2153. 'difference', 'element?', 'empty?', 'enable-type-theory',
  2154. 'error-to-string', 'eval', 'eval-kl', 'exception', 'explode', 'external',
  2155. 'fail', 'fail-if', 'file', 'findall', 'fix', 'fst', 'fwhen', 'gensym',
  2156. 'get-time', 'hash', 'hd', 'hdstr', 'hdv', 'head', 'identical',
  2157. 'implementation', 'in', 'include', 'include-all-but', 'inferences',
  2158. 'input', 'input+', 'integer?', 'intern', 'intersection', 'is', 'kill',
  2159. 'language', 'length', 'limit', 'lineread', 'loaded', 'macro', 'macroexpand',
  2160. 'map', 'mapcan', 'maxinferences', 'mode', 'n->string', 'nl', 'nth', 'null',
  2161. 'number?', 'occurrences', 'occurs-check', 'open', 'os', 'out', 'port',
  2162. 'porters', 'pos', 'pr', 'preclude', 'preclude-all-but', 'print', 'profile',
  2163. 'profile-results', 'ps', 'quit', 'read', 'read+', 'read-byte', 'read-file',
  2164. 'read-file-as-bytelist', 'read-file-as-string', 'read-from-string',
  2165. 'release', 'remove', 'return', 'reverse', 'run', 'save', 'set',
  2166. 'simple-error', 'snd', 'specialise', 'spy', 'step', 'stinput', 'stoutput',
  2167. 'str', 'string->n', 'string->symbol', 'string?', 'subst', 'symbol?',
  2168. 'systemf', 'tail', 'tc', 'tc?', 'thaw', 'tl', 'tlstr', 'tlv', 'track',
  2169. 'tuple?', 'undefmacro', 'unify', 'unify!', 'union', 'unprofile',
  2170. 'unspecialise', 'untrack', 'variable?', 'vector', 'vector->', 'vector?',
  2171. 'verified', 'version', 'warn', 'when', 'write-byte', 'write-to-file',
  2172. 'y-or-n?',
  2173. )
  2174. BUILTINS_ANYWHERE = ('where', 'skip', '>>', '_', '!', '<e>', '<!>')
  2175. MAPPINGS = {s: Keyword for s in DECLARATIONS}
  2176. MAPPINGS.update((s, Name.Builtin) for s in BUILTINS)
  2177. MAPPINGS.update((s, Keyword) for s in SPECIAL_FORMS)
  2178. valid_symbol_chars = r'[\w!$%*+,<=>?/.\'@&#:-]'
  2179. valid_name = f'{valid_symbol_chars}+'
  2180. symbol_name = rf'[a-z!$%*+,<=>?/.\'@&#_-]{valid_symbol_chars}*'
  2181. variable = rf'[A-Z]{valid_symbol_chars}*'
  2182. tokens = {
  2183. 'string': [
  2184. (r'"', String, '#pop'),
  2185. (r'c#\d{1,3};', String.Escape),
  2186. (r'~[ARS%]', String.Interpol),
  2187. (r'(?s).', String),
  2188. ],
  2189. 'root': [
  2190. (r'(?s)\\\*.*?\*\\', Comment.Multiline), # \* ... *\
  2191. (r'\\\\.*', Comment.Single), # \\ ...
  2192. (r'\s+', Whitespace),
  2193. (r'_{5,}', Punctuation),
  2194. (r'={5,}', Punctuation),
  2195. (r'(;|:=|\||--?>|<--?)', Punctuation),
  2196. (r'(:-|:|\{|\})', Literal),
  2197. (r'[+-]*\d*\.\d+(e[+-]?\d+)?', Number.Float),
  2198. (r'[+-]*\d+', Number.Integer),
  2199. (r'"', String, 'string'),
  2200. (variable, Name.Variable),
  2201. (r'(true|false|<>|\[\])', Keyword.Pseudo),
  2202. (symbol_name, Literal),
  2203. (r'(\[|\]|\(|\))', Punctuation),
  2204. ],
  2205. }
  2206. def get_tokens_unprocessed(self, text):
  2207. tokens = RegexLexer.get_tokens_unprocessed(self, text)
  2208. tokens = self._process_symbols(tokens)
  2209. tokens = self._process_declarations(tokens)
  2210. return tokens
  2211. def _relevant(self, token):
  2212. return token not in (Text, Whitespace, Comment.Single, Comment.Multiline)
  2213. def _process_declarations(self, tokens):
  2214. opening_paren = False
  2215. for index, token, value in tokens:
  2216. yield index, token, value
  2217. if self._relevant(token):
  2218. if opening_paren and token == Keyword and value in self.DECLARATIONS:
  2219. declaration = value
  2220. yield from self._process_declaration(declaration, tokens)
  2221. opening_paren = value == '(' and token == Punctuation
  2222. def _process_symbols(self, tokens):
  2223. opening_paren = False
  2224. for index, token, value in tokens:
  2225. if opening_paren and token in (Literal, Name.Variable):
  2226. token = self.MAPPINGS.get(value, Name.Function)
  2227. elif token == Literal and value in self.BUILTINS_ANYWHERE:
  2228. token = Name.Builtin
  2229. opening_paren = value == '(' and token == Punctuation
  2230. yield index, token, value
  2231. def _process_declaration(self, declaration, tokens):
  2232. for index, token, value in tokens:
  2233. if self._relevant(token):
  2234. break
  2235. yield index, token, value
  2236. if declaration == 'datatype':
  2237. prev_was_colon = False
  2238. token = Keyword.Type if token == Literal else token
  2239. yield index, token, value
  2240. for index, token, value in tokens:
  2241. if prev_was_colon and token == Literal:
  2242. token = Keyword.Type
  2243. yield index, token, value
  2244. if self._relevant(token):
  2245. prev_was_colon = token == Literal and value == ':'
  2246. elif declaration == 'package':
  2247. token = Name.Namespace if token == Literal else token
  2248. yield index, token, value
  2249. elif declaration == 'define':
  2250. token = Name.Function if token == Literal else token
  2251. yield index, token, value
  2252. for index, token, value in tokens:
  2253. if self._relevant(token):
  2254. break
  2255. yield index, token, value
  2256. if value == '{' and token == Literal:
  2257. yield index, Punctuation, value
  2258. for index, token, value in self._process_signature(tokens):
  2259. yield index, token, value
  2260. else:
  2261. yield index, token, value
  2262. else:
  2263. token = Name.Function if token == Literal else token
  2264. yield index, token, value
  2265. return
  2266. def _process_signature(self, tokens):
  2267. for index, token, value in tokens:
  2268. if token == Literal and value == '}':
  2269. yield index, Punctuation, value
  2270. return
  2271. elif token in (Literal, Name.Function):
  2272. token = Name.Variable if value.istitle() else Keyword.Type
  2273. yield index, token, value
  2274. class CPSALexer(RegexLexer):
  2275. """
  2276. A CPSA lexer based on the CPSA language as of version 2.2.12
  2277. """
  2278. name = 'CPSA'
  2279. aliases = ['cpsa']
  2280. filenames = ['*.cpsa']
  2281. mimetypes = []
  2282. url = 'https://web.cs.wpi.edu/~guttman/cs564/cpsauser.html'
  2283. version_added = '2.1'
  2284. # list of known keywords and builtins taken form vim 6.4 scheme.vim
  2285. # syntax file.
  2286. _keywords = (
  2287. 'herald', 'vars', 'defmacro', 'include', 'defprotocol', 'defrole',
  2288. 'defskeleton', 'defstrand', 'deflistener', 'non-orig', 'uniq-orig',
  2289. 'pen-non-orig', 'precedes', 'trace', 'send', 'recv', 'name', 'text',
  2290. 'skey', 'akey', 'data', 'mesg',
  2291. )
  2292. _builtins = (
  2293. 'cat', 'enc', 'hash', 'privk', 'pubk', 'invk', 'ltk', 'gen', 'exp',
  2294. )
  2295. # valid names for identifiers
  2296. # well, names can only not consist fully of numbers
  2297. # but this should be good enough for now
  2298. valid_name = r'[\w!$%&*+,/:<=>?@^~|-]+'
  2299. tokens = {
  2300. 'root': [
  2301. # the comments - always starting with semicolon
  2302. # and going to the end of the line
  2303. (r';.*$', Comment.Single),
  2304. # whitespaces - usually not relevant
  2305. (r'\s+', Whitespace),
  2306. # numbers
  2307. (r'-?\d+\.\d+', Number.Float),
  2308. (r'-?\d+', Number.Integer),
  2309. # support for uncommon kinds of numbers -
  2310. # have to figure out what the characters mean
  2311. # (r'(#e|#i|#b|#o|#d|#x)[\d.]+', Number),
  2312. # strings, symbols and characters
  2313. (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
  2314. (r"'" + valid_name, String.Symbol),
  2315. (r"#\\([()/'\"._!§$%& ?=+-]|[a-zA-Z0-9]+)", String.Char),
  2316. # constants
  2317. (r'(#t|#f)', Name.Constant),
  2318. # special operators
  2319. (r"('|#|`|,@|,|\.)", Operator),
  2320. # highlight the keywords
  2321. (words(_keywords, suffix=r'\b'), Keyword),
  2322. # first variable in a quoted string like
  2323. # '(this is syntactic sugar)
  2324. (r"(?<='\()" + valid_name, Name.Variable),
  2325. (r"(?<=#\()" + valid_name, Name.Variable),
  2326. # highlight the builtins
  2327. (words(_builtins, prefix=r'(?<=\()', suffix=r'\b'), Name.Builtin),
  2328. # the remaining functions
  2329. (r'(?<=\()' + valid_name, Name.Function),
  2330. # find the remaining variables
  2331. (valid_name, Name.Variable),
  2332. # the famous parentheses!
  2333. (r'(\(|\))', Punctuation),
  2334. (r'(\[|\])', Punctuation),
  2335. ],
  2336. }
  2337. class XtlangLexer(RegexLexer):
  2338. """An xtlang lexer for the Extempore programming environment.
  2339. This is a mixture of Scheme and xtlang, really. Keyword lists are
  2340. taken from the Extempore Emacs mode
  2341. (https://github.com/extemporelang/extempore-emacs-mode)
  2342. """
  2343. name = 'xtlang'
  2344. url = 'http://extempore.moso.com.au'
  2345. aliases = ['extempore']
  2346. filenames = ['*.xtm']
  2347. mimetypes = []
  2348. version_added = '2.2'
  2349. common_keywords = (
  2350. 'lambda', 'define', 'if', 'else', 'cond', 'and',
  2351. 'or', 'let', 'begin', 'set!', 'map', 'for-each',
  2352. )
  2353. scheme_keywords = (
  2354. 'do', 'delay', 'quasiquote', 'unquote', 'unquote-splicing', 'eval',
  2355. 'case', 'let*', 'letrec', 'quote',
  2356. )
  2357. xtlang_bind_keywords = (
  2358. 'bind-func', 'bind-val', 'bind-lib', 'bind-type', 'bind-alias',
  2359. 'bind-poly', 'bind-dylib', 'bind-lib-func', 'bind-lib-val',
  2360. )
  2361. xtlang_keywords = (
  2362. 'letz', 'memzone', 'cast', 'convert', 'dotimes', 'doloop',
  2363. )
  2364. common_functions = (
  2365. '*', '+', '-', '/', '<', '<=', '=', '>', '>=', '%', 'abs', 'acos',
  2366. 'angle', 'append', 'apply', 'asin', 'assoc', 'assq', 'assv',
  2367. 'atan', 'boolean?', 'caaaar', 'caaadr', 'caaar', 'caadar',
  2368. 'caaddr', 'caadr', 'caar', 'cadaar', 'cadadr', 'cadar',
  2369. 'caddar', 'cadddr', 'caddr', 'cadr', 'car', 'cdaaar',
  2370. 'cdaadr', 'cdaar', 'cdadar', 'cdaddr', 'cdadr', 'cdar',
  2371. 'cddaar', 'cddadr', 'cddar', 'cdddar', 'cddddr', 'cdddr',
  2372. 'cddr', 'cdr', 'ceiling', 'cons', 'cos', 'floor', 'length',
  2373. 'list', 'log', 'max', 'member', 'min', 'modulo', 'not',
  2374. 'reverse', 'round', 'sin', 'sqrt', 'substring', 'tan',
  2375. 'println', 'random', 'null?', 'callback', 'now',
  2376. )
  2377. scheme_functions = (
  2378. 'call-with-current-continuation', 'call-with-input-file',
  2379. 'call-with-output-file', 'call-with-values', 'call/cc',
  2380. 'char->integer', 'char-alphabetic?', 'char-ci<=?', 'char-ci<?',
  2381. 'char-ci=?', 'char-ci>=?', 'char-ci>?', 'char-downcase',
  2382. 'char-lower-case?', 'char-numeric?', 'char-ready?',
  2383. 'char-upcase', 'char-upper-case?', 'char-whitespace?',
  2384. 'char<=?', 'char<?', 'char=?', 'char>=?', 'char>?', 'char?',
  2385. 'close-input-port', 'close-output-port', 'complex?',
  2386. 'current-input-port', 'current-output-port', 'denominator',
  2387. 'display', 'dynamic-wind', 'eof-object?', 'eq?', 'equal?',
  2388. 'eqv?', 'even?', 'exact->inexact', 'exact?', 'exp', 'expt',
  2389. 'force', 'gcd', 'imag-part', 'inexact->exact', 'inexact?',
  2390. 'input-port?', 'integer->char', 'integer?',
  2391. 'interaction-environment', 'lcm', 'list->string',
  2392. 'list->vector', 'list-ref', 'list-tail', 'list?', 'load',
  2393. 'magnitude', 'make-polar', 'make-rectangular', 'make-string',
  2394. 'make-vector', 'memq', 'memv', 'negative?', 'newline',
  2395. 'null-environment', 'number->string', 'number?',
  2396. 'numerator', 'odd?', 'open-input-file', 'open-output-file',
  2397. 'output-port?', 'pair?', 'peek-char', 'port?', 'positive?',
  2398. 'procedure?', 'quotient', 'rational?', 'rationalize', 'read',
  2399. 'read-char', 'real-part', 'real?',
  2400. 'remainder', 'scheme-report-environment', 'set-car!', 'set-cdr!',
  2401. 'string', 'string->list', 'string->number', 'string->symbol',
  2402. 'string-append', 'string-ci<=?', 'string-ci<?', 'string-ci=?',
  2403. 'string-ci>=?', 'string-ci>?', 'string-copy', 'string-fill!',
  2404. 'string-length', 'string-ref', 'string-set!', 'string<=?',
  2405. 'string<?', 'string=?', 'string>=?', 'string>?', 'string?',
  2406. 'symbol->string', 'symbol?', 'transcript-off', 'transcript-on',
  2407. 'truncate', 'values', 'vector', 'vector->list', 'vector-fill!',
  2408. 'vector-length', 'vector?',
  2409. 'with-input-from-file', 'with-output-to-file', 'write',
  2410. 'write-char', 'zero?',
  2411. )
  2412. xtlang_functions = (
  2413. 'toString', 'afill!', 'pfill!', 'tfill!', 'tbind', 'vfill!',
  2414. 'array-fill!', 'pointer-fill!', 'tuple-fill!', 'vector-fill!', 'free',
  2415. 'array', 'tuple', 'list', '~', 'cset!', 'cref', '&', 'bor',
  2416. 'ang-names', '<<', '>>', 'nil', 'printf', 'sprintf', 'null', 'now',
  2417. 'pset!', 'pref-ptr', 'vset!', 'vref', 'aset!', 'aref', 'aref-ptr',
  2418. 'tset!', 'tref', 'tref-ptr', 'salloc', 'halloc', 'zalloc', 'alloc',
  2419. 'schedule', 'exp', 'log', 'sin', 'cos', 'tan', 'asin', 'acos', 'atan',
  2420. 'sqrt', 'expt', 'floor', 'ceiling', 'truncate', 'round',
  2421. 'llvm_printf', 'push_zone', 'pop_zone', 'memzone', 'callback',
  2422. 'llvm_sprintf', 'make-array', 'array-set!', 'array-ref',
  2423. 'array-ref-ptr', 'pointer-set!', 'pointer-ref', 'pointer-ref-ptr',
  2424. 'stack-alloc', 'heap-alloc', 'zone-alloc', 'make-tuple', 'tuple-set!',
  2425. 'tuple-ref', 'tuple-ref-ptr', 'closure-set!', 'closure-ref', 'pref',
  2426. 'pdref', 'impc_null', 'bitcast', 'void', 'ifret', 'ret->', 'clrun->',
  2427. 'make-env-zone', 'make-env', '<>', 'dtof', 'ftod', 'i1tof',
  2428. 'i1tod', 'i1toi8', 'i1toi32', 'i1toi64', 'i8tof', 'i8tod',
  2429. 'i8toi1', 'i8toi32', 'i8toi64', 'i32tof', 'i32tod', 'i32toi1',
  2430. 'i32toi8', 'i32toi64', 'i64tof', 'i64tod', 'i64toi1',
  2431. 'i64toi8', 'i64toi32',
  2432. )
  2433. # valid names for Scheme identifiers (names cannot consist fully
  2434. # of numbers, but this should be good enough for now)
  2435. valid_scheme_name = r'[\w!$%&*+,/:<=>?@^~|-]+'
  2436. # valid characters in xtlang names & types
  2437. valid_xtlang_name = r'[\w.!-]+'
  2438. valid_xtlang_type = r'[]{}[\w<>,*/|!-]+'
  2439. tokens = {
  2440. # keep track of when we're exiting the xtlang form
  2441. 'xtlang': [
  2442. (r'\(', Punctuation, '#push'),
  2443. (r'\)', Punctuation, '#pop'),
  2444. (r'(?<=bind-func\s)' + valid_xtlang_name, Name.Function),
  2445. (r'(?<=bind-val\s)' + valid_xtlang_name, Name.Function),
  2446. (r'(?<=bind-type\s)' + valid_xtlang_name, Name.Function),
  2447. (r'(?<=bind-alias\s)' + valid_xtlang_name, Name.Function),
  2448. (r'(?<=bind-poly\s)' + valid_xtlang_name, Name.Function),
  2449. (r'(?<=bind-lib\s)' + valid_xtlang_name, Name.Function),
  2450. (r'(?<=bind-dylib\s)' + valid_xtlang_name, Name.Function),
  2451. (r'(?<=bind-lib-func\s)' + valid_xtlang_name, Name.Function),
  2452. (r'(?<=bind-lib-val\s)' + valid_xtlang_name, Name.Function),
  2453. # type annotations
  2454. (r':' + valid_xtlang_type, Keyword.Type),
  2455. # types
  2456. (r'(<' + valid_xtlang_type + r'>|\|' + valid_xtlang_type + r'\||/' +
  2457. valid_xtlang_type + r'/|' + valid_xtlang_type + r'\*)\**',
  2458. Keyword.Type),
  2459. # keywords
  2460. (words(xtlang_keywords, prefix=r'(?<=\()'), Keyword),
  2461. # builtins
  2462. (words(xtlang_functions, prefix=r'(?<=\()'), Name.Function),
  2463. include('common'),
  2464. # variables
  2465. (valid_xtlang_name, Name.Variable),
  2466. ],
  2467. 'scheme': [
  2468. # quoted symbols
  2469. (r"'" + valid_scheme_name, String.Symbol),
  2470. # char literals
  2471. (r"#\\([()/'\"._!§$%& ?=+-]|[a-zA-Z0-9]+)", String.Char),
  2472. # special operators
  2473. (r"('|#|`|,@|,|\.)", Operator),
  2474. # keywords
  2475. (words(scheme_keywords, prefix=r'(?<=\()'), Keyword),
  2476. # builtins
  2477. (words(scheme_functions, prefix=r'(?<=\()'), Name.Function),
  2478. include('common'),
  2479. # variables
  2480. (valid_scheme_name, Name.Variable),
  2481. ],
  2482. # common to both xtlang and Scheme
  2483. 'common': [
  2484. # comments
  2485. (r';.*$', Comment.Single),
  2486. # whitespaces - usually not relevant
  2487. (r'\s+', Whitespace),
  2488. # numbers
  2489. (r'-?\d+\.\d+', Number.Float),
  2490. (r'-?\d+', Number.Integer),
  2491. # binary/oct/hex literals
  2492. (r'(#b|#o|#x)[\d.]+', Number),
  2493. # strings
  2494. (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
  2495. # true/false constants
  2496. (r'(#t|#f)', Name.Constant),
  2497. # keywords
  2498. (words(common_keywords, prefix=r'(?<=\()'), Keyword),
  2499. # builtins
  2500. (words(common_functions, prefix=r'(?<=\()'), Name.Function),
  2501. # the famous parentheses!
  2502. (r'(\(|\))', Punctuation),
  2503. ],
  2504. 'root': [
  2505. # go into xtlang mode
  2506. (words(xtlang_bind_keywords, prefix=r'(?<=\()', suffix=r'\b'),
  2507. Keyword, 'xtlang'),
  2508. include('scheme')
  2509. ],
  2510. }
  2511. class FennelLexer(RegexLexer):
  2512. """A lexer for the Fennel programming language.
  2513. Fennel compiles to Lua, so all the Lua builtins are recognized as well
  2514. as the special forms that are particular to the Fennel compiler.
  2515. """
  2516. name = 'Fennel'
  2517. url = 'https://fennel-lang.org'
  2518. aliases = ['fennel', 'fnl']
  2519. filenames = ['*.fnl']
  2520. version_added = '2.3'
  2521. # this list is current as of Fennel version 0.10.0.
  2522. special_forms = (
  2523. '#', '%', '*', '+', '-', '->', '->>', '-?>', '-?>>', '.', '..',
  2524. '/', '//', ':', '<', '<=', '=', '>', '>=', '?.', '^', 'accumulate',
  2525. 'and', 'band', 'bnot', 'bor', 'bxor', 'collect', 'comment', 'do', 'doc',
  2526. 'doto', 'each', 'eval-compiler', 'for', 'hashfn', 'icollect', 'if',
  2527. 'import-macros', 'include', 'length', 'let', 'lshift', 'lua',
  2528. 'macrodebug', 'match', 'not', 'not=', 'or', 'partial', 'pick-args',
  2529. 'pick-values', 'quote', 'require-macros', 'rshift', 'set',
  2530. 'set-forcibly!', 'tset', 'values', 'when', 'while', 'with-open', '~='
  2531. )
  2532. declarations = (
  2533. 'fn', 'global', 'lambda', 'local', 'macro', 'macros', 'var', 'λ'
  2534. )
  2535. builtins = (
  2536. '_G', '_VERSION', 'arg', 'assert', 'bit32', 'collectgarbage',
  2537. 'coroutine', 'debug', 'dofile', 'error', 'getfenv',
  2538. 'getmetatable', 'io', 'ipairs', 'load', 'loadfile', 'loadstring',
  2539. 'math', 'next', 'os', 'package', 'pairs', 'pcall', 'print',
  2540. 'rawequal', 'rawget', 'rawlen', 'rawset', 'require', 'select',
  2541. 'setfenv', 'setmetatable', 'string', 'table', 'tonumber',
  2542. 'tostring', 'type', 'unpack', 'xpcall'
  2543. )
  2544. # based on the scheme definition, but disallowing leading digits and
  2545. # commas, and @ is not allowed.
  2546. valid_name = r'[a-zA-Z_!$%&*+/:<=>?^~|-][\w!$%&*+/:<=>?^~|\.-]*'
  2547. tokens = {
  2548. 'root': [
  2549. # the only comment form is a semicolon; goes to the end of the line
  2550. (r';.*$', Comment.Single),
  2551. (r',+', Text),
  2552. (r'\s+', Whitespace),
  2553. (r'-?\d+\.\d+', Number.Float),
  2554. (r'-?\d+', Number.Integer),
  2555. (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
  2556. (r'(true|false|nil)', Name.Constant),
  2557. # these are technically strings, but it's worth visually
  2558. # distinguishing them because their intent is different
  2559. # from regular strings.
  2560. (r':' + valid_name, String.Symbol),
  2561. # special forms are keywords
  2562. (words(special_forms, suffix=' '), Keyword),
  2563. # these are ... even more special!
  2564. (words(declarations, suffix=' '), Keyword.Declaration),
  2565. # lua standard library are builtins
  2566. (words(builtins, suffix=' '), Name.Builtin),
  2567. # special-case the vararg symbol
  2568. (r'\.\.\.', Name.Variable),
  2569. # regular identifiers
  2570. (valid_name, Name.Variable),
  2571. # all your normal paired delimiters for your programming enjoyment
  2572. (r'(\(|\))', Punctuation),
  2573. (r'(\[|\])', Punctuation),
  2574. (r'(\{|\})', Punctuation),
  2575. # the # symbol is shorthand for a lambda function
  2576. (r'#', Punctuation),
  2577. ]
  2578. }
  2579. class JanetLexer(RegexLexer):
  2580. """A lexer for the Janet programming language.
  2581. """
  2582. name = 'Janet'
  2583. url = 'https://janet-lang.org/'
  2584. aliases = ['janet']
  2585. filenames = ['*.janet', '*.jdn']
  2586. mimetypes = ['text/x-janet', 'application/x-janet']
  2587. version_added = '2.18'
  2588. # XXX: gets too slow
  2589. #flags = re.MULTILINE | re.VERBOSE
  2590. special_forms = (
  2591. 'break', 'def', 'do', 'fn', 'if', 'quote', 'quasiquote', 'splice',
  2592. 'set', 'unquote', 'upscope', 'var', 'while'
  2593. )
  2594. builtin_macros = (
  2595. '%=', '*=', '++', '+=', '--', '-=', '->', '->>', '-?>',
  2596. '-?>>', '/=', 'and', 'as->', 'as-macro', 'as?->',
  2597. 'assert', 'case', 'catseq', 'chr', 'comment', 'compif',
  2598. 'comptime', 'compwhen', 'cond', 'coro', 'def-',
  2599. 'default', 'defdyn', 'defer', 'defmacro', 'defmacro-',
  2600. 'defn', 'defn-', 'delay', 'doc', 'each', 'eachk',
  2601. 'eachp', 'edefer', 'ev/do-thread', 'ev/gather',
  2602. 'ev/spawn', 'ev/spawn-thread', 'ev/with-deadline',
  2603. 'ffi/defbind', 'fiber-fn', 'for', 'forever', 'forv',
  2604. 'generate', 'if-let', 'if-not', 'if-with', 'import',
  2605. 'juxt', 'label', 'let', 'loop', 'match', 'or', 'prompt',
  2606. 'protect', 'repeat', 'seq', 'short-fn', 'tabseq',
  2607. 'toggle', 'tracev', 'try', 'unless', 'use', 'var-',
  2608. 'varfn', 'when', 'when-let', 'when-with', 'with',
  2609. 'with-dyns', 'with-syms', 'with-vars',
  2610. # obsolete builtin macros
  2611. 'eachy'
  2612. )
  2613. builtin_functions = (
  2614. '%', '*', '+', '-', '/', '<', '<=', '=', '>', '>=',
  2615. 'abstract?', 'accumulate', 'accumulate2', 'all',
  2616. 'all-bindings', 'all-dynamics', 'any?', 'apply',
  2617. 'array', 'array/clear', 'array/concat', 'array/ensure',
  2618. 'array/fill', 'array/insert', 'array/new',
  2619. 'array/new-filled', 'array/peek', 'array/pop',
  2620. 'array/push', 'array/remove', 'array/slice',
  2621. 'array/trim', 'array/weak', 'array?', 'asm',
  2622. 'bad-compile', 'bad-parse', 'band', 'blshift', 'bnot',
  2623. 'boolean?', 'bor', 'brshift', 'brushift', 'buffer',
  2624. 'buffer/bit', 'buffer/bit-clear', 'buffer/bit-set',
  2625. 'buffer/bit-toggle', 'buffer/blit', 'buffer/clear',
  2626. 'buffer/fill', 'buffer/format', 'buffer/from-bytes',
  2627. 'buffer/new', 'buffer/new-filled', 'buffer/popn',
  2628. 'buffer/push', 'buffer/push-at', 'buffer/push-byte',
  2629. 'buffer/push-string', 'buffer/push-word',
  2630. 'buffer/slice', 'buffer/trim', 'buffer?', 'bxor',
  2631. 'bytes?', 'cancel', 'cfunction?', 'cli-main', 'cmp',
  2632. 'comp', 'compare', 'compare<', 'compare<=', 'compare=',
  2633. 'compare>', 'compare>=', 'compile', 'complement',
  2634. 'count', 'curenv', 'debug', 'debug/arg-stack',
  2635. 'debug/break', 'debug/fbreak', 'debug/lineage',
  2636. 'debug/stack', 'debug/stacktrace', 'debug/step',
  2637. 'debug/unbreak', 'debug/unfbreak', 'debugger',
  2638. 'debugger-on-status', 'dec', 'deep-not=', 'deep=',
  2639. 'defglobal', 'describe', 'dictionary?', 'disasm',
  2640. 'distinct', 'div', 'doc*', 'doc-format', 'doc-of',
  2641. 'dofile', 'drop', 'drop-until', 'drop-while', 'dyn',
  2642. 'eflush', 'empty?', 'env-lookup', 'eprin', 'eprinf',
  2643. 'eprint', 'eprintf', 'error', 'errorf',
  2644. 'ev/acquire-lock', 'ev/acquire-rlock',
  2645. 'ev/acquire-wlock', 'ev/all-tasks', 'ev/call',
  2646. 'ev/cancel', 'ev/capacity', 'ev/chan', 'ev/chan-close',
  2647. 'ev/chunk', 'ev/close', 'ev/count', 'ev/deadline',
  2648. 'ev/full', 'ev/give', 'ev/give-supervisor', 'ev/go',
  2649. 'ev/lock', 'ev/read', 'ev/release-lock',
  2650. 'ev/release-rlock', 'ev/release-wlock', 'ev/rselect',
  2651. 'ev/rwlock', 'ev/select', 'ev/sleep', 'ev/take',
  2652. 'ev/thread', 'ev/thread-chan', 'ev/write', 'eval',
  2653. 'eval-string', 'even?', 'every?', 'extreme', 'false?',
  2654. 'ffi/align', 'ffi/call', 'ffi/calling-conventions',
  2655. 'ffi/close', 'ffi/context', 'ffi/free', 'ffi/jitfn',
  2656. 'ffi/lookup', 'ffi/malloc', 'ffi/native',
  2657. 'ffi/pointer-buffer', 'ffi/pointer-cfunction',
  2658. 'ffi/read', 'ffi/signature', 'ffi/size', 'ffi/struct',
  2659. 'ffi/trampoline', 'ffi/write', 'fiber/can-resume?',
  2660. 'fiber/current', 'fiber/getenv', 'fiber/last-value',
  2661. 'fiber/maxstack', 'fiber/new', 'fiber/root',
  2662. 'fiber/setenv', 'fiber/setmaxstack', 'fiber/status',
  2663. 'fiber?', 'file/close', 'file/flush', 'file/lines',
  2664. 'file/open', 'file/read', 'file/seek', 'file/tell',
  2665. 'file/temp', 'file/write', 'filter', 'find',
  2666. 'find-index', 'first', 'flatten', 'flatten-into',
  2667. 'flush', 'flycheck', 'freeze', 'frequencies',
  2668. 'from-pairs', 'function?', 'gccollect', 'gcinterval',
  2669. 'gcsetinterval', 'gensym', 'get', 'get-in', 'getline',
  2670. 'getproto', 'group-by', 'has-key?', 'has-value?',
  2671. 'hash', 'idempotent?', 'identity', 'import*', 'in',
  2672. 'inc', 'index-of', 'indexed?', 'int/s64',
  2673. 'int/to-bytes', 'int/to-number', 'int/u64', 'int?',
  2674. 'interleave', 'interpose', 'invert', 'juxt*', 'keep',
  2675. 'keep-syntax', 'keep-syntax!', 'keys', 'keyword',
  2676. 'keyword/slice', 'keyword?', 'kvs', 'last', 'length',
  2677. 'lengthable?', 'load-image', 'macex', 'macex1',
  2678. 'maclintf', 'make-env', 'make-image', 'map', 'mapcat',
  2679. 'marshal', 'math/abs', 'math/acos', 'math/acosh',
  2680. 'math/asin', 'math/asinh', 'math/atan', 'math/atan2',
  2681. 'math/atanh', 'math/cbrt', 'math/ceil', 'math/cos',
  2682. 'math/cosh', 'math/erf', 'math/erfc', 'math/exp',
  2683. 'math/exp2', 'math/expm1', 'math/floor', 'math/gamma',
  2684. 'math/gcd', 'math/hypot', 'math/lcm', 'math/log',
  2685. 'math/log-gamma', 'math/log10', 'math/log1p',
  2686. 'math/log2', 'math/next', 'math/pow', 'math/random',
  2687. 'math/rng', 'math/rng-buffer', 'math/rng-int',
  2688. 'math/rng-uniform', 'math/round', 'math/seedrandom',
  2689. 'math/sin', 'math/sinh', 'math/sqrt', 'math/tan',
  2690. 'math/tanh', 'math/trunc', 'max', 'max-of', 'mean',
  2691. 'memcmp', 'merge', 'merge-into', 'merge-module', 'min',
  2692. 'min-of', 'mod', 'module/add-paths',
  2693. 'module/expand-path', 'module/find', 'module/value',
  2694. 'nan?', 'nat?', 'native', 'neg?', 'net/accept',
  2695. 'net/accept-loop', 'net/address', 'net/address-unpack',
  2696. 'net/chunk', 'net/close', 'net/connect', 'net/flush',
  2697. 'net/listen', 'net/localname', 'net/peername',
  2698. 'net/read', 'net/recv-from', 'net/send-to',
  2699. 'net/server', 'net/setsockopt', 'net/shutdown',
  2700. 'net/write', 'next', 'nil?', 'not', 'not=', 'number?',
  2701. 'odd?', 'one?', 'os/arch', 'os/cd', 'os/chmod',
  2702. 'os/clock', 'os/compiler', 'os/cpu-count',
  2703. 'os/cryptorand', 'os/cwd', 'os/date', 'os/dir',
  2704. 'os/environ', 'os/execute', 'os/exit', 'os/getenv',
  2705. 'os/isatty', 'os/link', 'os/lstat', 'os/mkdir',
  2706. 'os/mktime', 'os/open', 'os/perm-int', 'os/perm-string',
  2707. 'os/pipe', 'os/posix-exec', 'os/posix-fork',
  2708. 'os/proc-close', 'os/proc-kill', 'os/proc-wait',
  2709. 'os/readlink', 'os/realpath', 'os/rename', 'os/rm',
  2710. 'os/rmdir', 'os/setenv', 'os/shell', 'os/sigaction',
  2711. 'os/sleep', 'os/spawn', 'os/stat', 'os/strftime',
  2712. 'os/symlink', 'os/time', 'os/touch', 'os/umask',
  2713. 'os/which', 'pairs', 'parse', 'parse-all',
  2714. 'parser/byte', 'parser/clone', 'parser/consume',
  2715. 'parser/eof', 'parser/error', 'parser/flush',
  2716. 'parser/has-more', 'parser/insert', 'parser/new',
  2717. 'parser/produce', 'parser/state', 'parser/status',
  2718. 'parser/where', 'partial', 'partition', 'partition-by',
  2719. 'peg/compile', 'peg/find', 'peg/find-all', 'peg/match',
  2720. 'peg/replace', 'peg/replace-all', 'pos?', 'postwalk',
  2721. 'pp', 'prewalk', 'prin', 'prinf', 'print', 'printf',
  2722. 'product', 'propagate', 'put', 'put-in', 'quit',
  2723. 'range', 'reduce', 'reduce2', 'repl', 'require',
  2724. 'resume', 'return', 'reverse', 'reverse!',
  2725. 'run-context', 'sandbox', 'scan-number', 'setdyn',
  2726. 'signal', 'slice', 'slurp', 'some', 'sort', 'sort-by',
  2727. 'sorted', 'sorted-by', 'spit', 'string',
  2728. 'string/ascii-lower', 'string/ascii-upper',
  2729. 'string/bytes', 'string/check-set', 'string/find',
  2730. 'string/find-all', 'string/format', 'string/from-bytes',
  2731. 'string/has-prefix?', 'string/has-suffix?',
  2732. 'string/join', 'string/repeat', 'string/replace',
  2733. 'string/replace-all', 'string/reverse', 'string/slice',
  2734. 'string/split', 'string/trim', 'string/triml',
  2735. 'string/trimr', 'string?', 'struct', 'struct/getproto',
  2736. 'struct/proto-flatten', 'struct/to-table',
  2737. 'struct/with-proto', 'struct?', 'sum', 'symbol',
  2738. 'symbol/slice', 'symbol?', 'table', 'table/clear',
  2739. 'table/clone', 'table/getproto', 'table/new',
  2740. 'table/proto-flatten', 'table/rawget', 'table/setproto',
  2741. 'table/to-struct', 'table/weak', 'table/weak-keys',
  2742. 'table/weak-values', 'table?', 'take', 'take-until',
  2743. 'take-while', 'thaw', 'trace', 'true?', 'truthy?',
  2744. 'tuple', 'tuple/brackets', 'tuple/setmap',
  2745. 'tuple/slice', 'tuple/sourcemap', 'tuple/type',
  2746. 'tuple?', 'type', 'unmarshal', 'untrace', 'update',
  2747. 'update-in', 'values', 'varglobal', 'walk',
  2748. 'warn-compile', 'xprin', 'xprinf', 'xprint', 'xprintf',
  2749. 'yield', 'zero?', 'zipcoll',
  2750. # obsolete builtin functions
  2751. 'tarray/buffer', 'tarray/copy-bytes', 'tarray/length',
  2752. 'tarray/new', 'tarray/properties', 'tarray/slice',
  2753. 'tarray/swap-bytes', 'thread/close', 'thread/current',
  2754. 'thread/exit', 'thread/new', 'thread/receive',
  2755. 'thread/send'
  2756. )
  2757. builtin_variables = (
  2758. 'debugger-env', 'default-peg-grammar', 'janet/build',
  2759. 'janet/config-bits', 'janet/version', 'load-image-dict',
  2760. 'make-image-dict', 'math/-inf', 'math/e', 'math/inf',
  2761. 'math/int-max', 'math/int-min', 'math/int32-max',
  2762. 'math/int32-min', 'math/nan', 'math/pi', 'module/cache',
  2763. 'module/loaders', 'module/loading', 'module/paths',
  2764. 'root-env', 'stderr', 'stdin', 'stdout'
  2765. )
  2766. constants = (
  2767. 'false', 'nil', 'true'
  2768. )
  2769. # XXX: this form not usable to pass to `suffix=`
  2770. #_token_end = r'''
  2771. # (?= # followed by one of:
  2772. # \s # whitespace
  2773. # | \# # comment
  2774. # | [)\]] # end delimiters
  2775. # | $ # end of file
  2776. # )
  2777. #'''
  2778. # ...so, express it like this
  2779. _token_end = r'(?=\s|#|[)\]]|$)'
  2780. _first_char = r'[a-zA-Z!$%&*+\-./<=>?@^_]'
  2781. _rest_char = rf'([0-9:]|{_first_char})'
  2782. valid_name = rf'{_first_char}({_rest_char})*'
  2783. _radix_unit = r'[0-9a-zA-Z][0-9a-zA-Z_]*'
  2784. # exponent marker, optional sign, one or more alphanumeric
  2785. _radix_exp = r'&[+-]?[0-9a-zA-Z]+'
  2786. # 2af3__bee_
  2787. _hex_unit = r'[0-9a-fA-F][0-9a-fA-F_]*'
  2788. # 12_000__
  2789. _dec_unit = r'[0-9][0-9_]*'
  2790. # E-23
  2791. # lower or uppercase e, optional sign, one or more digits
  2792. _dec_exp = r'[eE][+-]?[0-9]+'
  2793. tokens = {
  2794. 'root': [
  2795. (r'#.*$', Comment.Single),
  2796. (r'\s+', Whitespace),
  2797. # radix number
  2798. (rf'''(?x)
  2799. [+-]? [0-9]{{1,2}} r {_radix_unit} \. ({_radix_unit})?
  2800. ({_radix_exp})?
  2801. ''',
  2802. Number),
  2803. (rf'''(?x)
  2804. [+-]? [0-9]{{1,2}} r (\.)? {_radix_unit}
  2805. ({_radix_exp})?
  2806. ''',
  2807. Number),
  2808. # hex number
  2809. (rf'(?x) [+-]? 0x {_hex_unit} \. ({_hex_unit})?',
  2810. Number.Hex),
  2811. (rf'(?x) [+-]? 0x (\.)? {_hex_unit}',
  2812. Number.Hex),
  2813. # decimal number
  2814. (rf'(?x) [+-]? {_dec_unit} \. ({_dec_unit})? ({_dec_exp})?',
  2815. Number.Float),
  2816. (rf'(?x) [+-]? (\.)? {_dec_unit} ({_dec_exp})?',
  2817. Number.Float),
  2818. # strings and buffers
  2819. (r'@?"', String, 'string'),
  2820. # long-strings and long-buffers
  2821. #
  2822. # non-empty content enclosed by a pair of n-backticks
  2823. # with optional leading @
  2824. (r'@?(`+)(.|\n)+?\1', String),
  2825. # things that hang out on front
  2826. #
  2827. # ' ~ , ; |
  2828. (r"['~,;|]", Operator),
  2829. # collection delimiters
  2830. #
  2831. # @( ( )
  2832. # @[ [ ]
  2833. # @{ { }
  2834. (r'@?[(\[{]|[)\]}]', Punctuation),
  2835. # constants
  2836. (words(constants, suffix=_token_end), Keyword.Constants),
  2837. # keywords
  2838. (rf'(:({_rest_char})+|:)', Name.Constant),
  2839. # symbols
  2840. (words(builtin_variables, suffix=_token_end),
  2841. Name.Variable.Global),
  2842. (words(special_forms, prefix=r'(?<=\()', suffix=_token_end),
  2843. Keyword.Reserved),
  2844. (words(builtin_macros, prefix=r'(?<=\()', suffix=_token_end),
  2845. Name.Builtin),
  2846. (words(builtin_functions, prefix=r'(?<=\()', suffix=_token_end),
  2847. Name.Function),
  2848. # other symbols
  2849. (valid_name, Name.Variable),
  2850. ],
  2851. 'string': [
  2852. (r'\\(u[0-9a-fA-F]{4}|U[0-9a-fA-F]{6})', String.Escape),
  2853. (r'\\x[0-9a-fA-F]{2}', String.Escape),
  2854. (r'\\.', String.Escape),
  2855. (r'"', String, '#pop'),
  2856. (r'[^\\"]+', String),
  2857. ]
  2858. }