diff --git a/www/media/idf/css/prettify.css b/www/media/idf/css/prettify.css index 13e9c52..2eb91bf 100644 --- a/www/media/idf/css/prettify.css +++ b/www/media/idf/css/prettify.css @@ -1,27 +1 @@ -/* Pretty printing styles. Used with prettify.js. */ - -.str { color: #080; } -.kwd { color: #008; } -.com { color: #800; } -.typ { color: #606; } -.lit { color: #066; } -.pun { color: #660; } -.pln { color: #000; } -.tag { color: #008; } -.atn { color: #606; } -.atv { color: #080; } -.dec { color: #606; } -pre.prettyprint { border:0px; padding:0; margin:0; } - -@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; } -} +.str,.atv{color:#080}.kwd,.tag{color:#008}.com{color:#800}.typ,.atn,.dec{color:#606}.lit{color:#066}.pun{color:#660}.pln{color:#000}pre.prettyprint{padding:2px;border:1px solid #888}@media print{.str{color:#060}.kwd,.tag{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{font-weight:bold}.lit{color:#044}.pun{color:#440}.atn,.typ{color:#404}.atv{color:#060}} \ No newline at end of file diff --git a/www/media/idf/js/lang-apollo.js b/www/media/idf/js/lang-apollo.js new file mode 100644 index 0000000..4042030 --- /dev/null +++ b/www/media/idf/js/lang-apollo.js @@ -0,0 +1 @@ +PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_COMMENT,/^#[^\r\n]*/,null,'#'],[PR.PR_PLAIN,/^[\t\n\r \xA0]+/,null,' \n\r \xa0'],[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],[PR.PR_LITERAL,/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],[PR.PR_PLAIN,/^-*(?:[!-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],[PR.PR_PUNCTUATION,/^[^\w\t\n\r \xA0()\"\\\';]+/]]),['apollo','agc','aea']) \ No newline at end of file diff --git a/www/media/idf/js/lang-css.js b/www/media/idf/js/lang-css.js new file mode 100644 index 0000000..c650d8f --- /dev/null +++ b/www/media/idf/js/lang-css.js @@ -0,0 +1 @@ +PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null,' \r\n']],[[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],['lang-css-kw',/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),['css']),PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),['css-kw']),PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),['css-str']) \ No newline at end of file diff --git a/www/media/idf/js/lang-hs.js b/www/media/idf/js/lang-hs.js new file mode 100644 index 0000000..27b221a --- /dev/null +++ b/www/media/idf/js/lang-hs.js @@ -0,0 +1 @@ +PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[\t\n\x0B\x0C\r ]+/,null,' \n\r '],[PR.PR_STRING,/^\"(?:[^\"\\\n\x0C\r]|\\[\s\S])*(?:\"|$)/,null,'\"'],[PR.PR_STRING,/^\'(?:[^\'\\\n\x0C\r]|\\[^&])\'?/,null,'\''],[PR.PR_LITERAL,/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+\-]?\d+)?)/i,null,'0123456789']],[[PR.PR_COMMENT,/^(?:(?:--+(?:[^\r\n\x0C]*)?)|(?:\{-(?:[^-]|-+[^-\}])*-\}))/],[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],[PR.PR_PLAIN,/^(?:[A-Z][\w\']*\.)*[a-zA-Z][\w\']*/],[PR.PR_PUNCTUATION,/^[^\t\n\x0B\x0C\r a-zA-Z0-9\'\"]+/]]),['hs']) \ No newline at end of file diff --git a/www/media/idf/js/lang-lisp.js b/www/media/idf/js/lang-lisp.js new file mode 100644 index 0000000..85c6c23 --- /dev/null +++ b/www/media/idf/js/lang-lisp.js @@ -0,0 +1 @@ +PR.registerLangHandler(PR.createSimpleLexer([['opn',/^\(/,null,'('],['clo',/^\)/,null,')'],[PR.PR_COMMENT,/^;[^\r\n]*/,null,';'],[PR.PR_PLAIN,/^[\t\n\r \xA0]+/,null,' \n\r \xa0'],[PR.PR_STRING,/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,null,'\"']],[[PR.PR_KEYWORD,/^(?:block|c[ad]+r|catch|cons|defun|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,/^[+\-]?(?:0x[0-9a-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[ed][+\-]?\d+)?)/i],[PR.PR_LITERAL,/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],[PR.PR_PLAIN,/^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],[PR.PR_PUNCTUATION,/^[^\w\t\n\r \xA0()\"\\\';]+/]]),['cl','el','lisp','scm']) \ No newline at end of file diff --git a/www/media/idf/js/lang-lua.js b/www/media/idf/js/lang-lua.js new file mode 100644 index 0000000..d107bab --- /dev/null +++ b/www/media/idf/js/lang-lua.js @@ -0,0 +1 @@ +PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[\t\n\r \xA0]+/,null,' \n\r \xa0'],[PR.PR_STRING,/^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])*(?:\'|$))/,null,'\"\'']],[[PR.PR_COMMENT,/^--(?:\[(=*)\[[\s\S]*?(?:\]\1\]|$)|[^\r\n]*)/],[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],[PR.PR_LITERAL,/^[+-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],[PR.PR_PLAIN,/^[a-z_]\w*/i],[PR.PR_PUNCTUATION,/^[^\w\t\n\r \xA0][^\w\t\n\r \xA0\"\'\-\+=]*/]]),['lua']) \ No newline at end of file diff --git a/www/media/idf/js/lang-ml.js b/www/media/idf/js/lang-ml.js new file mode 100644 index 0000000..698d6de --- /dev/null +++ b/www/media/idf/js/lang-ml.js @@ -0,0 +1 @@ +PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[\t\n\r \xA0]+/,null,' \n\r \xa0'],[PR.PR_COMMENT,/^#(?:if[\t\n\r \xA0]+(?:[a-z_$][\w\']*|``[^\r\n\t`]*(?:``|$))|else|endif|light)/i,null,'#'],[PR.PR_STRING,/^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])*(?:\'|$))/,null,'\"\'']],[[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/],[PR.PR_LITERAL,/^[+\-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],[PR.PR_PLAIN,/^(?:[a-z_]\w*[!?#]?|``[^\r\n\t`]*(?:``|$))/i],[PR.PR_PUNCTUATION,/^[^\t\n\r \xA0\"\'\w]+/]]),['fs','ml']) \ No newline at end of file diff --git a/www/media/idf/js/lang-proto.js b/www/media/idf/js/lang-proto.js new file mode 100644 index 0000000..e67967f --- /dev/null +++ b/www/media/idf/js/lang-proto.js @@ -0,0 +1 @@ +PR.registerLangHandler(PR.sourceDecorator({keywords:'bool bytes default double enum extend extensions false fixed32 fixed64 float group import int32 int64 max message option optional package repeated required returns rpc service sfixed32 sfixed64 sint32 sint64 string syntax to true uint32 uint64',cStyleComments:true}),['proto']) \ No newline at end of file diff --git a/www/media/idf/js/lang-sql.js b/www/media/idf/js/lang-sql.js new file mode 100644 index 0000000..ff381cd --- /dev/null +++ b/www/media/idf/js/lang-sql.js @@ -0,0 +1 @@ +PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[\t\n\r \xA0]+/,null,' \n\r \xa0'],[PR.PR_STRING,/^(?:"(?:[^\"\\]|\\.)*"|'(?:[^\'\\]|\\.)*')/,null,'\"\'']],[[PR.PR_COMMENT,/^(?:--[^\r\n]*|\/\*[\s\S]*?(?:\*\/|$))/],[PR.PR_KEYWORD,/^(?:ADD|ALL|ALTER|AND|ANY|AS|ASC|AUTHORIZATION|BACKUP|BEGIN|BETWEEN|BREAK|BROWSE|BULK|BY|CASCADE|CASE|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMN|COMMIT|COMPUTE|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|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|NATIONAL|NOCHECK|NONCLUSTERED|NOT|NULL|NULLIF|OF|OFF|OFFSETS|ON|OPEN|OPENDATASOURCE|OPENQUERY|OPENROWSET|OPENXML|OPTION|OR|ORDER|OUTER|OVER|PERCENT|PLAN|PRECISION|PRIMARY|PRINT|PROC|PROCEDURE|PUBLIC|RAISERROR|READ|READTEXT|RECONFIGURE|REFERENCES|REPLICATION|RESTORE|RESTRICT|RETURN|REVOKE|RIGHT|ROLLBACK|ROWCOUNT|ROWGUIDCOL|RULE|SAVE|SCHEMA|SELECT|SESSION_USER|SET|SETUSER|SHUTDOWN|SOME|STATISTICS|SYSTEM_USER|TABLE|TEXTSIZE|THEN|TO|TOP|TRAN|TRANSACTION|TRIGGER|TRUNCATE|TSEQUAL|UNION|UNIQUE|UPDATE|UPDATETEXT|USE|USER|VALUES|VARYING|VIEW|WAITFOR|WHEN|WHERE|WHILE|WITH|WRITETEXT)(?=[^\w-]|$)/i,null],[PR.PR_LITERAL,/^[+-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],[PR.PR_PLAIN,/^[a-z_][\w-]*/i],[PR.PR_PUNCTUATION,/^[^\w\t\n\r \xA0\"\'][^\w\t\n\r \xA0+\-\"\']*/]]),['sql']) \ No newline at end of file diff --git a/www/media/idf/js/lang-vb.js b/www/media/idf/js/lang-vb.js new file mode 100644 index 0000000..cabce85 --- /dev/null +++ b/www/media/idf/js/lang-vb.js @@ -0,0 +1 @@ +PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[\t\n\r \xA0\u2028\u2029]+/,null,' \n\r \xa0\u2028\u2029'],[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'],[PR.PR_COMMENT,/^[\'\u2018\u2019][^\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],[PR.PR_COMMENT,/^REM[^\r\n\u2028\u2029]*/i],[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],[PR.PR_PLAIN,/^(?:(?:[a-z]|_\w)\w*|\[(?:[a-z]|_\w)\w*\])/i],[PR.PR_PUNCTUATION,/^[^\w\t\n\r \"\'\[\]\xA0\u2018\u2019\u201C\u201D\u2028\u2029]+/],[PR.PR_PUNCTUATION,/^(?:\[|\])/]]),['vb','vbs']) \ No newline at end of file diff --git a/www/media/idf/js/lang-wiki.js b/www/media/idf/js/lang-wiki.js new file mode 100644 index 0000000..00a1b6b --- /dev/null +++ b/www/media/idf/js/lang-wiki.js @@ -0,0 +1 @@ +PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[\t \xA0a-gi-z0-9]+/,null,' \xa0abcdefgijklmnopqrstuvwxyz0123456789'],[PR.PR_PUNCTUATION,/^[=*~\^\[\]]+/,null,'=*~^[]']],[['lang-wiki.meta',/(?:^^|\r\n?|\n)(#[a-z]+)\b/],[PR.PR_LITERAL,/^(?:[A-Z][a-z][a-z0-9]+[A-Z][a-z][a-zA-Z0-9]+)\b/],['lang-',/^\{\{\{([\s\S]+?)\}\}\}/],['lang-',/^`([^\r\n`]+)`/],[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']) \ No newline at end of file diff --git a/www/media/idf/js/prettify.js b/www/media/idf/js/prettify.js index 05e6818..06ffc84 100644 --- a/www/media/idf/js/prettify.js +++ b/www/media/idf/js/prettify.js @@ -1,1350 +1,46 @@ -// 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 - * 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 - * - * 2) define style rules. See the example page for examples. - * 3) mark the
and tags in your source
- * with class=prettyprint.
- * You can also use the (html deprecated) 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")
- */
-
-var PR_keywords = new Object();
-/** initialize the keyword list for our target languages. */
-(function () {
- var CPP_KEYWORDS = (
- "bool break case catch char class const const_cast continue default " +
- "delete deprecated dllexport dllimport do double dynamic_cast else enum " +
- "explicit extern false float for friend goto if inline int long mutable " +
- "naked namespace new noinline noreturn nothrow novtable operator private " +
- "property protected public register reinterpret_cast return selectany " +
- "short signed sizeof static static_cast struct switch template this " +
- "thread throw true try typedef typeid typename union unsigned using " +
- "declaration, using directive uuid virtual void volatile while typeof");
- var JAVA_KEYWORDS = (
- "abstract default goto package synchronized boolean do if private this " +
- "break double implements protected throw byte else import public throws " +
- "case enum instanceof return transient catch extends int short try char " +
- "final interface static void class finally long strictfp volatile const " +
- "float native super while continue for new switch");
- var PYTHON_KEYWORDS = (
- "and assert break class continue def del elif else except exec finally " +
- "for from global if import in is lambda not or pass print raise return " +
- "try while yield False True None");
- var JSCRIPT_KEYWORDS = (
- "abstract boolean break byte case catch char class const continue " +
- "debugger default delete do double else enum export extends false final " +
- "finally float for function goto if implements import in instanceof int " +
- "interface long native new null package private protected public return " +
- "short static super switch synchronized this throw throws transient " +
- "true try typeof var void volatile while with NaN Infinity");
- var PERL_KEYWORDS = (
- "foreach require sub unless until use elsif BEGIN END");
- var SH_KEYWORDS = (
- "if then do else fi end");
- var RUBY_KEYWORDS = (
- "if then elsif else end begin do rescue ensure while for class module " +
- "def yield raise until unless and or not when case super undef break " +
- "next redo retry in return alias defined");
- var KEYWORDS = [CPP_KEYWORDS, JAVA_KEYWORDS, JSCRIPT_KEYWORDS, PERL_KEYWORDS,
- PYTHON_KEYWORDS, RUBY_KEYWORDS, SH_KEYWORDS];
- for (var k = 0; k < KEYWORDS.length; k++) {
- var kw = KEYWORDS[k].split(' ');
- for (var i = 0; i < kw.length; i++) {
- if (kw[i]) { PR_keywords[kw[i]] = true; }
- }
- }
-}).call(this);
-
-// token style names. correspond to css classes
-/** token style for a string literal */
-var PR_STRING = 'str';
-/** token style for a keyword */
-var PR_KEYWORD = 'kwd';
-/** token style for a comment */
-var PR_COMMENT = 'com';
-/** token style for a type */
-var PR_TYPE = 'typ';
-/** token style for a literal value. e.g. 1, null, true. */
-var PR_LITERAL = 'lit';
-/** token style for a punctuation string. */
-var PR_PUNCTUATION = 'pun';
-/** token style for a punctuation string. */
-var PR_PLAIN = 'pln';
-
-/** token style for an sgml tag. */
-var PR_TAG = 'tag';
-/** token style for a markup declaration such as a DOCTYPE. */
-var PR_DECLARATION = 'dec';
-/** token style for embedded source. */
-var PR_SOURCE = 'src';
-/** token style for an sgml attribute name. */
-var PR_ATTRIB_NAME = 'atn';
-/** token style for an sgml attribute value. */
-var PR_ATTRIB_VALUE = 'atv';
-
-/** the position of the end of a token during. A division of a string into
- * n tokens can be represented as a series n - 1 token ends, as long as
- * runs of whitespace warrant their own token.
- * @private
- */
-function PR_TokenEnd(end, style) {
- if (undefined === style) { throw new Error('BAD'); }
- if ('number' != typeof(end)) { throw new Error('BAD'); }
- this.end = end;
- this.style = style;
-}
-PR_TokenEnd.prototype.toString = function () {
- return '[PR_TokenEnd ' + this.end +
- (this.style ? ':' + this.style : '') + ']';
-};
-
-
-/** a chunk of text with a style. These are used to represent both the output
- * from the lexing functions as well as intermediate results.
- * @constructor
- * @param token the token text
- * @param style one of the token styles defined in designdoc-template, or null
- * for a styleless token, such as an embedded html tag.
- * @private
- */
-function PR_Token(token, style) {
- if (undefined === style) { throw new Error('BAD'); }
- this.token = token;
- this.style = style;
-}
-
-PR_Token.prototype.toString = function () {
- return '[PR_Token ' + this.token + (this.style ? ':' + this.style : '') + ']';
-};
-
-
-/** a helper class that decodes common html entities used to escape source and
- * markup punctuation characters in html.
- * @constructor
- * @private
- */
-function PR_DecodeHelper() {
- this.next = 0;
- this.ch = '\0';
-}
-
-PR_DecodeHelper.prototype.decode = function (s, i) {
- var next = i + 1;
- var ch = s.charAt(i);
- if ('&' == ch) {
- var semi = s.indexOf(';', next);
- if (semi >= 0 && semi < next + 4) {
- var entityName = s.substring(next, semi).toLowerCase();
- next = semi + 1;
- if ('lt' == entityName) {
- ch = '<';
- } else if ('gt' == entityName) {
- ch = '>';
- } else if ('quot' == entityName) {
- ch = '"';
- } else if ('apos' == entityName) {
- ch = '\'';
- } else if ('amp' == entityName) {
- ch = '&';
- } else {
- next = i + 1;
- }
- }
- }
- this.next = next;
- this.ch = ch;
- return this.ch;
-}
-
-
-// some string utilities
-function PR_isWordChar(ch) {
- return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z');
-}
-
-function PR_isIdentifierStart(ch) {
- return PR_isWordChar(ch) || ch == '_' || ch == '$' || ch == '@';
-}
-
-function PR_isIdentifierPart(ch) {
- return PR_isIdentifierStart(ch) || PR_isDigitChar(ch);
-}
-
-function PR_isSpaceChar(ch) {
- return "\t \r\n".indexOf(ch) >= 0;
-}
-
-function PR_isDigitChar(ch) {
- return ch >= '0' && ch <= '9';
-}
-
-function PR_trim(s) {
- var i = 0, j = s.length - 1;
- while (i <= j && PR_isSpaceChar(s.charAt(i))) { ++i; }
- while (j > i && PR_isSpaceChar(s.charAt(j))) { --j; }
- return s.substring(i, j + 1);
-}
-
-function PR_startsWith(s, prefix) {
- return s.length >= prefix.length && prefix == s.substring(0, prefix.length);
-}
-
-function PR_endsWith(s, suffix) {
- return s.length >= suffix.length &&
- suffix == s.substring(s.length - suffix.length, s.length);
-}
-
-/** true iff prefix matches the first prefix characters in chars[0:len].
- * @private
- */
-function PR_prefixMatch(chars, len, prefix) {
- if (len < prefix.length) { return false; }
- for (var i = 0, n = prefix.length; i < n; ++i) {
- if (prefix.charAt(i) != chars[i]) { return false; }
- }
- return true;
-}
-
-/** used to convert html special characters embedded in XMP tags into html. */
-function PR_textToHtml(str) {
- return str.replace(/&/g, '&').replace(//g, '>');
-}
-
-
-/** split markup into chunks of html tags (style null) and
- * plain text (style {@link #PR_PLAIN}).
- *
- * @param s a String of html.
- * @return an Array of PR_Tokens of style PR_PLAIN and null.
- * @private
- */
-function PR_chunkify(s) {
- var chunks = new Array();
- var state = 0;
- var start = 0;
- var pos = -1;
- for (var i = 0, n = s.length; i < n; ++i) {
- var ch = s.charAt(i);
- switch (state) {
- case 0:
- if ('<' == ch) { state = 1; }
- break;
- case 1:
- pos = i - 1;
- if ('/' == ch) { state = 2; }
- else if (PR_isWordChar(ch)) { state = 3; }
- else if ('<' == ch) { state = 1; }
- else { state = 0; }
- break;
- case 2:
- if (PR_isWordChar(ch)) { state = 3; }
- else if ('<' == ch) { state = 1; }
- else { state = 0; }
- break;
- case 3:
- if ('>' == ch) {
- if (pos > start) {
- chunks.push(new PR_Token(s.substring(start, pos), PR_PLAIN));
- }
- chunks.push(new PR_Token(s.substring(pos, i + 1), null));
- start = i + 1;
- pos = -1;
- state = 0;
- }
- break;
- }
- }
- if (s.length > start) {
- chunks.push(new PR_Token(s.substring(start, s.length), PR_PLAIN));
- }
- return chunks;
-}
-
-/** splits chunks around entities.
- * @private
- */
-function PR_splitEntities(chunks) {
- var chunksOut = new Array();
- var state = 0;
- for (var ci = 0, nc = chunks.length; ci < nc; ++ci) {
- var chunk = chunks[ci];
- if (PR_PLAIN != chunk.style) {
- chunksOut.push(chunk);
- continue;
- }
- var s = chunk.token;
- var pos = 0;
- var start;
- for (var i = 0; i < s.length; ++i) {
- var ch = s.charAt(i);
- switch (state) {
- case 0:
- if ('&' == ch) { state = 1; }
- break;
- case 1:
- if ('#' == ch || PR_isWordChar(ch)) {
- start = i - 1;
- state = 2;
- } else {
- state = 0;
- }
- break;
- case 2:
- if (';' == ch) {
- if (start > pos) {
- chunksOut.push(
- new PR_Token(s.substring(pos, start), chunk.style));
- }
- chunksOut.push(new PR_Token(s.substring(start, i + 1), null));
- pos = i + 1;
- state = 0;
- }
- break;
- }
- }
- if (s.length > pos) {
- chunksOut.push(pos ?
- new PR_Token(s.substring(pos, s.length), chunk.style) :
- chunk);
- }
- }
- return chunksOut;
-}
-
-/** walk the tokenEnds list and the chunk list in parallel to generate a list
- * of split tokens.
- * @private
- */
-function PR_splitChunks(chunks, tokenEnds) {
- var tokens = new Array(); // the output
-
- var ci = 0; // index into chunks
- // position of beginning of amount written so far in absolute space.
- var posAbs = 0;
- // position of amount written so far in chunk space
- var posChunk = 0;
-
- // current chunk
- var chunk = new PR_Token('', null);
-
- for (var ei = 0, ne = tokenEnds.length; ei < ne; ++ei) {
- var tokenEnd = tokenEnds[ei];
- var end = tokenEnd.end;
-
- var tokLen = end - posAbs;
- var remainingInChunk = chunk.token.length - posChunk;
-
- // FIX Nicolas LASSALLE : remainingInChunk and tokLen can both be equals so that the while is infinite !
- if (remainingInChunk != tokLen) {
- while (remainingInChunk <= tokLen) {
- if (remainingInChunk > 0) {
- tokens.push(
- new PR_Token(chunk.token.substring(posChunk, chunk.token.length),
- null == chunk.style ? null : tokenEnd.style));
- }
- posAbs += remainingInChunk;
- posChunk = 0;
- if (ci < chunks.length) { chunk = chunks[ci++]; }
-
- tokLen = end - posAbs;
- remainingInChunk = chunk.token.length - posChunk;
- }
- }
-
- if (tokLen) {
- tokens.push(
- new PR_Token(chunk.token.substring(posChunk, posChunk + tokLen),
- tokenEnd.style));
- posAbs += tokLen;
- posChunk += tokLen;
- }
- }
-
- return tokens;
-}
-
-/** splits markup tokens into declarations, tags, and source chunks.
- * @private
- */
-function PR_splitMarkup(chunks) {
- // A state machine to split out declarations, tags, etc.
- // This state machine deals with absolute space in the text, indexed by k,
- // and position in the current chunk, indexed by pos and tokenStart to
- // generate a list of the ends of tokens.
- // Absolute space is calculated by considering the chunks as appended into
- // one big string, as they were before being split.
-
- // Known failure cases
- // Server side scripting sections such as ...?> in attributes.
- // i.e.
- // Handling this would require a stack, and we don't use PHP.
-
- // The output: a list of pairs of PR_TokenEnd instances
- var tokenEnds = new Array();
-
- var state = 0; // FSM state variable
- var k = 0; // position in absolute space of the start of the current chunk
- var tokenStart = -1; // the start of the current token
-
- // Try to find a closing tag for any open