Skip to content

Instantly share code, notes, and snippets.

@torao
Created February 20, 2021 10:23
Show Gist options
  • Save torao/f30a65f71f5738596b6505ecd73a4f85 to your computer and use it in GitHub Desktop.
Save torao/f30a65f71f5738596b6505ecd73a4f85 to your computer and use it in GitHub Desktop.
TLA+ syntax hi-light extension for Prism.js
/* USAGE: Declare the following script after prism.js and specify language-tlsplus.
<script src="prism.js"></script>
<script>Prism.languages.tlaplus={...}</script>
<pre><code class="language-tlsplus">...</code></pre>
*/
Prism.languages.tlaplus={comment:[{pattern:/\(\*[\s\S]*?(?:\*\)|$)/,lookbehind:!0,greedy:!0},{pattern:/\\\*.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},keyword:/\b(?:ACTION|ASSUME|ASSUMPTION|AXIOM|BOOLEAN|BY|CASE|CHOOSE|CONSTANT|CONSTANTS|COROLLARY|DEF|DEFINE|DEFS|DOMAIN|ELSE|ENABLED|EXCEPT|EXTENDS|HAVE|HIDE|IF|IN|INSTANCE|LAMBDA|LEMMA|LET|LOCAL|MODULE|NEW|OBVIOUS|OMITTED|ONLY|OTHER|PICK|PROOF|PROPOSITION|PROVE|QED|RECURSIVE|STATE|STRING|SUBSET|SUFFICES|TAKE|TEMPORAL|THEN|THEOREM|UNCHANGED|UNION|USE|VARIABLE|VARIABLES|WITH|WITNESS)\b/,boolean:/\b(?:TRUE|FALSE)\b/,number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,prolog:/(====+|----+)/,rule:{pattern:/\b\w+(\(.*?\)|\[.*?\])?\s*==/,inside:{atrule:/\b\w+(\(.*?\)|\[.*?\])?/}},symbol:/\b\w+'/};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment