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
|
<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>highlight.boo</title>
<meta name="generator" content="KF5::SyntaxHighlighting - Definition (Boo) - Theme (Breeze Dark)"/>
</head><body style="background-color:#232629;color:#cfcfc2"><pre>
<span style="color:#7a7c7d">"""module docstring"""</span>
<span style="color:#3daee9">namespace</span> My.NameSpace <span style="color:#7a7c7d">#optional namespace declaration</span>
<span style="color:#3daee9">import</span> Assembly.Reference <span style="color:#7a7c7d">#import statements</span>
<span style="color:#7a7c7d">#followed by the Members of this module (classes, methods, etc.)</span>
<span style="font-weight:bold">class</span> MyClass:
<span style="color:#fdbc4b;font-weight:bold">pass</span>
<span style="font-weight:bold">def</span> domyfunction<span style="color:#3f8058">(</span>it<span style="color:#3f8058">)</span>:
<span style="color:#2980b9">print</span><span style="color:#3f8058">(</span>it<span style="color:#3f8058">)</span>
<span style="color:#7a7c7d">#start "main" section that is executed when script is run</span>
x <span style="color:#3daee9">as</span> <span style="color:#2980b9">int</span>
x <span style="color:#3f8058">=</span> <span style="color:#f67400">3</span>
domyfunction<span style="color:#3f8058">(</span>x<span style="color:#3f8058">)</span>
<span style="color:#7a7c7d">#optional assembly attribute declarations used when compiling</span>
[assembly: AssemblyTitle<span style="color:#3f8058">(</span><span style="color:#f44f4f">'foo'</span><span style="color:#3f8058">)</span>]
[assembly: AssemblyDescription<span style="color:#3f8058">(</span><span style="color:#f44f4f">'bar'</span><span style="color:#3f8058">)</span>]
<span style="color:#3daee9">import</span> MyLibrary
<span style="color:#2980b9">print</span> <span style="color:#3f8058">(</span>Version<span style="color:#3f8058">)</span>
doit<span style="color:#3f8058">()</span>
[Module]
<span style="font-weight:bold">class</span> MainClass:
<span style="font-weight:bold">public</span> <span style="font-weight:bold">static</span> Version <span style="color:#3daee9">as</span> <span style="color:#2980b9">string</span>
<span style="font-weight:bold">static</span> <span style="font-weight:bold">def</span> <span style="font-weight:bold">constructor</span><span style="color:#3f8058">()</span>:
Version <span style="color:#3f8058">=</span> <span style="color:#f44f4f">"0.1"</span>
<span style="font-weight:bold">def</span> doit<span style="color:#3f8058">()</span>:
<span style="color:#7a7c7d">#you can refer to "globals" from within your library, too:</span>
<span style="color:#2980b9">print</span><span style="color:#3f8058">(</span><span style="color:#f44f4f">"This library's version is: "</span><span style="color:#3f8058">+</span>MainClass.Version<span style="color:#3f8058">)</span>
</pre></body></html>
|