| OLD | NEW |
| (Empty) |
| 1 // Copyright (C) 2011 Martin S. | |
| 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 tex highlighting as discussed on | |
| 18 * <a href="http://meta.tex.stackexchange.com/questions/872/text-immediate-follo
wing-double-backslashes-is-highlighted-as-macro-inside-a-code/876#876">meta.tex.
stackexchange.com</a>. | |
| 19 * | |
| 20 * @author Martin S. | |
| 21 */ | |
| 22 | |
| 23 PR['registerLangHandler']( | |
| 24 PR['createSimpleLexer']( | |
| 25 [ | |
| 26 // whitespace | |
| 27 [PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'], | |
| 28 // all comments begin with '%' | |
| 29 [PR['PR_COMMENT'], /^%[^\r\n]*/, null, '%'] | |
| 30 ], | |
| 31 [ | |
| 32 //[PR['PR_DECLARATION'], /^\\([egx]?def|(new|renew|provide)(command|env
ironment))\b/], | |
| 33 // any command starting with a \ and contains | |
| 34 // either only letters (a-z,A-Z), '@' (internal macros) | |
| 35 [PR['PR_KEYWORD'], /^\\[a-zA-Z@]+/], | |
| 36 // or contains only one character | |
| 37 [PR['PR_KEYWORD'], /^\\./], | |
| 38 // Highlight dollar for math mode and ampersam for tabular | |
| 39 [PR['PR_TYPE'], /^[$&]/], | |
| 40 // numeric measurement values with attached units | |
| 41 [PR['PR_LITERAL'], | |
| 42 /[+-]?(?:\.\d+|\d+(?:\.\d*)?)(cm|em|ex|in|pc|pt|bp|mm)/i], | |
| 43 // punctuation usually occurring within commands | |
| 44 [PR['PR_PUNCTUATION'], /^[{}()\[\]=]+/] | |
| 45 ]), | |
| 46 ['latex', 'tex']); | |
| OLD | NEW |