Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: bower_components/google-code-prettify/src/lang-lua.js

Issue 786953007: npm_modules: Fork bower_components into Polymer 0.4.0 and 0.5.0 versions (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (C) 2008 Google Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15
16
17 /**
18 * @fileoverview
19 * Registers a language handler for Lua.
20 *
21 *
22 * To use, include prettify.js and this file in your HTML page.
23 * Then put your code in an HTML tag like
24 * <pre class="prettyprint lang-lua">(my Lua code)</pre>
25 *
26 *
27 * I used http://www.lua.org/manual/5.1/manual.html#2.1
28 * Because of the long-bracket concept used in strings and comments, Lua does
29 * not have a regular lexical grammar, but luckily it fits within the space
30 * of irregular grammars supported by javascript regular expressions.
31 *
32 * @author mikesamuel@gmail.com
33 */
34
35 PR['registerLangHandler'](
36 PR['createSimpleLexer'](
37 [
38 // Whitespace
39 [PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
40 // A double or single quoted, possibly multi-line, string.
41 [PR['PR_STRING'], /^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\ ]|\\[\s\S])*(?:\'|$))/, null, '"\'']
42 ],
43 [
44 // A comment is either a line comment that starts with two dashes, or
45 // two dashes preceding a long bracketed block.
46 [PR['PR_COMMENT'], /^--(?:\[(=*)\[[\s\S]*?(?:\]\1\]|$)|[^\r\n]*)/],
47 // A long bracketed block not preceded by -- is a string.
48 [PR['PR_STRING'], /^\[(=*)\[[\s\S]*?(?:\]\1\]|$)/],
49 [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],
50 // A number is a hex integer literal, a decimal real literal, or in
51 // scientific notation.
52 [PR['PR_LITERAL'],
53 /^[+-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],
54 // An identifier
55 [PR['PR_PLAIN'], /^[a-z_]\w*/i],
56 // A run of punctuation
57 [PR['PR_PUNCTUATION'], /^[^\w\t\n\r \xA0][^\w\t\n\r \xA0\"\'\-\+=]*/]
58 ]),
59 ['lua']);
OLDNEW
« no previous file with comments | « bower_components/google-code-prettify/src/lang-llvm.js ('k') | bower_components/google-code-prettify/src/lang-matlab.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698