B
    G
\q                 @   s   d Z ddlZddl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 dddd	g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-2017 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    N)Lexer
RegexLexerbygroupswordsdo_insertions)
TextCommentOperatorKeywordNameStringNumberPunctuationGeneric
Whitespace)_scilab_builtinsMatlabLexerMatlabSessionLexerOctaveLexerScilabLexerc               @   s6  e Zd ZdZdZdgZdgZdg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efddee	 e
  d ej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dfd efd!efgd"ed#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(Zd)d* Zd+S ),r   z=
    For Matlab source code.

    .. versionadded:: 0.10
    ZMatlabZmatlabz*.mztext/matlab)CsinsindsinhasinasindasinhcoscosdcoshacosacosdacoshtantandtanhatanatandZatan2atanhsecsecdsechasecasecdasechcsccscdcschacscacscdacschcotcotdcothacotacotdacothhypot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betaincbetalnZellipjZellipkeerferfcerfcxerfinvZexpintgammagammaincgammalnZpsilegendrecrossdotfactorisprimeprimesgcdlcmratratspermsnchoosek	factorialZcart2sphZcart2polZpol2cartZsph2cartZhsv2rgbZrgb2hsv)CzerosoneseyerepmatrandrandnlinspacelogspaceZ	freqspacemeshgrid
accumarraysizelengthndimsnumeldispisemptyisequalisequalwithequalnanscatreshapediagblkdiagtriltriufliplrflipudflipdimZrot90findendZsub2indZind2subbsxfunndgridpermuteipermuteshiftdim	circshiftsqueezeisscalarisvectorZansepsrealmaxrealminpiiinfnanisnanisinfisfinitejZwhycompanZgalleryhadamardhankelhilbinvhilbmagicpascalrossertoeplitzvander	wilkinsonz^!.*z%\{\s*\nblockcommentz%.*$z^\s*functiondeffunc)breakcasecatchclassdefcontinueelseelseifr   Z
enumeratedeventsforfunctionglobalifmethods	otherwiseZparfor
persistent
propertiesreturnZspmdswitchtrywhilez\b)suffix(|z)\bz	\.\.\..*$z-|==|~=|<|>|<=|>=|&&|&|~|\|\|?z\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\z\[|\]|\(|\)|\{|\}|:|@|\.|,z=|:|;z(?<=[\w)\].])\'+z&(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?z\d+[eEf][+-]?[0-9]+z\d+z(?<![\w)\].])\'stringz[a-zA-Z_]\w*.z[^\']*\'z#popz^\s*%\}z^.*\nz0(\s*)(?:(.+)(\s*)(=)(\s*))?(.+)(\()(.*)(\))(\s*)z(\s*)([a-zA-Z_]\w*))rootr   r   r   c             C   s,   t d| t jrdS t d| t jr(dS d S )Nz^\s*%g?z^!\w+)rematchM)text r   5lib/python3.7/site-packages/pygments/lexers/matlab.pyanalyse_text   s    zMatlabLexer.analyse_textN)__name__
__module____qualname____doc__namealiases	filenames	mimetypesZelfunZspecfunZelmatr   ZOtherr   Z	Multiliner
   r   joinr   Builtinr	   r   r   FloatIntegerr   r   r   Functiontokensr   r   r   r   r   r      sN   






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   sN  t f | j}d}g }x
t|D ]}| }|drn|t|dtj	|d d fgf ||dd  7 }q"|dr|t|dtj	|d d fgf ||dd  7 }q"|drt|}dtj
|f}|||gf q"|rxt|||D ]
}	|	V  qW d}g }| tj|fV  q"W |rJx t|||D ]}	|	V  q:W d S )N z>> r      z>>   z???)r   Zoptionsline_refinditergroup
startswithappendlenr   ZPromptZ	Tracebackr   get_tokens_unprocessedstartZOutput)
selfr   ZmlexerZcurcodeZ
insertionsr   lineidxtokenitemr   r   r   r      s8    





z)MatlabSessionLexer.get_tokens_unprocessedN)r   r   r   r   r   r   r   r   r   r   r   r      s   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octavez*.mz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_matchesrD   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exitrq   ZfalseZ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inputZintmaxZintminr   Zis_absolute_filenameZisargoutZisboolZiscellZ	iscellstrZischarZ	iscomplexr~   ZisfieldZisfloatZisglobalZishandleZisieeeZisindexZ	isintegerZ	islogicalZismatrixZismethodZisnull	isnumericZisobjectrI   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merger   Z	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_optionsrp   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quitrk   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sizeofZ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	transposetrueZtypeinfoumaskZuminusunameZundo_string_escapesunlinkZuplusupperZusageZusleepZvecZ	vectorizeZvertcatwaitpidZwarningZwarrantyZwhos_line_formatZ	yes_or_noro   r   ZInfr   ZNaN)closeloadZwhoZwhos(h  rx   Zaccumdimr    r8   r2   Z	addtodateZallchildZancestorZanovaZarch_fitZarch_rndZ	arch_testZareaZarma_rndZarrayfunasciiZ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   r5   ZcovrJ   rc   r/   ZcstrcatZcsvreadZcsvwriteZctimeZcumtrapzZcurlZcutZcylinderZ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ezsurfcre   rn   ZfailZfcdfZfeatherZfftconvZfftfiltZfftshiftZfigureZ
fileattribZ	filepartsZfillfindallZfindobjZfindstrZfinvflagr   r   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   r   ZisfigureZishermitianZ
ishghandleZis_leap_yearZisletterZismacZismemberZispcrf   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legendrb   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nbinrndrm   r   ZnewplotZnewsZnonzerosZnormcdfZnormestZnorminvZnormpdfZnormrndZnowrA   ZnullZoceanZolsZ
onenormestZoptimgetZoptimsetZorderfieldsZorientZorthZpackZparetoZparseparamsr   ZpatchZpathdefZpcgZpchipZpcolorZpcrZpeaksZperiodogramZperlrl   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prepadrg   printZprint_usageZprismZprobitZqpZqqplotZquadccZquadgkZquadlZquadvZquiverZqzhessZrainbowZrandirangeZrankZranksrj   r>   r=   r?   recordZrectangle_lwZrectangle_swZrectintZrefreshZrefreshdataZregexptranslaterr   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tempnameZ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untarrH   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)rR   ZamdZbalancerU   rV   rS   rW   rT   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dmpermrd   ZeigZeigsZendgrentZendpwentZetreeZfftZfftnZfftwfilterr   Zfullrh   ZgetgrentZgetgrgidZgetgrnamZgetpwentgetpwnamgetpwuidZ	getrusageZgivensZgmtimeZgnuplot_binaryZhessZifftZifftninvZisdebugmodeZissparseZkronZ	localtimelookupZlsodeZlsode_optionsZluZluincZluupdateZmatrix_typemaxminZmktimeZpinvZqrZqrdeleteZqrinsertZqrshiftZqrupdateZquadZquad_optionsZqzrs   ZrandeZrandgrt   ZrandpZrandpermZrcondZregexpZregexpiZ	regexprepZschurZsetgrentZsetpwentsortZspallocZsparseZspparmsZsprankZsqrtmZstrfindZstrftimeZstrptimeZstrrepZsvdZ
svd_driverZsylZsymamdZsymbfactZsymrcmZtimeZtsearchZtypecastZurlreadZurlwrite)MrB   r   r!   r7   r9   r1   r3   rC   argr+   r-   r   r   r%   r'   rX   rY   rZ   ZbincoeffZcbrtrM   rE   r   r   r4   r6   r.   r0   r[   r\   r]   r^   r;   ZfiniterK   rL   Zfmodr_   r`   ra   rF   isalnumisalphaisasciiZiscntrlisdigitr   Zisgraphr   islowerZisnar   ZisprintZispunctisspaceisupperZisxdigitri   Zlgammar<   lowerrO   rG   rP   rN   Zroundbr(   r*   rQ   r   r   r@   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[%#].*$z^\s*functionr   ))__FILE____LINE__r   r   r   r   r   dor   r   r   end_try_catchend_unwind_protectendclassdef	endeventsendforendfunctionendif
endmethodsendproperties	endswitchendwhiler   r   r   r   r   r   r   r   r   r   r   r!  staticr   r   untilunwind_protectunwind_protect_cleanupr   z\b)r   z-=|!=|!|/=|--z-|==|~=|<|>|<=|>=|&&|&|~|\|\|?z$\*=|\+=|\^=|\/=|\\=|\*\*|\+\+|\.\*\*z\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\z[\[\](){}:@.,]z=|:|;z"[^"]*"z&(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?z\d+[eEf][+-]?[0-9]+z\d+z(?<=[\w)\].])\'+z(?<![\w)\].])\'r   z[a-zA-Z_]\w*r   z[^']*'z#popz0(\s*)(?:(.+)(\s*)(=)(\s*))?(.+)(\()(.*)(\))(\s*)z(\s*)([a-zA-Z_]\w*))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      sR   Y 



c               @   s  e Zd ZdZdZdgZdddg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scilabz*.sciz*.scez*.tstztext/scilabz//.*?$z^\s*functionr   ))rx  ry  r   r   r   r   r   rz  r   r   r   r{  r|  r}  r~  r  r  r  r  r  r  r  r   r   r   r   r   r   r   r   r   r   r   r!  r  r   r   r  r  r  r   z\b)r   z-|==|~=|<|>|<=|>=|&&|&|~|\|\|?z\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\z[\[\](){}@.,=:;]z"[^"]*"z(?<=[\w)\].])\'+z(?<![\w)\].])\'r   z&(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?z\d+[eEf][+-]?[0-9]+z\d+z[a-zA-Z_]\w*r   z[^']*'z#popz0(\s*)(?:(.+)(\s*)(=)(\s*))?(.+)(\()(.*)(\))(\s*)z(\s*)([a-zA-Z_]\w*))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   V  sB   





)r   r   Zpygments.lexerr   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x
6   