Commits

Anonymous committed 29eaf1f Draft

initial version

Comments (0)

Files changed (1)

+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Author : Florent Kaisser <florent.dev@kaisser.name>
+ Rev : Juillet 2013
+ Usage:
+ 1.  Place this file in ~/.gnome2/gtksourceview*/language-specs/opa.lang
+ 2.  Create a /usr/share/mime/packages/opa-mime.xml with this text:
+     <?xml version="1.0" encoding="UTF-8"?>
+     <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
+       <mime-type type="text/x-opa">
+         <comment>Opa programming language</comment>
+         <glob pattern="*.opa"/>
+       </mime-type>
+     </mime-info>
+ 3.  Run update-mime-database /usr/share/mime
+-->
+<language id="opa" _name="Opa" version="2.0" _section="Sources">
+
+  <metadata>
+    <property name="mimetypes">text/plain;text/x-opa</property>
+    <property name="globs">*.opa</property>
+    <property name="line-comment-start">//</property>
+    <property name="block-comment-start">/*</property>
+    <property name="block-comment-end">*/</property>
+  </metadata>
+
+  <styles>
+    <style id="error" _name="Error" map-to="def:error"/>
+    <style id="comment" _name="Comment" map-to="def:comment"/>
+    <style id="string" _name="String" map-to="def:string"/>
+    <style id="special" _name="Special Constant" map-to="def:special-constant"/>    
+    <style id="declaration" _name="Declaration" map-to="def:type"/>
+    <style id="keyword" _name="Keyword" map-to="def:keyword"/>
+    <style id="number" _name="Number" map-to="def:decimal"/>
+    <style id="type" _name="Data Type" map-to="def:type"/>
+    <style id="external" _name="External" map-to="def:preprocessor"/>
+    <style id="modifier" _name="Modifier" map-to="def:type"/>
+    <style id="opabuiltin" _name="Built In" map-to="def:builtin"/>
+    <style id="boolean" _name="Boolean value" map-to="def:builtin"/>
+    <style id="variable" _name="Variable" map-to="def:identifier"/> 
+    <style id="element-name" _name="Element name" map-to="def:identifier"/>    
+    <style id="special" _name="special" map-to="def:builtin"/>   
+    <style id="xmltag"  _name="Tag"/>   
+    <style id="operator" _name="Operator" map-to="def:operator"/>       
+  </styles>
+  
+  <definitions>
+		<context id="opa">
+		
+			<include>
+				<context id="string" style-ref="string" end-at-line-end="true">
+				  <start>"</start>
+				  <end>"</end>
+				</context>
+				      
+				<context id="character" style-ref="special" end-at-line-end="true">
+				  <start>'</start>
+				  <end>'</end>
+				</context>
+				
+				<context id="bypass" style-ref="special" end-at-line-end="true">
+				  <start>%%</start>
+				  <end>%%</end>
+				</context>				
+				            
+				<context id="line-comment" style-ref="comment" end-at-line-end="true">
+				  <start>//</start>
+				  <include>
+				    <context ref="def:in-line-comment"/>
+				  </include>
+				</context>
+
+        <context id="start-tag" style-ref="xmltag" class="no-spell-check">
+            <start>&lt;(?!/)(?!-)(?!\+)</start>
+            <end>/?&gt;</end>
+            <include>
+                <context sub-pattern="0" where="start" style-ref="element-name"/>
+                <context sub-pattern="0" where="end" style-ref="element-name"/>
+                <context ref="xml:entity"/>
+                <context ref="xml:character-reference"/>
+                <context ref="xml:unallowed-chars"/>
+                <context ref="xml:namespace"/>
+                <context ref="xml:attribute-name"/>
+                <context ref="xml:element-name"/>
+                <context ref="html_id"/>
+            </include>
+        </context>		
+        
+       <context id="end-tag" style-ref="xmltag" class="no-spell-check">
+            <start>&lt;/</start>
+            <end>&gt;</end>
+            <include>
+                <context sub-pattern="0" where="start" style-ref="element-name"/>
+                <context sub-pattern="0" where="end" style-ref="element-name"/>
+                <context ref="xml:entity"/>
+                <context ref="xml:character-reference"/>
+                <context ref="xml:unallowed-chars"/>
+                <context ref="xml:namespace"/>
+                <context ref="xml:element-name"/>
+            </include>
+        </context>        
+
+				<context id="block-comment" style-ref="comment">
+				  <start>/\*</start>
+				  <end>\*/</end>
+				  <include>
+				    <context ref="def:in-comment"/>
+				  </include>
+				</context>
+
+				<context id="close-comment-outside-comment" style-ref="error">
+				  <match>\*/(?!\*)</match>
+				</context>   
+				
+				<context id="dbpath" style-ref="special" >
+				  <match>/[a-zA-Z_][a-zA-Z0-9_/]*</match>
+				</context>
+				
+				<context id="html_id" style-ref="variable">
+      		<match>\#[a-zA-Z_][a-zA-Z0-9_]*</match>
+    		</context>
+    		
+ 				<context id="directive" style-ref="variable">
+      		<match>\@[a-zA-Z_][a-zA-Z0-9_]*</match>
+    		</context>   		
+				
+				<context id="numeric" style-ref="number">
+				  <match extended="true">
+				    (\b([0-9]+|0[xX][0-9a-fA-F]+)[Ll]?\b|\b(([0-9]+[Ee][-]?[0-9]+|([0-9]*\.[0-9]+|[0-9]+\.)([Ee][-]?[0-9]+)?)[fFdD]?|[0-9]+[FfDd]))
+				  </match>
+				</context>    
+				
+				<context id="operators" style-ref="operator" extend-parent="false">
+      		<match>[-\=\+\*\?&amp;&lt;&gt;~|]</match>
+    		</context>
+    		
+    		<context id="keyword-operators" style-ref="operator" >
+    			<keyword>not</keyword>
+          <keyword>or</keyword>
+          <keyword>and</keyword>
+				</context>
+				
+				<context id="external" style-ref="external">
+				  <keyword>import</keyword>
+				  <keyword>package</keyword>
+				</context>
+				
+				<context id="declaration" style-ref="declaration">
+					<keyword>module</keyword>
+					<keyword>function</keyword>
+					<keyword>database</keyword>
+					<keyword>type</keyword>
+					<keyword>val</keyword>
+					<keyword>var</keyword>
+					<keyword>with</keyword>		  
+				</context> 
+				
+				<context id="modifier" style-ref="modifier">
+					<keyword>abstract</keyword>
+					<keyword>private</keyword>
+					<keyword>public</keyword>
+					<keyword>server</keyword>
+					<keyword>exposed</keyword>
+					<keyword>protected</keyword>		  
+				</context>               
+
+				<context id="flow" style-ref="keyword">
+					<keyword>case</keyword>
+					<keyword>match</keyword>
+				  <keyword>else</keyword>
+					<keyword>for</keyword>
+					<keyword>if</keyword>
+					<keyword>match</keyword>
+				</context>
+				
+				<context id="boolean" style-ref="boolean">
+					<keyword>true</keyword>
+					<keyword>false</keyword>
+				</context>   
+				
+				<context id="special" style-ref="special">
+					<keyword>some</keyword>
+					<keyword>none</keyword>
+					<keyword>success</keyword>					
+					<keyword>failure</keyword>						
+				</context>   	
+				
+							 
+				
+				<context id="stdlib-general-data-type" style-ref="opabuiltin">
+					<keyword>bool</keyword>
+					<keyword>float</keyword>
+					<keyword>int</keyword>
+					<keyword>string</keyword>
+					<keyword>option</keyword>    	
+				</context> 
+				
+				<context id="stdlib-containers" style-ref="opabuiltin">
+					<keyword>list</keyword>
+					<keyword>map</keyword>
+					<keyword>set</keyword>    	
+				</context>  
+				
+				 <context id="stdlib-modules" style-ref="opabuiltin">
+					<keyword>Ansi</keyword>
+					<keyword>Binary</keyword>
+					<keyword>Bitwise</keyword>
+					<keyword>Bool</keyword>
+					<keyword>Buffer</keyword>
+					<keyword>Cactutf</keyword>
+					<keyword>Client_code</keyword>
+					<keyword>Closure</keyword>
+					<keyword>Continuation</keyword>
+					<keyword>CoreProfiler</keyword>
+					<keyword>Core_client_code</keyword>
+					<keyword>Core_server_code</keyword>
+					<keyword>Cps</keyword>
+					<keyword>Debug</keyword>
+					<keyword>Deprecated</keyword>
+					<keyword>Exception</keyword>
+					<keyword>ExecInit</keyword>
+					<keyword>FiniteSingleThreadLazy</keyword>
+					<keyword>Float</keyword>
+					<keyword>Hashtbl</keyword>
+					<keyword>Int</keyword>
+					<keyword>Int32</keyword>
+					<keyword>Int64</keyword>
+					<keyword>Itextrator</keyword>
+					<keyword>JsAst</keyword>
+					<keyword>List</keyword>
+					<keyword>LowLevelArray</keyword>
+					<keyword>Magic</keyword>
+					<keyword>Make_textralist</keyword>
+					<keyword>Math</keyword>
+					<keyword>Mutable</keyword>
+					<keyword>OpaTsc</keyword>
+					<keyword>OpaTsc_get</keyword>
+					<keyword>OpaType</keyword>
+					<keyword>OpaValue</keyword>
+					<keyword>Option</keyword>
+					<keyword>Order</keyword>
+					<keyword>Outcome</keyword>
+					<keyword>Random</keyword>
+					<keyword>Record</keyword>
+					<keyword>Reference</keyword>
+					<keyword>Server</keyword>
+					<keyword>ServerAst</keyword>
+					<keyword>ServerCode</keyword>
+					<keyword>ServerReference</keyword>
+					<keyword>String</keyword>
+					<keyword>Text</keyword>
+					<keyword>Textavl</keyword>
+					<keyword>Unicode</keyword>
+					<keyword>Void</keyword>
+				</context> 
+			</include>     
+		</context>  
+  </definitions>
+<!--    <context id="opa">
+      <include>
+        <context ref="string"/>
+        <context ref="character"/>
+        <context ref="line-comment"/>
+        <context ref="block-comment"/>
+        <context ref="close-comment-outside-comment"/>
+        <context ref="annotation"/>
+        <context ref="external"/>
+        <context ref="declaration"/>
+        <context ref="modifier"/>
+        <context ref="flow"/>
+        <context ref="special"/>
+        <context ref="numeric"/>
+        <context ref="stdlib-general-data-type"/>
+        <context ref="stdlib-containers"/>
+        <context ref="stdlib-modules"/>                
+      </include>
+    </context>
+-->    
+</language>