1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
|
<?xml version="1.0" encoding="UTF-8"?>
<!--
The Why3 Verification Platform / The Why3 Development Team
Copyright 2010-2013 - INRIA - CNRS - Paris-Sud University
This software is distributed under the terms of the GNU Lesser
General Public License version 2.1, with the special exception
on linking described in file LICENSE.
-->
<!--
This file was based on ocaml.lang by
Copyright (C) 2007 Eric Cooper <ecc@cmu.edu>
Copyright (C) 2007 Eric Norige <thelema314@gmail.com>
-->
<language id="why3" _name="Why3" version="2.0" _section="Sources">
<metadata>
<property name="mimetypes">text/x-why3</property>
<property name="globs">*.mlw;*.why</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="base-n-integer" _name="Base-N Integer" map-to="def:base-n-integer"/>
<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="string" _name="String" map-to="def:string"/>
<style id="keyword" _name="Keyword" map-to="def:keyword"/>
<style id="meta-keyword" _name="Type, module or object keyword" map-to="def:keyword"/>
<style id="fun-keyword" _name="Builtin-function keyword" map-to="def:keyword"/>
<style id="type" _name="Data Type" map-to="def:type"/>
<style id="label" _name="Labeled argument" map-to="def:type"/>
<!--
<style id="poly-variant" _name="Polymorphic Variant" map-to="def:type"/>
-->
<style id="variant" _name="Variant Constructor" map-to="def:type"/>
<style id="type-var" _name="Type Variable" map-to="def:type"/>
<style id="module" _name="Module Path" map-to="def:type"/>
<style id="escape" _name="Escaped Character" map-to="def:special-char"/>
<style id="boolean" _name="Boolean value" map-to="def:boolean"/>
<style id="spec-keyword" _name="Specification keyword" map-to="def:shebang"/>
<style id="error" _name="Error" map-to="def:error"/>
</styles>
<definitions>
<define-regex id="cap-ident">\b[A-Z][A-Za-z0-9_']*</define-regex>
<define-regex id="low-ident">\b[a-z][A-Za-z0-9_']*</define-regex>
<define-regex id="char-esc">\\((\\|"|'|n|t|b|r)|[0-9]{3}|x[0-9a-fA-F]{2})</define-regex>
<!-- " -->
<context id="escape-seq" style-ref="escape">
<match>\%{char-esc}</match>
</context>
<!-- here's the main context -->
<context id="why3">
<include>
<context id="symbol-star">
<match>\(\*\)</match>
</context>
<context id="comment" style-ref="comment">
<start>\(\*</start>
<end>\*\)</end>
<include>
<context ref="symbol-star"/>
<context id="comment-in-comment" style-ref="comment">
<start>\(\*</start>
<end>\*\)</end>
<include>
<context ref="string"/>
<context ref="symbol-star"/>
<context ref="comment-in-comment"/>
<context ref="def:in-comment:*"/>
</include>
</context>
<context ref="string"/>
<context ref="def:in-comment:*"/>
</include>
</context>
<context id="decimal" style-ref="decimal">
<match>[-]?[0-9][0-9_]*[lLn]?</match>
</context>
<context id="hex-number" style-ref="base-n-integer">
<match>[-]?0[xX][0-9A-Fa-f][0-9A-Fa-f_]*[lL]?</match>
</context>
<context id="octal-number" style-ref="base-n-integer">
<match>[-]?0[oO][0-7][0-7_]*[lL]?</match>
</context>
<context id="binary-number" style-ref="base-n-integer">
<match>[-]?0[bB][01][01_]*[lL]?</match>
</context>
<context id="floating-point-number" style-ref="floating-point">
<match>[-]?[0-9][0-9_]*(\.[0-9_]*)?([Ee][+-]?[0-9][0-9_]*)?</match>
</context>
<context id="attributes" style-ref="string">
<start>\[\@</start>
<end>\]</end>
</context>
<!--
<context id="label" style-ref="label">
<match>[~?]\%{low-ident}</match>
</context>
<context id="poly-variant" style-ref="poly-variant">
<match>`\%{cap-ident}</match>
</context>
-->
<context id="modpath" style-ref="module">
<!-- include final '.'? At the moment, no. -->
<match>\%{cap-ident}(\.\%{cap-ident})*(?=\.)</match>
</context>
<context id="variant" style-ref="variant">
<match>\%{cap-ident}</match>
</context>
<context id="string" style-ref="string">
<start>"</start>
<end>"</end>
<include>
<context ref="escape-seq"/>
</include>
</context>
<!--
<context id="character-constant" style-ref="string">
<match>('\%{char-esc}')|('[^\\']')</match>
</context>
-->
<context id="type-var" style-ref="type-var">
<match>'\%{low-ident}</match>
</context>
<context id="recordlit">
<start>\{</start>
<end>\}</end>
<include>
<context ref="why3"/>
</include>
</context>
<context id="badrecord" style-ref="error" extend-parent="false">
<match>}</match>
</context>
<!--
<context id="arraylit">
<start>\[\|</start>
<end>\|\]</end>
<include>
<context ref="why3"/>
</include>
</context>
<context id="badarray" style-ref="error" extend-parent="false">
<match>\|\]</match>
</context>
<context id="listlit">
<start>\[</start>
<end>(?<!\|)\]</end>
<include>
<context ref="why3"/>
</include>
</context>
<context id="badlist" style-ref="error" extend-parent="false">
<match>\]</match>
</context>
-->
<context id="keywords" style-ref="meta-keyword">
<keyword>abstract</keyword>
<keyword>as</keyword>
<keyword>axiom</keyword>
<keyword>clone</keyword>
<keyword>coinductive</keyword>
<keyword>constant</keyword>
<keyword>end</keyword>
<keyword>exception</keyword>
<keyword>export</keyword>
<keyword>function</keyword>
<keyword>goal</keyword>
<keyword>ghost</keyword>
<keyword>import</keyword>
<keyword>inductive</keyword>
<keyword>lemma</keyword>
<keyword>meta</keyword>
<keyword>mutable</keyword>
<keyword>module</keyword>
<keyword>predicate</keyword>
<keyword>private</keyword>
<keyword>scope</keyword>
<keyword>theory</keyword>
<keyword>type</keyword>
<keyword>use</keyword>
<keyword>val</keyword>
<keyword>with</keyword>
</context>
<context id="meta-words" style-ref="keyword">
<keyword>any</keyword>
<keyword>begin</keyword>
<keyword>break</keyword>
<keyword>by</keyword>
<keyword>continue</keyword>
<keyword>do</keyword>
<keyword>done</keyword>
<keyword>downto</keyword>
<keyword>else</keyword>
<keyword>exists</keyword>
<keyword>for</keyword>
<keyword>forall</keyword>
<keyword>fun</keyword>
<keyword>if</keyword>
<keyword>in</keyword>
<keyword>label</keyword>
<keyword>let</keyword>
<keyword>loop</keyword>
<keyword>match</keyword>
<keyword>not</keyword>
<keyword>raise</keyword>
<keyword>rec</keyword>
<keyword>return</keyword>
<keyword>so</keyword>
<keyword>then</keyword>
<keyword>to</keyword>
<keyword>try</keyword>
<keyword>while</keyword>
<keyword>-></keyword>
</context>
<context id="spec" style-ref="spec-keyword">
<keyword>absurd</keyword>
<keyword>alias</keyword>
<keyword>assert</keyword>
<keyword>assume</keyword>
<keyword>at</keyword>
<keyword>diverges</keyword>
<keyword>ensures</keyword>
<keyword>check</keyword>
<keyword>invariant</keyword>
<keyword>old</keyword>
<keyword>pure</keyword>
<keyword>raises</keyword>
<keyword>reads</keyword>
<keyword>requires</keyword>
<keyword>returns</keyword>
<keyword>variant</keyword>
<keyword>writes</keyword>
</context>
<context id="bool-const" style-ref="boolean">
<keyword>true</keyword>
<keyword>false</keyword>
</context>
<context id="types" style-ref="type">
<keyword>array</keyword>
<keyword>bool</keyword>
<keyword>int</keyword>
<keyword>list</keyword>
<keyword>map</keyword>
<keyword>option</keyword>
<keyword>real</keyword>
<keyword>ref</keyword>
<keyword>unit</keyword>
</context>
<context id="var">
<match>\%{low-ident}</match>
</context>
</include>
</context>
</definitions>
</language>
|