Debian Codegraph @

examples/prism-javascript.html

raw symbols SCIP
1 <h2>Variable assignment</h2>
2 <pre><code>var foo = "bar", baz = 5;</code></pre>
3
4 <h2>Operators</h2>
5 <pre><code>(1 + 2 * 3)/4 >= 3 &amp;&amp; 4 &lt; 5 || 6 > 7</code></pre>
6
7 <h2>Indented code</h2>
8 <pre><code>if (true) {
9 while (true) {
10 doSomething();
11 }
12 }</code></pre>
13
14 <h2>Regex with slashes</h2>
15 <pre><code>var foo = /([^/])\/(\\?.|\[.+?])+?\/[gim]{0,3}/g;</code></pre>
16
17 <h2>Regex that ends with double slash</h2>
18 <pre><code>var bar = /\/\*[\w\W]*?\*\//g;</code></pre>
19
20 <h2>Single line comments &amp; regexes</h2>
21 <pre><code>// http://lea.verou.me
22 var comment = /\/\*[\w\W]*?\*\//g;</code></pre>
23
24 <h2>Link in comment</h2>
25 <pre><code>// http://lea.verou.me
26 /* http://lea.verou.me */</code></pre>
27
28 <h2>Nested strings</h2>
29 <pre><code>var foo = "foo", bar = "He \"said\" 'hi'!"</code></pre>
30
31 <h2>Strings inside comments</h2>
32 <pre><code>// "foo"
33 /* "foo" */</code></pre>
34
35 <h2>Strings with slashes</h2>
36 <pre><code>env.content + '&lt;/' + env.tag + '>'
37 var foo = "/" + "/";
38 var foo = "http://prismjs.com"; // Strings are strings and comments are comments ;)</code></pre>
39
40 <h2>Regex inside single line comment</h2>
41 <pre><code>// hey, /this doesn’t fail!/ :D</code></pre>
42
43 <h2>Two or more division operators on the same line</h2>
44 <pre><code>var foo = 5 / 6 / 7;</code></pre>
45
46 <h2>A division operator on the same line as a regex</h2>
47 <pre><code>var foo = 1/2, bar = /a/g;
48 var foo = /a/, bar = 3/4;</code></pre>
49
50 <h2>ES6 features</h2>
51 <pre><code>// Regex "y" and "u" flags
52 var a = /[a-zA-Z]+/gimyu;
53
54 // for..of loops
55 for(let x of y) { }
56
57 // Modules: import
58 import { foo as bar } from "file.js"
59
60 // Template strings
61 `Only on ${y} one line`
62 `This template string ${x} is on
63
64 multiple lines.`
65 `40 + 2 = ${ 40 + 2 }`
66 `The squares of the first 3 natural integers are ${[for (x of [1,2,3]) x*x].join(', ')}`</code></pre>