Created
August 8, 2011 08:23
-
-
Save garrett/1131410 to your computer and use it in GitHub Desktop.
Quick patch to make gedit's coffeescript language support recognize one-line block comments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- | |
Author: Marc Harter <[email protected]> | |
Copyright (C) 2004 Marc Harter <[email protected]> | |
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="coffee" _name="CoffeeScript" version="2.0" _section="Scripts"> | |
<metadata> | |
<property name="mimetypes">application/coffeescript;text/coffeescript;application/cakefile;text/cakefile;</property> | |
<property name="globs">*.coffee;*.Cakefile</property> | |
<property name="line-comment-start">#</property> | |
<property name="block-comment-start">###</property> | |
<property name="block-comment-end">###</property> | |
</metadata> | |
<styles> | |
<style id="comment" _name="Comment" map-to="def:comment"/> | |
<style id="error" _name="Error" map-to="def:error"/> | |
<style id="string" _name="String" map-to="def:string"/> | |
<style id="global" _name="Global Value" map-to="def:special-constant"/> | |
<style id="constant" _name="Constant" map-to="def:special-constant"/> | |
<style id="boolean" _name="Boolean value" map-to="def:boolean"/> | |
<style id="statement" _name="Statement" map-to="def:statement"/> | |
<style id="loop" _name="Loop" map-to="def:keyword"/> | |
<style id="conditional" _name="Conditional" map-to="def:keyword"/> | |
<style id="exception" _name="Exception" map-to="def:error"/> | |
<style id="operator" _name="Operator" map-to="def:keyword"/> | |
<style id="keyword" _name="Keyword" map-to="def:keyword"/> | |
<style id="assessor" _name="Assessor" map-to="def:identifier"/> | |
<style id="regexp" _name="RegExp" map-to="def:special-char"/> | |
<style id="function" _name="Function" map-to="def:function"/> | |
<style id="application" _name="Application" map-to="def:identifier"/> | |
<style id="constructors" _name="Constructors" map-to="def:type"/> | |
</styles> | |
<definitions> | |
<context id="coffee"> | |
<include> | |
<!-- Comments --> | |
<context id="block-comment" style-ref="comment"> | |
<start>^[ \t]*###([^#]|$)</start> | |
<end>###</end> | |
<include> | |
<context ref="def:in-comment"/> | |
</include> | |
</context> | |
<context id="line-comment" style-ref="comment"> | |
<start>#</start> | |
<end>$</end> | |
<include> | |
<context ref="def:line-continue"/> | |
<context ref="def:in-comment"/> | |
</include> | |
</context> | |
<!-- Regexps --> | |
<context id="regexp" style-ref="regexp"> | |
<match>(?<!\d)\s*/(?![\s/*+{}?]).*/[igmy]*</match> | |
</context> | |
<context id="heregex" style-ref="regexp"> | |
<start>\/\/\/</start> | |
<end>\/\/\/</end> | |
<include> | |
<context ref="def:line-continue"/> | |
<context ref="line-comment"/> | |
</include> | |
</context> | |
<!-- Strings --> | |
<context id="string-heredocs-single" style-ref="string"> | |
<start>'''</start> | |
<end>'''</end> | |
<include> | |
<context ref="def:line-continue"/> | |
<context ref="def:escape"/> | |
</include> | |
</context> | |
<context id="string-heredocs-double" style-ref="string"> | |
<start>"""</start> | |
<end>"""</end> | |
<include> | |
<context ref="def:line-continue"/> | |
<context ref="def:escape"/> | |
<context id="interpolation-heredocs-double" style-ref="assessor" extend-parent="false"> | |
<match>\#{[^}]+}</match> | |
</context> | |
</include> | |
</context> | |
<context id="string-double" style-ref="string"> | |
<start>"</start> | |
<end>"</end> | |
<include> | |
<context id="interpolation-string-double" style-ref="assessor" extend-parent="false"> | |
<match>\#{[^}]+}</match> | |
</context> | |
<context ref="def:line-continue"/> | |
<context ref="def:escape"/> | |
</include> | |
</context> | |
<context id="string-single" style-ref="string"> | |
<start>'</start> | |
<end>'</end> | |
<include> | |
<context ref="def:line-continue"/> | |
<context ref="def:escape"/> | |
</include> | |
</context> | |
<context id="string-javascript" style-ref="string"> | |
<start>`</start> | |
<end>`</end> | |
<include> | |
<context ref="def:line-continue"/> | |
<context ref="def:escape"/> | |
</include> | |
</context> | |
<!-- Numbers --> | |
<context ref="def:float"/> | |
<context ref="def:decimal"/> | |
<context ref="def:octal"/> | |
<context ref="def:hexadecimal"/> | |
<!-- Constants --> | |
<context id="global" style-ref="global"> | |
<keyword>undefined</keyword> | |
<keyword>null</keyword> | |
</context> | |
<context id="constant" style-ref="constant"> | |
<match>\b[A-Z0-9_]+\b</match> | |
</context> | |
<context id="boolean" style-ref="boolean"> | |
<keyword>false</keyword> | |
<keyword>true</keyword> | |
<keyword>yes</keyword> | |
<keyword>no</keyword> | |
<keyword>on</keyword> | |
<keyword>off</keyword> | |
</context> | |
<define-regex id="statement-keyword" extended="true"> | |
\b(return|break|continue|throw)\b | |
</define-regex> | |
<define-regex id="loop-keyword" extended="true"> | |
\b(for(\s+own)?|while|until|loop)\b | |
</define-regex> | |
<define-regex id="conditional-keyword" extended="true"> | |
\b(if|else|unless|switch|when|then|and|or|in|of|by|is|isnt| | |
not)\b | |
</define-regex> | |
<define-regex id="keywords-keyword" extended="true"> | |
\b(instanceof|typeof|delete|new|where|class|extends|super| | |
try|catch|finally)\b | |
</define-regex> | |
<define-regex id="operator-regex" extended="true"> | |
(-[\-=>]?|\+[+=]?|[*&|\/%=<>^~:!?]+) | |
</define-regex> | |
<define-regex id="novalue-keywords" extended="true"> | |
\%{statement-keyword}| | |
\%{loop-keyword}| | |
\%{conditional-keyword}| | |
\%{keywords-keyword} | |
</define-regex> | |
<context id="statement" style-ref="statement"> | |
<match>\%{statement-keyword}</match> | |
</context> | |
<context id="loop" style-ref="loop"> | |
<match>\%{loop-keyword}</match> | |
</context> | |
<context id="conditional" style-ref="conditional"> | |
<match>\%{conditional-keyword}</match> | |
</context> | |
<context id="operator" style-ref="operator"> | |
<match>\%{operator-regex}([ \t]*)</match> | |
</context> | |
<!-- Keywords --> | |
<context id="keywords" style-ref="keyword"> | |
<match>\%{keywords-keyword}</match> | |
</context> | |
<context id="exception" style-ref="exception"> | |
<keyword>try</keyword> | |
<keyword>catch</keyword> | |
<keyword>finally</keyword> | |
</context> | |
<context id="assessor" style-ref="assessor"> | |
<match>(@([a-zA-Z\$_](\w|\$)*)|this)</match> | |
</context> | |
<context id="functions" style-ref="function"> | |
<keyword>\b\w+\b(?=\s*(=|:)\s*(\([\w,\s]*\))?\s*(-\>|=\>))</keyword> | |
</context> | |
<context id="constructors" style-ref="constructors"> | |
<match>\b[A-Z][A-Za-z0-9_]+\b(?!\.)</match> | |
</context> | |
<context id="application" style-ref="application"> | |
<match extended="true"> | |
\b @? [A-Za-z0-9_]+ ( | |
(?= [(]) | | |
\s+ ( | |
(?= =>) | | |
(?=\S)(?! | |
\%{novalue-keywords} | [\])}=:,#] | | |
[-+*/]= | \%{operator-regex}\s ) | |
) | |
) | |
</match> | |
</context> | |
</include> | |
</context> | |
</definitions> | |
</language> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/coffee_script.lang b/coffee_script.lang | |
index 92edd49..b351e02 100644 | |
--- a/coffee_script.lang | |
+++ b/coffee_script.lang | |
@@ -56,7 +56,7 @@ | |
<!-- Comments --> | |
<context id="block-comment" style-ref="comment"> | |
<start>^[ \t]*###([^#]|$)</start> | |
- <end>^.*###([^#]|$)</end> | |
+ <end>###</end> | |
<include> | |
<context ref="def:in-comment"/> | |
</include> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment