3

V'íc¨Hã@stdZddlZddlmZmZddlmZmZmZm	Z	m
Z
mZmZm
Z
mZddgZGdd„deƒZGdd„deƒZdS)	zÚ
    pygments.lexers.rebol
    ~~~~~~~~~~~~~~~~~~~~~

    Lexers for the REBOL and related languages.

    :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
éN)Ú
RegexLexerÚbygroups)	ÚTextÚCommentÚOperatorÚKeywordÚNameÚStringÚNumberÚGenericÚ
WhitespaceÚ
RebolLexerÚRedLexerc#@seZdZdZdZdgZdddgZdgZej	ej
BZdZd	d
„Z
defdejd
fdefgdefdejdfdejfdejdfdejfdedfdedfdejfdejfdefdejdfdejfd ejfd!ejfd"ejfd#ejfd$ejfd%ejfd&ejfd'efd(ejfd)ejfd*ejfd+ejfd,ed-fd.ed/fd0ed1fd2efd3ejfd4e
fd5ejfd6ejd7fd8efg!d9efeej fd:efd;ej fded<fgd=efeej fd:efd;ej fded>fd?ed<fgd9ejfeejfd;ejfdejd<fgedejd<fd@ejd<fdAejd<fgeejfdejdBfdCejfdDejd<fgd9ejfeejfd:ejfd;ejfdejd<fgdEejfdFejd<fgdejfdGejfd?ejd<fgd9efeefd:efd;efded<fgd=efeefd:efd;efded>fd?ed<fgdHed>fdIed<fded-fded/fdJefgdKœ
Z!dLdM„Z"dNS)Or
zN
    A `REBOL <http://www.rebol.com/>`_ lexer.

    .. versionadded:: 1.1
    ZREBOLZrebolz*.rz*.r3z*.rebztext/x-rebolz(?:\^\([0-9a-f]{1,4}\)*)ccsÐ|jƒ}tjd|ƒr*|jƒtj|fVn¢tjd|ƒrL|jƒtj|fVn€tjd|ƒrn|jƒtj|fVn^tjd|ƒr|jƒt	j
|fVn<tjd|ƒr²|jƒtj|fVntjd|ƒrÒ|jƒtj|fVnútjd|ƒrð|jƒt	|fVnÜtjd|ƒr|jƒt
|fVn¼tjd	|ƒr0|jƒt	|fVnœtjd
|ƒrR|jƒt	j|fVnztjd|ƒrv|jƒtjj|fVnVtjd|ƒr˜|jƒtj|fVn4tjd
|ƒrº|jƒtj|fVn|jƒtj|fVdS)Nz.*:$a(native|alias|all|any|as-string|as-binary|bind|bound\?|case|catch|checksum|comment|debase|dehex|exclude|difference|disarm|either|else|enbase|foreach|remove-each|form|free|get|get-env|if|in|intersect|loop|minimum-of|maximum-of|mold|new-line|new-line\?|not|now|prin|print|reduce|compose|construct|repeat|reverse|save|script\?|set|shift|switch|throw|to-hex|trace|try|type\?|union|unique|unless|unprotect|unset|until|use|value\?|while|compress|decompress|secure|open|close|read|read-io|write-io|write|update|query|wait|input\?|exp|log-10|log-2|log-e|square-root|cosine|sine|tangent|arccosine|arcsine|arctangent|protect|lowercase|uppercase|entab|detab|connected\?|browse|launch|stats|get-modes|set-modes|to-local-file|to-rebol-file|encloak|decloak|create-link|do-browser|bind\?|hide|draw|show|size-text|textinfo|offset-to-caret|caret-to-offset|local-request-file|rgb-to-hsv|hsv-to-rgb|crypt-strength\?|dh-make-key|dh-generate-key|dh-compute-key|dsa-make-key|dsa-generate-key|dsa-make-signature|dsa-verify-signature|rsa-make-key|rsa-generate-key|rsa-encrypt)$a4(add|subtract|multiply|divide|remainder|power|and~|or~|xor~|minimum|maximum|negate|complement|absolute|random|head|tail|next|back|skip|at|pick|first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|last|path|find|select|make|to|copy\*|insert|remove|change|poke|clear|trim|sort|min|max|abs|cp|copy)$a—(error|source|input|license|help|install|echo|Usage|with|func|throw-on-error|function|does|has|context|probe|\?\?|as-pair|mod|modulo|round|repend|about|set-net|append|join|rejoin|reform|remold|charset|array|replace|move|extract|forskip|forall|alter|first+|also|take|for|forever|dispatch|attempt|what-dir|change-dir|clean-path|list-dir|dirize|rename|split-path|delete|make-dir|delete-dir|in-dir|confirm|dump-obj|upgrade|what|build-tag|process-source|build-markup|decode-cgi|read-cgi|write-user|save-user|set-user-name|protect-system|parse-xml|cvs-date|cvs-version|do-boot|get-net-info|desktop|layout|scroll-para|get-face|alert|set-face|uninstall|unfocus|request-dir|center-face|do-events|net-error|decode-url|parse-header|parse-header-date|parse-email-addrs|import-email|send|build-attach-body|resend|show-popup|hide-popup|open-events|find-key-face|do-face|viewtop|confine|find-window|insert-event-func|remove-event-func|inform|dump-pane|dump-face|flag-face|deflag-face|clear-fields|read-net|vbug|path-thru|read-thru|load-thru|do-thru|launch-thru|load-image|request-download|do-face-alt|set-font|set-para|get-style|set-style|make-face|stylize|choose|hilight-text|hilight-all|unlight-text|focus|scroll-drag|clear-face|reset-face|scroll-face|resize-face|load-stock|load-stock-block|notify|request|flash|request-color|request-pass|request-text|request-list|request-date|request-file|dbug|editor|link-relative-path|emailer|parse-error)$zO(halt|quit|do|load|q|recycle|call|run|ask|parse|view|unview|return|exit|break)$zREBOL$zto-.*z5(\+|-|\*|/|//|\*\*|and|or|xor|=\?|=|==|<>|<|>|<=|>=)$z.*\?$z.*\!$z'.*z#.*z%.*)ÚgroupÚreÚmatchÚstartrÚ
SubheadingrÚBuiltinÚFunctionrÚ	NamespaceÚ	ExceptionZHeadingrÚTypeÚVariableÚInstanceÚLabelÚ	Decorator)ÚlexerrÚword©rú9/tmp/pip-build-gk9425m9/Pygments/pygments/lexers/rebol.pyÚ
word_callback#sJzRebolLexer.word_callbackz[^R]+z
REBOL\s+\[ÚscriptÚRz\s+z#"Úcharz#\{[0-9a-f]*\}z2#\{Úbin2z64#\{[0-9a-z+/=\s]*\}ú"Ústringz\{Ústring2z;#+.*\nz;\*+.*\nz;.*\nz%"Ú
stringFilez%[^(^{")\s\[\]]+z[+-]?([a-z]{1,3})?\$\d+(\.\d+)?z[+-]?\d+\:\d+(\:\d+)?(\.\d+)?zJ\d+[\-/][0-9a-z]+[\-/]\d+(\/\d+\:\d+((\:\d+)?([.\d+]?([+-]?\d+:\d+)?)?)?)?z\d+(\.\d+)+\.\d+z\d+X\d+z#[+-]?\d+(\'\d+)?([.,]\d*)?E[+-]?\d+z[+-]?\d+(\'\d+)?[.,]\d*z[+-]?\d+(\'\d+)?z[\[\]()]z [a-z]+[^(^{"\s:)]*://[^(^{"\s)]*z mailto:[^(^{"@\s)]+@[^(^{"@\s)]+z[^(^{"@\s)]+@[^(^{"@\s)]+z
comment\s"ÚcommentString1zcomment\s\{ÚcommentString2zcomment\s\[ÚcommentBlockzcomment\s[^(\s{"\[]+z/[^(^{")\s/[\]]*z"([^(^{")\s/[\]]+)(?=[:({"\s/\[\]])z
<[\w:.-]*>z<[^(<>\s")]+Útagz
([^(^{")\s]+)z[^(^")]+z[(|)]+z\^.z#popz	[^(^{})]+z#pushz\}z\^."z."Ú	tagStringz
[^(<>\r\n")]+ú>z(\d+\.)+z\d+z([01]\s*){8}z\[z\]z[^(\[\]"{)]+)
Úrootr"r'r(r)r$r-r.Útupler%r*r+r,cCs,tjd|tjƒrdStjd|tjƒr(dSdS)zS
        Check if code contains REBOL header and so it probably not R code
        z^\s*REBOL\s*\[gð?z
\s*REBOL\s*\[gà?N)rrÚ
IGNORECASEÚsearch)Útextrrr Úanalyse_textêszRebolLexer.analyse_textN)#Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚnameÚaliasesÚ	filenamesÚ	mimetypesrr2Ú	MULTILINEÚflagsÚ	escape_rer!rrÚStrongrr	ÚCharr
ÚHexÚSpecialÚPreprocrrÚFloatÚOtherrÚConstantÚ	AttributeÚTagÚEscapeÚtokensr5rrrr r
s¼
W










c$@seZdZdZdZddgZddgZddgZej	ej
BZd	Zd
d„Z
defd
ejdfdejdfdefgdefdejdfdejfdejdfdejfdeejejeƒfdedfdedfdejfdejfdefd ejd!fd"ejfd#ejfd$ejfd%ejfd&ej fd'ej fd(ejfd)ejfd*efd+ejfd,ejfd-ejfd.ejfd/ed0fd1ed2fd3ed4fd5efd6ej!fd7e
fd8ej"fd9ej"d:fd;efg"d<efeej#fd=efd>ej#fded?fgd@efeej#fd=efd>ej#fdedAfdBed?fgd<ejfeejfd>ejfdejd?fgedejd?fdCejd?fdDejd?fgeej"fdej"dEfdFej"fdGej"d?fgd<ej"feej"fd=ej"fd>ej"fdej"d?fgdHej fdIej d?fgdejfdJejfdBejd?fgd<efeefd=efd>efded?fgd@efeefd=efd>efdedAfdBed?fgdKedAfdLed?fded0fded2fdMefgdNœ
Z$dOS)PrzX
    A `Red-language <http://www.red-lang.org/>`_ lexer.

    .. versionadded:: 2.0
    ZRedZredz
red/systemz*.redz*.redsz
text/x-redztext/x-red-systemz(?:\^\([0-9a-f]{1,4}\)*)ccs|jƒ}tjd|ƒr*|jƒtj|fVnìtjd|ƒrL|jƒtj|fVnÊtjd|ƒrn|jƒtj|fVn¨tjd|ƒr’|jƒtjj	|fVn„tjd|ƒr´|jƒt
j|fVnbtjd|ƒrÖ|jƒtj|fVn@tjd|ƒrö|jƒt
|fVn tjd|ƒr|jƒt
j|fVnþtjd	|ƒr8|jƒt
|fVnÞtjd
|ƒrX|jƒt
|fVn¾tjd|ƒrz|jƒt
j|fVnœtjd|ƒrž|jƒtjj|fVnxtjd
|ƒrÀ|jƒtj|fVnVtjd|ƒrâ|jƒtj|fVn4tjd|ƒr|jƒtj|fVn|jƒtj|fVdS)Nz.*:$a(if|unless|either|any|all|while|until|loop|repeat|foreach|forall|func|function|does|has|switch|case|reduce|compose|get|set|print|prin|equal\?|not-equal\?|strict-equal\?|lesser\?|greater\?|lesser-or-equal\?|greater-or-equal\?|same\?|not|type\?|stats|bind|union|replace|charset|routine)$af(make|random|reflect|to|form|mold|absolute|add|divide|multiply|negate|power|remainder|round|subtract|even\?|odd\?|and~|complement|or~|xor~|append|at|back|change|clear|copy|find|head|head\?|index\?|insert|length\?|next|pick|poke|remove|reverse|select|sort|skip|swap|tail|tail\?|take|trim|create|close|delete|modify|open|open\?|query|read|rename|update|write)$z`(yes|on|no|off|true|false|tab|cr|lf|newline|escape|slash|sp|space|null|none|crlf|dot|null-byte)$ze(#system-global|#include|#enum|#define|#either|#if|#import|#export|#switch|#default|#get-definition)$zš(system|halt|quit|quit-return|do|load|q|recycle|call|run|ask|parse|raise-error|return|exit|break|alias|push|pop|probe|\?\?|spec-of|body-of|quote|forever)$zý(action\?|block\?|char\?|datatype\?|file\?|function\?|get-path\?|zero\?|get-word\?|integer\?|issue\?|lit-path\?|lit-word\?|logic\?|native\?|op\?|paren\?|path\?|refinement\?|set-path\?|set-word\?|string\?|unset\?|any-struct\?|none\?|word\?|any-series\?)$z(JNICALL|stdcall|cdecl|infix)$zto-.*zN(\+|-\*\*|-|\*\*|//|/|\*|and|or|xor|=\?|===|==|=|<>|<=|>=|<<<|>>>|<<|>>|<|>%)$z.*\!$z'.*z#.*z%.*z:.*)rrrrrrrrrZPseudorrrrrrrrr)rrrrrr r!sNzRedLexer.word_callbackz[^R]+zRed/System\s+\[r"zRed\s+\[r#z\s+z#"r$z#\{[0-9a-f\s]*\}z2#\{r%z64#\{[0-9a-z+/=\s]*\}z$([0-9a-f]+)(h)((\s)|(?=[\[\]{}"()]))r&r'z\{r(z;#+.*\nz;\*+.*\nz;.*\nz%"r)z%[^(^{")\s\[\]]+z[+-]?([a-z]{1,3})?\$\d+(\.\d+)?z[+-]?\d+\:\d+(\:\d+)?(\.\d+)?zH\d+[\-/][0-9a-z]+[\-/]\d+(/\d+:\d+((:\d+)?([\.\d+]?([+-]?\d+:\d+)?)?)?)?z\d+(\.\d+)+\.\d+z\d+X\d+z#[+-]?\d+(\'\d+)?([.,]\d*)?E[+-]?\d+z[+-]?\d+(\'\d+)?[.,]\d*z[+-]?\d+(\'\d+)?z[\[\]()]z [a-z]+[^(^{"\s:)]*://[^(^{"\s)]*z mailto:[^(^{"@\s)]+@[^(^{"@\s)]+z[^(^{"@\s)]+@[^(^{"@\s)]+z
comment\s"r*zcomment\s\{r+zcomment\s\[r,zcomment\s[^(\s{"\[]+z/[^(^{^")\s/[\]]*z#([^(^{^")\s/[\]]+)(?=[:({"\s/\[\]])z
<[\w:.-]*>z<[^(<>\s")]+r-z
([^(^{")\s]+)z[^(^")]+z[(|)]+z\^.z#popz	[^(^{})]+z#pushz\}z\^."z."r.z
[^(<>\r\n")]+r/z(\d+\.)+z\d+z([01]\s*){8}z\[z\]z[^(\[\]"{)]+)
r0r"r'r(r)r$r-r.r1r%r*r+r,N)%r6r7r8r9r:r;r<r=rr2r>r?r@r!rrrArr	rBr
rCrrrrrDrErrFrGrrHrIrJrKrLrrrr rösÀ8











)r9rZpygments.lexerrrZpygments.tokenrrrrrr	r
rrÚ__all__r
rrrrr Ú<module>	s,c