OLD | NEW |
| (Empty) |
1 // Copyright (C) 2012 Jeffrey Arnold | |
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 * @fileoverview | |
17 * Support for R documentation (Rd) files | |
18 * | |
19 * Minimal highlighting or Rd files, basically just highlighting | |
20 * macros. It does not try to identify verbatim or R-like regions of | |
21 * macros as that is too complicated for a lexer. Descriptions of the | |
22 * Rd format can be found | |
23 * http://cran.r-project.org/doc/manuals/R-exts.html and | |
24 * http://developer.r-project.org/parseRd.pdf. | |
25 * | |
26 * @author Jeffrey Arnold | |
27 */ | |
28 PR['registerLangHandler']( | |
29 PR['createSimpleLexer']( | |
30 [ | |
31 // whitespace | |
32 [PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'], | |
33 // all comments begin with '%' | |
34 [PR['PR_COMMENT'], /^%[^\r\n]*/, null, '%'] | |
35 ], | |
36 [// special macros with no args | |
37 [PR['PR_LITERAL'], /^\\(?:cr|l?dots|R|tab)\b/], | |
38 // macros | |
39 [PR['PR_KEYWORD'], /^\\[a-zA-Z@]+/], | |
40 // highlighted as macros, since technically they are | |
41 [PR['PR_KEYWORD'], /^#(?:ifn?def|endif)/ ], | |
42 // catch escaped brackets | |
43 [PR['PR_PLAIN'], /^\\[{}]/], | |
44 // punctuation | |
45 [PR['PR_PUNCTUATION'], /^[{}()\[\]]+/] | |
46 ]), | |
47 ['Rd', 'rd']); | |
OLD | NEW |