Added ada syntax highlighting

This commit is contained in:
hyung-hwan 2014-05-25 14:04:46 +00:00
parent 792cd682f0
commit 7e830706e7
20 changed files with 1407 additions and 315 deletions

View File

@ -6,9 +6,12 @@
<link type="text/css" rel="stylesheet" href="<?=base_url_make('/css/common.css')?>" />
<link type="text/css" rel="stylesheet" href="<?=base_url_make('/css/code.css')?>" />
<script type="text/javascript" src="<?=base_url_make('/js/prettify/prettify.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/prettify/lang-ada.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/prettify/lang-basic.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/prettify/lang-css.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/prettify/lang-lisp.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/prettify/lang-lua.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/prettify/lang-pascal.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/prettify/lang-sql.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/prettify/lang-vb.js')?>"></script>
@ -173,14 +176,18 @@ print anchor ("code/fetch/{$project->id}/${xpar}{$revreq}", $this->lang->line('D
<?php
$fileext = substr(strrchr($file['name'], '.'), 1);
if ($fileext == "") $fileext = "html";
if ($fileext == 'adb' || $fileext == 'ads') $fileext = 'ada';
else if ($fileext == 'pas') $fileext = 'pascal';
else if ($fileext == 'bas') $fileext = 'basic';
if ($fileext != '') $prettyprint_lang = "lang-$fileext";
$prettyprint_linenums = 'linenums';
if ($login['settings'] != NULL &&
$login['settings']->code_hide_line_num == 'Y') $prettyprint_linenums = '';
?>
<pre class="prettyprint <?=$prettyprint_linenums?> lang-<?=$fileext?>" id="code_blame_mainarea_result_pre">
<pre class="prettyprint <?=$prettyprint_linenums?> <?=$prettyprint_lang?>" id="code_blame_mainarea_result_pre">
<?php
$content = $file['content'];

View File

@ -6,9 +6,12 @@
<link type="text/css" rel="stylesheet" href="<?=base_url_make('/css/common.css')?>" />
<link type="text/css" rel="stylesheet" href="<?=base_url_make('/css/code.css')?>" />
<script type="text/javascript" src="<?=base_url_make('/js/prettify/prettify.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/prettify/lang-ada.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/prettify/lang-basic.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/prettify/lang-css.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/prettify/lang-lisp.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/prettify/lang-lua.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/prettify/lang-pascal.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/prettify/lang-sql.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/prettify/lang-vb.js')?>"></script>
@ -176,14 +179,18 @@ $this->load->view (
<?php
$fileext = substr(strrchr($file['name'], '.'), 1);
if ($fileext == '') $fileext = "html";
if ($fileext == 'adb' || $fileext == 'ads') $fileext = 'ada';
else if ($fileext == 'pas') $fileext = 'pascal';
else if ($fileext == 'bas') $fileext = 'basic';
if ($fileext != '') $prettyprint_lang = "lang-$fileext";
$prettyprint_linenums = 'linenums';
if ($login['settings'] != NULL &&
$login['settings']->code_hide_line_num == 'Y') $prettyprint_linenums = '';
?>
<pre class="prettyprint <?=$prettyprint_linenums?> lang-<?=$fileext?>" id="code_file_mainarea_result_pre">
<pre class="prettyprint <?=$prettyprint_linenums?> <?=$prettyprint_lang?>" id="code_file_mainarea_result_pre">
<?php print htmlspecialchars($file['content']); ?>
</pre>

View File

@ -1,15 +1,34 @@
wwwdir=$(WWWDIR)/js/prettify
www_DATA = \
lang-ada.js \
lang-apollo.js \
lang-basic.js \
lang-clj.js \
lang-css.js \
lang-dart.js \
lang-erlang.js \
lang-go.js \
lang-hs.js \
lang-lisp.js \
lang-llvm.js \
lang-lua.js \
lang-matlab.js \
lang-ml.js \
lang-mumps.js \
lang-n.js \
lang-pascal.js \
lang-proto.js \
lang-r.js \
lang-rd.js \
lang-scala.js \
lang-sql.js \
lang-tcl.js \
lang-tex.js \
lang-vb.js \
lang-vhdl.js \
lang-wiki.js \
lang-xq.js \
lang-yaml.js \
prettify.css \
prettify.js

View File

@ -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']);

View File

@ -30,19 +30,95 @@
* @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],
['lang-css-str', /^url\(([^\)\"\']+)\)/i],
[PR['PR_KEYWORD'],
/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,
null],
@ -55,7 +131,7 @@ PR['registerLangHandler'](
// 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}/i],
[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],
@ -63,6 +139,8 @@ PR['registerLangHandler'](
[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']([],
[
@ -70,6 +148,9 @@ PR['registerLangHandler'](
/^-?(?:[_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']([],
[

View File

@ -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']);

View File

@ -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']);

View File

@ -28,6 +28,7 @@
* 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
@ -90,4 +91,4 @@ PR['registerLangHandler'](
// A printable non-space non-special character
[PR['PR_PUNCTUATION'], /^[^\w\t\n\r \xA0()\"\\\';]+/]
]),
['cl', 'el', 'lisp', 'scm']);
['cl', 'el', 'lisp', 'lsp', 'scm', 'ss', 'rkt']);

View File

@ -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']);

File diff suppressed because one or more lines are too long

View File

@ -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']);
})();

View File

@ -20,6 +20,7 @@
* @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|'
@ -27,24 +28,26 @@
+ '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';
var 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']
];
var 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(
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]+'
@ -56,7 +59,7 @@
// with an optional modifier like UL for unsigned long
+ '[a-z]*', 'i'), null, '0123456789'],
[PR.PR_PUNCTUATION, /^.[^\s\w\.$@\'\"\`\/\#]*/, null]
];
PR.registerLangHandler(PR.createSimpleLexer(shortcutStylePatterns, fallthroughStylePatterns), ['n', 'nemerle']);
[PR['PR_PUNCTUATION'], /^.[^\s\w\.$@\'\"\`\/\#]*/, null]
]),
['n', 'nemerle']);
})();

View File

@ -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']);

View File

@ -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']);

View File

@ -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']);

View File

@ -25,8 +25,9 @@
*
*
* 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 as the basis
* for the keyword list.
* 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
*/
@ -44,7 +45,7 @@ PR['registerLangHandler'](
// 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|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|MATCH|MERGE|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|USING|VALUES|VARYING|VIEW|WAITFOR|WHEN|WHERE|WHILE|WITH|WRITETEXT)(?=[^\w-]|$)/i, null],
[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'],

View File

@ -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']);

View File

@ -20,27 +20,27 @@
* @author Martin S.
*/
PR.registerLangHandler(
PR.createSimpleLexer(
PR['registerLangHandler'](
PR['createSimpleLexer'](
[
// whitespace
[PR.PR_PLAIN, /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
[PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
// all comments begin with '%'
[PR.PR_COMMENT, /^%[^\r\n]*/, null, '%']
[PR['PR_COMMENT'], /^%[^\r\n]*/, null, '%']
],
[
//[PR.PR_DECLARATION, /^\\([egx]?def|(new|renew|provide)(command|environment))\b/],
//[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@]+/],
[PR['PR_KEYWORD'], /^\\[a-zA-Z@]+/],
// or contains only one character
[PR.PR_KEYWORD, /^\\./],
[PR['PR_KEYWORD'], /^\\./],
// Highlight dollar for math mode and ampersam for tabular
[PR.PR_TYPE, /^[$&]/],
[PR['PR_TYPE'], /^[$&]/],
// numeric measurement values with attached units
[PR.PR_LITERAL,
[PR['PR_LITERAL'],
/[+-]?(?:\.\d+|\d+(?:\.\d*)?)(cm|em|ex|in|pc|pt|bp|mm)/i],
// punctuation usually occurring within commands
[PR.PR_PUNCTUATION, /^[{}()\[\]=]+/]
[PR['PR_PUNCTUATION'], /^[{}()\[\]=]+/]
]),
['latex', 'tex']);

View File

@ -41,17 +41,22 @@ PR['registerLangHandler'](
'"\u201C\u201D'],
// A comment starts with a single quote and runs until the end of the
// line.
[PR['PR_COMMENT'], /^[\'\u2018\u2019][^\r\n\u2028\u2029]*/, null, '\'\u2018\u2019']
// 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[^\r\n\u2028\u2029]*/i],
[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?
[PR['PR_PLAIN'], /^(?:(?:[a-z]|_\w)\w*|\[(?:[a-z]|_\w)\w*\])/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]+/],

File diff suppressed because it is too large Load Diff