// Copyright (C) 2006 Google Inc.<\/span>
<\/span>//<\/span>
<\/span>// Licensed under the Apache License, Version 2.0 (the "License");<\/span>
<\/span>// you may not use this file except in compliance with the License.<\/span>
<\/span>// You may obtain a copy of the License at<\/span>
<\/span>//<\/span>
<\/span>// http://www.apache.org/licenses/LICENSE-2.0<\/span>
<\/span>//<\/span>
<\/span>// Unless required by applicable law or agreed to in writing, software<\/span>
<\/span>// distributed under the License is distributed on an "AS IS" BASIS,<\/span>
<\/span>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<\/span>
<\/span>// See the License for the specific language governing permissions and<\/span>
<\/span>// limitations under the License.<\/span>
<\/span>/**
* @fileoverview
* some functions for browser-side pretty printing of code contained in html.
*
* The lexer should work on a number of languages including C and friends,
* Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, and Makefiles.
* It works passably on Ruby, PHP and Awk and a decent subset of Perl, but,
* because of commenting conventions, doesn\'t work on Smalltalk, Lisp-like, or
* CAML-like languages.
*
* If there\'s a language not mentioned here, then I don\'t know it, and don\'t
* know whether it works. If it has a C-like, Bash-like, or XML-like syntax
* then it should work passably.
*
* Usage:
* 1) include this source file in an html page via
* <script type="text/javascript" src="/path/to/prettify.js"></script>
* 2) define style rules. See the example page for examples.
* 3) mark the <pre> and <code> tags in your source with class=prettyprint.
* You can also use the (html deprecated) <xmp> tag, but the pretty printer
* needs to do more substantial DOM manipulations to support that, so some
* css styles may not be preserved.
* That\'s it. I wanted to keep the API as simple as possible, so there\'s no
* need to specify which language the code is in.
*
* Change log:
* cbeust, 2006/08/22
* Java annotations (start with "@") are now captured as literals ("lit")
*/<\/span>
<\/span>var<\/span> <\/span>PR_keywords<\/span> <\/span>=<\/span> <\/span>{<\/span>}<\/span>;<\/span>
<\/span>/** initialize the keyword list for our target languages. */<\/span>
<\/span>(<\/span>function<\/span> <\/span>(<\/span>)<\/span> <\/span>{<\/span>
<\/span>var<\/span> <\/span>CPP_KEYWORDS<\/span> <\/span>=<\/span> <\/span>"<\/span>abstract bool break case catch char class const <\/span>"<\/span><\/span> <\/span>+<\/span>
<\/span>"<\/span>const_cast continue default delete deprecated dllexport dllimport do <\/span>"<\/span><\/span> <\/span>+<\/span>
<\/span>"<\/span>double dynamic_cast else enum explicit extern false float for friend <\/span>"<\/span><\/span> <\/span>+<\/span>
<\/span>"<\/span>goto if inline int long mutable naked namespace new noinline noreturn <\/span>"<\/span><\/span> <\/span>+<\/span>
<\/span>"<\/span>nothrow novtable operator private property protected public register <\/span>"<\/span><\/span> <\/span>+<\/span>
<\/span>"<\/span>reinterpret_cast return selectany short signed sizeof static <\/span>"<\/span><\/span> <\/span>+<\/span>
<\/span>"<\/span>static_cast struct switch template this thread throw true try typedef <\/span>"<\/span><\/span> <\/span>+<\/span>
<\/span>"<\/span>typeid typename union unsigned using declaration, directive uuid <\/span>"<\/span><\/span> <\/span>+<\/span>
<\/span>"<\/span>virtual void volatile while typeof<\/span>"<\/span><\/span>;<\/span>
<\/span>var<\/span> <\/span>CSHARP_KEYWORDS<\/span> <\/span>=<\/span> <\/span>"<\/span>as base by byte checked decimal delegate descending <\/span>"<\/span><\/span> <\/span>+<\/span>
<\/span>"<\/span>event finally fixed foreach from group implicit in interface internal <\/span>"<\/span><\/span> <\/span>+<\/span>
<\/span>"<\/span>into is lock null object out override orderby params readonly ref sbyte <\/span>"<\/span><\/span> <\/span>+<\/span>
<\/span>"<\/span>sealed stackalloc string select uint ulong unchecked unsafe ushort var<\/span>"<\/span><\/span>;<\/span>
<\/span>var<\/span> <\/span>JAVA_KEYWORDS<\/span> <\/span>=<\/span> <\/span>"<\/span>package synchronized boolean implements import throws <\/span>"<\/span><\/span> <\/span>+<\/span>
<\/span>"<\/span>instanceof transient extends final strictfp native super<\/span>"<\/span><\/span>;<\/span>
<\/span>var<\/span> <\/span>JSCRIPT_KEYWORDS<\/span> <\/span>=<\/span> <\/span>"<\/span>debugger export function with NaN Infinity<\/span>