a
    "=`|                     @   s   d Z ddlZddlmZmZmZmZmZmZ ddl	m
Z
mZmZmZmZmZmZmZmZmZ ddlmZ g dZG dd deZed	ZG d
d deZG dd deZG dd deZdS )z
    pygments.lexers.matlab
    ~~~~~~~~~~~~~~~~~~~~~~

    Lexers for Matlab and related languages.

    :copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    N)Lexer
RegexLexerbygroupsdefaultwordsdo_insertions)
TextCommentOperatorKeywordNameStringNumberPunctuationGeneric
Whitespace)_scilab_builtins)MatlabLexerMatlabSessionLexerOctaveLexerScilabLexerc                   @   s  e Zd ZdZdZdgZdgZdgZdZdZ	dZ
d	Zd
ejfdejdfdefdedfeddddefddee	 e
  d ejfdeeefde eeeedfeefdejfdejfdejfdefdefdefd efd!ed"fd#efd$efgd%ejd&fd'ejfd$ejfgd(eeeeeeejeeee
d&fd)eeejd&fgd*ed&fgd+ed&feed&fd,efd-efd.efd/ed&fed&gd0Zd1d2 Z d3S )4r   z=
    For Matlab source code.

    .. versionadded:: 0.10
    ZMatlabZmatlab*.mztext/matlab)FsinsindsinhasinasindasinhcoscosdcoshacosacosdacoshtantandtanhatanatandZatan2Zatan2datanhsecsecdsechasecasecdasechcsccscdcschacscacscdacschcotcotdcothacotacotdacothhypotZdeg2radZrad2degexpZexpm1logZlog1pZlog10Zlog2Zpow2realpowreallogrealsqrtsqrtnthrootZnextpow2absanglecomplexconjimagrealunwrapisrealcplxpairfixfloorceilroundmodremsign)*airybesseljbesselybesselhbesselibesselkbetabetaincZ
betaincinvbetalnZellipjZellipkeerferfcerfcxerfinvZerfcinvZexpintgammagammaincZgammaincinvgammalnZpsilegendrecrossdotfactorisprimeprimesgcdlcmratratspermsnchoosek	factorialZcart2sphZcart2polZpol2cartZsph2cartZhsv2rgbZrgb2hsv)HzerosoneseyerepmatZrepelemlinspacelogspaceZ	freqspacemeshgrid
accumarraysizelengthndimsnumeldispisemptyisequalZisequalncatreshapediagblkdiagtriltriufliplrflipudZflipZrot90findendZsub2indZind2subbsxfunndgridpermuteipermuteshiftdim	circshiftsqueezeisscalarisvectorZisrowZiscolumnismatrixepsrealmaxrealminintmaxintminZflintmaxpiiinfnanisnanisinfisfinitejtruefalsecompanZgalleryhadamardhankelhilbinvhilbmagicpascalrossertoeplitzvander	wilkinsonz<-|==|~=|<=|>=|<|>|&&|&|~|\|\|?|\.\*|\*|\+|\.\^|\.\\|\./|/|\\z^!.*z%\{\s*\nblockcommentz%.*$^\s*function\bdeffunc)breakcasecatchclassdefcontinueelseelseifr   forfunctionglobalif	otherwiseZparfor
persistentreturnZspmdswitchtrywhilez(?<!\.)\b)prefixsuffix(|z)\bz(\.\.\.)(.*)$z-(?:^|(?<=;))(\s*)(\w+)(\s+)(?!=|\(|(?:%s)\s+)commandargsz4(?<!\w)((\d+\.\d*)|(\d*\.\d+))([eEf][+-]?\d+)?(?!\w)z\b\d+[eEf][+-]?[0-9]+\bz\b\d+\bz\[|\]|\(|\)|\{|\}|:|@|\.|,=|:|;(?<=[\w)\].])\'+z"(""|[^"])*"(?<![\w)\].])\'string[a-zA-Z_]\w*.z^\s*%\}#popz^.*\n1(\s*)(?:(\S+)(\s*)(=)(\s*))?(.+)(\()(.*)(\))(\s*)(\s*)([a-zA-Z_]\w*)[^']*'=z[ \t]+z'[^']*'z[^';\s]+;)rootr   r   r   r   c                    sb   t  fdd  D d }|dr6d|vr6dS td tjrJdS td	 tjr^dS d S )
Nc                 3   s   | ]}t d  s|V  qdS )^\s*%N)rematch).0linetext 8/usr/lib/python3/dist-packages/pygments/lexers/matlab.py	<genexpr>   s   z+MatlabLexer.analyse_text.<locals>.<genexpr> r   {g      ?r   g?z^!\w+)next
splitlinesstrip
startswithr   searchM)r   Zfirst_non_commentr   r   r   analyse_text   s    
zMatlabLexer.analyse_textN)!__name__
__module____qualname____doc__namealiases	filenames	mimetypesZelfunZspecfunZelmatZ
_operatorsr   ZOtherr	   Z	Multiliner   r   joinr   Builtinr   r   r
   r   FloatIntegerr   r   Functionr   tokensr   r   r   r   r   r      sx   
8


	Wr   z.*?
c                   @   s"   e Zd ZdZdZdgZdd ZdS )r   z
    For Matlab sessions.  Modeled after PythonConsoleLexer.
    Contributed by Ken Schutte <kschutte@csail.mit.edu>.

    .. versionadded:: 0.10
    zMatlab sessionZmatlabsessionc              	   c   s  t f i | j}d}g }d}t|D ]x}| }|drv|t|dtj	|d d fgf ||dd  7 }n|dr|t|dtj	|d d fgf ||dd  7 }n|drt|}dtj
|f}	|||	gf n|rPt|d	 d	 d	 }
|d
|
 rF|t|dtj	|d |
 fgf |||
d  7 }n||7 }n6|rtt|||E d H  d}g }| tj|fV  | drd}q&d}q&|rt|||E d H  d S )Nr   Fz>> r      z>>   z??? z...T)r   Zoptionsline_refinditergroupr   appendlenr   ZPromptZ	Tracebackr   get_tokens_unprocessedstartZOutputr   endswith)selfr   ZmlexerZcurcodeZ
insertionsZcontinuationr   r   idxtokenZ
line_startr   r   r   r      sT    









z)MatlabSessionLexer.get_tokens_unprocessedN)r   r   r   r   r   r   r   r   r   r   r   r      s   r   c                   @   s*  e Zd ZdZdZdgZdgZdgZdZdZ	dZ
d	Zd
ZdZdefdedfedddefeee	 e
 e e ddejfeeddejfdefdefdefdefdefdefdefdejfdejfdejfdefdedfdefd efgd!ed"fgd#eeeeeeejeeee
d"fd$eeejd"fgd%Zd&S )'r   z@
    For GNU Octave source code.

    .. versionadded:: 1.5
    ZOctaveZoctaver   ztext/octave(=  ZaddlistenerZaddpathZaddpropertyallandanyZargnamesargvZassigninatexitZautoloadZavailable_graphics_toolkitsZbeep_on_errorZbitandZbitmaxZbitorZbitshiftZbitxorr   ZcellZcellstrcharclassZclccolumnsZcommand_line_pathZcompletion_append_charZcompletion_matchesrF   Zconfirm_recursive_rmdirZcputimeZcrash_dumps_octave_coreZ
ctransposeZcumprodZcumsumZdebug_on_errorZdebug_on_interruptZdebug_on_warningZdefault_save_optionsZdellistenerr   Zdiffr}   Zdoc_cache_fileZdo_string_escapesZdoubleZdrawnoweZecho_executing_commandsr   eqerrnoZ
errno_listerrorevalZevalinexecZexistexitrs   r   ZfclearZfcloseZfcntlZfdispZfeofZferrorZfevalZfflushZfgetlZfgetsZ
fieldnamesZfile_in_loadpathZfile_in_pathZ
filemarkerZfilesepZfind_dir_in_pathZfixed_point_formatZfnmatchZfopenforkZformulaZfprintfZfputsZfreadZfreportZfrewindZfscanfZfseekZfskiplZftellZ	functionsZfwritegeZgenpathgetgetegidgetenvgeteuidgetgidgetpgrpgetpidgetppidgetuidZglobgtZgui_modeZhistory_controlZhistory_fileZhistory_sizeZhistory_timestamp_format_stringhomeZhorzcatr<   ZifelseZignore_function_time_stampZ
inferiortoZ	info_fileZinfo_programZinlineinputr   r   r   Zis_absolute_filenameZisargoutZisboolZiscellZ	iscellstrZischarZ	iscomplexr~   ZisfieldZisfloatZisglobalZishandleZisieeeZisindexZ	isintegerZ	islogicalr   ZismethodZisnull	isnumericZisobjectrK   Zis_rooted_relative_filenameZissortedZisstructZ	isvarnameZkbhitZkeyboardkillZlasterrZ	lasterrorZlastwarnZldividelerz   linkru   ZlogicallstatltZmake_absolute_filenameZmakeinfo_programZmax_recursion_depthmergemethodsZ	mfilenameZminusZ	mislockedmkdirmkfifoZmkstempZmldivideZmlockZmouse_wheel_zoomZmpowerZmrdivideZmtimesZmunlockZnarginZnargoutZnative_float_formatr{   neZnfieldsZnnzZnormnotr|   ZnzmaxZoctave_config_infoZoctave_core_file_limitZoctave_core_file_nameZoctave_core_file_optionsrr   orZoutput_max_field_widthZoutput_precisionZpage_output_immediatelyZpage_screen_outputpathpathseppauseZpcloser   r   pipeZpluspopenZpowerZprint_empty_dimensionsZprintfZprint_struct_array_contentsZprodZprogram_invocation_nameZprogram_nameputenvZputspwdquitrm   ZrdivideZreaddirreadlinkZread_readline_init_filer   r   ZrehashrenameZrepelemsZre_read_readline_init_fileresetr   ZresizeZrestoredefaultpathZrethrowrmdirZrmfieldZrmpathZrowsZsave_header_format_stringZsave_precisionZsaving_historyZscanfsetZsetenvZ	shell_cmdZsighup_dumps_octave_coreZsigterm_dumps_octave_coreZsilent_functionsZsinglery   Z
size_equalZsizemaxZsizeofsleepsourceZsparse_auto_mutateZsplit_long_rowsZsprintfr   ZsscanfstatstderrstdinstdoutZstrcmpZstrcmpiZstring_fill_charZstrncmpZstrncmpiZstructZstruct_levels_to_printZstrvcatZsubsasgnZsubsrefsumZsumsqZ
superiortoZsuppress_verbose_help_messagesymlinksystemZticZtilde_expandtimesZtmpfileZtmpnamZtocZtoupperZ	transposer   ZtypeinfoumaskZuminusunameZundo_string_escapesunlinkZuplusupperZusageZusleepZvecZ	vectorizeZvertcatwaitpidZwarningZwarrantyZwhos_line_formatZ	yes_or_norq   r   ZInfr   ZNaN)closeloadZwhoZwhos(h  rx   Zaccumdimr"   r:   r4   Z	addtodateZallchildZancestorZanovaZarch_fitZarch_rndZ	arch_testZareaZarma_rndZarrayfunasciiasctimer.   r   assertr(   Zautoreg_matrixZautumnZaxesZaxisZbarZbarhZbartlettZbartlett_testZbeepZbetacdfZbetainvZbetapdfZbetarndZbicgstabZbicubicZbinaryZbinocdfZbinoinvZbinopdfZbinorndZbitcmpZbitgetZbitsetZblackmanZblanksr   ZboneZboxZbrightenZcalendarcastZ
cauchy_cdfZ
cauchy_invZ
cauchy_pdfZ
cauchy_rndZcaxisZcelldispcenterZcgsZchisquare_test_homogeneityZchisquare_test_independencer   ZclaZclabelZclfZclockZcloglogZclosereqZcolonZcolorbarZcolormapZcolpermZcometZcommon_sizeZcommutation_matrixr   Zcompare_versionsZcompassZcomputerZcondZcondestZcontourZcontourcZcontourfZcontrastZconvZconvhullZcoolZcopperZcopyfileZcorZcorrcoefZcor_testr   r7   ZcovrL   re   r1   ZcstrcatZcsvreadZcsvwritectimeZcumtrapzZcurlZcutZcylinderdateZdatenumZdatestrZdatetickZdatevecZdblquadZdealZdeblankZdeconvZdelaunayZ	delaunayndeleteZdemoZdetrendZdiffparaZdiffusedirZdiscrete_cdfZdiscrete_invZdiscrete_pdfZdiscrete_rndZdisplayZ
divergenceZdlmwriteZdosZdsearchZdsearchnZduplication_matrixZdurbinlevinsonZ	ellipsoidZempirical_cdfZempirical_invZempirical_pdfZempirical_rndZeomdayZerrorbarZetimeZ	etreeplotZexampleZexpcdfZexpinvZexpmZexppdfZexprndZ	ezcontourZ
ezcontourfZezmeshZezmeshcZezplotZezpolarZezsurfZezsurfcrg   rp   ZfailZfcdfZfeatherZfftconvZfftfiltZfftshiftZfigureZ
fileattribZ	filepartsZfillfindallZfindobjZfindstrZfinvflagZflipdimr   r   ZfpdfZfplotZ	fractdiffZfreqzZ
freqz_plotZfrndZfsolveZf_test_regressionZftpZfullfileZfzeroZgamcdfZgaminvZgampdfZgamrndZgcaZgcbfZgcboZgcfZ
genvarnameZgeocdfZgeoinvZgeopdfZgeorndZgetfieldZginputZglpkZglsZgplotZgradientZgraphics_toolkitZgrayZgridZgriddataZ	griddatanZgtextZgunzipZgzipr   Zhammingr   ZhanningZhggroupZhiddenr   ZhistZhistcZholdZhotZhotelling_testZhoushZhsvZhurstZhygecdfZhygeinvZhygepdfZhygerndZidivideZ	ifftshiftZimageZimagescZimfinfoZimreadZimshowZimwriteindexinfoZ	inpolygonZ	inputnameZinterpftZinterpnZ	intersectr   ZiqrZisaZ
isdefiniteisdirZis_duplicate_entryr   ZisequalwithequalnansZisfigureZishermitianZ
ishghandleZis_leap_yearZisletterZismacZismemberZispcrh   Zispropr   ZissquareZ	isstrpropZissymmetricZisunixZis_valid_file_idr   ZjetZkendallZkolmogorov_smirnov_cdfZkolmogorov_smirnov_testZkruskal_wallis_testZkrylovZkurtosisZlaplace_cdfZlaplace_invZlaplace_pdfZlaplace_rndZlegendrd   licenser   ZlinkpropZlist_primesZ	loadaudioZloadobjZlogistic_cdfZlogistic_invZlogistic_pdfZlogistic_rndZlogitZloglogZ	loglogerrZlogmZlogncdfZlogninvZlognpdfZlognrndrv   ZlookforZ
ls_commandZ	lsqnonnegr   ZmahalanobisZmanovaZ
matlabrootZmcnemar_testZmeanZmeansqZmedianZmenuZmeshZmeshcrw   ZmeshzZmexextZmgetZmkppmodeZmomentZmovefileZmpolesZmputZnamelengthmaxZnargchkZ
nargoutchkZnbincdfZnbininvZnbinpdfZnbinrndro   r   ZnewplotZnewsZnonzerosZnormcdfZnormestZnorminvZnormpdfZnormrndZnowrC   ZnullZoceanZolsZ
onenormestZoptimgetZoptimsetZorderfieldsZorientZorthZpackZparetoZparseparamsr   ZpatchZpathdefZpcgZpchipZpcolorZpcrZpeaksZperiodogramZperlrn   ZpieZpinkZplanerotZ	playaudioZplotZ
plotmatrixZplotyyZpoisscdfZpoissinvZpoisspdfZpoissrndZpolarZpolyZ
polyaffineZpolyareaZ	polyderivZpolyfitZpolygcdZpolyintZpolyoutZ
polyreduceZpolyvalZpolyvalmZpostpadZpowersetZppderZppintZppjumpsZppplotZppvalZ	pqpnonnegZprepadri   printZprint_usageZprismZprobitZqpZqqplotZquadccZquadgkZquadlZquadvZquiverZqzhessZrainbowZrandirangeZrankZranksrl   r@   r?   rA   recordZrectangle_lwZrectangle_swZrectintZrefreshZrefreshdataZregexptranslatert   ZresidueZribbonrindexrootsZroser   ZrotdimZrrefrunZ	run_countZrundemosZrun_testZruntestsZsaveasZ	saveaudioZsaveobjZsavepathZscatterr+   ZsemilogxZsemilogxerrZsemilogyZsemilogyerrZsetaudioZsetdiffZsetfieldZsetxorZshadingshiftr   Z	sign_testZsincr   ZsinetoneZsinewaveZskewnesssliceZsombreroZsortrowsZ	spaugmentZ	spconvertZspdiagsZspearmanZspectral_adfZspectral_xdfZspecularZspeedZspencerZspeyeZspfunZsphereZspinmapZsplineZsponesZsprandZsprandnZ	sprandsymZspringZspstatsZspyZsqpZstairsZ
statisticsZstdZstdnormal_cdfZstdnormal_invZstdnormal_pdfZstdnormal_rndZstemZstftZstrcatZstrchrZstrjustZstrmatchZstrreadZstrsplitZstrtokZstrtrimZstrtruncZ	structfunZ
studentizeZsubplotZ	subsindexZsubspaceZsubstrZ	substructZsummerZsurfZsurfaceZsurfcZsurflZsurfnormZsvdsZ	swapbytesZsylvester_matrixZsymvarZ	synthesistabler%   ZtarZtcdfZtempdirZtempnametestr   ZtextreadZtextscanZtinvtitler   ZtpdfZtraceZtrapzZ
treelayoutZtreeplotZtriangle_lwZtriangle_swr   ZtrimeshZ
triplequadZtriplotZtrisurfr   ZtrndZtsearchnZt_testZt_test_regressiontypeZunidcdfZunidinvZunidpdfZunidrndZunifcdfZunifinvZunifpdfZunifrndunionuniqueZunixZunmkppZunpackZuntabifyZuntarrJ   ZunzipZu_testZvalidatestringr   varZvar_testZvechZverversionZviewZvoronoiZvoronoinZwaitforbuttonpressZwavreadZwavwriteZwblcdfZwblinvZwblpdfZwblrndZweekdayZ
welch_testZwhatZwhiteZwhitebgZwienrndZwilcoxon_testr   ZwinterZxlabelZxlimZylabelZ
yulewalkerzipZzlabelZz_test)rT   ZamdZbalancerW   rX   rU   rY   rV   Zbitpackr   ZbuiltinZccolamdZcellfunZ
cellslicesZcholZ
choldeleteZ
cholinsertZcholinvZ	cholshiftZ
cholupdateZcolamdZcollocZ	convhullnZconvnZcsymamdZcummaxZcumminZdaspkZdaspk_optionsZdasrtZdasrt_optionsZdasslZdassl_optionsZdbclearZdbdownZdbstackZdbstatusZdbstopZdbtypeZdbupZdbwhereZdetZdlmreadZdmpermrf   ZeigZeigsZendgrentZendpwentZetreeZfftZfftnZfftwfilterr   Zfullrj   ZgetgrentZgetgrgidZgetgrnamZgetpwentgetpwnamgetpwuidZ	getrusageZgivensgmtimeZgnuplot_binaryZhessZifftZifftninvZisdebugmodeZissparseZkron	localtimelookupZlsodeZlsode_optionsZluZluincZluupdateZmatrix_typemaxminmktimeZpinvZqrZqrdeleteZqrinsertZqrshiftZqrupdateZquadZquad_optionsZqzZrandZrandeZrandgZrandnZrandpZrandpermZrcondZregexpZregexpiZ	regexprepZschurZsetgrentZsetpwentsortZspallocZsparseZspparmsZsprankZsqrtmZstrfindstrftimestrptimeZstrrepZsvdZ
svd_driverZsylZsymamdZsymbfactZsymrcmtimeZtsearchZtypecastZurlreadZurlwrite)MrD   r!   r#   r9   r;   r3   r5   rE   argr-   r/   r   r   r'   r)   rZ   r[   r\   ZbincoeffZcbrtrO   rG   r   r    r6   r8   r0   r2   r]   r^   r_   r`   r=   ZfiniterM   rN   Zfmodra   rb   rc   rH   isalnumisalphaisasciiZiscntrlisdigitr   Zisgraphr   islowerZisnar   ZisprintZispunctisspaceisupperZisxdigitrk   Zlgammar>   lowerrQ   rI   rR   rP   Zroundbr*   r,   rS   r   r   rB   r$   r&   Ztoasciitolowerxor)ZEDITORZ	EXEC_PATHIZ
IMAGE_PATHZNAZOCTAVE_HOMEZOCTAVE_VERSIONZPAGERZPAGER_FLAGSSEEK_CURSEEK_ENDSEEK_SETZSIGS_ISBLKS_ISCHRS_ISDIRS_ISFIFOS_ISLNKS_ISREGS_ISSOCKZ	WCONTINUE	WCOREDUMPWEXITSTATUSWIFCONTINUED	WIFEXITEDWIFSIGNALED
WIFSTOPPEDWNOHANGWSTOPSIGWTERMSIG	WUNTRACEDz[%#].*$r   r   )Z__FILE__Z__LINE__r   r   r   r   r   Zdor   r   r   Zend_try_catchZend_unwind_protectZendclassdefZ	endeventsZendforZendfunctionZendifZ
endmethodsZendpropertiesZ	endswitchZendwhileZeventsr   r   r  r   r   r)  r   r   Z
propertiesr   r;  Zstaticr   r   ZuntilZunwind_protectZunwind_protect_cleanupr   r   r   z-=|!=|!|/=|---|==|~=|<|>|<=|>=|&&|&|~|\|\|?z$\*=|\+=|\^=|\/=|\\=|\*\*|\+\+|\.\*\*\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\z[\[\](){}:@.,]r   "[^"]*"&(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?\d+[eEf][+-]?[0-9]+\d+r   r   r   r   r   r   r   r   r   r   r   r   N)r   r   r   r   r   r   r   r   Z
builtin_kwZ
command_kwZfunction_kwZloadable_kwZ
mapping_kwZbuiltin_constsr	   r   r   r   r   Constantr
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r      sh   Z 	1

r   c                   @   s  e Zd ZdZdZdgZg dZdgZdej	fde
dfed	d
de
feejej ej d
dejfeejd
dejfdefdefdefdefdefdedfdejfdejfdejfdefdefgdedfdedfgdeeeeeeejeeee
dfdeeejdfgdZdS )r   z<
    For Scilab source code.

    .. versionadded:: 1.5
    ZScilabZscilab)z*.sciz*.scez*.tstztext/scilabz//.*?$r   r   r  r   r  r  r  z[\[\](){}@.,=:;]r  r   r   r   r  r  r  r   r   r   r   r   r   r  N)r   r   r   r   r   r   r   r   r	   Singler   r   r   Zfunctions_kwZcommands_kwZ	macros_kwr   r   Zvariables_kwr  r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r     s^   	*

r   )r   r   Zpygments.lexerr   r   r   r   r   r   Zpygments.tokenr   r	   r
   r   r   r   r   r   r   r   Zpygments.lexersr   __all__r   compiler   r   r   r   r   r   r   r   <module>   s   
 0 
F   