Debian Codegraph @

examples/prism-parser.html

raw symbols SCIP
1 <h2>Comments</h2>
2 <pre><code>$foo[bar] # Some comment</code></pre>
3
4 <h2>Variables and functions</h2>
5 <pre><code>@navigation[]
6 $sections[^table::load[sections.cfg]]
7 $sections.uri</code></pre>
8
9 <h2>Literals</h2>
10 <pre><code>$foo(3+$bar)
11 ^switch[$sMode]{
12 ^case[def]{$result(true)}
13 }
14 ^if(in "/news/"){}</code></pre>
15
16 <h2>Escape sequences</h2>
17 <pre><code>^^
18 ^"
19 ^;</code></pre>
20
21 <h2>Embedded in markup</h2>
22 <pre><code>&lt;nav>
23 &lt;ul>
24 ^sections.menu{
25 &lt;li>
26 &lt;a href="$sections.uri">$sections.name&lt;/a>
27 &lt;/li>
28 }
29 &lt;/ul>
30 &lt;/nav></code></pre>
31
32 <h2>Full example</h2>
33 <pre><code>@CLASS
34 MyTable
35
36 @create[uParam]
37 ^switch[$uParam.CLASS_NAME]{
38 ^case[string;void]{$t[^table::create{$uParam}]}
39 ^case[table;MyTable]{$t[^table::create[$uParam]]}
40 ^case[DEFAULT]{^throw[MyTable;Unsupported type $uParam.CLASS_NAME]}
41 }
42
43 # method will return value in different calling contexts
44 @GET[sMode]
45 ^switch[$sMode]{
46 ^case[table]{$result[$t]}
47 ^case[bool]{$result($t!=0)}
48 ^case[def]{$result(true)}
49 ^case[expression;double]{$result($t)}
50 ^case[DEFAULT]{^throw[MyTable;Unsupported mode '$sMode']}
51 }
52
53
54 # method will handle access to the "columns"
55 @GET_DEFAULT[sName]
56 $result[$t.$sName]
57
58
59 # wrappers for all existing methods are required
60 @count[]
61 ^t.count[]
62
63 @menu[jCode;sSeparator]
64 ^t.menu{$jCode}[$sSeparator]
65
66
67 # new functionality
68 @remove[iOffset;iLimit]
69 $iLimit(^iLimit.int(0))
70 $t[^t.select(^t.offset[]&lt;$iOffset || ^t.offset[]>=$iOffset+$iLimit)]</code></pre>