mirror of
https://gitlab.com/JKANetwork/CheckServer.git
synced 2026-12-06 01:38:19 +01:00
Start again
This commit is contained in:
1 parent
c0d3912413
commit
091f119048
4382 files changed
+1762543
-9606
No files matched your search
+26
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "google-code-prettify",
|
||||
"version": "1.0.4",
|
||||
"main": [
|
||||
"./bin/prettify.min.css",
|
||||
"./bin/prettify.min.js"
|
||||
],
|
||||
"dependencies": {},
|
||||
"ignore": [
|
||||
"closure-compiler",
|
||||
"js-modules",
|
||||
"tests",
|
||||
"yui-compressor",
|
||||
"Makefile"
|
||||
],
|
||||
"homepage": "https://github.com/tcollard/google-code-prettify",
|
||||
"_release": "1.0.4",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.4",
|
||||
"commit": "80478ff92dec68d56498bad7451546d11c15e541"
|
||||
},
|
||||
"_source": "https://github.com/tcollard/google-code-prettify.git",
|
||||
"_target": "~1.0.4",
|
||||
"_originalSource": "google-code-prettify"
|
||||
}
|
||||
+172
@@ -0,0 +1,172 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Change Log</title>
|
||||
</head>
|
||||
<body bgcolor="white">
|
||||
<a style="float:right" href="README.html">README</a>
|
||||
|
||||
<h1>Known Issues</h1>
|
||||
<ul>
|
||||
<li>Perl formatting is really crappy. Partly because the author is lazy and
|
||||
partly because Perl is
|
||||
<a href="http://www.perlmonks.org/?node_id=663393">hard</a> to parse.
|
||||
<li>On some browsers, <code><code></code> elements with newlines in the text
|
||||
which use CSS to specify <code>white-space:pre</code> will have the newlines
|
||||
improperly stripped if the element is not attached to the document at the time
|
||||
the stripping is done. Also, on IE 6, all newlines will be stripped from
|
||||
<code><code></code> elements because of the way IE6 produces
|
||||
<code>innerHTML</code>. Workaround: use <code><pre></code> for code with
|
||||
newlines.
|
||||
</ul>
|
||||
|
||||
<h1>Change Log</h1>
|
||||
<h2>29 March 2007</h2>
|
||||
<ul>
|
||||
<li>Added <a href="tests/prettify_test.html#PHP">tests</a> for PHP support
|
||||
to address
|
||||
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=3"
|
||||
>issue 3</a>.
|
||||
<li>Fixed
|
||||
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=6"
|
||||
>bug</a>: <code>prettyPrintOne</code> was not halting. This was not
|
||||
reachable through the normal entry point.
|
||||
<li>Fixed
|
||||
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=4"
|
||||
>bug</a>: recursing into a script block or PHP tag that was not properly
|
||||
closed would not silently drop the content.
|
||||
(<a href="tests/prettify_test.html#issue4">test</a>)
|
||||
<li>Fixed
|
||||
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=8"
|
||||
>bug</a>: was eating tabs
|
||||
(<a href="tests/prettify_test.html#issue8">test</a>)
|
||||
<li>Fixed entity handling so that the caveat
|
||||
<blockquote>
|
||||
<p>Caveats: please properly escape less-thans. <tt>x&lt;y</tt>
|
||||
instead of <tt>x<y</tt>, and use <tt>"</tt> instead of
|
||||
<tt>&quot;</tt> for string delimiters.</p>
|
||||
</blockquote>
|
||||
is no longer applicable.
|
||||
<li>Added noisefree's C#
|
||||
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=4"
|
||||
>patch</a>
|
||||
<li>Added a <a href="http://google-code-prettify.googlecode.com/files/prettify-small.zip">distribution</a> that has comments and
|
||||
whitespace removed to reduce download size from 45.5kB to 12.8kB.
|
||||
</ul>
|
||||
<h2>4 Jul 2008</h2>
|
||||
<ul>
|
||||
<li>Added <a href="http://code.google.com/p/google-code-prettify/issues/detail?id=17">language specific formatters</a> that are triggered by the presence
|
||||
of a <code>lang-<language-file-extension></code></li>
|
||||
<li>Fixed <a href="http://code.google.com/p/google-code-prettify/issues/detail?id=29">bug</a>: python handling of <code>'''string'''</code>
|
||||
<li>Fixed bug: <code>/</code> in regex <code>[charsets] should not end regex</code>
|
||||
</ul>
|
||||
<h2>5 Jul 2008</h2>
|
||||
<ul>
|
||||
<li>Defined language extensions for Lisp and Lua</code>
|
||||
</ul>
|
||||
<h2>14 Jul 2008</h2>
|
||||
<ul>
|
||||
<li>Language handlers for F#, OCAML, SQL</code>
|
||||
<li>Support for <code>nocode</code> spans to allow embedding of line
|
||||
numbers and code annotations which should not be styled or otherwise
|
||||
affect the tokenization of prettified code.
|
||||
See the issue 22
|
||||
<a href="tests/prettify_test.html#issue22">testcase</a>.</code>
|
||||
</ul>
|
||||
<h2>6 Jan 2009</h2>
|
||||
<ul>
|
||||
<li>Language handlers for Visual Basic, Haskell, CSS, and WikiText</li>
|
||||
<li>Added <tt>.mxml</tt> extension to the markup style handler for
|
||||
Flex <a href="http://en.wikipedia.org/wiki/MXML">MXML files</a>. See
|
||||
<a
|
||||
href="http://code.google.com/p/google-code-prettify/issues/detail?id=37"
|
||||
>issue 37</a>.
|
||||
<li>Added <tt>.m</tt> extension to the C style handler so that Objective
|
||||
C source files properly highlight. See
|
||||
<a
|
||||
href="http://code.google.com/p/google-code-prettify/issues/detail?id=58"
|
||||
>issue 58</a>.
|
||||
<li>Changed HTML lexer to use the same embedded source mechanism as the
|
||||
wiki language handler, and changed to use the registered
|
||||
CSS handler for STYLE element content.
|
||||
</ul>
|
||||
<h2>21 May 2009</h2>
|
||||
<ul>
|
||||
<li>Rewrote to improve performance on large files.
|
||||
See <a href="http://mikesamuel.blogspot.com/2009/05/efficient-parsing-in-javascript.html">benchmarks</a>.</li>
|
||||
<li>Fixed bugs with highlighting of Haskell line comments, Lisp
|
||||
number literals, Lua strings, C preprocessor directives,
|
||||
newlines in Wiki code on Windows, and newlines in IE6.</li>
|
||||
</ul>
|
||||
<h2>14 August 2009</h2>
|
||||
<ul>
|
||||
<li>Fixed prettifying of <code><code></code> blocks with embedded newlines.
|
||||
</ul>
|
||||
<h2>3 October 2009</h2>
|
||||
<ul>
|
||||
<li>Fixed prettifying of XML/HTML tags that contain uppercase letters.
|
||||
</ul>
|
||||
<h2>19 July 2010</h2>
|
||||
<ul>
|
||||
<li>Added support for line numbers. Bug
|
||||
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=22"
|
||||
>22</a></li>
|
||||
<li>Added YAML support. Bug
|
||||
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=123"
|
||||
>123</a></li>
|
||||
<li>Added VHDL support courtesy Le Poussin.</li>
|
||||
<li>IE performance improvements. Bug
|
||||
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=102"
|
||||
>102</a> courtesy jacobly.</li>
|
||||
<li>A variety of markup formatting fixes courtesy smain and thezbyg.</li>
|
||||
<li>Fixed copy and paste in IE[678].
|
||||
<li>Changed output to use <code>&#160;</code> instead of
|
||||
<code>&nbsp;</code> so that the output works when embedded in XML.
|
||||
Bug
|
||||
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=108"
|
||||
>108</a>.</li>
|
||||
</ul>
|
||||
<h2>7 September 2010</h2>
|
||||
<ul>
|
||||
<li>Added support for coffeescript courtesy Cezary Bartoszuk.</li>
|
||||
</ul>
|
||||
<h2>4 March 2011</h2>
|
||||
<ul>
|
||||
<li>Added a <a href="http://google-code-prettify.googlecode.com/svn/trunk/styles/index.html">themes
|
||||
gallery</a> to showcase contributed styles.</li>
|
||||
<li>Added support for XQuery courtesy Patrick Wied, Nemerle
|
||||
courtesy Zimin A.V., and Latex support courtesy Martin S.</li>
|
||||
</ul>
|
||||
<h2>29 March 2011</h2>
|
||||
<ul>
|
||||
<li>Fixed IE newline issues, and copying/pasting of prettified
|
||||
source code from IE. This required significant internal changes
|
||||
but involves no API changes.
|
||||
<b>Caveat:</b> <code>prettyPrintOne</code> injects the HTML
|
||||
passed to it into a <code><pre></code> element.
|
||||
If the HTML comes from a trusted source, this may allow XSS.
|
||||
Do not do this. This should not be a problem for existing apps
|
||||
since the standard usage is to rewrite the HTML and then inject
|
||||
it, so anyone doing that with untrusted HTML already has an XSS
|
||||
vulnerability. If you sanitize and prettify HTML from an
|
||||
untrusted source, sanitize first.
|
||||
</ul>
|
||||
<h2>4 February 2013</h2>
|
||||
<ul>
|
||||
<li>Language handlers for Dart, Erlang, Mumps, TCL, R, S., and others</li>
|
||||
<li>Bug fix: VB REM style comments.</li>
|
||||
<li>Bug fix: CSS color literals / ID selector confusion.</li>
|
||||
<li>Bug fix: IE8 line breaks.</li>
|
||||
</ul>
|
||||
<h2>24 February 2013</h2>
|
||||
<ul>
|
||||
<li>Added a one script autoload&run mechanism and a way to
|
||||
embed hints in processing instructions/comments.
|
||||
See <a href="examples/quine.html">example</a>.
|
||||
</ul>
|
||||
<h2>4 March 2013</h2>
|
||||
<ul>
|
||||
<li>Matlab language handler courtesy Amro³</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
Vendored
+191
@@ -0,0 +1,191 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Copyright 2011 Mike Samuel et al
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" value="text/html; charset=UTF-8" />
|
||||
<title>Javascript code prettifier</title>
|
||||
|
||||
<link href="src/prettify.css" type="text/css" rel="stylesheet" />
|
||||
|
||||
<script src="src/prettify.js" type="text/javascript"></script>
|
||||
|
||||
<style type="text/css">
|
||||
body { margin-left: .5in }
|
||||
h1, h2, h3, h4, .footer { margin-left: -.4in; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()" bgcolor="white">
|
||||
<h1>Javascript code prettifier</h1>
|
||||
<h1>Javascript 代码美容师</h1>
|
||||
<h2>安装使用</h2>
|
||||
<ol>
|
||||
<li><a href="http://google-code-prettify.googlecode.com/files/prettify-small-5-Jul-2008.zip">下载</a> 文件
|
||||
<li>在你的文件中包含这儿的脚本和样式表(你要保证这儿的 css 和 js 文件按在你的服务器上, 并且调整在 <tt>script</tt> 和 <tt>link</tt>标签中的路径)
|
||||
<pre class="prettyprint">
|
||||
<link href="prettify.css" type="text/css" rel="stylesheet" />
|
||||
<script type="text/javascript" src="prettify.js"></script></pre>
|
||||
<li>添加<code class="prettyprint">onload="prettyPrint()"</code> 到你的文件的 body 标签中.
|
||||
<li>修改样式表,使用你自己喜欢的颜色.</li>
|
||||
</ol>
|
||||
|
||||
<h2>使用方法<br></h2>
|
||||
<p>在
|
||||
<tt><pre class="prettyprint">...</pre></tt> 或 <tt><code class="prettyprint">...</code></tt>
|
||||
中间放上代码片段,它就会自动被美化了.
|
||||
|
||||
<table summary="code examples">
|
||||
<tr>
|
||||
<th>The original
|
||||
<th>Prettier
|
||||
<tr>
|
||||
<td><pre style="border: 1px solid #888;padding: 2px"
|
||||
><a name="voila1"></a>class Voila {
|
||||
public:
|
||||
// Voila
|
||||
static const string VOILA = "Voila";
|
||||
|
||||
// will not interfere with embedded <a href="#voila1">tags</a>.
|
||||
}</pre>
|
||||
|
||||
<td><pre class="prettyprint"><a name="voila2"></a>class Voila {
|
||||
public:
|
||||
// Voila
|
||||
static const string VOILA = "Voila";
|
||||
|
||||
// will not interfere with embedded <a href="#voila2">tags</a>.
|
||||
}</pre>
|
||||
</table>
|
||||
|
||||
|
||||
<h2>常见问题</h2>
|
||||
<h3 id="langs">它是为什么语言工作的?</h3>
|
||||
<p><tt>prettify.js中的注释是权威的,但是它的语法分析程序可以在很多语言中使用</tt>,包括 C ,
|
||||
Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, 和 Makefiles.
|
||||
它在 Ruby, PHP, VB, 和 Awk 中还算可以,而且也可以在 Perl 和 Ruby的合适子集中起作用,但是, 因为注释的约定,它对
|
||||
Smalltalk, 或 CAML类似的语言起作用.<br></p>
|
||||
|
||||
|
||||
<p>LISP系列的语言可以使用一个拓展<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-lisp.js"><code>lang-lisp.js</code></a>.</p><p>对于 <a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-css"><code>CSS</code></a>,
|
||||
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-hs"><code>Haskell</code></a>,
|
||||
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-lua.js"><code>Lua</code></a>,
|
||||
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-ml.js"><code>OCAML, SML, F#</code></a>,
|
||||
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-vb.js"><code>Visual Basic</code></a>,
|
||||
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-sql.js"><code>SQL</code></a>,
|
||||
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-proto.js"><code>Protocol Buffers</code></a>, 和
|
||||
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-wiki.js"><code>WikiText</code></a>..也是类似的</p><p>如果你想给你喜欢的语言写个拓展版本, 请参阅<tt>src/lang-lisp.js</tt> ,并写一个包括你的语言的拓展的 <a href="http://code.google.com/p/google-code-prettify/issues/list"
|
||||
>发布</a> 和一个测试用例.</p>
|
||||
|
||||
<h3>如何指定我的代码在哪种语言里?</h3>
|
||||
<p>你不需要指定语言环境,因为 <code>prettyprint()</code>
|
||||
会对此进行猜测. 你可以使用<code> prettyprint </code>这个类通过指定语言的拓展名来指定语言,就像这样:</p>
|
||||
<pre class="prettyprint lang-html"
|
||||
><pre class="prettyprint <b>lang-html</b>">
|
||||
The lang-* class specifies the language file extensions.
|
||||
File extensions supported by default include
|
||||
"bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html",
|
||||
"java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh",
|
||||
"xhtml", "xml", "xsl".
|
||||
</pre></pre>
|
||||
|
||||
<h3>它在混淆代码例子上不起作用吗?</h3>
|
||||
<p>是的. 美化混淆代码就像给小猪涂口红,也就是不在这个工具的范围内. <br></p>
|
||||
|
||||
<h3>它可以在那些浏览器上工作?</h3>
|
||||
<p>这个工具已经在 IE 6, Firefox 1.5 & 2, 和 Safari 2.0.4 上测试通过. 打开 <a href="tests/prettify_test.html">测试页面</a> ,看看它能不能在你的浏览器上起作用.</p>
|
||||
|
||||
<h3>有什么改变?</h3>
|
||||
<p>查看 <a href="CHANGES.html">变化日志</a></p>
|
||||
|
||||
<h3> 为什么Prettyprinting 对WordPress中的字符串没用?</h3>
|
||||
<p>很显然,wordpress 在 "smart quoting" 时会改变关闭符号.
|
||||
这使得关闭符号跟开始符号不配套.
|
||||
<p>这和复制粘贴代码一样,破坏了美化作用. 去
|
||||
<a href="http://wordpress.org/support/topic/125038"
|
||||
>WordPress's help center</a> 查看更多关于如何关闭插入代码段时的"smart quoting"的信息.</p>
|
||||
|
||||
<h3>如何在我的代码中加入行号? (Out of date -- see <a href="README.html">English version</a>)</h3>
|
||||
<p>你可以使用 <code>nocode</code> 类来标记 span 标记不是代码.
|
||||
<pre><pre class=prettyprint>
|
||||
<span class="<b>nocode</b>">1:</span> /* This is line 1 of my code
|
||||
<span class="<b>nocode</b>">2:</span> * and here's line 2 */
|
||||
<span class="<b>nocode</b>">3:</span> print("I'm line number 3");
|
||||
</pre></pre>得到
|
||||
<pre class=prettyprint>
|
||||
<span class="nocode">1:</span> /* This is line 1 of my code
|
||||
<span class="nocode">2:</span> * and here's line 2 */
|
||||
<span class="nocode">3:</span> print("I'm line number 3");
|
||||
</pre>
|
||||
|
||||
<p>查看一个更完整的例子: issue22
|
||||
<a href="tests/prettify_test.html#issue22">testcase</a>.</p>
|
||||
|
||||
<h3>我得到了这样一条错误信息 "a is not a function" 或 "opt_whenDone is not a function"</h3>
|
||||
<p>如果你通过事件句柄条用 <code>prettyPrint</code> , 把它隐藏到一个函数中. <br></p><p>不要这么写
|
||||
</p><blockquote>
|
||||
<code class="prettyprint lang-js"
|
||||
>addEventListener('load', prettyPrint, false);</code>
|
||||
</blockquote>而要这么写
|
||||
<blockquote>
|
||||
<code class="prettyprint lang-js"
|
||||
>addEventListener('load', function (event) { prettyPrint() }, false);</code>
|
||||
</blockquote>这样的话,浏览器就不会把时间对象传递给 <code>prettyPrint</code> ,事件对象会让它困惑的.
|
||||
|
||||
<br><br><br>
|
||||
|
||||
<div class="footer">
|
||||
<!-- Created: Tue Oct 3 17:51:56 PDT 2006 -->
|
||||
<!-- hhmts start -->
|
||||
Last modified: Wed Jan 7 13:25:42 PST 2009<br><!-- hhmts end -->
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+233
@@ -0,0 +1,233 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Javascript code prettifier</title>
|
||||
|
||||
<link href="src/prettify.css" type="text/css" rel="stylesheet" />
|
||||
|
||||
<script src="src/prettify.js" type="text/javascript"></script>
|
||||
|
||||
<style type="text/css">
|
||||
body { margin-left: .5in }
|
||||
h1, h2, h3, h4, .footer { margin-left: -.4in; }
|
||||
a.Extension { display: inline-block; width: 5em; height:2.5em; border: 1px solid black; vertical-align: top; text-align: center }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint()" bgcolor="white">
|
||||
<small style="float: right">Languages : <a href="README-zh-Hans.html">CH</a></small>
|
||||
<h1>Javascript code prettifier</h1>
|
||||
|
||||
<h2>Setup</h2>
|
||||
<ol>
|
||||
<li><a href="http://code.google.com/p/google-code-prettify/downloads/list">Download</a> a distribution
|
||||
<li>Include the script tag below in your document
|
||||
<pre class="prettyprint">
|
||||
>script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js></script></pre>
|
||||
<li>See <a href="http://code.google.com/p/google-code-prettify/wiki/GettingStarted">Getting Started</a> to configure that URL with options you need.</a>
|
||||
<li>Look at the <a href="http://google-code-prettify.googlecode.com/svn/trunk/styles/index.html">skin gallery</a> and pick styles that suit you.</li>
|
||||
</ol>
|
||||
|
||||
<h2>Usage</h2>
|
||||
<p>Put code snippets in
|
||||
<tt><pre class="prettyprint">...</pre></tt>
|
||||
or <tt><code class="prettyprint">...</code></tt>
|
||||
and it will automatically be pretty printed.
|
||||
|
||||
<table summary="code examples">
|
||||
<tr>
|
||||
<th>The original
|
||||
<th>Prettier
|
||||
<tr>
|
||||
<td><pre style="border: 1px solid #888;padding: 2px"
|
||||
><a name="voila1"></a>class Voila {
|
||||
public:
|
||||
// Voila
|
||||
static const string VOILA = "Voila";
|
||||
|
||||
// will not interfere with embedded <a href="#voila1">tags</a>.
|
||||
}</pre>
|
||||
|
||||
<td><pre class="prettyprint"><a name="voila2"></a>class Voila {
|
||||
public:
|
||||
// Voila
|
||||
static const string VOILA = "Voila";
|
||||
|
||||
// will not interfere with embedded <a href="#voila2">tags</a>.
|
||||
}</pre>
|
||||
</table>
|
||||
|
||||
<h2>FAQ</h2>
|
||||
<h3 id="langs">For which languages does it work?</h3>
|
||||
<p>The comments in <tt>prettify.js</tt> are authoritative but the lexer
|
||||
should work on a number of languages including C and friends,
|
||||
Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, Makefiles,
|
||||
and Rust.
|
||||
It works passably on Ruby, PHP, VB, and Awk and a decent subset of Perl
|
||||
and Ruby, but, because of commenting conventions, but doesn't work on
|
||||
Smalltalk.</p>
|
||||
|
||||
<p>Other languages are supported via extensions:
|
||||
<div>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-apollo.js">Apollo</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-basic.js">Basic</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-clj.js">Clojure</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-css.js">CSS</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-dart.js">Dart</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-erlang.js">Erlang</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-go.js">Go</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-hs.js">Haskell</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-lisp.js">Lisp, Scheme</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-llvm.js">Llvm</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-lua.js">Lua</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-matlab.js">Matlab</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-ml.js">MLs:F#, Ocaml,SML</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-mumps.js">Mumps</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-n.js">Nemerle</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-pascal.js">Pascal</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-proto.js">Protocol buffers</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-r.js">R, S</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-rd.js">RD</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-scala.js">Scala</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-sql.js">SQL</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-tcl.js">TCL</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-tex.js">Latek</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-vb.js">Visual Basic</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-vhdl.js">CHDL</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-wiki.js">Wiki</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-xq.js">XQ</a>
|
||||
<a class="Extension" href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-yaml.js">YAML</a>
|
||||
</div>
|
||||
|
||||
<p>If you'd like to add an extension for your favorite language, please
|
||||
look at <tt>src/lang-lisp.js</tt> and file an
|
||||
<a href="http://code.google.com/p/google-code-prettify/issues/list"
|
||||
>issue</a> including your language extension, and a testcase.</p>
|
||||
|
||||
<h3>How do I specify the language of my code?</h3>
|
||||
<p>You don't need to specify the language since <code>prettyprint()</code>
|
||||
will guess. You can specify a language by specifying the language extension
|
||||
along with the <code>prettyprint</code> class like so:</p>
|
||||
<pre class="prettyprint lang-html"
|
||||
><pre class="prettyprint <b>lang-html</b>">
|
||||
The lang-* class specifies the language file extensions.
|
||||
File extensions supported by default include
|
||||
"bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html",
|
||||
"java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh",
|
||||
"xhtml", "xml", "xsl".
|
||||
</pre></pre>
|
||||
|
||||
<p>You may also use the
|
||||
<a href="http://dev.w3.org/html5/spec-author-view/the-code-element.html#the-code-element"
|
||||
>HTML 5</a> convention of embedding a <tt>code</tt> element inside the
|
||||
<code>PRE</code> and using <code>language-java</code> style classes.
|
||||
E.g. <xmp class="prettyprint"><pre class="prettyprint"><code class="language-java">...</code></pre></xmp>
|
||||
|
||||
<h3>It doesn't work on <tt><obfuscated code sample></tt>?</h3>
|
||||
<p>Yes. Prettifying obfuscated code is like putting lipstick on a pig
|
||||
— i.e. outside the scope of this tool.</p>
|
||||
|
||||
<h3>Which browsers does it work with?</h3>
|
||||
<p>It's been tested with IE 6, Firefox 1.5 & 2, and Safari 2.0.4.
|
||||
Look at <a href="tests/prettify_test.html">the test page</a> to see if it
|
||||
works in your browser.</p>
|
||||
|
||||
<h3>What's changed?</h3>
|
||||
<p>See the <a href="CHANGES.html">change log</a></p>
|
||||
|
||||
<h3>Why doesn't Prettyprinting of strings work on WordPress?</h3>
|
||||
<p>Apparently wordpress does "smart quoting" which changes close quotes.
|
||||
This causes end quotes to not match up with open quotes.
|
||||
<p>This breaks prettifying as well as copying and pasting of code samples.
|
||||
See
|
||||
<a href="http://wordpress.org/support/topic/125038"
|
||||
>WordPress's help center</a> for info on how to stop smart quoting of code
|
||||
snippets.</p>
|
||||
|
||||
<h3 id="linenums">How do I put line numbers in my code?</h3>
|
||||
<p>You can use the <code>linenums</code> class to turn on line
|
||||
numbering. If your code doesn't start at line number 1, you can
|
||||
add a colon and a line number to the end of that class as in
|
||||
<code>linenums:52</code>.
|
||||
|
||||
<p>For example
|
||||
<pre class="prettyprint"><pre class="prettyprint linenums:<b>4</b>"
|
||||
>// This is line 4.
|
||||
foo();
|
||||
bar();
|
||||
baz();
|
||||
boo();
|
||||
far();
|
||||
faz();
|
||||
<pre></pre>
|
||||
produces
|
||||
<pre class="prettyprint linenums:4"
|
||||
>// This is line 4.
|
||||
foo();
|
||||
bar();
|
||||
baz();
|
||||
boo();
|
||||
far();
|
||||
faz();
|
||||
</pre>
|
||||
|
||||
<h3>How do I prevent a portion of markup from being marked as code?</h3>
|
||||
<p>You can use the <code>nocode</code> class to identify a span of markup
|
||||
that is not code.
|
||||
<pre class="prettyprint"><pre class=prettyprint>
|
||||
int x = foo(); /* This is a comment <span class="nocode">This is not code</span>
|
||||
Continuation of comment */
|
||||
int y = bar();
|
||||
</pre></pre>
|
||||
produces
|
||||
<pre class="prettyprint">
|
||||
int x = foo(); /* This is a comment <span class="nocode">This is not code</span>
|
||||
Continuation of comment */
|
||||
int y = bar();
|
||||
</pre>
|
||||
|
||||
<p>For a more complete example see the issue22
|
||||
<a href="tests/prettify_test.html#issue22">testcase</a>.</p>
|
||||
|
||||
<h3>I get an error message "a is not a function" or "opt_whenDone is not a function"</h3>
|
||||
<p>If you are calling <code>prettyPrint</code> via an event handler, wrap it in a function.
|
||||
Instead of doing
|
||||
<blockquote>
|
||||
<code class="prettyprint lang-js"
|
||||
>addEventListener('load', prettyPrint, false);</code>
|
||||
</blockquote>
|
||||
wrap it in a closure like
|
||||
<blockquote>
|
||||
<code class="prettyprint lang-js"
|
||||
>addEventListener('load', function (event) { prettyPrint() }, false);</code>
|
||||
</blockquote>
|
||||
so that the browser does not pass an event object to <code>prettyPrint</code> which
|
||||
will confuse it.
|
||||
|
||||
<h3>How can I customize the colors and styles of my code?</h3>
|
||||
<p>
|
||||
Prettify adds <code><span></code> with <code>class</code>es describing
|
||||
the kind of code. You can create CSS styles to matches these
|
||||
classes.
|
||||
See the
|
||||
<a href="http://google-code-prettify.googlecode.com/svn/trunk/styles/index.html">
|
||||
theme gallery</a> for examples.
|
||||
</p>
|
||||
|
||||
<h3>I can't add classes to my code (because it comes from Markdown, etc.)</h3>
|
||||
<p>
|
||||
Instead of <code class="prettyprint"><pre class="prettyprint ..."></code> you can use a
|
||||
comment or processing instructions that survives processing instructions :
|
||||
<code><?prettify ...?></code> works as explained in
|
||||
<a href="http://code.google.com/p/google-code-prettify/wiki/GettingStarted">Getting Started</a></p>
|
||||
|
||||
<br><br><br>
|
||||
|
||||
<div class="footer">
|
||||
<!-- Created: Tue Oct 3 17:51:56 PDT 2006 -->
|
||||
<!-- hhmts start -->Last modified: Mon Mar 4 14:16:04 EST 2013 <!-- hhmts end -->
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
# Google Code Prettify
|
||||
|
||||
Direct port of svn into git from http://google-code-prettify.googlecode.com/svn/trunk/
|
||||
|
||||
## Install
|
||||
|
||||
via [Bower](http://twitter.github.com/bower/)
|
||||
|
||||
bower install google-code-prettify
|
||||
|
||||
or [Yeoman](http://yeoman.io/)
|
||||
|
||||
yeoman install google-code-prettify
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
The prettify script is AMD compatible and can be used modularly. Here is an example of it in an AMD module:
|
||||
|
||||
```javascript
|
||||
define(['jquery', 'prettify'], function($, prettify){
|
||||
var code = null;
|
||||
$('pre').addClass('prettyprint').each(function(idx, el){
|
||||
code = el.firstChild;
|
||||
code.innerHTML = prettify.prettyPrintOne(code.innerHTML);
|
||||
})
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
This version of google-code-prettify defines an anonymous module, which is more flexible. To allow your AMD loader to find google-code-prettify with a more convenient name, map a path to it as follows:
|
||||
|
||||
```js
|
||||
// using RequireJS
|
||||
require.config({
|
||||
prettify: 'bower_components/google-code-prettify/prettify'
|
||||
});
|
||||
|
||||
// using curl.js
|
||||
curl.config({
|
||||
prettify: 'bower_components/google-code-prettify/prettify'
|
||||
});
|
||||
```
|
||||
|
||||
Or it may just be used in a global context like the following:
|
||||
|
||||
```javascript
|
||||
(function(){
|
||||
$('pre').addClass('prettyprint');
|
||||
prettyPrint();
|
||||
})();
|
||||
```
|
||||
|
||||
More information can be found in the original [README.html](http://google-code-prettify.googlecode.com/svn/trunk/README.html)
|
||||
@@ -0,0 +1 @@
|
||||
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
|
||||
@@ -0,0 +1,30 @@
|
||||
!function(){var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
|
||||
(function(){function S(a){function d(e){var b=e.charCodeAt(0);if(b!==92)return b;var a=e.charAt(1);return(b=r[a])?b:"0"<=a&&a<="7"?parseInt(e.substring(1),8):a==="u"||a==="x"?parseInt(e.substring(2),16):e.charCodeAt(1)}function g(e){if(e<32)return(e<16?"\\x0":"\\x")+e.toString(16);e=String.fromCharCode(e);return e==="\\"||e==="-"||e==="]"||e==="^"?"\\"+e:e}function b(e){var b=e.substring(1,e.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),e=[],a=
|
||||
b[0]==="^",c=["["];a&&c.push("^");for(var a=a?1:0,f=b.length;a<f;++a){var h=b[a];if(/\\[bdsw]/i.test(h))c.push(h);else{var h=d(h),l;a+2<f&&"-"===b[a+1]?(l=d(b[a+2]),a+=2):l=h;e.push([h,l]);l<65||h>122||(l<65||h>90||e.push([Math.max(65,h)|32,Math.min(l,90)|32]),l<97||h>122||e.push([Math.max(97,h)&-33,Math.min(l,122)&-33]))}}e.sort(function(e,a){return e[0]-a[0]||a[1]-e[1]});b=[];f=[];for(a=0;a<e.length;++a)h=e[a],h[0]<=f[1]+1?f[1]=Math.max(f[1],h[1]):b.push(f=h);for(a=0;a<b.length;++a)h=b[a],c.push(g(h[0])),
|
||||
h[1]>h[0]&&(h[1]+1>h[0]&&c.push("-"),c.push(g(h[1])));c.push("]");return c.join("")}function s(e){for(var a=e.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),c=a.length,d=[],f=0,h=0;f<c;++f){var l=a[f];l==="("?++h:"\\"===l.charAt(0)&&(l=+l.substring(1))&&(l<=h?d[l]=-1:a[f]=g(l))}for(f=1;f<d.length;++f)-1===d[f]&&(d[f]=++x);for(h=f=0;f<c;++f)l=a[f],l==="("?(++h,d[h]||(a[f]="(?:")):"\\"===l.charAt(0)&&(l=+l.substring(1))&&l<=h&&
|
||||
(a[f]="\\"+d[l]);for(f=0;f<c;++f)"^"===a[f]&&"^"!==a[f+1]&&(a[f]="");if(e.ignoreCase&&m)for(f=0;f<c;++f)l=a[f],e=l.charAt(0),l.length>=2&&e==="["?a[f]=b(l):e!=="\\"&&(a[f]=l.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return a.join("")}for(var x=0,m=!1,j=!1,k=0,c=a.length;k<c;++k){var i=a[k];if(i.ignoreCase)j=!0;else if(/[a-z]/i.test(i.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){m=!0;j=!1;break}}for(var r={b:8,t:9,n:10,v:11,
|
||||
f:12,r:13},n=[],k=0,c=a.length;k<c;++k){i=a[k];if(i.global||i.multiline)throw Error(""+i);n.push("(?:"+s(i)+")")}return RegExp(n.join("|"),j?"gi":"g")}function T(a,d){function g(a){var c=a.nodeType;if(c==1){if(!b.test(a.className)){for(c=a.firstChild;c;c=c.nextSibling)g(c);c=a.nodeName.toLowerCase();if("br"===c||"li"===c)s[j]="\n",m[j<<1]=x++,m[j++<<1|1]=a}}else if(c==3||c==4)c=a.nodeValue,c.length&&(c=d?c.replace(/\r\n?/g,"\n"):c.replace(/[\t\n\r ]+/g," "),s[j]=c,m[j<<1]=x,x+=c.length,m[j++<<1|1]=
|
||||
a)}var b=/(?:^|\s)nocode(?:\s|$)/,s=[],x=0,m=[],j=0;g(a);return{a:s.join("").replace(/\n$/,""),d:m}}function H(a,d,g,b){d&&(a={a:d,e:a},g(a),b.push.apply(b,a.g))}function U(a){for(var d=void 0,g=a.firstChild;g;g=g.nextSibling)var b=g.nodeType,d=b===1?d?a:g:b===3?V.test(g.nodeValue)?a:d:d;return d===a?void 0:d}function C(a,d){function g(a){for(var j=a.e,k=[j,"pln"],c=0,i=a.a.match(s)||[],r={},n=0,e=i.length;n<e;++n){var z=i[n],w=r[z],t=void 0,f;if(typeof w==="string")f=!1;else{var h=b[z.charAt(0)];
|
||||
if(h)t=z.match(h[1]),w=h[0];else{for(f=0;f<x;++f)if(h=d[f],t=z.match(h[1])){w=h[0];break}t||(w="pln")}if((f=w.length>=5&&"lang-"===w.substring(0,5))&&!(t&&typeof t[1]==="string"))f=!1,w="src";f||(r[z]=w)}h=c;c+=z.length;if(f){f=t[1];var l=z.indexOf(f),B=l+f.length;t[2]&&(B=z.length-t[2].length,l=B-f.length);w=w.substring(5);H(j+h,z.substring(0,l),g,k);H(j+h+l,f,I(w,f),k);H(j+h+B,z.substring(B),g,k)}else k.push(j+h,w)}a.g=k}var b={},s;(function(){for(var g=a.concat(d),j=[],k={},c=0,i=g.length;c<i;++c){var r=
|
||||
g[c],n=r[3];if(n)for(var e=n.length;--e>=0;)b[n.charAt(e)]=r;r=r[1];n=""+r;k.hasOwnProperty(n)||(j.push(r),k[n]=q)}j.push(/[\S\s]/);s=S(j)})();var x=d.length;return g}function v(a){var d=[],g=[];a.tripleQuotedStrings?d.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?d.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
|
||||
q,"'\"`"]):d.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&g.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var b=a.hashComments;b&&(a.cStyleComments?(b>1?d.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):d.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),g.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,q])):d.push(["com",
|
||||
/^#[^\n\r]*/,q,"#"]));a.cStyleComments&&(g.push(["com",/^\/\/[^\n\r]*/,q]),g.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));if(b=a.regexLiterals){var s=(b=b>1?"":"\n\r")?".":"[\\S\\s]";g.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+("/(?=[^/*"+b+"])(?:[^/\\x5B\\x5C"+b+"]|\\x5C"+s+"|\\x5B(?:[^\\x5C\\x5D"+b+"]|\\x5C"+
|
||||
s+")*(?:\\x5D|$))+/")+")")])}(b=a.types)&&g.push(["typ",b]);b=(""+a.keywords).replace(/^ | $/g,"");b.length&&g.push(["kwd",RegExp("^(?:"+b.replace(/[\s,]+/g,"|")+")\\b"),q]);d.push(["pln",/^\s+/,q," \r\n\t\u00a0"]);b="^.[^\\s\\w.$@'\"`/\\\\]*";a.regexLiterals&&(b+="(?!s*/)");g.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,
|
||||
q],["pun",RegExp(b),q]);return C(d,g)}function J(a,d,g){function b(a){var c=a.nodeType;if(c==1&&!x.test(a.className))if("br"===a.nodeName)s(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)b(a);else if((c==3||c==4)&&g){var d=a.nodeValue,i=d.match(m);if(i)c=d.substring(0,i.index),a.nodeValue=c,(d=d.substring(i.index+i[0].length))&&a.parentNode.insertBefore(j.createTextNode(d),a.nextSibling),s(a),c||a.parentNode.removeChild(a)}}function s(a){function b(a,c){var d=
|
||||
c?a.cloneNode(!1):a,e=a.parentNode;if(e){var e=b(e,1),g=a.nextSibling;e.appendChild(d);for(var i=g;i;i=g)g=i.nextSibling,e.appendChild(i)}return d}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),d;(d=a.parentNode)&&d.nodeType===1;)a=d;c.push(a)}for(var x=/(?:^|\s)nocode(?:\s|$)/,m=/\r\n?|\n/,j=a.ownerDocument,k=j.createElement("li");a.firstChild;)k.appendChild(a.firstChild);for(var c=[k],i=0;i<c.length;++i)b(c[i]);d===(d|0)&&c[0].setAttribute("value",d);var r=j.createElement("ol");
|
||||
r.className="linenums";for(var d=Math.max(0,d-1|0)||0,i=0,n=c.length;i<n;++i)k=c[i],k.className="L"+(i+d)%10,k.firstChild||k.appendChild(j.createTextNode("\u00a0")),r.appendChild(k);a.appendChild(r)}function p(a,d){for(var g=d.length;--g>=0;){var b=d[g];F.hasOwnProperty(b)?D.console&&console.warn("cannot override language handler %s",b):F[b]=a}}function I(a,d){if(!a||!F.hasOwnProperty(a))a=/^\s*</.test(d)?"default-markup":"default-code";return F[a]}function K(a){var d=a.h;try{var g=T(a.c,a.i),b=g.a;
|
||||
a.a=b;a.d=g.d;a.e=0;I(d,b)(a);var s=/\bMSIE\s(\d+)/.exec(navigator.userAgent),s=s&&+s[1]<=8,d=/\n/g,x=a.a,m=x.length,g=0,j=a.d,k=j.length,b=0,c=a.g,i=c.length,r=0;c[i]=m;var n,e;for(e=n=0;e<i;)c[e]!==c[e+2]?(c[n++]=c[e++],c[n++]=c[e++]):e+=2;i=n;for(e=n=0;e<i;){for(var p=c[e],w=c[e+1],t=e+2;t+2<=i&&c[t+1]===w;)t+=2;c[n++]=p;c[n++]=w;e=t}c.length=n;var f=a.c,h;if(f)h=f.style.display,f.style.display="none";try{for(;b<k;){var l=j[b+2]||m,B=c[r+2]||m,t=Math.min(l,B),A=j[b+1],G;if(A.nodeType!==1&&(G=x.substring(g,
|
||||
t))){s&&(G=G.replace(d,"\r"));A.nodeValue=G;var L=A.ownerDocument,o=L.createElement("span");o.className=c[r+1];var v=A.parentNode;v.replaceChild(o,A);o.appendChild(A);g<l&&(j[b+1]=A=L.createTextNode(x.substring(t,l)),v.insertBefore(A,o.nextSibling))}g=t;g>=l&&(b+=2);g>=B&&(r+=2)}}finally{if(f)f.style.display=h}}catch(u){D.console&&console.log(u&&u.stack||u)}}var D=window,y=["break,continue,do,else,for,if,return,while"],E=[[y,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
|
||||
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],M=[E,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],N=[E,"abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],
|
||||
O=[N,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"],E=[E,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],P=[y,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
|
||||
Q=[y,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],W=[y,"as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"],y=[y,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],R=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,
|
||||
V=/\S/,X=v({keywords:[M,O,E,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",P,Q,y],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),F={};p(X,["default-code"]);p(C([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",
|
||||
/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);p(C([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],
|
||||
["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);p(C([],[["atv",/^[\S\s]+/]]),["uq.val"]);p(v({keywords:M,hashComments:!0,cStyleComments:!0,types:R}),["c","cc","cpp","cxx","cyc","m"]);p(v({keywords:"null,true,false"}),["json"]);p(v({keywords:O,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:R}),
|
||||
["cs"]);p(v({keywords:N,cStyleComments:!0}),["java"]);p(v({keywords:y,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]);p(v({keywords:P,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]);p(v({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]);p(v({keywords:Q,
|
||||
hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]);p(v({keywords:E,cStyleComments:!0,regexLiterals:!0}),["javascript","js"]);p(v({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);p(v({keywords:W,cStyleComments:!0,multilineStrings:!0}),["rc","rs","rust"]);
|
||||
p(C([],[["str",/^[\S\s]+/]]),["regex"]);var Y=D.PR={createSimpleLexer:C,registerLangHandler:p,sourceDecorator:v,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:D.prettyPrintOne=function(a,d,g){var b=document.createElement("div");b.innerHTML="<pre>"+a+"</pre>";b=b.firstChild;g&&J(b,g,!0);K({h:d,j:g,c:b,i:1});
|
||||
return b.innerHTML},prettyPrint:D.prettyPrint=function(a,d){function g(){for(var b=D.PR_SHOULD_USE_CONTINUATION?c.now()+250:Infinity;i<p.length&&c.now()<b;i++){for(var d=p[i],j=h,k=d;k=k.previousSibling;){var m=k.nodeType,o=(m===7||m===8)&&k.nodeValue;if(o?!/^\??prettify\b/.test(o):m!==3||/\S/.test(k.nodeValue))break;if(o){j={};o.replace(/\b(\w+)=([\w%+\-.:]+)/g,function(a,b,c){j[b]=c});break}}k=d.className;if((j!==h||e.test(k))&&!v.test(k)){m=!1;for(o=d.parentNode;o;o=o.parentNode)if(f.test(o.tagName)&&
|
||||
o.className&&e.test(o.className)){m=!0;break}if(!m){d.className+=" prettyprinted";m=j.lang;if(!m){var m=k.match(n),y;if(!m&&(y=U(d))&&t.test(y.tagName))m=y.className.match(n);m&&(m=m[1])}if(w.test(d.tagName))o=1;else var o=d.currentStyle,u=s.defaultView,o=(o=o?o.whiteSpace:u&&u.getComputedStyle?u.getComputedStyle(d,q).getPropertyValue("white-space"):0)&&"pre"===o.substring(0,3);u=j.linenums;if(!(u=u==="true"||+u))u=(u=k.match(/\blinenums\b(?::(\d+))?/))?u[1]&&u[1].length?+u[1]:!0:!1;u&&J(d,u,o);r=
|
||||
{h:m,c:d,j:u,i:o};K(r)}}}i<p.length?setTimeout(g,250):"function"===typeof a&&a()}for(var b=d||document.body,s=b.ownerDocument||document,b=[b.getElementsByTagName("pre"),b.getElementsByTagName("code"),b.getElementsByTagName("xmp")],p=[],m=0;m<b.length;++m)for(var j=0,k=b[m].length;j<k;++j)p.push(b[m][j]);var b=q,c=Date;c.now||(c={now:function(){return+new Date}});var i=0,r,n=/\blang(?:uage)?-([\w.]+)(?!\S)/,e=/\bprettyprint\b/,v=/\bprettyprinted\b/,w=/pre|xmp/i,t=/^code$/i,f=/^(?:pre|code|xmp)$/i,
|
||||
h={};g()}};typeof define==="function"&&define.amd&&define("google-code-prettify",[],function(){return Y})})();}()
|
||||
@@ -0,0 +1,34 @@
|
||||
!function(){var r=null;
|
||||
(function(){function X(e){function j(){try{J.doScroll("left")}catch(e){P(j,50);return}w("poll")}function w(j){if(!(j.type=="readystatechange"&&x.readyState!="complete")&&((j.type=="load"?n:x)[z](i+j.type,w,!1),!m&&(m=!0)))e.call(n,j.type||j)}var Y=x.addEventListener,m=!1,C=!0,t=Y?"addEventListener":"attachEvent",z=Y?"removeEventListener":"detachEvent",i=Y?"":"on";if(x.readyState=="complete")e.call(n,"lazy");else{if(x.createEventObject&&J.doScroll){try{C=!n.frameElement}catch(A){}C&&j()}x[t](i+"DOMContentLoaded",
|
||||
w,!1);x[t](i+"readystatechange",w,!1);n[t](i+"load",w,!1)}}function Q(){S&&X(function(){var e=K.length;$(e?function(){for(var j=0;j<e;++j)(function(e){P(function(){n.exports[K[e]].apply(n,arguments)},0)})(j)}:void 0)})}for(var n=window,P=n.setTimeout,x=document,J=x.documentElement,L=x.head||x.getElementsByTagName("head")[0]||J,z="",A=x.scripts,m=A.length;--m>=0;){var M=A[m],T=M.src.match(/^[^#?]*\/run_prettify\.js(\?[^#]*)?(?:#.*)?$/);if(T){z=T[1]||"";M.parentNode.removeChild(M);break}}var S=!0,D=
|
||||
[],N=[],K=[];z.replace(/[&?]([^&=]+)=([^&]+)/g,function(e,j,w){w=decodeURIComponent(w);j=decodeURIComponent(j);j=="autorun"?S=!/^[0fn]/i.test(w):j=="lang"?D.push(w):j=="skin"?N.push(w):j=="callback"&&K.push(w)});m=0;for(z=D.length;m<z;++m)(function(){var e=x.createElement("script");e.onload=e.onerror=e.onreadystatechange=function(){if(e&&(!e.readyState||/loaded|complete/.test(e.readyState)))e.onerror=e.onload=e.onreadystatechange=r,--R,R||P(Q,0),e.parentNode&&e.parentNode.removeChild(e),e=r};e.type=
|
||||
"text/javascript";e.src="https://google-code-prettify.googlecode.com/svn/loader/lang-"+encodeURIComponent(D[m])+".js";L.insertBefore(e,L.firstChild)})(D[m]);for(var R=D.length,A=[],m=0,z=N.length;m<z;++m)A.push("https://google-code-prettify.googlecode.com/svn/loader/skins/"+encodeURIComponent(N[m])+".css");A.push("https://google-code-prettify.googlecode.com/svn/loader/prettify.css");(function(e){function j(m){if(m!==w){var n=x.createElement("link");n.rel="stylesheet";n.type="text/css";if(m+1<w)n.error=
|
||||
n.onerror=function(){j(m+1)};n.href=e[m];L.appendChild(n)}}var w=e.length;j(0)})(A);var $=function(){window.PR_SHOULD_USE_CONTINUATION=!0;var e;(function(){function j(a){function d(f){var b=f.charCodeAt(0);if(b!==92)return b;var a=f.charAt(1);return(b=i[a])?b:"0"<=a&&a<="7"?parseInt(f.substring(1),8):a==="u"||a==="x"?parseInt(f.substring(2),16):f.charCodeAt(1)}function h(f){if(f<32)return(f<16?"\\x0":"\\x")+f.toString(16);f=String.fromCharCode(f);return f==="\\"||f==="-"||f==="]"||f==="^"?"\\"+f:
|
||||
f}function b(f){var b=f.substring(1,f.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),f=[],a=b[0]==="^",c=["["];a&&c.push("^");for(var a=a?1:0,g=b.length;a<g;++a){var k=b[a];if(/\\[bdsw]/i.test(k))c.push(k);else{var k=d(k),o;a+2<g&&"-"===b[a+1]?(o=d(b[a+2]),a+=2):o=k;f.push([k,o]);o<65||k>122||(o<65||k>90||f.push([Math.max(65,k)|32,Math.min(o,90)|32]),o<97||k>122||f.push([Math.max(97,k)&-33,Math.min(o,122)&-33]))}}f.sort(function(f,a){return f[0]-
|
||||
a[0]||a[1]-f[1]});b=[];g=[];for(a=0;a<f.length;++a)k=f[a],k[0]<=g[1]+1?g[1]=Math.max(g[1],k[1]):b.push(g=k);for(a=0;a<b.length;++a)k=b[a],c.push(h(k[0])),k[1]>k[0]&&(k[1]+1>k[0]&&c.push("-"),c.push(h(k[1])));c.push("]");return c.join("")}function e(f){for(var a=f.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),c=a.length,d=[],g=0,k=0;g<c;++g){var o=a[g];o==="("?++k:"\\"===o.charAt(0)&&(o=+o.substring(1))&&(o<=k?d[o]=-1:a[g]=h(o))}for(g=
|
||||
1;g<d.length;++g)-1===d[g]&&(d[g]=++j);for(k=g=0;g<c;++g)o=a[g],o==="("?(++k,d[k]||(a[g]="(?:")):"\\"===o.charAt(0)&&(o=+o.substring(1))&&o<=k&&(a[g]="\\"+d[o]);for(g=0;g<c;++g)"^"===a[g]&&"^"!==a[g+1]&&(a[g]="");if(f.ignoreCase&&F)for(g=0;g<c;++g)o=a[g],f=o.charAt(0),o.length>=2&&f==="["?a[g]=b(o):f!=="\\"&&(a[g]=o.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return a.join("")}for(var j=0,F=!1,l=!1,I=0,c=a.length;I<c;++I){var p=a[I];if(p.ignoreCase)l=
|
||||
!0;else if(/[a-z]/i.test(p.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){F=!0;l=!1;break}}for(var i={b:8,t:9,n:10,v:11,f:12,r:13},q=[],I=0,c=a.length;I<c;++I){p=a[I];if(p.global||p.multiline)throw Error(""+p);q.push("(?:"+e(p)+")")}return RegExp(q.join("|"),l?"gi":"g")}function m(a,d){function h(a){var c=a.nodeType;if(c==1){if(!b.test(a.className)){for(c=a.firstChild;c;c=c.nextSibling)h(c);c=a.nodeName.toLowerCase();if("br"===c||"li"===c)e[l]="\n",F[l<<1]=j++,F[l++<<1|1]=a}}else if(c==
|
||||
3||c==4)c=a.nodeValue,c.length&&(c=d?c.replace(/\r\n?/g,"\n"):c.replace(/[\t\n\r ]+/g," "),e[l]=c,F[l<<1]=j,j+=c.length,F[l++<<1|1]=a)}var b=/(?:^|\s)nocode(?:\s|$)/,e=[],j=0,F=[],l=0;h(a);return{a:e.join("").replace(/\n$/,""),d:F}}function n(a,d,h,b){d&&(a={a:d,e:a},h(a),b.push.apply(b,a.g))}function x(a){for(var d=void 0,h=a.firstChild;h;h=h.nextSibling)var b=h.nodeType,d=b===1?d?a:h:b===3?S.test(h.nodeValue)?a:d:d;return d===a?void 0:d}function C(a,d){function h(a){for(var l=a.e,j=[l,"pln"],c=
|
||||
0,p=a.a.match(e)||[],m={},q=0,f=p.length;q<f;++q){var B=p[q],y=m[B],u=void 0,g;if(typeof y==="string")g=!1;else{var k=b[B.charAt(0)];if(k)u=B.match(k[1]),y=k[0];else{for(g=0;g<i;++g)if(k=d[g],u=B.match(k[1])){y=k[0];break}u||(y="pln")}if((g=y.length>=5&&"lang-"===y.substring(0,5))&&!(u&&typeof u[1]==="string"))g=!1,y="src";g||(m[B]=y)}k=c;c+=B.length;if(g){g=u[1];var o=B.indexOf(g),H=o+g.length;u[2]&&(H=B.length-u[2].length,o=H-g.length);y=y.substring(5);n(l+k,B.substring(0,o),h,j);n(l+k+o,g,A(y,
|
||||
g),j);n(l+k+H,B.substring(H),h,j)}else j.push(l+k,y)}a.g=j}var b={},e;(function(){for(var h=a.concat(d),l=[],i={},c=0,p=h.length;c<p;++c){var m=h[c],q=m[3];if(q)for(var f=q.length;--f>=0;)b[q.charAt(f)]=m;m=m[1];q=""+m;i.hasOwnProperty(q)||(l.push(m),i[q]=r)}l.push(/[\S\s]/);e=j(l)})();var i=d.length;return h}function t(a){var d=[],h=[];a.tripleQuotedStrings?d.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,
|
||||
r,"'\""]):a.multiLineStrings?d.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,r,"'\"`"]):d.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,r,"\"'"]);a.verbatimStrings&&h.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,r]);var b=a.hashComments;b&&(a.cStyleComments?(b>1?d.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,r,"#"]):d.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\n\r]*)/,
|
||||
r,"#"]),h.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,r])):d.push(["com",/^#[^\n\r]*/,r,"#"]));a.cStyleComments&&(h.push(["com",/^\/\/[^\n\r]*/,r]),h.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,r]));if(b=a.regexLiterals){var e=(b=b>1?"":"\n\r")?".":"[\\S\\s]";h.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+
|
||||
("/(?=[^/*"+b+"])(?:[^/\\x5B\\x5C"+b+"]|\\x5C"+e+"|\\x5B(?:[^\\x5C\\x5D"+b+"]|\\x5C"+e+")*(?:\\x5D|$))+/")+")")])}(b=a.types)&&h.push(["typ",b]);b=(""+a.keywords).replace(/^ | $/g,"");b.length&&h.push(["kwd",RegExp("^(?:"+b.replace(/[\s,]+/g,"|")+")\\b"),r]);d.push(["pln",/^\s+/,r," \r\n\t\u00a0"]);b="^.[^\\s\\w.$@'\"`/\\\\]*";a.regexLiterals&&(b+="(?!s*/)");h.push(["lit",/^@[$_a-z][\w$@]*/i,r],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,r],["pln",/^[$_a-z][\w$@]*/i,r],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,
|
||||
r,"0123456789"],["pln",/^\\[\S\s]?/,r],["pun",RegExp(b),r]);return C(d,h)}function z(a,d,h){function b(a){var c=a.nodeType;if(c==1&&!j.test(a.className))if("br"===a.nodeName)e(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)b(a);else if((c==3||c==4)&&h){var d=a.nodeValue,i=d.match(m);if(i)c=d.substring(0,i.index),a.nodeValue=c,(d=d.substring(i.index+i[0].length))&&a.parentNode.insertBefore(l.createTextNode(d),a.nextSibling),e(a),c||a.parentNode.removeChild(a)}}
|
||||
function e(a){function b(a,c){var d=c?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),h=a.nextSibling;f.appendChild(d);for(var e=h;e;e=h)h=e.nextSibling,f.appendChild(e)}return d}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),d;(d=a.parentNode)&&d.nodeType===1;)a=d;c.push(a)}for(var j=/(?:^|\s)nocode(?:\s|$)/,m=/\r\n?|\n/,l=a.ownerDocument,i=l.createElement("li");a.firstChild;)i.appendChild(a.firstChild);for(var c=[i],p=0;p<c.length;++p)b(c[p]);d===(d|0)&&c[0].setAttribute("value",
|
||||
d);var n=l.createElement("ol");n.className="linenums";for(var d=Math.max(0,d-1|0)||0,p=0,q=c.length;p<q;++p)i=c[p],i.className="L"+(p+d)%10,i.firstChild||i.appendChild(l.createTextNode("\u00a0")),n.appendChild(i);a.appendChild(n)}function i(a,d){for(var h=d.length;--h>=0;){var b=d[h];U.hasOwnProperty(b)?V.console&&console.warn("cannot override language handler %s",b):U[b]=a}}function A(a,d){if(!a||!U.hasOwnProperty(a))a=/^\s*</.test(d)?"default-markup":"default-code";return U[a]}function D(a){var d=
|
||||
a.h;try{var h=m(a.c,a.i),b=h.a;a.a=b;a.d=h.d;a.e=0;A(d,b)(a);var e=/\bMSIE\s(\d+)/.exec(navigator.userAgent),e=e&&+e[1]<=8,d=/\n/g,i=a.a,j=i.length,h=0,l=a.d,n=l.length,b=0,c=a.g,p=c.length,t=0;c[p]=j;var q,f;for(f=q=0;f<p;)c[f]!==c[f+2]?(c[q++]=c[f++],c[q++]=c[f++]):f+=2;p=q;for(f=q=0;f<p;){for(var x=c[f],y=c[f+1],u=f+2;u+2<=p&&c[u+1]===y;)u+=2;c[q++]=x;c[q++]=y;f=u}c.length=q;var g=a.c,k;if(g)k=g.style.display,g.style.display="none";try{for(;b<n;){var o=l[b+2]||j,H=c[t+2]||j,u=Math.min(o,H),E=l[b+
|
||||
1],W;if(E.nodeType!==1&&(W=i.substring(h,u))){e&&(W=W.replace(d,"\r"));E.nodeValue=W;var Z=E.ownerDocument,s=Z.createElement("span");s.className=c[t+1];var z=E.parentNode;z.replaceChild(s,E);s.appendChild(E);h<o&&(l[b+1]=E=Z.createTextNode(i.substring(u,o)),z.insertBefore(E,s.nextSibling))}h=u;h>=o&&(b+=2);h>=H&&(t+=2)}}finally{if(g)g.style.display=k}}catch(v){V.console&&console.log(v&&v.stack||v)}}var V=window,G=["break,continue,do,else,for,if,return,while"],O=[[G,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
|
||||
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],J=[O,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],K=[O,"abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],
|
||||
L=[K,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"],O=[O,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],M=[G,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
|
||||
N=[G,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],R=[G,"as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"],G=[G,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],Q=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,
|
||||
S=/\S/,T=t({keywords:[J,L,O,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",M,N,G],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),U={};i(T,["default-code"]);i(C([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",
|
||||
/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);i(C([["pln",/^\s+/,r," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,r,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],
|
||||
["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);i(C([],[["atv",/^[\S\s]+/]]),["uq.val"]);i(t({keywords:J,hashComments:!0,cStyleComments:!0,types:Q}),["c","cc","cpp","cxx","cyc","m"]);i(t({keywords:"null,true,false"}),["json"]);i(t({keywords:L,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:Q}),
|
||||
["cs"]);i(t({keywords:K,cStyleComments:!0}),["java"]);i(t({keywords:G,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]);i(t({keywords:M,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]);i(t({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]);i(t({keywords:N,
|
||||
hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]);i(t({keywords:O,cStyleComments:!0,regexLiterals:!0}),["javascript","js"]);i(t({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);i(t({keywords:R,cStyleComments:!0,multilineStrings:!0}),["rc","rs","rust"]);
|
||||
i(C([],[["str",/^[\S\s]+/]]),["regex"]);var X=V.PR={createSimpleLexer:C,registerLangHandler:i,sourceDecorator:t,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:function(a,d,e){var b=document.createElement("div");b.innerHTML="<pre>"+a+"</pre>";b=b.firstChild;e&&z(b,e,!0);D({h:d,j:e,c:b,i:1});return b.innerHTML},
|
||||
prettyPrint:e=e=function(a,d){function e(){for(var b=V.PR_SHOULD_USE_CONTINUATION?c.now()+250:Infinity;p<j.length&&c.now()<b;p++){for(var d=j[p],m=k,l=d;l=l.previousSibling;){var n=l.nodeType,s=(n===7||n===8)&&l.nodeValue;if(s?!/^\??prettify\b/.test(s):n!==3||/\S/.test(l.nodeValue))break;if(s){m={};s.replace(/\b(\w+)=([\w%+\-.:]+)/g,function(a,b,c){m[b]=c});break}}l=d.className;if((m!==k||f.test(l))&&!w.test(l)){n=!1;for(s=d.parentNode;s;s=s.parentNode)if(g.test(s.tagName)&&s.className&&f.test(s.className)){n=
|
||||
!0;break}if(!n){d.className+=" prettyprinted";n=m.lang;if(!n){var n=l.match(q),A;if(!n&&(A=x(d))&&u.test(A.tagName))n=A.className.match(q);n&&(n=n[1])}if(y.test(d.tagName))s=1;else var s=d.currentStyle,v=i.defaultView,s=(s=s?s.whiteSpace:v&&v.getComputedStyle?v.getComputedStyle(d,r).getPropertyValue("white-space"):0)&&"pre"===s.substring(0,3);v=m.linenums;if(!(v=v==="true"||+v))v=(v=l.match(/\blinenums\b(?::(\d+))?/))?v[1]&&v[1].length?+v[1]:!0:!1;v&&z(d,v,s);t={h:n,c:d,j:v,i:s};D(t)}}}p<j.length?
|
||||
P(e,250):"function"===typeof a&&a()}for(var b=d||document.body,i=b.ownerDocument||document,b=[b.getElementsByTagName("pre"),b.getElementsByTagName("code"),b.getElementsByTagName("xmp")],j=[],m=0;m<b.length;++m)for(var l=0,n=b[m].length;l<n;++l)j.push(b[m][l]);var b=r,c=Date;c.now||(c={now:function(){return+new Date}});var p=0,t,q=/\blang(?:uage)?-([\w.]+)(?!\S)/,f=/\bprettyprint\b/,w=/\bprettyprinted\b/,y=/pre|xmp/i,u=/^code$/i,g=/^(?:pre|code|xmp)$/i,k={};e()}};typeof define==="function"&&define.amd&&
|
||||
define("google-code-prettify",[],function(){return X})})();return e}();R||P(Q,0)})();}()
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "google-code-prettify",
|
||||
"version": "1.0.1",
|
||||
"main": [
|
||||
"./bin/prettify.min.css",
|
||||
"./bin/prettify.min.js"
|
||||
],
|
||||
"dependencies": {},
|
||||
"ignore": [
|
||||
"closure-compiler",
|
||||
"js-modules",
|
||||
"tests",
|
||||
"yui-compressor",
|
||||
"Makefile"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Making Quines Prettier</title>
|
||||
<!-- The defer is not necessary for autoloading, but is necessary for the
|
||||
script at the bottom to work as a Quine. -->
|
||||
<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?autoload=true&skin=sunburst&lang=css" defer="defer"></script>
|
||||
<style>.operative { font-weight: bold; border:1px solid yellow }</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Making Quines Prettier</h1>
|
||||
|
||||
<p>
|
||||
Below is the content of this page prettified. The <code><pre></code>
|
||||
element is prettified because it has <code>class="prettyprint"</code> and
|
||||
because the sourced script loads a JavaScript library that styles source
|
||||
code.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The line numbers to the left appear because the preceding comment
|
||||
<code><?prettify lang=html linenums=true?></code> turns on
|
||||
line-numbering and the
|
||||
<a href="http://google-code-prettify.googlecode.com/svn/trunk/styles/index.html">stylesheet</a>
|
||||
(see <code>skin=sunburst</code> in the <code><script src></code>)
|
||||
specifies that every fifth line should be numbered.
|
||||
</p>
|
||||
|
||||
<!-- Language hints can be put in XML application directive style comments. -->
|
||||
<?prettify lang=html linenums=true?>
|
||||
<pre class="prettyprint" id="quine" style="border:4px solid #88c"></pre>
|
||||
|
||||
<script>//<![CDATA[
|
||||
(function () {
|
||||
function html(s) {
|
||||
return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
||||
}
|
||||
|
||||
var quineHtml = html(
|
||||
'<!DOCTYPE html>\n<html>\n'
|
||||
+ document.documentElement.innerHTML
|
||||
+ '\n<\/html>\n');
|
||||
|
||||
// Highlight the operative parts:
|
||||
quineHtml = quineHtml.replace(
|
||||
/<script src[\s\S]*?><\/script>|<!--\?[\s\S]*?-->|<pre\b[\s\S]*?<\/pre>/g,
|
||||
'<span class="operative">$&</span>');
|
||||
|
||||
document.getElementById("quine").innerHTML = quineHtml;
|
||||
})();
|
||||
//]]>
|
||||
</script></body>
|
||||
</html>
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
// Copyright (C) 2009 Onno Hommes.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for the AGC/AEA Assembly Language as described
|
||||
* at http://virtualagc.googlecode.com
|
||||
* <p>
|
||||
* This file could be used by goodle code to allow syntax highlight for
|
||||
* Virtual AGC SVN repository or if you don't want to commonize
|
||||
* the header for the agc/aea html assembly listing.
|
||||
*
|
||||
* @author ohommes@alumni.cmu.edu
|
||||
*/
|
||||
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer'](
|
||||
[
|
||||
// A line comment that starts with ;
|
||||
[PR['PR_COMMENT'], /^#[^\r\n]*/, null, '#'],
|
||||
// Whitespace
|
||||
[PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
|
||||
// A double quoted, possibly multi-line, string.
|
||||
[PR['PR_STRING'], /^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/, null, '"']
|
||||
],
|
||||
[
|
||||
[PR['PR_KEYWORD'], /^(?:ADS|AD|AUG|BZF|BZMF|CAE|CAF|CA|CCS|COM|CS|DAS|DCA|DCOM|DCS|DDOUBL|DIM|DOUBLE|DTCB|DTCF|DV|DXCH|EDRUPT|EXTEND|INCR|INDEX|NDX|INHINT|LXCH|MASK|MSK|MP|MSU|NOOP|OVSK|QXCH|RAND|READ|RELINT|RESUME|RETURN|ROR|RXOR|SQUARE|SU|TCR|TCAA|OVSK|TCF|TC|TS|WAND|WOR|WRITE|XCH|XLQ|XXALQ|ZL|ZQ|ADD|ADZ|SUB|SUZ|MPY|MPR|MPZ|DVP|COM|ABS|CLA|CLZ|LDQ|STO|STQ|ALS|LLS|LRS|TRA|TSQ|TMI|TOV|AXT|TIX|DLY|INP|OUT)\s/,null],
|
||||
[PR['PR_TYPE'], /^(?:-?GENADR|=MINUS|2BCADR|VN|BOF|MM|-?2CADR|-?[1-6]DNADR|ADRES|BBCON|[SE]?BANK\=?|BLOCK|BNKSUM|E?CADR|COUNT\*?|2?DEC\*?|-?DNCHAN|-?DNPTR|EQUALS|ERASE|MEMORY|2?OCT|REMADR|SETLOC|SUBRO|ORG|BSS|BES|SYN|EQU|DEFINE|END)\s/,null],
|
||||
// A single quote possibly followed by a word that optionally ends with
|
||||
// = ! or ?.
|
||||
[PR['PR_LITERAL'],
|
||||
/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],
|
||||
// Any word including labels that optionally ends with = ! or ?.
|
||||
[PR['PR_PLAIN'],
|
||||
/^-*(?:[!-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],
|
||||
// A printable non-space non-special character
|
||||
[PR['PR_PUNCTUATION'], /^[^\w\t\n\r \xA0()\"\\\';]+/]
|
||||
]),
|
||||
['apollo', 'agc', 'aea']);
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
// Contributed by peter dot kofler at code minus cop dot org
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for Basic.
|
||||
*
|
||||
* To use, include prettify.js and this file in your HTML page.
|
||||
* Then put your code in an HTML tag like
|
||||
* <pre class="prettyprint lang-basic">(my BASIC code)</pre>
|
||||
*
|
||||
* @author peter dot kofler at code minus cop dot org
|
||||
*/
|
||||
|
||||
PR.registerLangHandler(
|
||||
PR.createSimpleLexer(
|
||||
[ // shortcutStylePatterns
|
||||
// "single-line-string"
|
||||
[PR.PR_STRING, /^(?:"(?:[^\\"\r\n]|\\.)*(?:"|$))/, null, '"'],
|
||||
// Whitespace
|
||||
[PR.PR_PLAIN, /^\s+/, null, ' \r\n\t\xA0']
|
||||
],
|
||||
[ // fallthroughStylePatterns
|
||||
// A line comment that starts with REM
|
||||
[PR.PR_COMMENT, /^REM[^\r\n]*/, null],
|
||||
[PR.PR_KEYWORD, /^\b(?:AND|CLOSE|CLR|CMD|CONT|DATA|DEF ?FN|DIM|END|FOR|GET|GOSUB|GOTO|IF|INPUT|LET|LIST|LOAD|NEW|NEXT|NOT|ON|OPEN|OR|POKE|PRINT|READ|RESTORE|RETURN|RUN|SAVE|STEP|STOP|SYS|THEN|TO|VERIFY|WAIT)\b/, null],
|
||||
[PR.PR_PLAIN, /^[A-Z][A-Z0-9]?(?:\$|%)?/i, null],
|
||||
// Literals .0, 0, 0.0 0E13
|
||||
[PR.PR_LITERAL, /^(?:\d+(?:\.\d*)?|\.\d+)(?:e[+\-]?\d+)?/i, null, '0123456789'],
|
||||
[PR.PR_PUNCTUATION, /^.[^\s\w\.$%"]*/, null]
|
||||
// [PR.PR_PUNCTUATION, /^[-,:;!<>=\+^\/\*]+/]
|
||||
]),
|
||||
['basic','cbm']);
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* @license Copyright (C) 2011 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for Clojure.
|
||||
*
|
||||
*
|
||||
* To use, include prettify.js and this file in your HTML page.
|
||||
* Then put your code in an HTML tag like
|
||||
* <pre class="prettyprint lang-lisp">(my lisp code)</pre>
|
||||
* The lang-cl class identifies the language as common lisp.
|
||||
* This file supports the following language extensions:
|
||||
* lang-clj - Clojure
|
||||
*
|
||||
*
|
||||
* I used lang-lisp.js as the basis for this adding the clojure specific
|
||||
* keywords and syntax.
|
||||
*
|
||||
* "Name" = 'Clojure'
|
||||
* "Author" = 'Rich Hickey'
|
||||
* "Version" = '1.2'
|
||||
* "About" = 'Clojure is a lisp for the jvm with concurrency primitives and a richer set of types.'
|
||||
*
|
||||
*
|
||||
* I used <a href="http://clojure.org/Reference">Clojure.org Reference</a> as
|
||||
* the basis for the reserved word list.
|
||||
*
|
||||
*
|
||||
* @author jwall@google.com
|
||||
*/
|
||||
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer'](
|
||||
[
|
||||
// clojure has more paren types than minimal lisp.
|
||||
['opn', /^[\(\{\[]+/, null, '([{'],
|
||||
['clo', /^[\)\}\]]+/, null, ')]}'],
|
||||
// A line comment that starts with ;
|
||||
[PR['PR_COMMENT'], /^;[^\r\n]*/, null, ';'],
|
||||
// Whitespace
|
||||
[PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
|
||||
// A double quoted, possibly multi-line, string.
|
||||
[PR['PR_STRING'], /^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/, null, '"']
|
||||
],
|
||||
[
|
||||
// clojure has a much larger set of keywords
|
||||
[PR['PR_KEYWORD'], /^(?:def|if|do|let|quote|var|fn|loop|recur|throw|try|monitor-enter|monitor-exit|defmacro|defn|defn-|macroexpand|macroexpand-1|for|doseq|dosync|dotimes|and|or|when|not|assert|doto|proxy|defstruct|first|rest|cons|defprotocol|deftype|defrecord|reify|defmulti|defmethod|meta|with-meta|ns|in-ns|create-ns|import|intern|refer|alias|namespace|resolve|ref|deref|refset|new|set!|memfn|to-array|into-array|aset|gen-class|reduce|map|filter|find|nil?|empty?|hash-map|hash-set|vec|vector|seq|flatten|reverse|assoc|dissoc|list|list?|disj|get|union|difference|intersection|extend|extend-type|extend-protocol|prn)\b/, null],
|
||||
[PR['PR_TYPE'], /^:[0-9a-zA-Z\-]+/]
|
||||
]),
|
||||
['clj']);
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
// Copyright (C) 2009 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for CSS.
|
||||
*
|
||||
*
|
||||
* To use, include prettify.js and this file in your HTML page.
|
||||
* Then put your code in an HTML tag like
|
||||
* <pre class="prettyprint lang-css"></pre>
|
||||
*
|
||||
*
|
||||
* http://www.w3.org/TR/CSS21/grammar.html Section G2 defines the lexical
|
||||
* grammar. This scheme does not recognize keywords containing escapes.
|
||||
*
|
||||
* @author mikesamuel@gmail.com
|
||||
*/
|
||||
|
||||
// This file is a call to a function defined in prettify.js which defines a
|
||||
// lexical scanner for CSS and maps tokens to styles.
|
||||
|
||||
// The call to PR['registerLangHandler'] is quoted so that Closure Compiler
|
||||
// will not rename the call so that this language extensions can be
|
||||
// compiled/minified separately from one another. Other symbols defined in
|
||||
// prettify.js are similarly quoted.
|
||||
|
||||
// The call is structured thus:
|
||||
// PR['registerLangHandler'](
|
||||
// PR['createSimpleLexer'](
|
||||
// shortcutPatterns,
|
||||
// fallThroughPatterns),
|
||||
// [languageId0, ..., languageIdN])
|
||||
|
||||
// Langugage IDs
|
||||
// =============
|
||||
// The language IDs are typically the file extensions of source files for
|
||||
// that language so that users can syntax highlight arbitrary files based
|
||||
// on just the extension. This is heuristic, but works pretty well in
|
||||
// practice.
|
||||
|
||||
// Patterns
|
||||
// ========
|
||||
// Lexers are typically implemented as a set of regular expressions.
|
||||
// The SimpleLexer function takes regular expressions, styles, and some
|
||||
// pragma-info and produces a lexer. A token description looks like
|
||||
// [STYLE_NAME, /regular-expression/, pragmas]
|
||||
|
||||
// Initially, simple lexer's inner loop looked like:
|
||||
|
||||
// while sourceCode is not empty:
|
||||
// try each regular expression in order until one matches
|
||||
// remove the matched portion from sourceCode
|
||||
|
||||
// This was really slow for large files because some JS interpreters
|
||||
// do a buffer copy on the matched portion which is O(n*n)
|
||||
|
||||
// The current loop now looks like
|
||||
|
||||
// 1. use js-modules/combinePrefixPatterns.js to
|
||||
// combine all regular expressions into one
|
||||
// 2. use a single global regular expresion match to extract all tokens
|
||||
// 3. for each token try regular expressions in order until one matches it
|
||||
// and classify it using the associated style
|
||||
|
||||
// This is a lot more efficient but it does mean that lookahead and lookbehind
|
||||
// can't be used across boundaries to classify tokens.
|
||||
|
||||
// Sometimes we need lookahead and lookbehind and sometimes we want to handle
|
||||
// embedded language -- JavaScript or CSS embedded in HTML, or inline assembly
|
||||
// in C.
|
||||
|
||||
// If a particular pattern has a numbered group, and its style pattern starts
|
||||
// with "lang-" as in
|
||||
// ['lang-js', /<script>(.*?)<\/script>/]
|
||||
// then the token classification step breaks the token into pieces.
|
||||
// Group 1 is re-parsed using the language handler for "lang-js", and the
|
||||
// surrounding portions are reclassified using the current language handler.
|
||||
// This mechanism gives us both lookahead, lookbehind, and language embedding.
|
||||
|
||||
// Shortcut Patterns
|
||||
// =================
|
||||
// A shortcut pattern is one that is tried before other patterns if the first
|
||||
// character in the token is in the string of characters.
|
||||
// This very effectively lets us make quick correct decisions for common token
|
||||
// types.
|
||||
|
||||
// All other patterns are fall-through patterns.
|
||||
|
||||
|
||||
|
||||
// The comments inline below refer to productions in the CSS specification's
|
||||
// lexical grammar. See link above.
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer'](
|
||||
// Shortcut patterns.
|
||||
[
|
||||
// The space production <s>
|
||||
[PR['PR_PLAIN'], /^[ \t\r\n\f]+/, null, ' \t\r\n\f']
|
||||
],
|
||||
// Fall-through patterns.
|
||||
[
|
||||
// Quoted strings. <string1> and <string2>
|
||||
[PR['PR_STRING'],
|
||||
/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/, null],
|
||||
[PR['PR_STRING'],
|
||||
/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/, null],
|
||||
['lang-css-str', /^url\(([^\)\"\']+)\)/i],
|
||||
[PR['PR_KEYWORD'],
|
||||
/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,
|
||||
null],
|
||||
// A property name -- an identifier followed by a colon.
|
||||
['lang-css-kw', /^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],
|
||||
// A C style block comment. The <comment> production.
|
||||
[PR['PR_COMMENT'], /^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],
|
||||
// Escaping text spans
|
||||
[PR['PR_COMMENT'], /^(?:<!--|-->)/],
|
||||
// A number possibly containing a suffix.
|
||||
[PR['PR_LITERAL'], /^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],
|
||||
// A hex color
|
||||
[PR['PR_LITERAL'], /^#(?:[0-9a-f]{3}){1,2}\b/i],
|
||||
// An identifier
|
||||
[PR['PR_PLAIN'],
|
||||
/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],
|
||||
// A run of punctuation
|
||||
[PR['PR_PUNCTUATION'], /^[^\s\w\'\"]+/]
|
||||
]),
|
||||
['css']);
|
||||
// Above we use embedded languages to highlight property names (identifiers
|
||||
// followed by a colon) differently from identifiers in values.
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer']([],
|
||||
[
|
||||
[PR['PR_KEYWORD'],
|
||||
/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]
|
||||
]),
|
||||
['css-kw']);
|
||||
// The content of an unquoted URL literal like url(http://foo/img.png) should
|
||||
// be colored as string content. This language handler is used above in the
|
||||
// URL production to do so.
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer']([],
|
||||
[
|
||||
[PR['PR_STRING'], /^[^\)\"\']+/]
|
||||
]),
|
||||
['css-str']);
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
// Copyright (C) 2013 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler Dart.
|
||||
* Loosely structured based on the DartLexer in Pygments: http://pygments.org/.
|
||||
*
|
||||
* To use, include prettify.js and this file in your HTML page.
|
||||
* Then put your code in an HTML tag like
|
||||
* <pre class="prettyprint lang-dart">(Dart code)</pre>
|
||||
*
|
||||
* @author armstrong.timothy@gmail.com
|
||||
*/
|
||||
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer'](
|
||||
[
|
||||
// Whitespace.
|
||||
[PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0']
|
||||
],
|
||||
[
|
||||
// Script tag.
|
||||
[PR['PR_COMMENT'], /^#!(?:.*)/],
|
||||
|
||||
// `import`, `library`, `part of`, `part`, `as`, `show`, and `hide`
|
||||
// keywords.
|
||||
[PR['PR_KEYWORD'], /^\b(?:import|library|part of|part|as|show|hide)\b/i],
|
||||
|
||||
// Single-line comments.
|
||||
[PR['PR_COMMENT'], /^\/\/(?:.*)/],
|
||||
|
||||
// Multiline comments.
|
||||
[PR['PR_COMMENT'], /^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//], // */
|
||||
|
||||
// `class` and `interface` keywords.
|
||||
[PR['PR_KEYWORD'], /^\b(?:class|interface)\b/i],
|
||||
|
||||
// General keywords.
|
||||
[PR['PR_KEYWORD'], /^\b(?:assert|break|case|catch|continue|default|do|else|finally|for|if|in|is|new|return|super|switch|this|throw|try|while)\b/i],
|
||||
|
||||
// Declaration keywords.
|
||||
[PR['PR_KEYWORD'], /^\b(?:abstract|const|extends|factory|final|get|implements|native|operator|set|static|typedef|var)\b/i],
|
||||
|
||||
// Keywords for types.
|
||||
[PR['PR_TYPE'], /^\b(?:bool|double|Dynamic|int|num|Object|String|void)\b/i],
|
||||
|
||||
// Keywords for constants.
|
||||
[PR['PR_KEYWORD'], /^\b(?:false|null|true)\b/i],
|
||||
|
||||
// Multiline strings, single- and double-quoted.
|
||||
[PR['PR_STRING'], /^r?[\']{3}[\s|\S]*?[^\\][\']{3}/],
|
||||
[PR['PR_STRING'], /^r?[\"]{3}[\s|\S]*?[^\\][\"]{3}/],
|
||||
|
||||
// Normal and raw strings, single- and double-quoted.
|
||||
[PR['PR_STRING'], /^r?\'(\'|(?:[^\n\r\f])*?[^\\]\')/],
|
||||
[PR['PR_STRING'], /^r?\"(\"|(?:[^\n\r\f])*?[^\\]\")/],
|
||||
|
||||
// Identifiers.
|
||||
[PR['PR_PLAIN'], /^[a-z_$][a-z0-9_]*/i],
|
||||
|
||||
// Operators.
|
||||
[PR['PR_PUNCTUATION'], /^[~!%^&*+=|?:<>/-]/],
|
||||
|
||||
// Hex numbers.
|
||||
[PR['PR_LITERAL'], /^\b0x[0-9a-f]+/i],
|
||||
|
||||
// Decimal numbers.
|
||||
[PR['PR_LITERAL'], /^\b\d+(?:\.\d*)?(?:e[+-]?\d+)?/i],
|
||||
[PR['PR_LITERAL'], /^\b\.\d+(?:e[+-]?\d+)?/i],
|
||||
|
||||
// Punctuation.
|
||||
[PR['PR_PUNCTUATION'], /^[(){}\[\],.;]/]
|
||||
]),
|
||||
['dart']);
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
// Copyright (C) 2013 Andrew Allen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for Erlang.
|
||||
*
|
||||
* Derived from https://raw.github.com/erlang/otp/dev/lib/compiler/src/core_parse.yrl
|
||||
* Modified from Mike Samuel's Haskell plugin for google-code-prettify
|
||||
*
|
||||
* @author achew22@gmail.com
|
||||
*/
|
||||
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer'](
|
||||
[
|
||||
// Whitespace
|
||||
// whitechar -> newline | vertab | space | tab | uniWhite
|
||||
// newline -> return linefeed | return | linefeed | formfeed
|
||||
[PR['PR_PLAIN'], /^[\t\n\x0B\x0C\r ]+/, null, '\t\n\x0B\x0C\r '],
|
||||
// Single line double-quoted strings.
|
||||
[PR['PR_STRING'], /^\"(?:[^\"\\\n\x0C\r]|\\[\s\S])*(?:\"|$)/,
|
||||
null, '"'],
|
||||
|
||||
// Handle atoms
|
||||
[PR['PR_LITERAL'], /^[a-z][a-zA-Z0-9_]*/],
|
||||
// Handle single quoted atoms
|
||||
[PR['PR_LITERAL'], /^\'(?:[^\'\\\n\x0C\r]|\\[^&])+\'?/,
|
||||
null, "'"],
|
||||
|
||||
// Handle macros. Just to be extra clear on this one, it detects the ?
|
||||
// then uses the regexp to end it so be very careful about matching
|
||||
// all the terminal elements
|
||||
[PR['PR_LITERAL'], /^\?[^ \t\n({]+/, null, "?"],
|
||||
|
||||
|
||||
|
||||
// decimal -> digit{digit}
|
||||
// octal -> octit{octit}
|
||||
// hexadecimal -> hexit{hexit}
|
||||
// integer -> decimal
|
||||
// | 0o octal | 0O octal
|
||||
// | 0x hexadecimal | 0X hexadecimal
|
||||
// float -> decimal . decimal [exponent]
|
||||
// | decimal exponent
|
||||
// exponent -> (e | E) [+ | -] decimal
|
||||
[PR['PR_LITERAL'],
|
||||
/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+\-]?\d+)?)/i,
|
||||
null, '0123456789']
|
||||
],
|
||||
[
|
||||
// TODO: catch @declarations inside comments
|
||||
|
||||
// Comments in erlang are started with % and go till a newline
|
||||
[PR['PR_COMMENT'], /^%[^\n]*/],
|
||||
|
||||
// Catch macros
|
||||
//[PR['PR_TAG'], /?[^( \n)]+/],
|
||||
|
||||
/**
|
||||
* %% Keywords (atoms are assumed to always be single-quoted).
|
||||
* 'module' 'attributes' 'do' 'let' 'in' 'letrec'
|
||||
* 'apply' 'call' 'primop'
|
||||
* 'case' 'of' 'end' 'when' 'fun' 'try' 'catch' 'receive' 'after'
|
||||
*/
|
||||
[PR['PR_KEYWORD'], /^(?:module|attributes|do|let|in|letrec|apply|call|primop|case|of|end|when|fun|try|catch|receive|after|char|integer|float,atom,string,var)\b/],
|
||||
|
||||
/**
|
||||
* Catch definitions (usually defined at the top of the file)
|
||||
* Anything that starts -something
|
||||
*/
|
||||
[PR['PR_KEYWORD'], /^-[a-z_]+/],
|
||||
|
||||
// Catch variables
|
||||
[PR['PR_TYPE'], /^[A-Z_][a-zA-Z0-9_]*/],
|
||||
|
||||
// matches the symbol production
|
||||
[PR['PR_PUNCTUATION'], /^[.,;]/]
|
||||
]),
|
||||
['erlang', 'erl']);
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
// Copyright (C) 2010 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for the Go language..
|
||||
* <p>
|
||||
* Based on the lexical grammar at
|
||||
* http://golang.org/doc/go_spec.html#Lexical_elements
|
||||
* <p>
|
||||
* Go uses a minimal style for highlighting so the below does not distinguish
|
||||
* strings, keywords, literals, etc. by design.
|
||||
* From a discussion with the Go designers:
|
||||
* <pre>
|
||||
* On Thursday, July 22, 2010, Mike Samuel <...> wrote:
|
||||
* > On Thu, Jul 22, 2010, Rob 'Commander' Pike <...> wrote:
|
||||
* >> Personally, I would vote for the subdued style godoc presents at http://golang.org
|
||||
* >>
|
||||
* >> Not as fancy as some like, but a case can be made it's the official style.
|
||||
* >> If people want more colors, I wouldn't fight too hard, in the interest of
|
||||
* >> encouragement through familiarity, but even then I would ask to shy away
|
||||
* >> from technicolor starbursts.
|
||||
* >
|
||||
* > Like http://golang.org/pkg/go/scanner/ where comments are blue and all
|
||||
* > other content is black? I can do that.
|
||||
* </pre>
|
||||
*
|
||||
* @author mikesamuel@gmail.com
|
||||
*/
|
||||
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer'](
|
||||
[
|
||||
// Whitespace is made up of spaces, tabs and newline characters.
|
||||
[PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
|
||||
// Not escaped as a string. See note on minimalism above.
|
||||
[PR['PR_PLAIN'], /^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])+(?:\'|$)|`[^`]*(?:`|$))/, null, '"\'']
|
||||
],
|
||||
[
|
||||
// Block comments are delimited by /* and */.
|
||||
// Single-line comments begin with // and extend to the end of a line.
|
||||
[PR['PR_COMMENT'], /^(?:\/\/[^\r\n]*|\/\*[\s\S]*?\*\/)/],
|
||||
[PR['PR_PLAIN'], /^(?:[^\/\"\'`]|\/(?![\/\*]))+/i]
|
||||
]),
|
||||
['go']);
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
// Copyright (C) 2009 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for Haskell.
|
||||
*
|
||||
*
|
||||
* To use, include prettify.js and this file in your HTML page.
|
||||
* Then put your code in an HTML tag like
|
||||
* <pre class="prettyprint lang-hs">(my lisp code)</pre>
|
||||
* The lang-cl class identifies the language as common lisp.
|
||||
* This file supports the following language extensions:
|
||||
* lang-cl - Common Lisp
|
||||
* lang-el - Emacs Lisp
|
||||
* lang-lisp - Lisp
|
||||
* lang-scm - Scheme
|
||||
*
|
||||
*
|
||||
* I used http://www.informatik.uni-freiburg.de/~thiemann/haskell/haskell98-report-html/syntax-iso.html
|
||||
* as the basis, but ignore the way the ncomment production nests since this
|
||||
* makes the lexical grammar irregular. It might be possible to support
|
||||
* ncomments using the lookbehind filter.
|
||||
*
|
||||
*
|
||||
* @author mikesamuel@gmail.com
|
||||
*/
|
||||
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer'](
|
||||
[
|
||||
// Whitespace
|
||||
// whitechar -> newline | vertab | space | tab | uniWhite
|
||||
// newline -> return linefeed | return | linefeed | formfeed
|
||||
[PR['PR_PLAIN'], /^[\t\n\x0B\x0C\r ]+/, null, '\t\n\x0B\x0C\r '],
|
||||
// Single line double and single-quoted strings.
|
||||
// char -> ' (graphic<' | \> | space | escape<\&>) '
|
||||
// string -> " {graphic<" | \> | space | escape | gap}"
|
||||
// escape -> \ ( charesc | ascii | decimal | o octal
|
||||
// | x hexadecimal )
|
||||
// charesc -> a | b | f | n | r | t | v | \ | " | ' | &
|
||||
[PR['PR_STRING'], /^\"(?:[^\"\\\n\x0C\r]|\\[\s\S])*(?:\"|$)/,
|
||||
null, '"'],
|
||||
[PR['PR_STRING'], /^\'(?:[^\'\\\n\x0C\r]|\\[^&])\'?/,
|
||||
null, "'"],
|
||||
// decimal -> digit{digit}
|
||||
// octal -> octit{octit}
|
||||
// hexadecimal -> hexit{hexit}
|
||||
// integer -> decimal
|
||||
// | 0o octal | 0O octal
|
||||
// | 0x hexadecimal | 0X hexadecimal
|
||||
// float -> decimal . decimal [exponent]
|
||||
// | decimal exponent
|
||||
// exponent -> (e | E) [+ | -] decimal
|
||||
[PR['PR_LITERAL'],
|
||||
/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+\-]?\d+)?)/i,
|
||||
null, '0123456789']
|
||||
],
|
||||
[
|
||||
// Haskell does not have a regular lexical grammar due to the nested
|
||||
// ncomment.
|
||||
// comment -> dashes [ any<symbol> {any}] newline
|
||||
// ncomment -> opencom ANYseq {ncomment ANYseq}closecom
|
||||
// dashes -> '--' {'-'}
|
||||
// opencom -> '{-'
|
||||
// closecom -> '-}'
|
||||
[PR['PR_COMMENT'], /^(?:(?:--+(?:[^\r\n\x0C]*)?)|(?:\{-(?:[^-]|-+[^-\}])*-\}))/],
|
||||
// reservedid -> case | class | data | default | deriving | do
|
||||
// | else | if | import | in | infix | infixl | infixr
|
||||
// | instance | let | module | newtype | of | then
|
||||
// | type | where | _
|
||||
[PR['PR_KEYWORD'], /^(?:case|class|data|default|deriving|do|else|if|import|in|infix|infixl|infixr|instance|let|module|newtype|of|then|type|where|_)(?=[^a-zA-Z0-9\']|$)/, null],
|
||||
// qvarid -> [ modid . ] varid
|
||||
// qconid -> [ modid . ] conid
|
||||
// varid -> (small {small | large | digit | ' })<reservedid>
|
||||
// conid -> large {small | large | digit | ' }
|
||||
// modid -> conid
|
||||
// small -> ascSmall | uniSmall | _
|
||||
// ascSmall -> a | b | ... | z
|
||||
// uniSmall -> any Unicode lowercase letter
|
||||
// large -> ascLarge | uniLarge
|
||||
// ascLarge -> A | B | ... | Z
|
||||
// uniLarge -> any uppercase or titlecase Unicode letter
|
||||
[PR['PR_PLAIN'], /^(?:[A-Z][\w\']*\.)*[a-zA-Z][\w\']*/],
|
||||
// matches the symbol production
|
||||
[PR['PR_PUNCTUATION'], /^[^\t\n\x0B\x0C\r a-zA-Z0-9\'\"]+/]
|
||||
]),
|
||||
['hs']);
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
// Copyright (C) 2008 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for Common Lisp and related languages.
|
||||
*
|
||||
*
|
||||
* To use, include prettify.js and this file in your HTML page.
|
||||
* Then put your code in an HTML tag like
|
||||
* <pre class="prettyprint lang-lisp">(my lisp code)</pre>
|
||||
* The lang-cl class identifies the language as common lisp.
|
||||
* This file supports the following language extensions:
|
||||
* lang-cl - Common Lisp
|
||||
* lang-el - Emacs Lisp
|
||||
* lang-lisp - Lisp
|
||||
* lang-scm - Scheme
|
||||
* lang-lsp - FAT 8.3 filename version of lang-lisp.
|
||||
*
|
||||
*
|
||||
* I used http://www.devincook.com/goldparser/doc/meta-language/grammar-LISP.htm
|
||||
* as the basis, but added line comments that start with ; and changed the atom
|
||||
* production to disallow unquoted semicolons.
|
||||
*
|
||||
* "Name" = 'LISP'
|
||||
* "Author" = 'John McCarthy'
|
||||
* "Version" = 'Minimal'
|
||||
* "About" = 'LISP is an abstract language that organizes ALL'
|
||||
* | 'data around "lists".'
|
||||
*
|
||||
* "Start Symbol" = [s-Expression]
|
||||
*
|
||||
* {Atom Char} = {Printable} - {Whitespace} - [()"\'']
|
||||
*
|
||||
* Atom = ( {Atom Char} | '\'{Printable} )+
|
||||
*
|
||||
* [s-Expression] ::= [Quote] Atom
|
||||
* | [Quote] '(' [Series] ')'
|
||||
* | [Quote] '(' [s-Expression] '.' [s-Expression] ')'
|
||||
*
|
||||
* [Series] ::= [s-Expression] [Series]
|
||||
* |
|
||||
*
|
||||
* [Quote] ::= '' !Quote = do not evaluate
|
||||
* |
|
||||
*
|
||||
*
|
||||
* I used <a href="http://gigamonkeys.com/book/">Practical Common Lisp</a> as
|
||||
* the basis for the reserved word list.
|
||||
*
|
||||
*
|
||||
* @author mikesamuel@gmail.com
|
||||
*/
|
||||
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer'](
|
||||
[
|
||||
['opn', /^\(+/, null, '('],
|
||||
['clo', /^\)+/, null, ')'],
|
||||
// A line comment that starts with ;
|
||||
[PR['PR_COMMENT'], /^;[^\r\n]*/, null, ';'],
|
||||
// Whitespace
|
||||
[PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
|
||||
// A double quoted, possibly multi-line, string.
|
||||
[PR['PR_STRING'], /^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/, null, '"']
|
||||
],
|
||||
[
|
||||
[PR['PR_KEYWORD'], /^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/, null],
|
||||
[PR['PR_LITERAL'],
|
||||
/^[+\-]?(?:[0#]x[0-9a-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[ed][+\-]?\d+)?)/i],
|
||||
// A single quote possibly followed by a word that optionally ends with
|
||||
// = ! or ?.
|
||||
[PR['PR_LITERAL'],
|
||||
/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],
|
||||
// A word that optionally ends with = ! or ?.
|
||||
[PR['PR_PLAIN'],
|
||||
/^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],
|
||||
// A printable non-space non-special character
|
||||
[PR['PR_PUNCTUATION'], /^[^\w\t\n\r \xA0()\"\\\';]+/]
|
||||
]),
|
||||
['cl', 'el', 'lisp', 'lsp', 'scm', 'ss', 'rkt']);
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
// Copyright (C) 2013 Nikhil Dabas
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for LLVM.
|
||||
* From https://gist.github.com/ndabas/2850418
|
||||
*
|
||||
*
|
||||
* To use, include prettify.js and this file in your HTML page.
|
||||
* Then put your code in an HTML tag like
|
||||
* <pre class="prettyprint lang-llvm">(my LLVM code)</pre>
|
||||
*
|
||||
*
|
||||
* The regular expressions were adapted from:
|
||||
* https://github.com/hansstimer/llvm.tmbundle/blob/76fedd8f50fd6108b1780c51d79fbe3223de5f34/Syntaxes/LLVM.tmLanguage
|
||||
*
|
||||
* http://llvm.org/docs/LangRef.html#constants describes the language grammar.
|
||||
*
|
||||
* @author Nikhil Dabas
|
||||
*/
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer'](
|
||||
[
|
||||
// Whitespace
|
||||
[PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
|
||||
// A double quoted, possibly multi-line, string.
|
||||
[PR['PR_STRING'], /^!?\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/, null, '"'],
|
||||
// comment.llvm
|
||||
[PR['PR_COMMENT'], /^;[^\r\n]*/, null, ';']
|
||||
],
|
||||
[
|
||||
// variable.llvm
|
||||
[PR['PR_PLAIN'], /^[%@!](?:[-a-zA-Z$._][-a-zA-Z$._0-9]*|\d+)/],
|
||||
|
||||
// According to http://llvm.org/docs/LangRef.html#well-formedness
|
||||
// These reserved words cannot conflict with variable names, because none of them start with a prefix character ('%' or '@').
|
||||
[PR['PR_KEYWORD'], /^[A-Za-z_][0-9A-Za-z_]*/, null],
|
||||
|
||||
// constant.numeric.float.llvm
|
||||
[PR['PR_LITERAL'], /^\d+\.\d+/],
|
||||
|
||||
// constant.numeric.integer.llvm
|
||||
[PR['PR_LITERAL'], /^(?:\d+|0[xX][a-fA-F0-9]+)/],
|
||||
|
||||
// punctuation
|
||||
[PR['PR_PUNCTUATION'], /^[()\[\]{},=*<>:]|\.\.\.$/]
|
||||
]),
|
||||
['llvm', 'll']);
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
// Copyright (C) 2008 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for Lua.
|
||||
*
|
||||
*
|
||||
* To use, include prettify.js and this file in your HTML page.
|
||||
* Then put your code in an HTML tag like
|
||||
* <pre class="prettyprint lang-lua">(my Lua code)</pre>
|
||||
*
|
||||
*
|
||||
* I used http://www.lua.org/manual/5.1/manual.html#2.1
|
||||
* Because of the long-bracket concept used in strings and comments, Lua does
|
||||
* not have a regular lexical grammar, but luckily it fits within the space
|
||||
* of irregular grammars supported by javascript regular expressions.
|
||||
*
|
||||
* @author mikesamuel@gmail.com
|
||||
*/
|
||||
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer'](
|
||||
[
|
||||
// Whitespace
|
||||
[PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
|
||||
// A double or single quoted, possibly multi-line, string.
|
||||
[PR['PR_STRING'], /^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])*(?:\'|$))/, null, '"\'']
|
||||
],
|
||||
[
|
||||
// A comment is either a line comment that starts with two dashes, or
|
||||
// two dashes preceding a long bracketed block.
|
||||
[PR['PR_COMMENT'], /^--(?:\[(=*)\[[\s\S]*?(?:\]\1\]|$)|[^\r\n]*)/],
|
||||
// A long bracketed block not preceded by -- is a string.
|
||||
[PR['PR_STRING'], /^\[(=*)\[[\s\S]*?(?:\]\1\]|$)/],
|
||||
[PR['PR_KEYWORD'], /^(?:and|break|do|else|elseif|end|false|for|function|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/, null],
|
||||
// A number is a hex integer literal, a decimal real literal, or in
|
||||
// scientific notation.
|
||||
[PR['PR_LITERAL'],
|
||||
/^[+-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],
|
||||
// An identifier
|
||||
[PR['PR_PLAIN'], /^[a-z_]\w*/i],
|
||||
// A run of punctuation
|
||||
[PR['PR_PUNCTUATION'], /^[^\w\t\n\r \xA0][^\w\t\n\r \xA0\"\'\-\+=]*/]
|
||||
]),
|
||||
['lua']);
|
||||
+180
@@ -0,0 +1,180 @@
|
||||
// Copyright (c) 2013 by Amro <amroamroamro@gmail.com>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for MATLAB.
|
||||
*
|
||||
* To use, include prettify.js and this file in your HTML page.
|
||||
* Then put your code inside an HTML tag like
|
||||
* <pre class="prettyprint lang-matlab">
|
||||
* </pre>
|
||||
*
|
||||
* @see https://github.com/amroamroamro/prettify-matlab
|
||||
*/
|
||||
(function (PR) {
|
||||
/*
|
||||
PR_PLAIN: plain text
|
||||
PR_STRING: string literals
|
||||
PR_KEYWORD: keywords
|
||||
PR_COMMENT: comments
|
||||
PR_TYPE: types
|
||||
PR_LITERAL: literal values (1, null, true, ..)
|
||||
PR_PUNCTUATION: punctuation string
|
||||
PR_SOURCE: embedded source
|
||||
PR_DECLARATION: markup declaration such as a DOCTYPE
|
||||
PR_TAG: sgml tag
|
||||
PR_ATTRIB_NAME: sgml attribute name
|
||||
PR_ATTRIB_VALUE: sgml attribute value
|
||||
*/
|
||||
var PR_IDENTIFIER = "ident",
|
||||
PR_CONSTANT = "const",
|
||||
PR_FUNCTION = "fun",
|
||||
PR_FUNCTION_TOOLBOX = "fun_tbx",
|
||||
PR_SYSCMD = "syscmd",
|
||||
PR_CODE_OUTPUT = "codeoutput",
|
||||
PR_ERROR = "err",
|
||||
PR_WARNING = "wrn",
|
||||
PR_TRANSPOSE = "transpose",
|
||||
PR_LINE_CONTINUATION = "linecont";
|
||||
|
||||
// Refer to: http://www.mathworks.com/help/matlab/functionlist-alpha.html
|
||||
var coreFunctions = [
|
||||
'abs|accumarray|acos(?:d|h)?|acot(?:d|h)?|acsc(?:d|h)?|actxcontrol(?:list|select)?|actxGetRunningServer|actxserver|addlistener|addpath|addpref|addtodate|airy|align|alim|all|allchild|alpha|alphamap|amd|ancestor|and|angle|annotation|any|area|arrayfun|asec(?:d|h)?|asin(?:d|h)?|assert|assignin|atan(?:2|d|h)?|audiodevinfo|audioplayer|audiorecorder|aufinfo|auread|autumn|auwrite|avifile|aviinfo|aviread|axes|axis|balance|bar(?:3|3h|h)?|base2dec|beep|BeginInvoke|bench|bessel(?:h|i|j|k|y)|beta|betainc|betaincinv|betaln|bicg|bicgstab|bicgstabl|bin2dec|bitand|bitcmp|bitget|bitmax|bitnot|bitor|bitset|bitshift|bitxor|blanks|blkdiag|bone|box|brighten|brush|bsxfun|builddocsearchdb|builtin|bvp4c|bvp5c|bvpget|bvpinit|bvpset|bvpxtend|calendar|calllib|callSoapService|camdolly|cameratoolbar|camlight|camlookat|camorbit|campan|campos|camproj|camroll|camtarget|camup|camva|camzoom|cart2pol|cart2sph|cast|cat|caxis|cd|cdf2rdf|cdfepoch|cdfinfo|cdflib(?:\.(?:close|closeVar|computeEpoch|computeEpoch16|create|createAttr|createVar|delete|deleteAttr|deleteAttrEntry|deleteAttrgEntry|deleteVar|deleteVarRecords|epoch16Breakdown|epochBreakdown|getAttrEntry|getAttrgEntry|getAttrMaxEntry|getAttrMaxgEntry|getAttrName|getAttrNum|getAttrScope|getCacheSize|getChecksum|getCompression|getCompressionCacheSize|getConstantNames|getConstantValue|getCopyright|getFileBackward|getFormat|getLibraryCopyright|getLibraryVersion|getMajority|getName|getNumAttrEntries|getNumAttrgEntries|getNumAttributes|getNumgAttributes|getReadOnlyMode|getStageCacheSize|getValidate|getVarAllocRecords|getVarBlockingFactor|getVarCacheSize|getVarCompression|getVarData|getVarMaxAllocRecNum|getVarMaxWrittenRecNum|getVarName|getVarNum|getVarNumRecsWritten|getVarPadValue|getVarRecordData|getVarReservePercent|getVarsMaxWrittenRecNum|getVarSparseRecords|getVersion|hyperGetVarData|hyperPutVarData|inquire|inquireAttr|inquireAttrEntry|inquireAttrgEntry|inquireVar|open|putAttrEntry|putAttrgEntry|putVarData|putVarRecordData|renameAttr|renameVar|setCacheSize|setChecksum|setCompression|setCompressionCacheSize|setFileBackward|setFormat|setMajority|setReadOnlyMode|setStageCacheSize|setValidate|setVarAllocBlockRecords|setVarBlockingFactor|setVarCacheSize|setVarCompression|setVarInitialRecs|setVarPadValue|SetVarReservePercent|setVarsCacheSize|setVarSparseRecords))?|cdfread|cdfwrite|ceil|cell2mat|cell2struct|celldisp|cellfun|cellplot|cellstr|cgs|checkcode|checkin|checkout|chol|cholinc|cholupdate|circshift|cla|clabel|class|clc|clear|clearvars|clf|clipboard|clock|close|closereq|cmopts|cmpermute|cmunique|colamd|colon|colorbar|colordef|colormap|colormapeditor|colperm|Combine|comet|comet3|commandhistory|commandwindow|compan|compass|complex|computer|cond|condeig|condest|coneplot|conj|containers\.Map|contour(?:3|c|f|slice)?|contrast|conv|conv2|convhull|convhulln|convn|cool|copper|copyfile|copyobj|corrcoef|cos(?:d|h)?|cot(?:d|h)?|cov|cplxpair|cputime|createClassFromWsdl|createSoapMessage|cross|csc(?:d|h)?|csvread|csvwrite|ctranspose|cumprod|cumsum|cumtrapz|curl|customverctrl|cylinder|daqread|daspect|datacursormode|datatipinfo|date|datenum|datestr|datetick|datevec|dbclear|dbcont|dbdown|dblquad|dbmex|dbquit|dbstack|dbstatus|dbstep|dbstop|dbtype|dbup|dde23|ddeget|ddesd|ddeset|deal|deblank|dec2base|dec2bin|dec2hex|decic|deconv|del2|delaunay|delaunay3|delaunayn|DelaunayTri|delete|demo|depdir|depfun|det|detrend|deval|diag|dialog|diary|diff|diffuse|dir|disp|display|dither|divergence|dlmread|dlmwrite|dmperm|doc|docsearch|dos|dot|dragrect|drawnow|dsearch|dsearchn|dynamicprops|echo|echodemo|edit|eig|eigs|ellipj|ellipke|ellipsoid|empty|enableNETfromNetworkDrive|enableservice|EndInvoke|enumeration|eomday|eq|erf|erfc|erfcinv|erfcx|erfinv|error|errorbar|errordlg|etime|etree|etreeplot|eval|evalc|evalin|event\.(?:EventData|listener|PropertyEvent|proplistener)|exifread|exist|exit|exp|expint|expm|expm1|export2wsdlg|eye|ezcontour|ezcontourf|ezmesh|ezmeshc|ezplot|ezplot3|ezpolar|ezsurf|ezsurfc|factor|factorial|fclose|feather|feature|feof|ferror|feval|fft|fft2|fftn|fftshift|fftw|fgetl|fgets|fieldnames|figure|figurepalette|fileattrib|filebrowser|filemarker|fileparts|fileread|filesep|fill|fill3|filter|filter2|find|findall|findfigs|findobj|findstr|finish|fitsdisp|fitsinfo|fitsread|fitswrite|fix|flag|flipdim|fliplr|flipud|floor|flow|fminbnd|fminsearch|fopen|format|fplot|fprintf|frame2im|fread|freqspace|frewind|fscanf|fseek|ftell|FTP|full|fullfile|func2str|functions|funm|fwrite|fzero|gallery|gamma|gammainc|gammaincinv|gammaln|gca|gcbf|gcbo|gcd|gcf|gco|ge|genpath|genvarname|get|getappdata|getenv|getfield|getframe|getpixelposition|getpref|ginput|gmres|gplot|grabcode|gradient|gray|graymon|grid|griddata(?:3|n)?|griddedInterpolant|gsvd|gt|gtext|guidata|guide|guihandles|gunzip|gzip|h5create|h5disp|h5info|h5read|h5readatt|h5write|h5writeatt|hadamard|handle|hankel|hdf|hdf5|hdf5info|hdf5read|hdf5write|hdfinfo|hdfread|hdftool|help|helpbrowser|helpdesk|helpdlg|helpwin|hess|hex2dec|hex2num|hgexport|hggroup|hgload|hgsave|hgsetget|hgtransform|Line truncated
|
||||
].join("|");
|
||||
var statsFunctions = [
|
||||
'addedvarplot|andrewsplot|anova(?:1|2|n)|ansaribradley|aoctool|barttest|bbdesign|beta(?:cdf|fit|inv|like|pdf|rnd|stat)|bino(?:cdf|fit|inv|pdf|rnd|stat)|biplot|bootci|bootstrp|boxplot|candexch|candgen|canoncorr|capability|capaplot|caseread|casewrite|categorical|ccdesign|cdfplot|chi2(?:cdf|gof|inv|pdf|rnd|stat)|cholcov|Classification(?:BaggedEnsemble|Discriminant(?:\.(?:fit|make|template))?|Ensemble|KNN(?:\.(?:fit|template))?|PartitionedEnsemble|PartitionedModel|Tree(?:\.(?:fit|template))?)|classify|classregtree|cluster|clusterdata|cmdscale|combnk|Compact(?:Classification(?:Discriminant|Ensemble|Tree)|Regression(?:Ensemble|Tree)|TreeBagger)|confusionmat|controlchart|controlrules|cophenet|copula(?:cdf|fit|param|pdf|rnd|stat)|cordexch|corr|corrcov|coxphfit|createns|crosstab|crossval|cvpartition|datasample|dataset|daugment|dcovary|dendrogram|dfittool|disttool|dummyvar|dwtest|ecdf|ecdfhist|ev(?:cdf|fit|inv|like|pdf|rnd|stat)|ExhaustiveSearcher|exp(?:cdf|fit|inv|like|pdf|rnd|stat)|factoran|fcdf|ff2n|finv|fitdist|fitensemble|fpdf|fracfact|fracfactgen|friedman|frnd|fstat|fsurfht|fullfact|gagerr|gam(?:cdf|fit|inv|like|pdf|rnd|stat)|GeneralizedLinearModel(?:\.fit)?|geo(?:cdf|inv|mean|pdf|rnd|stat)|gev(?:cdf|fit|inv|like|pdf|rnd|stat)|gline|glmfit|glmval|glyphplot|gmdistribution(?:\.fit)?|gname|gp(?:cdf|fit|inv|like|pdf|rnd|stat)|gplotmatrix|grp2idx|grpstats|gscatter|haltonset|harmmean|hist3|histfit|hmm(?:decode|estimate|generate|train|viterbi)|hougen|hyge(?:cdf|inv|pdf|rnd|stat)|icdf|inconsistent|interactionplot|invpred|iqr|iwishrnd|jackknife|jbtest|johnsrnd|KDTreeSearcher|kmeans|knnsearch|kruskalwallis|ksdensity|kstest|kstest2|kurtosis|lasso|lassoglm|lassoPlot|leverage|lhsdesign|lhsnorm|lillietest|LinearModel(?:\.fit)?|linhyptest|linkage|logn(?:cdf|fit|inv|like|pdf|rnd|stat)|lsline|mad|mahal|maineffectsplot|manova1|manovacluster|mdscale|mhsample|mle|mlecov|mnpdf|mnrfit|mnrnd|mnrval|moment|multcompare|multivarichart|mvn(?:cdf|pdf|rnd)|mvregress|mvregresslike|mvt(?:cdf|pdf|rnd)|NaiveBayes(?:\.fit)?|nan(?:cov|max|mean|median|min|std|sum|var)|nbin(?:cdf|fit|inv|pdf|rnd|stat)|ncf(?:cdf|inv|pdf|rnd|stat)|nct(?:cdf|inv|pdf|rnd|stat)|ncx2(?:cdf|inv|pdf|rnd|stat)|NeighborSearcher|nlinfit|nlintool|nlmefit|nlmefitsa|nlparci|nlpredci|nnmf|nominal|NonLinearModel(?:\.fit)?|norm(?:cdf|fit|inv|like|pdf|rnd|stat)|normplot|normspec|ordinal|outlierMeasure|parallelcoords|paretotails|partialcorr|pcacov|pcares|pdf|pdist|pdist2|pearsrnd|perfcurve|perms|piecewisedistribution|plsregress|poiss(?:cdf|fit|inv|pdf|rnd|tat)|polyconf|polytool|prctile|princomp|ProbDist(?:Kernel|Parametric|UnivKernel|UnivParam)?|probplot|procrustes|qqplot|qrandset|qrandstream|quantile|randg|random|randsample|randtool|range|rangesearch|ranksum|rayl(?:cdf|fit|inv|pdf|rnd|stat)|rcoplot|refcurve|refline|regress|Regression(?:BaggedEnsemble|Ensemble|PartitionedEnsemble|PartitionedModel|Tree(?:\.(?:fit|template))?)|regstats|relieff|ridge|robustdemo|robustfit|rotatefactors|rowexch|rsmdemo|rstool|runstest|sampsizepwr|scatterhist|sequentialfs|signrank|signtest|silhouette|skewness|slicesample|sobolset|squareform|statget|statset|stepwise|stepwisefit|surfht|tabulate|tblread|tblwrite|tcdf|tdfread|tiedrank|tinv|tpdf|TreeBagger|treedisp|treefit|treeprune|treetest|treeval|trimmean|trnd|tstat|ttest|ttest2|unid(?:cdf|inv|pdf|rnd|stat)|unif(?:cdf|inv|it|pdf|rnd|stat)|vartest(?:2|n)?|wbl(?:cdf|fit|inv|like|pdf|rnd|stat)|wblplot|wishrnd|x2fx|xptread|zscore|ztest'
|
||||
].join("|");
|
||||
var imageFunctions = [
|
||||
'adapthisteq|analyze75info|analyze75read|applycform|applylut|axes2pix|bestblk|blockproc|bwarea|bwareaopen|bwboundaries|bwconncomp|bwconvhull|bwdist|bwdistgeodesic|bweuler|bwhitmiss|bwlabel|bwlabeln|bwmorph|bwpack|bwperim|bwselect|bwtraceboundary|bwulterode|bwunpack|checkerboard|col2im|colfilt|conndef|convmtx2|corner|cornermetric|corr2|cp2tform|cpcorr|cpselect|cpstruct2pairs|dct2|dctmtx|deconvblind|deconvlucy|deconvreg|deconvwnr|decorrstretch|demosaic|dicom(?:anon|dict|info|lookup|read|uid|write)|edge|edgetaper|entropy|entropyfilt|fan2para|fanbeam|findbounds|fliptform|freqz2|fsamp2|fspecial|ftrans2|fwind1|fwind2|getheight|getimage|getimagemodel|getline|getneighbors|getnhood|getpts|getrangefromclass|getrect|getsequence|gray2ind|graycomatrix|graycoprops|graydist|grayslice|graythresh|hdrread|hdrwrite|histeq|hough|houghlines|houghpeaks|iccfind|iccread|iccroot|iccwrite|idct2|ifanbeam|im2bw|im2col|im2double|im2int16|im2java2d|im2single|im2uint16|im2uint8|imabsdiff|imadd|imadjust|ImageAdapter|imageinfo|imagemodel|imapplymatrix|imattributes|imbothat|imclearborder|imclose|imcolormaptool|imcomplement|imcontour|imcontrast|imcrop|imdilate|imdisplayrange|imdistline|imdivide|imellipse|imerode|imextendedmax|imextendedmin|imfill|imfilter|imfindcircles|imfreehand|imfuse|imgca|imgcf|imgetfile|imhandles|imhist|imhmax|imhmin|imimposemin|imlincomb|imline|immagbox|immovie|immultiply|imnoise|imopen|imoverview|imoverviewpanel|impixel|impixelinfo|impixelinfoval|impixelregion|impixelregionpanel|implay|impoint|impoly|impositionrect|improfile|imputfile|impyramid|imreconstruct|imrect|imregconfig|imregionalmax|imregionalmin|imregister|imresize|imroi|imrotate|imsave|imscrollpanel|imshow|imshowpair|imsubtract|imtool|imtophat|imtransform|imview|ind2gray|ind2rgb|interfileinfo|interfileread|intlut|ippl|iptaddcallback|iptcheckconn|iptcheckhandle|iptcheckinput|iptcheckmap|iptchecknargin|iptcheckstrs|iptdemos|iptgetapi|iptGetPointerBehavior|iptgetpref|ipticondir|iptnum2ordinal|iptPointerManager|iptprefs|iptremovecallback|iptSetPointerBehavior|iptsetpref|iptwindowalign|iradon|isbw|isflat|isgray|isicc|isind|isnitf|isrgb|isrset|lab2double|lab2uint16|lab2uint8|label2rgb|labelmatrix|makecform|makeConstrainToRectFcn|makehdr|makelut|makeresampler|maketform|mat2gray|mean2|medfilt2|montage|nitfinfo|nitfread|nlfilter|normxcorr2|ntsc2rgb|openrset|ordfilt2|otf2psf|padarray|para2fan|phantom|poly2mask|psf2otf|qtdecomp|qtgetblk|qtsetblk|radon|rangefilt|reflect|regionprops|registration\.metric\.(?:MattesMutualInformation|MeanSquares)|registration\.optimizer\.(?:OnePlusOneEvolutionary|RegularStepGradientDescent)|rgb2gray|rgb2ntsc|rgb2ycbcr|roicolor|roifill|roifilt2|roipoly|rsetwrite|std2|stdfilt|strel|stretchlim|subimage|tformarray|tformfwd|tforminv|tonemap|translate|truesize|uintlut|viscircles|warp|watershed|whitepoint|wiener2|xyz2double|xyz2uint16|ycbcr2rgb'
|
||||
].join("|");
|
||||
var optimFunctions = [
|
||||
'bintprog|color|fgoalattain|fminbnd|fmincon|fminimax|fminsearch|fminunc|fseminf|fsolve|fzero|fzmult|gangstr|ktrlink|linprog|lsqcurvefit|lsqlin|lsqnonlin|lsqnonneg|optimget|optimset|optimtool|quadprog'
|
||||
].join("|");
|
||||
|
||||
// identifiers: variable/function name, or a chain of variable names joined by dots (obj.method, struct.field1.field2, etc..)
|
||||
// valid variable names (start with letter, and contains letters, digits, and underscores).
|
||||
// we match "xx.yy" as a whole so that if "xx" is plain and "yy" is not, we dont get a false positive for "yy"
|
||||
//var reIdent = '(?:[a-zA-Z][a-zA-Z0-9_]*)';
|
||||
//var reIdentChain = '(?:' + reIdent + '(?:\.' + reIdent + ')*' + ')';
|
||||
|
||||
// patterns that always start with a known character. Must have a shortcut string.
|
||||
var shortcutStylePatterns = [
|
||||
// whitespaces: space, tab, carriage return, line feed, line tab, form-feed, non-break space
|
||||
[PR.PR_PLAIN, /^[ \t\r\n\v\f\xA0]+/, null, " \t\r\n\u000b\u000c\u00a0"],
|
||||
|
||||
// block comments
|
||||
//TODO: chokes on nested block comments
|
||||
//TODO: false positives when the lines with %{ and %} contain non-spaces
|
||||
//[PR.PR_COMMENT, /^%(?:[^\{].*|\{(?:%|%*[^\}%])*(?:\}+%?)?)/, null],
|
||||
[PR.PR_COMMENT, /^%\{[^%]*%+(?:[^\}%][^%]*%+)*\}/, null],
|
||||
|
||||
// single-line comments
|
||||
[PR.PR_COMMENT, /^%[^\r\n]*/, null, "%"],
|
||||
|
||||
// system commands
|
||||
[PR_SYSCMD, /^![^\r\n]*/, null, "!"]
|
||||
];
|
||||
|
||||
// patterns that will be tried in order if the shortcut ones fail. May have shortcuts.
|
||||
var fallthroughStylePatterns = [
|
||||
// line continuation
|
||||
[PR_LINE_CONTINUATION, /^\.\.\.\s*[\r\n]/, null],
|
||||
|
||||
// error message
|
||||
[PR_ERROR, /^\?\?\? [^\r\n]*/, null],
|
||||
|
||||
// warning message
|
||||
[PR_WARNING, /^Warning: [^\r\n]*/, null],
|
||||
|
||||
// command prompt/output
|
||||
//[PR_CODE_OUTPUT, /^>>\s+[^\r\n]*[\r\n]{1,2}[^=]*=[^\r\n]*[\r\n]{1,2}[^\r\n]*/, null], // full command output (both loose/compact format): `>> EXP\nVAR =\n VAL`
|
||||
[PR_CODE_OUTPUT, /^>>\s+/, null], // only the command prompt `>> `
|
||||
[PR_CODE_OUTPUT, /^octave:\d+>\s+/, null], // Octave command prompt `octave:1> `
|
||||
|
||||
// identifier (chain) or closing-parenthesis/brace/bracket, and IS followed by transpose operator
|
||||
// this way we dont misdetect the transpose operator ' as the start of a string
|
||||
["lang-matlab-operators", /^((?:[a-zA-Z][a-zA-Z0-9_]*(?:\.[a-zA-Z][a-zA-Z0-9_]*)*|\)|\]|\}|\.)')/, null],
|
||||
|
||||
// identifier (chain), and NOT followed by transpose operator
|
||||
// this must come AFTER the "is followed by transpose" step (otherwise it chops the last char of identifier)
|
||||
["lang-matlab-identifiers", /^([a-zA-Z][a-zA-Z0-9_]*(?:\.[a-zA-Z][a-zA-Z0-9_]*)*)(?!')/, null],
|
||||
|
||||
// single-quoted strings: allow for escaping with '', no multilines
|
||||
//[PR.PR_STRING, /(?:(?<=(?:\(|\[|\{|\s|=|;|,|:))|^)'(?:[^']|'')*'(?=(?:\)|\]|\}|\s|=|;|,|:|~|<|>|&|-|\+|\*|\.|\^|\|))/, null], // string vs. transpose (check before/after context using negative/positive lookbehind/lookahead)
|
||||
[PR.PR_STRING, /^'(?:[^']|'')*'/, null], // "'"
|
||||
|
||||
// floating point numbers: 1, 1.0, 1i, -1.1E-1
|
||||
[PR.PR_LITERAL, /^[+\-]?\.?\d+(?:\.\d*)?(?:[Ee][+\-]?\d+)?[ij]?/, null],
|
||||
|
||||
// parentheses, braces, brackets
|
||||
[PR.PR_TAG, /^(?:\{|\}|\(|\)|\[|\])/, null], // "{}()[]"
|
||||
|
||||
// other operators
|
||||
[PR.PR_PUNCTUATION, /^(?:<|>|=|~|@|&|;|,|:|!|\-|\+|\*|\^|\.|\||\\|\/)/, null]
|
||||
];
|
||||
|
||||
var identifiersPatterns = [
|
||||
// list of keywords (`iskeyword`)
|
||||
[PR.PR_KEYWORD, /^\b(?:break|case|catch|classdef|continue|else|elseif|end|for|function|global|if|otherwise|parfor|persistent|return|spmd|switch|try|while)\b/, null],
|
||||
|
||||
// some specials variables/constants
|
||||
[PR_CONSTANT, /^\b(?:true|false|inf|Inf|nan|NaN|eps|pi|ans|nargin|nargout|varargin|varargout)\b/, null],
|
||||
|
||||
// some data types
|
||||
[PR.PR_TYPE, /^\b(?:cell|struct|char|double|single|logical|u?int(?:8|16|32|64)|sparse)\b/, null],
|
||||
|
||||
// commonly used builtin functions from core MATLAB and a few popular toolboxes
|
||||
[PR_FUNCTION, new RegExp('^\\b(?:' + coreFunctions + ')\\b'), null],
|
||||
[PR_FUNCTION_TOOLBOX, new RegExp('^\\b(?:' + statsFunctions + ')\\b'), null],
|
||||
[PR_FUNCTION_TOOLBOX, new RegExp('^\\b(?:' + imageFunctions + ')\\b'), null],
|
||||
[PR_FUNCTION_TOOLBOX, new RegExp('^\\b(?:' + optimFunctions + ')\\b'), null],
|
||||
|
||||
// plain identifier (user-defined variable/function name)
|
||||
[PR_IDENTIFIER, /^[a-zA-Z][a-zA-Z0-9_]*(?:\.[a-zA-Z][a-zA-Z0-9_]*)*/, null]
|
||||
];
|
||||
|
||||
var operatorsPatterns = [
|
||||
// forward to identifiers to match
|
||||
["lang-matlab-identifiers", /^([a-zA-Z][a-zA-Z0-9_]*(?:\.[a-zA-Z][a-zA-Z0-9_]*)*)/, null],
|
||||
|
||||
// parentheses, braces, brackets
|
||||
[PR.PR_TAG, /^(?:\{|\}|\(|\)|\[|\])/, null], // "{}()[]"
|
||||
|
||||
// other operators
|
||||
[PR.PR_PUNCTUATION, /^(?:<|>|=|~|@|&|;|,|:|!|\-|\+|\*|\^|\.|\||\\|\/)/, null],
|
||||
|
||||
// transpose operators
|
||||
[PR_TRANSPOSE, /^'/, null]
|
||||
];
|
||||
|
||||
PR.registerLangHandler(
|
||||
PR.createSimpleLexer([], identifiersPatterns),
|
||||
["matlab-identifiers"]
|
||||
);
|
||||
PR.registerLangHandler(
|
||||
PR.createSimpleLexer([], operatorsPatterns),
|
||||
["matlab-operators"]
|
||||
);
|
||||
PR.registerLangHandler(
|
||||
PR.createSimpleLexer(shortcutStylePatterns, fallthroughStylePatterns),
|
||||
["matlab"]
|
||||
);
|
||||
})(window['PR']);
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
// Copyright (C) 2008 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for OCaml, SML, F# and similar languages.
|
||||
*
|
||||
* Based on the lexical grammar at
|
||||
* http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/manual/spec.html#_Toc270597388
|
||||
*
|
||||
* @author mikesamuel@gmail.com
|
||||
*/
|
||||
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer'](
|
||||
[
|
||||
// Whitespace is made up of spaces, tabs and newline characters.
|
||||
[PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
|
||||
// #if ident/#else/#endif directives delimit conditional compilation
|
||||
// sections
|
||||
[PR['PR_COMMENT'],
|
||||
/^#(?:if[\t\n\r \xA0]+(?:[a-z_$][\w\']*|``[^\r\n\t`]*(?:``|$))|else|endif|light)/i,
|
||||
null, '#'],
|
||||
// A double or single quoted, possibly multi-line, string.
|
||||
// F# allows escaped newlines in strings.
|
||||
[PR['PR_STRING'], /^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])(?:\'|$))/, null, '"\'']
|
||||
],
|
||||
[
|
||||
// Block comments are delimited by (* and *) and may be
|
||||
// nested. Single-line comments begin with // and extend to
|
||||
// the end of a line.
|
||||
// TODO: (*...*) comments can be nested. This does not handle that.
|
||||
[PR['PR_COMMENT'], /^(?:\/\/[^\r\n]*|\(\*[\s\S]*?\*\))/],
|
||||
[PR['PR_KEYWORD'], /^(?:abstract|and|as|assert|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|if|in|inherit|inline|interface|internal|lazy|let|match|member|module|mutable|namespace|new|null|of|open|or|override|private|public|rec|return|static|struct|then|to|true|try|type|upcast|use|val|void|when|while|with|yield|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|global|include|method|mixin|object|parallel|process|protected|pure|sealed|trait|virtual|volatile)\b/],
|
||||
// A number is a hex integer literal, a decimal real literal, or in
|
||||
// scientific notation.
|
||||
[PR['PR_LITERAL'],
|
||||
/^[+\-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],
|
||||
[PR['PR_PLAIN'], /^(?:[a-z_][\w']*[!?#]?|``[^\r\n\t`]*(?:``|$))/i],
|
||||
// A printable non-space non-special character
|
||||
[PR['PR_PUNCTUATION'], /^[^\t\n\r \xA0\"\'\w]+/]
|
||||
]),
|
||||
['fs', 'ml']);
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
// Copyright (C) 2011 Kitware Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for MUMPS.
|
||||
*
|
||||
*
|
||||
* To use, include prettify.js and this file in your HTML page.
|
||||
* Then put your code in an HTML tag like
|
||||
* <pre class="prettyprint lang-mumps">(my SQL code)</pre>
|
||||
*
|
||||
* Commands, intrinsic functions and variables taken from ISO/IEC 11756:1999(E)
|
||||
*
|
||||
* @author chris.harris@kitware.com
|
||||
*
|
||||
* Known issues:
|
||||
*
|
||||
* - Currently can't distinguish between keywords and local or global variables having the same name
|
||||
* for exampe SET IF="IF?"
|
||||
* - m file are already used for MatLab hence using mumps.
|
||||
*/
|
||||
|
||||
(function () {
|
||||
|
||||
|
||||
var commands = 'B|BREAK|' +
|
||||
'C|CLOSE|' +
|
||||
'D|DO|' +
|
||||
'E|ELSE|' +
|
||||
'F|FOR|' +
|
||||
'G|GOTO|' +
|
||||
'H|HALT|' +
|
||||
'H|HANG|' +
|
||||
'I|IF|' +
|
||||
'J|JOB|' +
|
||||
'K|KILL|' +
|
||||
'L|LOCK|' +
|
||||
'M|MERGE|' +
|
||||
'N|NEW|' +
|
||||
'O|OPEN|' +
|
||||
'Q|QUIT|' +
|
||||
'R|READ|' +
|
||||
'S|SET|' +
|
||||
'TC|TCOMMIT|' +
|
||||
'TRE|TRESTART|' +
|
||||
'TRO|TROLLBACK|' +
|
||||
'TS|TSTART|' +
|
||||
'U|USE|' +
|
||||
'V|VIEW|' +
|
||||
'W|WRITE|' +
|
||||
'X|XECUTE';
|
||||
|
||||
var intrinsicVariables = 'D|DEVICE|' +
|
||||
'EC|ECODE|' +
|
||||
'ES|ESTACK|' +
|
||||
'ET|ETRAP|' +
|
||||
'H|HOROLOG|' +
|
||||
'I|IO|' +
|
||||
'J|JOB|' +
|
||||
'K|KEY|' +
|
||||
'P|PRINCIPAL|' +
|
||||
'Q|QUIT|' +
|
||||
'ST|STACK|' +
|
||||
'S|STORAGE|' +
|
||||
'SY|SYSTEM|' +
|
||||
'T|TEST|' +
|
||||
'TL|TLEVEL|' +
|
||||
'TR|TRESTART|' +
|
||||
'X|' +
|
||||
'Y|' +
|
||||
'Z[A-Z]*|';
|
||||
|
||||
var intrinsicFunctions = 'A|ASCII|' +
|
||||
'C|CHAR|' +
|
||||
'D|DATA|' +
|
||||
'E|EXTRACT|' +
|
||||
'F|FIND|' +
|
||||
'FN|FNUMBER|' +
|
||||
'G|GET|' +
|
||||
'J|JUSTIFY|' +
|
||||
'L|LENGTH|' +
|
||||
'NA|NAME|' +
|
||||
'O|ORDER|' +
|
||||
'P|PIECE|' +
|
||||
'QL|QLENGTH|' +
|
||||
'QS|QSUBSCRIPT|' +
|
||||
'Q|QUERY|' +
|
||||
'R|RANDOM|' +
|
||||
'RE|REVERSE|' +
|
||||
'S|SELECT|' +
|
||||
'ST|STACK|' +
|
||||
'T|TEXT|' +
|
||||
'TR|TRANSLATE|' +
|
||||
'V|VIEW|' *
|
||||
'Z[A-Z]*|';
|
||||
|
||||
var intrinsic = intrinsicVariables + intrinsicFunctions;
|
||||
|
||||
|
||||
var shortcutStylePatterns = [
|
||||
// Whitespace
|
||||
[PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
|
||||
// A double or single quoted, possibly multi-line, string.
|
||||
[PR['PR_STRING'], /^(?:"(?:[^"]|\\.)*")/, null, '"']
|
||||
];
|
||||
|
||||
var fallthroughStylePatterns = [
|
||||
// A line comment that starts with ;
|
||||
[PR['PR_COMMENT'], /^;[^\r\n]*/, null, ';'],
|
||||
// Add intrinsic variables and functions as declarations, there not really but it mean
|
||||
// they will hilighted differently from commands.
|
||||
[PR['PR_DECLARATION'], new RegExp('^(?:\\$(?:' + intrinsic + '))\\b', 'i'), null],
|
||||
// Add commands as keywords
|
||||
[PR['PR_KEYWORD'], new RegExp('^(?:[^\\$]' + commands + ')\\b', 'i'), null],
|
||||
// A number is a decimal real literal or in scientific notation.
|
||||
[PR['PR_LITERAL'],
|
||||
/^[+-]?(?:(?:\.\d+|\d+(?:\.\d*)?)(?:E[+\-]?\d+)?)/i],
|
||||
// An identifier
|
||||
[PR['PR_PLAIN'], /^[a-z][a-zA-Z0-9]*/i],
|
||||
// Exclude $ % and ^
|
||||
[PR['PR_PUNCTUATION'], /^[^\w\t\n\r\xA0\"\$;%\^]|_/]
|
||||
];
|
||||
// Can't use m as its already used for MatLab
|
||||
PR.registerLangHandler(PR.createSimpleLexer(shortcutStylePatterns, fallthroughStylePatterns), ['mumps']);
|
||||
})();
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
// Copyright (C) 2011 Zimin A.V.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for the Nemerle language.
|
||||
* http://nemerle.org
|
||||
* @author Zimin A.V.
|
||||
*/
|
||||
(function () {
|
||||
// http://nemerle.org/wiki/index.php?title=Base_keywords
|
||||
var keywords = 'abstract|and|as|base|catch|class|def|delegate|enum|event|extern|false|finally|'
|
||||
+ 'fun|implements|interface|internal|is|macro|match|matches|module|mutable|namespace|new|'
|
||||
+ 'null|out|override|params|partial|private|protected|public|ref|sealed|static|struct|'
|
||||
+ 'syntax|this|throw|true|try|type|typeof|using|variant|virtual|volatile|when|where|with|'
|
||||
+ 'assert|assert2|async|break|checked|continue|do|else|ensures|for|foreach|if|late|lock|new|nolate|'
|
||||
+ 'otherwise|regexp|repeat|requires|return|surroundwith|unchecked|unless|using|while|yield';
|
||||
|
||||
PR['registerLangHandler'](PR['createSimpleLexer'](
|
||||
// shortcutStylePatterns
|
||||
[
|
||||
[PR['PR_STRING'], /^(?:\'(?:[^\\\'\r\n]|\\.)*\'|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/, null, '"'],
|
||||
[PR['PR_COMMENT'], /^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/, null, '#'],
|
||||
[PR['PR_PLAIN'], /^\s+/, null, ' \r\n\t\xA0']
|
||||
],
|
||||
// fallthroughStylePatterns
|
||||
[
|
||||
[PR['PR_STRING'], /^@\"(?:[^\"]|\"\")*(?:\"|$)/, null],
|
||||
[PR['PR_STRING'], /^<#(?:[^#>])*(?:#>|$)/, null],
|
||||
[PR['PR_STRING'], /^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/, null],
|
||||
[PR['PR_COMMENT'], /^\/\/[^\r\n]*/, null],
|
||||
[PR['PR_COMMENT'], /^\/\*[\s\S]*?(?:\*\/|$)/, null],
|
||||
[PR['PR_KEYWORD'], new RegExp('^(?:' + keywords + ')\\b'), null],
|
||||
[PR['PR_TYPE'], /^(?:array|bool|byte|char|decimal|double|float|int|list|long|object|sbyte|short|string|ulong|uint|ufloat|ulong|ushort|void)\b/, null],
|
||||
[PR['PR_LITERAL'], /^@[a-z_$][a-z_$@0-9]*/i, null],
|
||||
[PR['PR_TYPE'], /^@[A-Z]+[a-z][A-Za-z_$@0-9]*/, null],
|
||||
[PR['PR_PLAIN'], /^'?[A-Za-z_$][a-z_$@0-9]*/i, null],
|
||||
[PR['PR_LITERAL'], new RegExp(
|
||||
'^(?:'
|
||||
// A hex number
|
||||
+ '0x[a-f0-9]+'
|
||||
// or an octal or decimal number,
|
||||
+ '|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)'
|
||||
// possibly in scientific notation
|
||||
+ '(?:e[+\\-]?\\d+)?'
|
||||
+ ')'
|
||||
// with an optional modifier like UL for unsigned long
|
||||
+ '[a-z]*', 'i'), null, '0123456789'],
|
||||
|
||||
[PR['PR_PUNCTUATION'], /^.[^\s\w\.$@\'\"\`\/\#]*/, null]
|
||||
]),
|
||||
['n', 'nemerle']);
|
||||
})();
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
// Contributed by peter dot kofler at code minus cop dot org
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for (Turbo) Pascal.
|
||||
*
|
||||
* To use, include prettify.js and this file in your HTML page.
|
||||
* Then put your code in an HTML tag like
|
||||
* <pre class="prettyprint lang-pascal">(my Pascal code)</pre>
|
||||
*
|
||||
* @author peter dot kofler at code minus cop dot org
|
||||
*/
|
||||
|
||||
PR.registerLangHandler(
|
||||
PR.createSimpleLexer(
|
||||
[ // shortcutStylePatterns
|
||||
// 'single-line-string'
|
||||
[PR.PR_STRING, /^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$))/, null, '\''],
|
||||
// Whitespace
|
||||
[PR.PR_PLAIN, /^\s+/, null, ' \r\n\t\xA0']
|
||||
],
|
||||
[ // fallthroughStylePatterns
|
||||
// A cStyleComments comment (* *) or {}
|
||||
[PR.PR_COMMENT, /^\(\*[\s\S]*?(?:\*\)|$)|^\{[\s\S]*?(?:\}|$)/, null],
|
||||
[PR.PR_KEYWORD, /^(?:ABSOLUTE|AND|ARRAY|ASM|ASSEMBLER|BEGIN|CASE|CONST|CONSTRUCTOR|DESTRUCTOR|DIV|DO|DOWNTO|ELSE|END|EXTERNAL|FOR|FORWARD|FUNCTION|GOTO|IF|IMPLEMENTATION|IN|INLINE|INTERFACE|INTERRUPT|LABEL|MOD|NOT|OBJECT|OF|OR|PACKED|PROCEDURE|PROGRAM|RECORD|REPEAT|SET|SHL|SHR|THEN|TO|TYPE|UNIT|UNTIL|USES|VAR|VIRTUAL|WHILE|WITH|XOR)\b/i, null],
|
||||
[PR.PR_LITERAL, /^(?:true|false|self|nil)/i, null],
|
||||
[PR.PR_PLAIN, /^[a-z][a-z0-9]*/i, null],
|
||||
// Literals .0, 0, 0.0 0E13
|
||||
[PR.PR_LITERAL, /^(?:\$[a-f0-9]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+\-]?\d+)?)/i, null, '0123456789'],
|
||||
[PR.PR_PUNCTUATION, /^.[^\s\w\.$@\'\/]*/, null]
|
||||
]),
|
||||
['pascal']);
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2006 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for Protocol Buffers as described at
|
||||
* http://code.google.com/p/protobuf/.
|
||||
*
|
||||
* Based on the lexical grammar at
|
||||
* http://research.microsoft.com/fsharp/manual/spec2.aspx#_Toc202383715
|
||||
*
|
||||
* @author mikesamuel@gmail.com
|
||||
*/
|
||||
|
||||
PR['registerLangHandler'](PR['sourceDecorator']({
|
||||
'keywords': (
|
||||
'bytes,default,double,enum,extend,extensions,false,'
|
||||
+ 'group,import,max,message,option,'
|
||||
+ 'optional,package,repeated,required,returns,rpc,service,'
|
||||
+ 'syntax,to,true'),
|
||||
'types': /^(bool|(double|s?fixed|[su]?int)(32|64)|float|string)\b/,
|
||||
'cStyleComments': true
|
||||
}), ['proto']);
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
// Copyright (C) 2012 Jeffrey B. Arnold
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for S, S-plus, and R source code.
|
||||
*
|
||||
*
|
||||
* To use, include prettify.js and this file in your HTML page.
|
||||
* Then put your code in an HTML tag like
|
||||
* <pre class="prettyprint lang-r"> code </pre>
|
||||
*
|
||||
* Language definition from
|
||||
* http://cran.r-project.org/doc/manuals/R-lang.html.
|
||||
* Many of the regexes are shared with the pygments SLexer,
|
||||
* http://pygments.org/.
|
||||
*
|
||||
* Original: https://raw.github.com/jrnold/prettify-lang-r-bugs/master/lang-r.js
|
||||
*
|
||||
* @author jeffrey.arnold@gmail.com
|
||||
*/
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer'](
|
||||
[
|
||||
[PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
|
||||
[PR['PR_STRING'], /^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/, null, '"'],
|
||||
[PR['PR_STRING'], /^\'(?:[^\'\\]|\\[\s\S])*(?:\'|$)/, null, "'"]
|
||||
],
|
||||
[
|
||||
[PR['PR_COMMENT'], /^#.*/],
|
||||
[PR['PR_KEYWORD'], /^(?:if|else|for|while|repeat|in|next|break|return|switch|function)(?![A-Za-z0-9_.])/],
|
||||
// hex numbes
|
||||
[PR['PR_LITERAL'], /^0[xX][a-fA-F0-9]+([pP][0-9]+)?[Li]?/],
|
||||
// Decimal numbers
|
||||
[PR['PR_LITERAL'], /^[+-]?([0-9]+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?[Li]?/],
|
||||
// builtin symbols
|
||||
[PR['PR_LITERAL'], /^(?:NULL|NA(?:_(?:integer|real|complex|character)_)?|Inf|TRUE|FALSE|NaN|\.\.(?:\.|[0-9]+))(?![A-Za-z0-9_.])/],
|
||||
// assignment, operators, and parens, etc.
|
||||
[PR['PR_PUNCTUATION'], /^(?:<<?-|->>?|-|==|<=|>=|<|>|&&?|!=|\|\|?|\*|\+|\^|\/|!|%.*?%|=|~|\$|@|:{1,3}|[\[\](){};,?])/],
|
||||
// valid variable names
|
||||
[PR['PR_PLAIN'], /^(?:[A-Za-z]+[A-Za-z0-9_.]*|\.[a-zA-Z_][0-9a-zA-Z\._]*)(?![A-Za-z0-9_.])/],
|
||||
// string backtick
|
||||
[PR['PR_STRING'], /^`.+`/]
|
||||
]),
|
||||
['r', 's', 'R', 'S', 'Splus']);
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
// Copyright (C) 2012 Jeffrey Arnold
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Support for R documentation (Rd) files
|
||||
*
|
||||
* Minimal highlighting or Rd files, basically just highlighting
|
||||
* macros. It does not try to identify verbatim or R-like regions of
|
||||
* macros as that is too complicated for a lexer. Descriptions of the
|
||||
* Rd format can be found
|
||||
* http://cran.r-project.org/doc/manuals/R-exts.html and
|
||||
* http://developer.r-project.org/parseRd.pdf.
|
||||
*
|
||||
* @author Jeffrey Arnold
|
||||
*/
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer'](
|
||||
[
|
||||
// whitespace
|
||||
[PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
|
||||
// all comments begin with '%'
|
||||
[PR['PR_COMMENT'], /^%[^\r\n]*/, null, '%']
|
||||
],
|
||||
[// special macros with no args
|
||||
[PR['PR_LITERAL'], /^\\(?:cr|l?dots|R|tab)\b/],
|
||||
// macros
|
||||
[PR['PR_KEYWORD'], /^\\[a-zA-Z@]+/],
|
||||
// highlighted as macros, since technically they are
|
||||
[PR['PR_KEYWORD'], /^#(?:ifn?def|endif)/ ],
|
||||
// catch escaped brackets
|
||||
[PR['PR_PLAIN'], /^\\[{}]/],
|
||||
// punctuation
|
||||
[PR['PR_PUNCTUATION'], /^[{}()\[\]]+/]
|
||||
]),
|
||||
['Rd', 'rd']);
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
// Copyright (C) 2010 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for Scala.
|
||||
*
|
||||
* Derived from http://lampsvn.epfl.ch/svn-repos/scala/scala-documentation/trunk/src/reference/SyntaxSummary.tex
|
||||
*
|
||||
* @author mikesamuel@gmail.com
|
||||
*/
|
||||
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer'](
|
||||
[
|
||||
// Whitespace
|
||||
[PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
|
||||
// A double or single quoted string
|
||||
// or a triple double-quoted multi-line string.
|
||||
[PR['PR_STRING'],
|
||||
/^(?:"(?:(?:""(?:""?(?!")|[^\\"]|\\.)*"{0,3})|(?:[^"\r\n\\]|\\.)*"?))/,
|
||||
null, '"'],
|
||||
[PR['PR_LITERAL'], /^`(?:[^\r\n\\`]|\\.)*`?/, null, '`'],
|
||||
[PR['PR_PUNCTUATION'], /^[!#%&()*+,\-:;<=>?@\[\\\]^{|}~]+/, null,
|
||||
'!#%&()*+,-:;<=>?@[\\]^{|}~']
|
||||
],
|
||||
[
|
||||
// A symbol literal is a single quote followed by an identifier with no
|
||||
// single quote following
|
||||
// A character literal has single quotes on either side
|
||||
[PR['PR_STRING'], /^'(?:[^\r\n\\']|\\(?:'|[^\r\n']+))'/],
|
||||
[PR['PR_LITERAL'], /^'[a-zA-Z_$][\w$]*(?!['$\w])/],
|
||||
[PR['PR_KEYWORD'], /^(?:abstract|case|catch|class|def|do|else|extends|final|finally|for|forSome|if|implicit|import|lazy|match|new|object|override|package|private|protected|requires|return|sealed|super|throw|trait|try|type|val|var|while|with|yield)\b/],
|
||||
[PR['PR_LITERAL'], /^(?:true|false|null|this)\b/],
|
||||
[PR['PR_LITERAL'], /^(?:(?:0(?:[0-7]+|X[0-9A-F]+))L?|(?:(?:0|[1-9][0-9]*)(?:(?:\.[0-9]+)?(?:E[+\-]?[0-9]+)?F?|L?))|\\.[0-9]+(?:E[+\-]?[0-9]+)?F?)/i],
|
||||
// Treat upper camel case identifiers as types.
|
||||
[PR['PR_TYPE'], /^[$_]*[A-Z][_$A-Z0-9]*[a-z][\w$]*/],
|
||||
[PR['PR_PLAIN'], /^[$a-zA-Z_][\w$]*/],
|
||||
[PR['PR_COMMENT'], /^\/(?:\/.*|\*(?:\/|\**[^*/])*(?:\*+\/?)?)/],
|
||||
[PR['PR_PUNCTUATION'], /^(?:\.+|\/)/]
|
||||
]),
|
||||
['scala']);
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
// Copyright (C) 2008 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for SQL.
|
||||
*
|
||||
*
|
||||
* To use, include prettify.js and this file in your HTML page.
|
||||
* Then put your code in an HTML tag like
|
||||
* <pre class="prettyprint lang-sql">(my SQL code)</pre>
|
||||
*
|
||||
*
|
||||
* http://savage.net.au/SQL/sql-99.bnf.html is the basis for the grammar, and
|
||||
* http://msdn.microsoft.com/en-us/library/aa238507(SQL.80).aspx and
|
||||
* http://meta.stackoverflow.com/q/92352/137403 as the bases for the keyword
|
||||
* list.
|
||||
*
|
||||
* @author mikesamuel@gmail.com
|
||||
*/
|
||||
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer'](
|
||||
[
|
||||
// Whitespace
|
||||
[PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
|
||||
// A double or single quoted, possibly multi-line, string.
|
||||
[PR['PR_STRING'], /^(?:"(?:[^\"\\]|\\.)*"|'(?:[^\'\\]|\\.)*')/, null,
|
||||
'"\'']
|
||||
],
|
||||
[
|
||||
// A comment is either a line comment that starts with two dashes, or
|
||||
// two dashes preceding a long bracketed block.
|
||||
[PR['PR_COMMENT'], /^(?:--[^\r\n]*|\/\*[\s\S]*?(?:\*\/|$))/],
|
||||
[PR['PR_KEYWORD'], /^(?:ADD|ALL|ALTER|AND|ANY|APPLY|AS|ASC|AUTHORIZATION|BACKUP|BEGIN|BETWEEN|BREAK|BROWSE|BULK|BY|CASCADE|CASE|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMN|COMMIT|COMPUTE|CONNECT|CONSTRAINT|CONTAINS|CONTAINSTABLE|CONTINUE|CONVERT|CREATE|CROSS|CURRENT|CURRENT_DATE|CURRENT_TIME|CURRENT_TIMESTAMP|CURRENT_USER|CURSOR|DATABASE|DBCC|DEALLOCATE|DECLARE|DEFAULT|DELETE|DENY|DESC|DISK|DISTINCT|DISTRIBUTED|DOUBLE|DROP|DUMMY|DUMP|ELSE|END|ERRLVL|ESCAPE|EXCEPT|EXEC|EXECUTE|EXISTS|EXIT|FETCH|FILE|FILLFACTOR|FOLLOWING|FOR|FOREIGN|FREETEXT|FREETEXTTABLE|FROM|FULL|FUNCTION|GOTO|GRANT|GROUP|HAVING|HOLDLOCK|IDENTITY|IDENTITYCOL|IDENTITY_INSERT|IF|IN|INDEX|INNER|INSERT|INTERSECT|INTO|IS|JOIN|KEY|KILL|LEFT|LIKE|LINENO|LOAD|MATCH|MATCHED|MERGE|NATURAL|NATIONAL|NOCHECK|NONCLUSTERED|NOCYCLE|NOT|NULL|NULLIF|OF|OFF|OFFSETS|ON|OPEN|OPENDATASOURCE|OPENQUERY|OPENROWSET|OPENXML|OPTION|OR|ORDER|OUTER|OVER|PARTITION|PERCENT|PIVOT|PLAN|PRECEDING|PRECISION|PRIMARY|PRINT|PROC|PROCEDURE|PUBLIC|RAISERROR|READ|READTEXT|RECONFIGURE|REFERENCES|REPLICATION|RESTORE|RESTRICT|RETURN|REVOKE|RIGHT|ROLLBACK|ROWCOUNT|ROWGUIDCOL|ROWS?|RULE|SAVE|SCHEMA|SELECT|SESSION_USER|SET|SETUSER|SHUTDOWN|SOME|START|STATISTICS|SYSTEM_USER|TABLE|TEXTSIZE|THEN|TO|TOP|TRAN|TRANSACTION|TRIGGER|TRUNCATE|TSEQUAL|UNBOUNDED|UNION|UNIQUE|UNPIVOT|UPDATE|UPDATETEXT|USE|USER|USING|VALUES|VARYING|VIEW|WAITFOR|WHEN|WHERE|WHILE|WITH|WITHIN|WRITETEXT|XML)(?=[^\w-]|$)/i, null],
|
||||
// A number is a hex integer literal, a decimal real literal, or in
|
||||
// scientific notation.
|
||||
[PR['PR_LITERAL'],
|
||||
/^[+-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],
|
||||
// An identifier
|
||||
[PR['PR_PLAIN'], /^[a-z_][\w-]*/i],
|
||||
// A run of punctuation
|
||||
[PR['PR_PUNCTUATION'], /^[^\w\t\n\r \xA0\"\'][^\w\t\n\r \xA0+\-\"\']*/]
|
||||
]),
|
||||
['sql']);
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
// Copyright (C) 2012 Pyrios.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for TCL
|
||||
*
|
||||
*
|
||||
* To use, include prettify.js and this file in your HTML page.
|
||||
* Then put your code in an HTML tag like
|
||||
* <pre class="prettyprint lang-tcl">proc foo {} {puts bar}</pre>
|
||||
*
|
||||
* I copy-pasted lang-lisp.js, so this is probably not 100% accurate.
|
||||
* I used http://wiki.tcl.tk/1019 for the keywords, but tried to only
|
||||
* include as keywords that had more impact on the program flow
|
||||
* rather than providing convenience. For example, I included 'if'
|
||||
* since that provides branching, but left off 'open' since that is more
|
||||
* like a proc. Add more if it makes sense.
|
||||
*
|
||||
* @author pyrios@gmail.com
|
||||
*/
|
||||
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer'](
|
||||
[
|
||||
['opn', /^\{+/, null, '{'],
|
||||
['clo', /^\}+/, null, '}'],
|
||||
// A line comment that starts with ;
|
||||
[PR['PR_COMMENT'], /^#[^\r\n]*/, null, '#'],
|
||||
// Whitespace
|
||||
[PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
|
||||
// A double quoted, possibly multi-line, string.
|
||||
[PR['PR_STRING'], /^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/, null, '"']
|
||||
],
|
||||
[
|
||||
[PR['PR_KEYWORD'], /^(?:after|append|apply|array|break|case|catch|continue|error|eval|exec|exit|expr|for|foreach|if|incr|info|proc|return|set|switch|trace|uplevel|upvar|while)\b/, null],
|
||||
[PR['PR_LITERAL'],
|
||||
/^[+\-]?(?:[0#]x[0-9a-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[ed][+\-]?\d+)?)/i],
|
||||
// A single quote possibly followed by a word that optionally ends with
|
||||
// = ! or ?.
|
||||
[PR['PR_LITERAL'],
|
||||
/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],
|
||||
// A word that optionally ends with = ! or ?.
|
||||
[PR['PR_PLAIN'],
|
||||
/^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],
|
||||
// A printable non-space non-special character
|
||||
[PR['PR_PUNCTUATION'], /^[^\w\t\n\r \xA0()\"\\\';]+/]
|
||||
]),
|
||||
['tcl']);
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
// Copyright (C) 2011 Martin S.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Support for tex highlighting as discussed on
|
||||
* <a href="http://meta.tex.stackexchange.com/questions/872/text-immediate-following-double-backslashes-is-highlighted-as-macro-inside-a-code/876#876">meta.tex.stackexchange.com</a>.
|
||||
*
|
||||
* @author Martin S.
|
||||
*/
|
||||
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer'](
|
||||
[
|
||||
// whitespace
|
||||
[PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
|
||||
// all comments begin with '%'
|
||||
[PR['PR_COMMENT'], /^%[^\r\n]*/, null, '%']
|
||||
],
|
||||
[
|
||||
//[PR['PR_DECLARATION'], /^\\([egx]?def|(new|renew|provide)(command|environment))\b/],
|
||||
// any command starting with a \ and contains
|
||||
// either only letters (a-z,A-Z), '@' (internal macros)
|
||||
[PR['PR_KEYWORD'], /^\\[a-zA-Z@]+/],
|
||||
// or contains only one character
|
||||
[PR['PR_KEYWORD'], /^\\./],
|
||||
// Highlight dollar for math mode and ampersam for tabular
|
||||
[PR['PR_TYPE'], /^[$&]/],
|
||||
// numeric measurement values with attached units
|
||||
[PR['PR_LITERAL'],
|
||||
/[+-]?(?:\.\d+|\d+(?:\.\d*)?)(cm|em|ex|in|pc|pt|bp|mm)/i],
|
||||
// punctuation usually occurring within commands
|
||||
[PR['PR_PUNCTUATION'], /^[{}()\[\]=]+/]
|
||||
]),
|
||||
['latex', 'tex']);
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
// Copyright (C) 2009 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for various flavors of basic.
|
||||
*
|
||||
*
|
||||
* To use, include prettify.js and this file in your HTML page.
|
||||
* Then put your code in an HTML tag like
|
||||
* <pre class="prettyprint lang-vb"></pre>
|
||||
*
|
||||
*
|
||||
* http://msdn.microsoft.com/en-us/library/aa711638(VS.71).aspx defines the
|
||||
* visual basic grammar lexical grammar.
|
||||
*
|
||||
* @author mikesamuel@gmail.com
|
||||
*/
|
||||
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer'](
|
||||
[
|
||||
// Whitespace
|
||||
[PR['PR_PLAIN'], /^[\t\n\r \xA0\u2028\u2029]+/, null, '\t\n\r \xA0\u2028\u2029'],
|
||||
// A double quoted string with quotes escaped by doubling them.
|
||||
// A single character can be suffixed with C.
|
||||
[PR['PR_STRING'], /^(?:[\"\u201C\u201D](?:[^\"\u201C\u201D]|[\"\u201C\u201D]{2})(?:[\"\u201C\u201D]c|$)|[\"\u201C\u201D](?:[^\"\u201C\u201D]|[\"\u201C\u201D]{2})*(?:[\"\u201C\u201D]|$))/i, null,
|
||||
'"\u201C\u201D'],
|
||||
// A comment starts with a single quote and runs until the end of the
|
||||
// line.
|
||||
// VB6 apparently allows _ as an escape sequence for newlines though
|
||||
// this is not a documented feature of VB.net.
|
||||
// http://meta.stackoverflow.com/q/121497/137403
|
||||
[PR['PR_COMMENT'], /^[\'\u2018\u2019](?:_(?:\r\n?|[^\r]?)|[^\r\n_\u2028\u2029])*/, null, '\'\u2018\u2019']
|
||||
],
|
||||
[
|
||||
[PR['PR_KEYWORD'], /^(?:AddHandler|AddressOf|Alias|And|AndAlso|Ansi|As|Assembly|Auto|Boolean|ByRef|Byte|ByVal|Call|Case|Catch|CBool|CByte|CChar|CDate|CDbl|CDec|Char|CInt|Class|CLng|CObj|Const|CShort|CSng|CStr|CType|Date|Decimal|Declare|Default|Delegate|Dim|DirectCast|Do|Double|Each|Else|ElseIf|End|EndIf|Enum|Erase|Error|Event|Exit|Finally|For|Friend|Function|Get|GetType|GoSub|GoTo|Handles|If|Implements|Imports|In|Inherits|Integer|Interface|Is|Let|Lib|Like|Long|Loop|Me|Mod|Module|MustInherit|MustOverride|MyBase|MyClass|Namespace|New|Next|Not|NotInheritable|NotOverridable|Object|On|Option|Optional|Or|OrElse|Overloads|Overridable|Overrides|ParamArray|Preserve|Private|Property|Protected|Public|RaiseEvent|ReadOnly|ReDim|RemoveHandler|Resume|Return|Select|Set|Shadows|Shared|Short|Single|Static|Step|Stop|String|Structure|Sub|SyncLock|Then|Throw|To|Try|TypeOf|Unicode|Until|Variant|Wend|When|While|With|WithEvents|WriteOnly|Xor|EndIf|GoSub|Let|Variant|Wend)\b/i, null],
|
||||
// A second comment form
|
||||
[PR['PR_COMMENT'], /^REM\b[^\r\n\u2028\u2029]*/i],
|
||||
// A boolean, numeric, or date literal.
|
||||
[PR['PR_LITERAL'],
|
||||
/^(?:True\b|False\b|Nothing\b|\d+(?:E[+\-]?\d+[FRD]?|[FRDSIL])?|(?:&H[0-9A-F]+|&O[0-7]+)[SIL]?|\d*\.\d+(?:E[+\-]?\d+)?[FRD]?|#\s+(?:\d+[\-\/]\d+[\-\/]\d+(?:\s+\d+:\d+(?::\d+)?(\s*(?:AM|PM))?)?|\d+:\d+(?::\d+)?(\s*(?:AM|PM))?)\s+#)/i],
|
||||
// An identifier. Keywords can be turned into identifers
|
||||
// with square brackets, and there may be optional type
|
||||
// characters after a normal identifier in square brackets.
|
||||
[PR['PR_PLAIN'], /^(?:(?:[a-z]|_\w)\w*(?:\[[%&@!#]+\])?|\[(?:[a-z]|_\w)\w*\])/i],
|
||||
// A run of punctuation
|
||||
[PR['PR_PUNCTUATION'],
|
||||
/^[^\w\t\n\r \"\'\[\]\xA0\u2018\u2019\u201C\u201D\u2028\u2029]+/],
|
||||
// Square brackets
|
||||
[PR['PR_PUNCTUATION'], /^(?:\[|\])/]
|
||||
]),
|
||||
['vb', 'vbs']);
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for VHDL '93.
|
||||
*
|
||||
* Based on the lexical grammar and keywords at
|
||||
* http://www.iis.ee.ethz.ch/~zimmi/download/vhdl93_syntax.html
|
||||
*
|
||||
* @author benoit@ryder.fr
|
||||
*/
|
||||
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer'](
|
||||
[
|
||||
// Whitespace
|
||||
[PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0']
|
||||
],
|
||||
[
|
||||
// String, character or bit string
|
||||
[PR['PR_STRING'], /^(?:[BOX]?"(?:[^\"]|"")*"|'.')/i],
|
||||
// Comment, from two dashes until end of line.
|
||||
[PR['PR_COMMENT'], /^--[^\r\n]*/],
|
||||
[PR['PR_KEYWORD'], /^(?:abs|access|after|alias|all|and|architecture|array|assert|attribute|begin|block|body|buffer|bus|case|component|configuration|constant|disconnect|downto|else|elsif|end|entity|exit|file|for|function|generate|generic|group|guarded|if|impure|in|inertial|inout|is|label|library|linkage|literal|loop|map|mod|nand|new|next|nor|not|null|of|on|open|or|others|out|package|port|postponed|procedure|process|pure|range|record|register|reject|rem|report|return|rol|ror|select|severity|shared|signal|sla|sll|sra|srl|subtype|then|to|transport|type|unaffected|units|until|use|variable|wait|when|while|with|xnor|xor)(?=[^\w-]|$)/i, null],
|
||||
// Type, predefined or standard
|
||||
[PR['PR_TYPE'], /^(?:bit|bit_vector|character|boolean|integer|real|time|string|severity_level|positive|natural|signed|unsigned|line|text|std_u?logic(?:_vector)?)(?=[^\w-]|$)/i, null],
|
||||
// Predefined attributes
|
||||
[PR['PR_TYPE'], /^\'(?:ACTIVE|ASCENDING|BASE|DELAYED|DRIVING|DRIVING_VALUE|EVENT|HIGH|IMAGE|INSTANCE_NAME|LAST_ACTIVE|LAST_EVENT|LAST_VALUE|LEFT|LEFTOF|LENGTH|LOW|PATH_NAME|POS|PRED|QUIET|RANGE|REVERSE_RANGE|RIGHT|RIGHTOF|SIMPLE_NAME|STABLE|SUCC|TRANSACTION|VAL|VALUE)(?=[^\w-]|$)/i, null],
|
||||
// Number, decimal or based literal
|
||||
[PR['PR_LITERAL'], /^\d+(?:_\d+)*(?:#[\w\\.]+#(?:[+\-]?\d+(?:_\d+)*)?|(?:\.\d+(?:_\d+)*)?(?:E[+\-]?\d+(?:_\d+)*)?)/i],
|
||||
// Identifier, basic or extended
|
||||
[PR['PR_PLAIN'], /^(?:[a-z]\w*|\\[^\\]*\\)/i],
|
||||
// Punctuation
|
||||
[PR['PR_PUNCTUATION'], /^[^\w\t\n\r \xA0\"\'][^\w\t\n\r \xA0\-\"\']*/]
|
||||
]),
|
||||
['vhdl', 'vhd']);
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
// Copyright (C) 2009 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for Wiki pages.
|
||||
*
|
||||
* Based on WikiSyntax at http://code.google.com/p/support/wiki/WikiSyntax
|
||||
*
|
||||
* @author mikesamuel@gmail.com
|
||||
*/
|
||||
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer'](
|
||||
[
|
||||
// Whitespace
|
||||
[PR['PR_PLAIN'], /^[\t \xA0a-gi-z0-9]+/, null,
|
||||
'\t \xA0abcdefgijklmnopqrstuvwxyz0123456789'],
|
||||
// Wiki formatting
|
||||
[PR['PR_PUNCTUATION'], /^[=*~\^\[\]]+/, null, '=*~^[]']
|
||||
],
|
||||
[
|
||||
// Meta-info like #summary, #labels, etc.
|
||||
['lang-wiki.meta', /(?:^^|\r\n?|\n)(#[a-z]+)\b/],
|
||||
// A WikiWord
|
||||
[PR['PR_LITERAL'], /^(?:[A-Z][a-z][a-z0-9]+[A-Z][a-z][a-zA-Z0-9]+)\b/
|
||||
],
|
||||
// A preformatted block in an unknown language
|
||||
['lang-', /^\{\{\{([\s\S]+?)\}\}\}/],
|
||||
// A block of source code in an unknown language
|
||||
['lang-', /^`([^\r\n`]+)`/],
|
||||
// An inline URL.
|
||||
[PR['PR_STRING'],
|
||||
/^https?:\/\/[^\/?#\s]*(?:\/[^?#\s]*)?(?:\?[^#\s]*)?(?:#\S*)?/i],
|
||||
[PR['PR_PLAIN'], /^(?:\r\n|[\s\S])[^#=*~^A-Zh\{`\[\r\n]*/]
|
||||
]),
|
||||
['wiki']);
|
||||
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer']([[PR['PR_KEYWORD'], /^#[a-z]+/i, null, '#']], []),
|
||||
['wiki.meta']);
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
// Copyright (C) 2011 Patrick Wied
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for XQuery.
|
||||
*
|
||||
* To use, include prettify.js and this file in your HTML page.
|
||||
* Then put your code in an HTML tag like
|
||||
* <pre class="prettyprint lang-xq"></pre>
|
||||
*
|
||||
*
|
||||
* @author Patrick Wied ( patpa7p@live.de )
|
||||
* @version 2010-09-28
|
||||
*/
|
||||
|
||||
// Falls back to plain for stylesheets that don't style fun.
|
||||
var PR_FUNCTION = 'fun pln';
|
||||
// Falls back to plaiin for stylesheets that don't style var.
|
||||
var PR_VARIABLE = 'var pln';
|
||||
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer'](
|
||||
[
|
||||
// Matching $var-ia_bles
|
||||
[PR_VARIABLE, /^\$[A-Za-z0-9_\-]+/, null, "$"]
|
||||
],
|
||||
[
|
||||
// Matching lt and gt operators
|
||||
// Not the best matching solution but you have to differentiate between the gt operator and the tag closing char
|
||||
[PR['PR_PLAIN'], /^[\s=][<>][\s=]/],
|
||||
// Matching @Attributes
|
||||
[PR['PR_LITERAL'], /^\@[\w-]+/],
|
||||
// Matching xml tags
|
||||
[PR['PR_TAG'], /^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],
|
||||
// Matching single or multiline xquery comments -> (: <text> :)
|
||||
[PR['PR_COMMENT'], /^\(:[\s\S]*?:\)/],
|
||||
// Tokenizing /{}:=;*,[]() as plain
|
||||
[PR['PR_PLAIN'], /^[\/\{\};,\[\]\(\)]$/],
|
||||
// Matching a double or single quoted, possibly multi-line, string.
|
||||
// with the special condition that a { in a string changes to xquery context
|
||||
[PR['PR_STRING'], /^(?:\"(?:[^\"\\\{]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\\{]|\\[\s\S])*(?:\'|$))/, null, '"\''],
|
||||
// Matching standard xquery keywords
|
||||
[PR['PR_KEYWORD'], /^(?:xquery|where|version|variable|union|typeswitch|treat|to|then|text|stable|sortby|some|self|schema|satisfies|returns|return|ref|processing-instruction|preceding-sibling|preceding|precedes|parent|only|of|node|namespace|module|let|item|intersect|instance|in|import|if|function|for|follows|following-sibling|following|external|except|every|else|element|descending|descendant-or-self|descendant|define|default|declare|comment|child|cast|case|before|attribute|assert|ascending|as|ancestor-or-self|ancestor|after|eq|order|by|or|and|schema-element|document-node|node|at)\b/],
|
||||
// Matching standard xquery types
|
||||
[PR['PR_TYPE'], /^(?:xs:yearMonthDuration|xs:unsignedLong|xs:time|xs:string|xs:short|xs:QName|xs:Name|xs:long|xs:integer|xs:int|xs:gYearMonth|xs:gYear|xs:gMonthDay|xs:gDay|xs:float|xs:duration|xs:double|xs:decimal|xs:dayTimeDuration|xs:dateTime|xs:date|xs:byte|xs:boolean|xs:anyURI|xf:yearMonthDuration)\b/, null],
|
||||
// Matching standard xquery functions
|
||||
[PR_FUNCTION, /^(?:xp:dereference|xinc:node-expand|xinc:link-references|xinc:link-expand|xhtml:restructure|xhtml:clean|xhtml:add-lists|xdmp:zip-manifest|xdmp:zip-get|xdmp:zip-create|xdmp:xquery-version|xdmp:word-convert|xdmp:with-namespaces|xdmp:version|xdmp:value|xdmp:user-roles|xdmp:user-last-login|xdmp:user|xdmp:url-encode|xdmp:url-decode|xdmp:uri-is-file|xdmp:uri-format|xdmp:uri-content-type|xdmp:unquote|xdmp:unpath|xdmp:triggers-database|xdmp:trace|xdmp:to-json|xdmp:tidy|xdmp:subbinary|xdmp:strftime|xdmp:spawn-in|xdmp:spawn|xdmp:sleep|xdmp:shutdown|xdmp:set-session-field|xdmp:set-response-encoding|xdmp:set-response-content-type|xdmp:set-response-code|xdmp:set-request-time-limit|xdmp:set|xdmp:servers|xdmp:server-status|xdmp:server-name|xdmp:server|xdmp:security-database|xdmp:security-assert|xdmp:schema-database|xdmp:save|xdmp:role-roles|xdmp:role|xdmp:rethrow|xdmp:restart|xdmp:request-timestamp|xdmp:request-status|xdmp:request-cancel|xdmp:request|xdmp:redirect-response|xdmp:random|xdmp:quote|xdmp:query-trace|xdmp:query-meters|xdmp:product-edition|xdmp:privilege-roles|xdmp:privilege|xdmp:pretty-print|xdmp:powerpoint-convert|xdmp:platform|xdmp:permission|xdmp:pdf-convert|xdmp:path|xdmp:octal-to-integer|xdmp:node-uri|xdmp:node-replace|xdmp:node-kind|xdmp:node-insert-child|xdmp:node-insert-before|xdmp:node-insert-after|xdmp:node-delete|xdmp:node-database|xdmp:mul64|xdmp:modules-root|xdmp:modules-database|xdmp:merging|xdmp:merge-cancel|xdmp:merge|xdmp:md5|xdmp:logout|xdmp:login|xdmp:log-level|xdmp:log|xdmp:lock-release|xdmp:lock-acquire|xdmp:load|xdmp:invoke-in|xdmp:invoke|xdmp:integer-to-octal|xdmp:integer-to-hex|xdmp:http-put|xdmp:http-post|xdmp:http-options|xdmp:http-head|xdmp:http-get|xdmp:http-delete|xdmp:hosts|xdmp:host-status|xdmp:host-name|xdmp:host|xdmp:hex-to-integer|xdmp:hash64|xdmp:hash32|xdmp:has-privilege|xdmp:groups|xdmp:group-serves|xdmp:group-servers|xdmp:group-name|xdmp:group-hosts|xdmp:group|xdmp:get-session-field-names|xdmp:get-session-field|xdmp:get-response-encoding|xdmp:get-response-code|xdmp:get-request-username|xdmp:get-request-user|xdmp:get-request-url|xdmp:get-request-protocol|xdmp:get-request-path|xdmp:get-request-method|xdmp:get-request-header-names|xdmp:get-request-header|xdmp:get-request-field-names|xdmp:get-request-field-filename|xdmp:get-request-field-content-type|xdmp:get-request-field|xdmp:get-request-client-certificate|xdmp:get-request-client-address|xdmp:get-request-body|xdmp:get-current-user|xdmp:get-current-roles|xdmp:get|xdmp:function-name|xdmp:function-module|xdmp:function|xdmp:from-json|xdmp:forests|xdmp:forest-status|xdmp:forest-restore|xdmp:forest-restart|xdmp:forest-name|xdmp:forest-delete|xdmp:forest-databases|xdmp:forest-counts|xdmp:forest-clear|xdmp:forest-backup|xdmp:forest|xdmp:filesystem-file|xdmp:filesystem-directory|xdmp:exists|xdmp:excel-convert|xdmp:eval-in|xdmp:eval|xdmp:estimate|xdmp:email|xdmp:element-content-type|xdmp:elapsed-time|xdmp:document-set-quality|xdmp:document-set-property|xdmp:document-set-properties|xdmp:document-set-permissions|xdmp:document-set-collections|xdmp:document-remove-properties|xdmp:document-remove-permissions|xdmp:document-remove-collections|xdmp:document-properties|xdmp:document-locks|xdmp:document-load|xdmp:document-insert|xdmp:document-get-quality|xdmp:document-get-properties|xdmp:document-get-permissions|xdmp:document-get-collections|xdmp:document-get|xdmp:document-forest|xdmp:document-delete|xdmp:document-add-properties|xdmp:document-add-permissions|xdmp:document-add-collections|xdmp:directory-properties|xdmp:directory-locks|xdmp:directory-delete|xdmp:directory-create|xdmp:directory|xdmp:diacritic-less|xdmp:describe|xdmp:default-permissions|xdmp:default-collections|xdmp:databases|xdmp:database-restore-validate|xdmp:database-restore-status|xdmp:database-restore-cancel|xdmp:database-restore|xdmp:database-name|xdmp:database-forests|xdmp:database-backup-validate|xdmp:database-backup-status|xdmp:database-backup-purge|xdmp:database-backup-cancel|xdmp:database-backup|xdmp:database|xdmp:collection-properties|xdmp:collection-locks|xdmp:collection-delete|xdmp:collation-canonical-uri|xdmp:castable-as|xdmp:can-grant-roles|xdmp:base64-encode|xdmp:base64-decode|xdmp:architecture|xdmp:apply|xdmp:amp-roles|xdmp:amp|xdmp:add64|xdmp:add-response-header|xdmp:access|trgr:trigger-set-recursive|trgr:trigger-set-permissions|trgr:trigger-set-name|trgr:trigger-set-module|trgr:trigger-set-event|trgr:trigger-set-description|trgr:trigger-remove-permissions|trgr:trigger-module|trgr:trigger-get-permissions|trgr:trigger-enable|trgr:trigger-disable|trgr:trigger-database-online-event|trgr:trigger-data-event|trgr:trigger-add-permissions|trgr:remove-trigger|trgr:property-content|trgr:pre-commit|trgr:post-commit|trgr:get-trigger-by-id|trgr:get-trigger|trgr:document-scope|trgr:document-content|trgr:directory-scope|trgr:create-trigger|trgr:collection-scope|trgr:any-property-content|thsr:set-entry|thsr:remove-term|thsr:remove-synonym|thsr:remove-entLine truncated
|
||||
// Matching normal words if none of the previous regular expressions matched
|
||||
[PR['PR_PLAIN'], /^[A-Za-z0-9_\-\:]+/],
|
||||
// Matching whitespaces
|
||||
[PR['PR_PLAIN'], /^[\t\n\r \xA0]+/]
|
||||
]),
|
||||
['xq', 'xquery']);
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// Contributed by ribrdb @ code.google.com
|
||||
|
||||
/**
|
||||
* @fileoverview
|
||||
* Registers a language handler for YAML.
|
||||
*
|
||||
* @author ribrdb
|
||||
*/
|
||||
|
||||
PR['registerLangHandler'](
|
||||
PR['createSimpleLexer'](
|
||||
[
|
||||
[PR['PR_PUNCTUATION'], /^[:|>?]+/, null, ':|>?'],
|
||||
[PR['PR_DECLARATION'], /^%(?:YAML|TAG)[^#\r\n]+/, null, '%'],
|
||||
[PR['PR_TYPE'], /^[&]\S+/, null, '&'],
|
||||
[PR['PR_TYPE'], /^!\S*/, null, '!'],
|
||||
[PR['PR_STRING'], /^"(?:[^\\"]|\\.)*(?:"|$)/, null, '"'],
|
||||
[PR['PR_STRING'], /^'(?:[^']|'')*(?:'|$)/, null, "'"],
|
||||
[PR['PR_COMMENT'], /^#[^\r\n]*/, null, '#'],
|
||||
[PR['PR_PLAIN'], /^\s+/, null, ' \t\r\n']
|
||||
],
|
||||
[
|
||||
[PR['PR_DECLARATION'], /^(?:---|\.\.\.)(?:[\r\n]|$)/],
|
||||
[PR['PR_PUNCTUATION'], /^-/],
|
||||
[PR['PR_KEYWORD'], /^\w+:[ \r\n]/],
|
||||
[PR['PR_PLAIN'], /^\w+/]
|
||||
]), ['yaml', 'yml']);
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/* Pretty printing styles. Used with prettify.js. */
|
||||
|
||||
/* SPAN elements with the classes below are added by prettyprint. */
|
||||
.pln { color: #000 } /* plain text */
|
||||
|
||||
@media screen {
|
||||
.str { color: #080 } /* string content */
|
||||
.kwd { color: #008 } /* a keyword */
|
||||
.com { color: #800 } /* a comment */
|
||||
.typ { color: #606 } /* a type name */
|
||||
.lit { color: #066 } /* a literal value */
|
||||
/* punctuation, lisp open bracket, lisp close bracket */
|
||||
.pun, .opn, .clo { color: #660 }
|
||||
.tag { color: #008 } /* a markup tag name */
|
||||
.atn { color: #606 } /* a markup attribute name */
|
||||
.atv { color: #080 } /* a markup attribute value */
|
||||
.dec, .var { color: #606 } /* a declaration; a variable name */
|
||||
.fun { color: red } /* a function name */
|
||||
}
|
||||
|
||||
/* Use higher contrast and text-weight for printable form. */
|
||||
@media print, projection {
|
||||
.str { color: #060 }
|
||||
.kwd { color: #006; font-weight: bold }
|
||||
.com { color: #600; font-style: italic }
|
||||
.typ { color: #404; font-weight: bold }
|
||||
.lit { color: #044 }
|
||||
.pun, .opn, .clo { color: #440 }
|
||||
.tag { color: #006; font-weight: bold }
|
||||
.atn { color: #404 }
|
||||
.atv { color: #060 }
|
||||
}
|
||||
|
||||
/* Put a border around prettyprinted code snippets. */
|
||||
pre.prettyprint { padding: 2px; border: 1px solid #888 }
|
||||
|
||||
/* Specify class=linenums on a pre to get line numbering */
|
||||
ol.linenums { margin-top: 0; margin-bottom: 0 } /* IE indents via margin-left */
|
||||
li.L0,
|
||||
li.L1,
|
||||
li.L2,
|
||||
li.L3,
|
||||
li.L5,
|
||||
li.L6,
|
||||
li.L7,
|
||||
li.L8 { list-style-type: none }
|
||||
/* Alternate shading for lines */
|
||||
li.L1,
|
||||
li.L3,
|
||||
li.L5,
|
||||
li.L7,
|
||||
li.L9 { background: #eee }
|
||||
+1655
File diff suppressed because it is too large.
Load diff
+1905
File diff suppressed because it is too large.
Load diff
+61
@@ -0,0 +1,61 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
||||
<html><head>
|
||||
<script src="../src/prettify.js"></script>
|
||||
<script src="../src/lang-css.js"></script>
|
||||
<style>
|
||||
body { margin: 0; padding: 0 }
|
||||
pre { margin: 0 }
|
||||
</style>
|
||||
</head>
|
||||
<script>
|
||||
// This page displays some code styled using a theme named in the
|
||||
// query part of the URL.
|
||||
var themeName = decodeURIComponent(document.location.search.replace(/^\?/, ''));
|
||||
|
||||
// Call out to the parent so that it can resize the iframe once this
|
||||
// document's body is loaded.
|
||||
function adjustHeightInParent() {
|
||||
if (parent !== window) {
|
||||
try {
|
||||
var div = document.body.getElementsByTagName('div')[0];
|
||||
parent.adjustChildIframeSize(
|
||||
themeName, div.offsetWidth, div.offsetHeight);
|
||||
} catch (ex) {
|
||||
// Can happen when this page is opened in its own tab.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load the necessary CSS
|
||||
(function () {
|
||||
document.title = 'Theme ' + themeName;
|
||||
// Load the stylesheet that we're demoing.
|
||||
var link = document.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
link.type = 'text/css';
|
||||
link.href = themeName === 'default'
|
||||
? '../src/prettify.css' : themeName + '.css';
|
||||
document.getElementsByTagName('head')[0].appendChild(link);
|
||||
})();
|
||||
</script>
|
||||
|
||||
<body onload="prettyPrint(); adjustHeightInParent()">
|
||||
<div style="width: 40em; display: inline-block">
|
||||
<pre class="prettyprint lang-html linenums">
|
||||
<script type="text/javascript">
|
||||
// Say hello world until the user starts questioning
|
||||
// the meaningfulness of their existence.
|
||||
function helloWorld(world) {
|
||||
for (var i = 42; --i >= 0;) {
|
||||
alert('Hello ' + String(world));
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
p { color: pink }
|
||||
b { color: blue }
|
||||
u { color: "umber" }
|
||||
</style>
|
||||
</pre>
|
||||
</div>
|
||||
</body></html>
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/* desert scheme ported from vim to google prettify */
|
||||
pre.prettyprint { display: block; background-color: #333 }
|
||||
pre .nocode { background-color: none; color: #000 }
|
||||
pre .str { color: #ffa0a0 } /* string - pink */
|
||||
pre .kwd { color: #f0e68c; font-weight: bold }
|
||||
pre .com { color: #87ceeb } /* comment - skyblue */
|
||||
pre .typ { color: #98fb98 } /* type - lightgreen */
|
||||
pre .lit { color: #cd5c5c } /* literal - darkred */
|
||||
pre .pun { color: #fff } /* punctuation */
|
||||
pre .pln { color: #fff } /* plaintext */
|
||||
pre .tag { color: #f0e68c; font-weight: bold } /* html/xml tag - lightyellow */
|
||||
pre .atn { color: #bdb76b; font-weight: bold } /* attribute name - khaki */
|
||||
pre .atv { color: #ffa0a0 } /* attribute value - pink */
|
||||
pre .dec { color: #98fb98 } /* decimal - lightgreen */
|
||||
|
||||
/* Specify class=linenums on a pre to get line numbering */
|
||||
ol.linenums { margin-top: 0; margin-bottom: 0; color: #AEAEAE } /* IE indents via margin-left */
|
||||
li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8 { list-style-type: none }
|
||||
/* Alternate shading for lines */
|
||||
li.L1,li.L3,li.L5,li.L7,li.L9 { }
|
||||
|
||||
@media print {
|
||||
pre.prettyprint { background-color: none }
|
||||
pre .str, code .str { color: #060 }
|
||||
pre .kwd, code .kwd { color: #006; font-weight: bold }
|
||||
pre .com, code .com { color: #600; font-style: italic }
|
||||
pre .typ, code .typ { color: #404; font-weight: bold }
|
||||
pre .lit, code .lit { color: #044 }
|
||||
pre .pun, code .pun { color: #440 }
|
||||
pre .pln, code .pln { color: #000 }
|
||||
pre .tag, code .tag { color: #006; font-weight: bold }
|
||||
pre .atn, code .atn { color: #404 }
|
||||
pre .atv, code .atv { color: #060 }
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
/* Doxy pretty-printing styles. Used with prettify.js. */
|
||||
|
||||
pre .str, code .str { color: #fec243; } /* string - eggyolk gold */
|
||||
pre .kwd, code .kwd { color: #8470FF; } /* keyword - light slate blue */
|
||||
pre .com, code .com { color: #32cd32; font-style: italic; } /* comment - green */
|
||||
pre .typ, code .typ { color: #6ecbcc; } /* type - turq green */
|
||||
pre .lit, code .lit { color: #d06; } /* literal - cherry red */
|
||||
pre .pun, code .pun { color: #8B8970; } /* punctuation - lemon chiffon4 */
|
||||
pre .pln, code .pln { color: #f0f0f0; } /* plaintext - white */
|
||||
pre .tag, code .tag { color: #9c9cff; } /* html/xml tag (bluey) */
|
||||
pre .htm, code .htm { color: #dda0dd; } /* html tag light purply*/
|
||||
pre .xsl, code .xsl { color: #d0a0d0; } /* xslt tag light purply*/
|
||||
pre .atn, code .atn { color: #46eeee; font-weight: normal;} /* html/xml attribute name - lt turquoise */
|
||||
pre .atv, code .atv { color: #EEB4B4; } /* html/xml attribute value - rosy brown2 */
|
||||
pre .dec, code .dec { color: #3387CC; } /* decimal - blue */
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
pre.prettyprint, code.prettyprint {
|
||||
font-family:'Droid Sans Mono','CPMono_v07 Bold','Droid Sans';
|
||||
font-weight: bold;
|
||||
font-size: 9pt;
|
||||
background-color: #0f0f0f;
|
||||
-moz-border-radius: 8px;
|
||||
-webkit-border-radius: 8px;
|
||||
-o-border-radius: 8px;
|
||||
-ms-border-radius: 8px;
|
||||
-khtml-border-radius: 8px;
|
||||
border-radius: 8px;
|
||||
} /* background is black (well, just a tad less dark ) */
|
||||
|
||||
pre.prettyprint {
|
||||
width: 95%;
|
||||
margin: 1em auto;
|
||||
padding: 1em;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
pre.prettyprint a, code.prettyprint a {
|
||||
text-decoration:none;
|
||||
}
|
||||
/* Specify class=linenums on a pre to get line numbering; line numbers themselves are the same color as punctuation */
|
||||
ol.linenums { margin-top: 0; margin-bottom: 0; color: #8B8970; } /* IE indents via margin-left */
|
||||
li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8 { list-style-type: none }
|
||||
/* Alternate shading for lines */
|
||||
li.L1,li.L3,li.L5,li.L7,li.L9 { }
|
||||
|
||||
/* print is mostly unchanged from default at present */
|
||||
@media print {
|
||||
pre.prettyprint, code.prettyprint { background-color: #fff; }
|
||||
pre .str, code .str { color: #088; }
|
||||
pre .kwd, code .kwd { color: #006; font-weight: bold; }
|
||||
pre .com, code .com { color: #0C3; font-style: italic; }
|
||||
pre .typ, code .typ { color: #404; font-weight: bold; }
|
||||
pre .lit, code .lit { color: #044; }
|
||||
pre .pun, code .pun { color: #440; }
|
||||
pre .pln, code .pln { color: #000; }
|
||||
pre .tag, code .tag { color: #b66ff7; font-weight: bold; }
|
||||
pre .htm, code .htm { color: #606; font-weight: bold; }
|
||||
pre .xsl, code .xsl { color: #606; font-weight: bold; }
|
||||
pre .atn, code .atn { color: #c71585; font-weight: normal; }
|
||||
pre .atv, code .atv { color: #088; font-weight: normal; }
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
||||
<html><head>
|
||||
<title>Prettify Themes Gallery</title>
|
||||
<style type="text/css">
|
||||
iframe { width: 100%; border-style: none; margin: 0; padding: 0 }
|
||||
</style>
|
||||
<script>
|
||||
var allThemes = [
|
||||
{ name: 'default' },
|
||||
{ name: 'desert',
|
||||
authorHtml: '<a href="http://code.google.com/u/@VhJeSlJYBhVMWgF7/">'
|
||||
+ 'techto…@<\/a>' },
|
||||
{ name: 'sunburst', authorHtml: 'David Leibovic' },
|
||||
{ name: 'sons-of-obsidian',
|
||||
authorHtml: '<a href="http://CodeTunnel.com/blog/post/71'
|
||||
+ '/google-code-prettify-obsidian-theme">Alex Ford<\/a>' },
|
||||
{ name: 'doxy', authorHtml: 'Robert Sperberg' },
|
||||
];
|
||||
|
||||
// Called by the demo.html frames loaded per theme to
|
||||
// size the iframes properly and to allow them to tile
|
||||
// the page nicely.
|
||||
function adjustChildIframeSize(themeName, width, height) {
|
||||
if (typeof console != 'undefined') {
|
||||
try {
|
||||
console.log('adjusting ' + themeName + ' to ' + width + 'x' + height);
|
||||
} catch (ex) {
|
||||
// Don't bother logging log failure.
|
||||
}
|
||||
}
|
||||
|
||||
var container = document.getElementById(themeName).parentNode;
|
||||
container.style.width = (+width + 16) + 'px';
|
||||
container.style.display = 'inline-block';
|
||||
var iframe = container.getElementsByTagName('iframe')[0];
|
||||
iframe.style.height = (+height + 16) + 'px';
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<noscript>This page requires JavaScript</noscript>
|
||||
|
||||
<h1>Gallery of themes for
|
||||
<a href="http://code.google.com/p/google-code-prettify/">code prettify</a></h1>
|
||||
<p>
|
||||
Click on a theme name for a link to the file in revision control.
|
||||
Print preview this page to see how the themes work on the printed page.
|
||||
</p>
|
||||
<script>(function () {
|
||||
// Produce an iframe per theme.
|
||||
// We pass the threme name to the iframe via its URI query, and
|
||||
// it loads prettify and the theme CSS, and calls back to this page
|
||||
// to resize the iframe.
|
||||
for (var i = 0, n = allThemes.length; i < n; ++i) {
|
||||
var theme = allThemes[i];
|
||||
if (!theme) { continue; }
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.name = theme.name;
|
||||
iframe.src = 'demo.html?' + encodeURIComponent(theme.name);
|
||||
var header = document.createElement('h2');
|
||||
header.id = theme.name;
|
||||
var linkToThemeSrc = document.createElement('a');
|
||||
linkToThemeSrc.href = (
|
||||
'http://code.google.com/p/google-code-prettify/source/browse/trunk/' +
|
||||
(theme.name === 'default'
|
||||
? 'src/prettify.css'
|
||||
: 'styles/' + encodeURIComponent(theme.name) + '.css'));
|
||||
linkToThemeSrc.appendChild(document.createTextNode(
|
||||
theme.name.replace(/\b[a-z]/g, // Capitalize first letter of each word
|
||||
function (letter) { return letter.toUpperCase(); })));
|
||||
header.appendChild(linkToThemeSrc);
|
||||
|
||||
var attribution;
|
||||
if (theme.authorHtml) {
|
||||
attribution = document.createElement('span');
|
||||
attribution.className = 'attribution';
|
||||
attribution.innerHTML = 'by ' + theme.authorHtml;
|
||||
}
|
||||
|
||||
var div = document.createElement('div');
|
||||
div.appendChild(header);
|
||||
if (attribution) { div.appendChild(attribution); }
|
||||
div.appendChild(iframe);
|
||||
document.body.appendChild(div);
|
||||
}
|
||||
})()</script>
|
||||
|
||||
</body></html>
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Derived from einaros's Sons of Obsidian theme at
|
||||
* http://studiostyl.es/schemes/son-of-obsidian by
|
||||
* Alex Ford of CodeTunnel:
|
||||
* http://CodeTunnel.com/blog/post/71/google-code-prettify-obsidian-theme
|
||||
*/
|
||||
|
||||
.str
|
||||
{
|
||||
color: #EC7600;
|
||||
}
|
||||
.kwd
|
||||
{
|
||||
color: #93C763;
|
||||
}
|
||||
.com
|
||||
{
|
||||
color: #66747B;
|
||||
}
|
||||
.typ
|
||||
{
|
||||
color: #678CB1;
|
||||
}
|
||||
.lit
|
||||
{
|
||||
color: #FACD22;
|
||||
}
|
||||
.pun
|
||||
{
|
||||
color: #F1F2F3;
|
||||
}
|
||||
.pln
|
||||
{
|
||||
color: #F1F2F3;
|
||||
}
|
||||
.tag
|
||||
{
|
||||
color: #8AC763;
|
||||
}
|
||||
.atn
|
||||
{
|
||||
color: #E0E2E4;
|
||||
}
|
||||
.atv
|
||||
{
|
||||
color: #EC7600;
|
||||
}
|
||||
.dec
|
||||
{
|
||||
color: purple;
|
||||
}
|
||||
pre.prettyprint
|
||||
{
|
||||
border: 0px solid #888;
|
||||
}
|
||||
ol.linenums
|
||||
{
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.prettyprint {
|
||||
background: #000;
|
||||
}
|
||||
li.L0, li.L1, li.L2, li.L3, li.L4, li.L5, li.L6, li.L7, li.L8, li.L9
|
||||
{
|
||||
color: #555;
|
||||
list-style-type: decimal;
|
||||
}
|
||||
li.L1, li.L3, li.L5, li.L7, li.L9 {
|
||||
background: #111;
|
||||
}
|
||||
@media print
|
||||
{
|
||||
.str
|
||||
{
|
||||
color: #060;
|
||||
}
|
||||
.kwd
|
||||
{
|
||||
color: #006;
|
||||
font-weight: bold;
|
||||
}
|
||||
.com
|
||||
{
|
||||
color: #600;
|
||||
font-style: italic;
|
||||
}
|
||||
.typ
|
||||
{
|
||||
color: #404;
|
||||
font-weight: bold;
|
||||
}
|
||||
.lit
|
||||
{
|
||||
color: #044;
|
||||
}
|
||||
.pun
|
||||
{
|
||||
color: #440;
|
||||
}
|
||||
.pln
|
||||
{
|
||||
color: #000;
|
||||
}
|
||||
.tag
|
||||
{
|
||||
color: #006;
|
||||
font-weight: bold;
|
||||
}
|
||||
.atn
|
||||
{
|
||||
color: #404;
|
||||
}
|
||||
.atv
|
||||
{
|
||||
color: #060;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/* Pretty printing styles. Used with prettify.js. */
|
||||
/* Vim sunburst theme by David Leibovic */
|
||||
|
||||
pre .str, code .str { color: #65B042; } /* string - green */
|
||||
pre .kwd, code .kwd { color: #E28964; } /* keyword - dark pink */
|
||||
pre .com, code .com { color: #AEAEAE; font-style: italic; } /* comment - gray */
|
||||
pre .typ, code .typ { color: #89bdff; } /* type - light blue */
|
||||
pre .lit, code .lit { color: #3387CC; } /* literal - blue */
|
||||
pre .pun, code .pun { color: #fff; } /* punctuation - white */
|
||||
pre .pln, code .pln { color: #fff; } /* plaintext - white */
|
||||
pre .tag, code .tag { color: #89bdff; } /* html/xml tag - light blue */
|
||||
pre .atn, code .atn { color: #bdb76b; } /* html/xml attribute name - khaki */
|
||||
pre .atv, code .atv { color: #65B042; } /* html/xml attribute value - green */
|
||||
pre .dec, code .dec { color: #3387CC; } /* decimal - blue */
|
||||
|
||||
pre.prettyprint, code.prettyprint {
|
||||
background-color: #000;
|
||||
-moz-border-radius: 8px;
|
||||
-webkit-border-radius: 8px;
|
||||
-o-border-radius: 8px;
|
||||
-ms-border-radius: 8px;
|
||||
-khtml-border-radius: 8px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
pre.prettyprint {
|
||||
width: 95%;
|
||||
margin: 1em auto;
|
||||
padding: 1em;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
|
||||
/* Specify class=linenums on a pre to get line numbering */
|
||||
ol.linenums { margin-top: 0; margin-bottom: 0; color: #AEAEAE; } /* IE indents via margin-left */
|
||||
li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8 { list-style-type: none }
|
||||
/* Alternate shading for lines */
|
||||
li.L1,li.L3,li.L5,li.L7,li.L9 { }
|
||||
|
||||
@media print {
|
||||
pre .str, code .str { color: #060; }
|
||||
pre .kwd, code .kwd { color: #006; font-weight: bold; }
|
||||
pre .com, code .com { color: #600; font-style: italic; }
|
||||
pre .typ, code .typ { color: #404; font-weight: bold; }
|
||||
pre .lit, code .lit { color: #044; }
|
||||
pre .pun, code .pun { color: #440; }
|
||||
pre .pln, code .pln { color: #000; }
|
||||
pre .tag, code .tag { color: #006; font-weight: bold; }
|
||||
pre .atn, code .atn { color: #404; }
|
||||
pre .atv, code .atv { color: #060; }
|
||||
}
|
||||
Reference in new issue
Block a user