medit/moo/mooedit/langs/octave.lang
2009-07-03 19:06:41 -07:00

239 lines
7.9 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
Authors: Søren Hauberg, Muthiah Annamalai
Copyright (C) 2006 Søren Hauberg <soren@hauberg.org>
Copyright (C) 2006 Muthiah Annamalai <gnumuthu@users.sf.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
-->
<language id="octave" _name="Octave" version="2.0" _section="Scientific">
<metadata>
<property name="mimetypes">text/x-octave;text/x-matlab</property>
<property name="globs">*.m</property>
<property name="line-comment-start">%</property>
</metadata>
<styles>
<style id="comment" _name="Comment" map-to="def:comment"/>
<style id="floating-point" _name="Floating Point" map-to="def:floating-point"/>
<style id="string" _name="String" map-to="def:string"/>
<style id="keyword" _name="Keyword" map-to="def:keyword"/>
<style id="base-n-integer" _name="Base-N Integer" map-to="def:base-n-integer"/>
<style id="function" _name="Function" map-to="def:function"/>
<style id="decimal" _name="Decimal" map-to="def:decimal"/>
<style id="boolean" _name="Boolean" map-to="def:boolean"/>
<style id="reserved-constant" _name="Reserved Constant" map-to="def:special-constant"/>
</styles>
<definitions>
<!--
this is not yet supported by octave, but it's supported
by matlab - http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f0-41244.html#f0-45380
-->
<context id="multiline-comment" style-ref="comment">
<start>^\s*%{\s*$</start>
<end>^\s*%}\s*$</end>
<include>
<context ref="def:in-comment"/>
</include>
</context>
<context id="line-comment" style-ref="comment" end-at-line-end="true">
<start>#|%</start>
<include>
<context ref="def:in-comment"/>
</include>
</context>
<context id="double-quoted-string" style-ref="string" end-at-line-end="true">
<start>"</start>
<end>"</end>
<include>
<context ref="def:escape"/>
<context ref="def:line-continue"/>
</include>
</context>
<context id="single-quoted-string" style-ref="string" end-at-line-end="true">
<!--
To do not misdetect the transpose operator ' as the start of a string
we assert to not follow a variable name (letters, digits and underscores)
or a closing bracket (round, square or curly) or a dot (to form the
array transpose operator ".'" ). -->
<start>(?&lt;![0-9a-zA-Z_)\]}\.])'</start>
<end>'</end>
<include>
<context style-ref="def:special-char">
<match>''</match>
</context>
<context ref="def:line-continue"/>
</include>
</context>
<context id="boolean" style-ref="boolean">
<keyword>false</keyword>
<keyword>true</keyword>
</context>
<context id="reserved-constant" style-ref="reserved-constant">
<keyword>pi</keyword>
<keyword>eps</keyword>
<keyword>Inf</keyword>
<keyword>inf</keyword>
<keyword>NaN</keyword>
<keyword>nan</keyword>
<keyword>NA</keyword>
</context>
<context id="keyword" style-ref="keyword">
<keyword>assert</keyword>
<keyword>break</keyword>
<keyword>case</keyword>
<keyword>catch</keyword>
<keyword>continue</keyword>
<keyword>do</keyword>
<keyword>elseif</keyword>
<keyword>else</keyword>
<keyword>endfor</keyword>
<keyword>endfunction</keyword>
<keyword>endif</keyword>
<keyword>end</keyword>
<keyword>endswitch</keyword>
<keyword>end_try_catch</keyword>
<keyword>end_unwind_protect</keyword>
<keyword>endwhile</keyword>
<keyword>for</keyword>
<keyword>function</keyword>
<keyword>global</keyword>
<keyword>if</keyword>
<keyword>nargin</keyword>
<keyword>nargout</keyword>
<keyword>otherwise</keyword>
<keyword>return</keyword>
<keyword>switch</keyword>
<keyword>try</keyword>
<keyword>until</keyword>
<keyword>unwind_protect_cleanup</keyword>
<keyword>unwind_protect</keyword>
<keyword>while</keyword>
</context>
<context id="decimal" style-ref="decimal">
<match>\b([1-9][0-9]*|0)([Uu]([Ll]|LL|ll)?|([Ll]|LL|ll)[Uu]?)?\b</match>
</context>
<context id="floating-point-number" style-ref="floating-point">
<match>\b([0-9]+[Ee][-]?[0-9]+|([0-9]*\.[0-9]+|[0-9]+\.)([Ee][-]?[0-9]+)?)[fFlL]?</match>
</context>
<context id="octal-number" style-ref="base-n-integer">
<match>\b0[0-7]+([Uu]([Ll]|LL|ll)?|([Ll]|LL|ll)[Uu]?)?\b</match>
</context>
<context id="hex-number" style-ref="base-n-integer">
<match>\b0[xX][0-9a-fA-F]+([Uu]([Ll]|LL|ll)?|([Ll]|LL|ll)[Uu]?)?\b</match>
</context>
<context id="function" style-ref="function">
<keyword>abs</keyword>
<keyword>acos</keyword>
<keyword>asin</keyword>
<keyword>atan2</keyword>
<keyword>atan</keyword>
<keyword>ceil</keyword>
<keyword>columns</keyword>
<keyword>conv</keyword>
<keyword>cosh</keyword>
<keyword>cos</keyword>
<keyword>cumprod</keyword>
<keyword>dims</keyword>
<keyword>error</keyword>
<keyword>fclose</keyword>
<keyword>floor</keyword>
<keyword>fopen</keyword>
<keyword>fprintf</keyword>
<keyword>fread</keyword>
<keyword>fsolve</keyword>
<keyword>imag</keyword>
<keyword>isempty</keyword>
<keyword>isinf</keyword>
<keyword>islogical</keyword>
<keyword>ismatrix</keyword>
<keyword>isnan</keyword>
<keyword>isna</keyword>
<keyword>isnumeric</keyword>
<keyword>isscalar</keyword>
<keyword>isstr</keyword>
<keyword>isvector</keyword>
<keyword>length</keyword>
<keyword>linspace</keyword>
<keyword>log10</keyword>
<keyword>log2</keyword>
<keyword>log</keyword>
<keyword>max</keyword>
<keyword>min</keyword>
<keyword>ones</keyword>
<keyword>printf</keyword>
<keyword>prod</keyword>
<keyword>real</keyword>
<keyword>rem</keyword>
<keyword>repmat</keyword>
<keyword>reshape</keyword>
<keyword>round</keyword>
<keyword>rows</keyword>
<keyword>setstr</keyword>
<keyword>sinh</keyword>
<keyword>sin</keyword>
<keyword>size</keyword>
<keyword>sort</keyword>
<keyword>sprintf</keyword>
<keyword>sqrt</keyword>
<keyword>strcat</keyword>
<keyword>strcmp</keyword>
<keyword>sum</keyword>
<keyword>system</keyword>
<keyword>tanh</keyword>
<keyword>tan</keyword>
<keyword>unlink</keyword>
<keyword>usage</keyword>
<keyword>varargin</keyword>
<keyword>varargout</keyword>
<keyword>warning</keyword>
<keyword>zeros</keyword>
</context>
<context id="octave">
<include>
<context ref="multiline-comment"/>
<context ref="line-comment"/>
<context ref="double-quoted-string"/>
<context ref="single-quoted-string"/>
<context ref="boolean"/>
<context ref="reserved-constant"/>
<context ref="keyword"/>
<context ref="decimal"/>
<context ref="floating-point-number"/>
<context ref="octal-number"/>
<context ref="hex-number"/>
<context ref="function"/>
</include>
</context>
</definitions>
</language>