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

Side by Side Diff: bower_components/google-code-prettify/src/lang-hs.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) 2009 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 Haskell.
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-hs">(my lisp code)</pre>
25 * The lang-cl class identifies the language as common lisp.
26 * This file supports the following language extensions:
27 * lang-cl - Common Lisp
28 * lang-el - Emacs Lisp
29 * lang-lisp - Lisp
30 * lang-scm - Scheme
31 *
32 *
33 * I used http://www.informatik.uni-freiburg.de/~thiemann/haskell/haskell98-repo rt-html/syntax-iso.html
34 * as the basis, but ignore the way the ncomment production nests since this
35 * makes the lexical grammar irregular. It might be possible to support
36 * ncomments using the lookbehind filter.
37 *
38 *
39 * @author mikesamuel@gmail.com
40 */
41
42 PR['registerLangHandler'](
43 PR['createSimpleLexer'](
44 [
45 // Whitespace
46 // whitechar -> newline | vertab | space | tab | uniWhite
47 // newline -> return linefeed | return | linefeed | formfeed
48 [PR['PR_PLAIN'], /^[\t\n\x0B\x0C\r ]+/, null, '\t\n\x0B\x0C\r '],
49 // Single line double and single-quoted strings.
50 // char -> ' (graphic<' | \> | space | escape<\&>) '
51 // string -> " {graphic<" | \> | space | escape | gap}"
52 // escape -> \ ( charesc | ascii | decimal | o octal
53 // | x hexadecimal )
54 // charesc -> a | b | f | n | r | t | v | \ | " | ' | &
55 [PR['PR_STRING'], /^\"(?:[^\"\\\n\x0C\r]|\\[\s\S])*(?:\"|$)/,
56 null, '"'],
57 [PR['PR_STRING'], /^\'(?:[^\'\\\n\x0C\r]|\\[^&])\'?/,
58 null, "'"],
59 // decimal -> digit{digit}
60 // octal -> octit{octit}
61 // hexadecimal -> hexit{hexit}
62 // integer -> decimal
63 // | 0o octal | 0O octal
64 // | 0x hexadecimal | 0X hexadecimal
65 // float -> decimal . decimal [exponent]
66 // | decimal exponent
67 // exponent -> (e | E) [+ | -] decimal
68 [PR['PR_LITERAL'],
69 /^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+\-]?\d+)?)/i,
70 null, '0123456789']
71 ],
72 [
73 // Haskell does not have a regular lexical grammar due to the nested
74 // ncomment.
75 // comment -> dashes [ any<symbol> {any}] newline
76 // ncomment -> opencom ANYseq {ncomment ANYseq}closecom
77 // dashes -> '--' {'-'}
78 // opencom -> '{-'
79 // closecom -> '-}'
80 [PR['PR_COMMENT'], /^(?:(?:--+(?:[^\r\n\x0C]*)?)|(?:\{-(?:[^-]|-+[^ -\}])*-\}))/],
81 // reservedid -> case | class | data | default | deriving | do
82 // | else | if | import | in | infix | infixl | infixr
83 // | instance | let | module | newtype | of | then
84 // | type | where | _
85 [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],
86 // qvarid -> [ modid . ] varid
87 // qconid -> [ modid . ] conid
88 // varid -> (small {small | large | digit | ' })<reservedid>
89 // conid -> large {small | large | digit | ' }
90 // modid -> conid
91 // small -> ascSmall | uniSmall | _
92 // ascSmall -> a | b | ... | z
93 // uniSmall -> any Unicode lowercase letter
94 // large -> ascLarge | uniLarge
95 // ascLarge -> A | B | ... | Z
96 // uniLarge -> any uppercase or titlecase Unicode letter
97 [PR['PR_PLAIN'], /^(?:[A-Z][\w\']*\.)*[a-zA-Z][\w\']*/],
98 // matches the symbol production
99 [PR['PR_PUNCTUATION'], /^[^\t\n\x0B\x0C\r a-zA-Z0-9\'\"]+/]
100 ]),
101 ['hs']);
OLDNEW
« no previous file with comments | « bower_components/google-code-prettify/src/lang-go.js ('k') | bower_components/google-code-prettify/src/lang-lisp.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698