%PDF- %PDF-
Direktori : /usr/share/gtksourceview-5/language-specs/ |
Current File : //usr/share/gtksourceview-5/language-specs/wren.lang |
<?xml version="1.0" encoding="UTF-8"?> <!-- vim: tabstop=2 shiftwidth=2 wren.lang basic syntax highlighting of Wren for GtkSourceView Copyright (C) 2024 Chance Snow <git@chancesnow.me> This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This program 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, see <http://www.gnu.org/licenses/>. --> <language id="wren" name="Wren" _section="Script" version="2.0"> <metadata> <property name="mimetypes">application/x-wren</property> <property name="globs">*.wren;</property> <property name="line-comment-start">//</property> <property name="block-comment-start">/*</property> <property name="block-comment-start">*/</property> </metadata> <styles> <style id="comment" name="Comment" map-to="def:comment"/> <style id="string" name="String" map-to="def:string"/> <style id="imported-module" name="Imported Module" map-to="def:string"/> <style id="keyword" name="Keyword" map-to="def:keyword"/> <style id="operator" name="Operator" map-to="def:operator"/> <style id="type" name="Data Type" map-to="def:type"/> <style id="escaped-character" name="Escaped Character" map-to="def:special-char"/> <style id="floating-point" name="Floating point number" map-to="def:floating-point"/> <style id="decimal" name="Decimal number" map-to="def:decimal"/> <style id="octal" name="Octal number" map-to="def:base-n-integer"/> <style id="hexadecimal" name="Hexadecimal number" map-to="def:base-n-integer"/> <style id="boolean" name="Boolean value" map-to="def:boolean"/> <style id="error" name="Error" map-to="def:error"/> </styles> <definitions> <!--regexs--> <define-regex id="escaped-character" extended="true"> \\( # leading backslash [\\\"\'nrbtfav\?] | # escaped character [0-7]{1,3} | # one, two, or three octal digits x[0-9A-Fa-f]+ # 'x' followed by hex digits ) </define-regex> <!--contexts used on the main context--> <!-- Module Import --> <context id="import"> <match extended="true"> (import)\s* (".*?")\s+ (for)\s+ </match> <!-- TODO: Something fancy, like detecting "error"s in malformed class identifiers? --> <!-- TODO: Add `((\s+(as)\s+)?` for import aliases --> <include> <context id="keyword" sub-pattern="1" style-ref="keyword" class="keyword"/> <context id="imported-module" sub-pattern="2" style-ref="imported-module" class="path"/> <context id="keyword" sub-pattern="3" style-ref="keyword" class="keyword"/> </include> </context> <context id="string" style-ref="string" end-at-line-end="true" class="string" class-disabled="no-spell-check"> <start>L?"</start> <end>"</end> <include> <context id="escaped-character" style-ref="escaped-character"> <match>\%{escaped-character}</match> </context> <context ref="def:line-continue"/> </include> </context> <!-- http://www.lysator.liu.se/c/ANSI-C-grammar-l.html --> <context id="float" style-ref="floating-point"> <match extended="true"> (?<![\w\.]) ((\.[0-9]+ | [0-9]+\.[0-9]*) ([Ee][+-]?[0-9]*)? | ([0-9]+[Ee][+-]?[0-9]*)) [fFlL]? (?![\w\.]) </match> </context> <context id="hexadecimal" style-ref="hexadecimal"> <match extended="true"> (?<![\w\.]) 0[xX][a-fA-F0-9]+[uUlL]* (?![\w\.]) </match> </context> <context id="invalid-hexadecimal" style-ref="error"> <match extended="true"> (?<![\w\.]) 0[xX][a-fA-F0-9]*[g-zG-Z][a-zA-Z0-9]*[uUlL]* (?![\w\.]) </match> </context> <context id="octal" style-ref="octal"> <match extended="true"> (?<![\w\.]) 0[0-7]+[uUlL]* (?![\w\.]) </match> </context> <context id="invalid-octal" style-ref="error"> <match extended="true"> (?<![\w\.]) 0[0-7]*[89][0-9]*[uUlL]* (?![\w\.]) </match> </context> <context id="decimal" style-ref="decimal"> <match extended="true"> (?<![\w\.]) (0|[1-9][0-9]*)[uUlL]* (?![\w\.]) </match> </context> <!-- https://wren.io/syntax.html --> <context id="keywords" style-ref="keyword"> <keyword>as</keyword> <keyword>break</keyword> <keyword>class</keyword> <keyword>construct</keyword> <keyword>continue</keyword> <keyword>else</keyword> <keyword>false</keyword> <keyword>for</keyword> <keyword>foreign</keyword> <keyword>if</keyword> <keyword>import</keyword> <keyword>in</keyword> <keyword>is</keyword> <keyword>null</keyword> <keyword>return</keyword> <keyword>static</keyword> <keyword>super</keyword> <keyword>this</keyword> <keyword>true</keyword> <keyword>var</keyword> <keyword>while</keyword> </context> <context id="operators" style-ref="operator"> <keyword>in</keyword> <keyword>is</keyword> </context> <!-- https://wren.io/modules --> <context id="types" style-ref="type"> <!-- Core classes --> <keyword>Bool</keyword> <keyword>Class</keyword> <keyword>Fiber</keyword> <keyword>Fn</keyword> <keyword>List</keyword> <keyword>Map</keyword> <keyword>Null</keyword> <keyword>Num</keyword> <keyword>Object</keyword> <keyword>Range</keyword> <keyword>Sequence</keyword> <keyword>String</keyword> <keyword>System</keyword> <!-- meta module (https://wren.io/modules/meta) --> <keyword>Meta</keyword> <!-- random module (https://wren.io/modules/random) --> <keyword>Random</keyword> </context> <context id="custom-type" style-ref="type"> <!-- User-defined class --> <match extended="true"> \b (?!(Bool|Class|Fiber|Fn|List|Map|Null|Num|Object|Range|Sequence|String|System|Meta|Random)) ([A-Z][A-Za-z]*) \b </match> </context> <context id="boolean" style-ref="boolean"> <keyword>true</keyword> <keyword>false</keyword> </context> <!-- Main context --> <context id="wren" class="no-spell-check"> <include> <context ref="gtk-doc:inline-docs-section"/> <context ref="def:c-like-comment" style-ref="comment"/> <context ref="def:c-like-comment-multiline" style-ref="comment"/> <context ref="def:c-like-close-comment-outside-comment" style-ref="comment"/> <context ref="import"/> <context ref="string"/> <context ref="float"/> <context ref="hexadecimal"/> <context ref="invalid-hexadecimal"/> <context ref="octal"/> <context ref="invalid-octal"/> <context ref="decimal"/> <context ref="keywords"/> <context ref="boolean"/> <context ref="operators"/> <context ref="types"/> <context ref="custom-type"/> </include> </context> </definitions> </language>