Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Contributed by http://jachguate.wordpress.com
- /**
- * @fileoverview
- * Registers a language handler for Delphi.
- *
- * 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-delphi">(my Delphi code)</pre>
- *
- * @author http://jachguate.wordpress.com
- */
- 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, /^(?:\/\/[^\r\n]*)|\(\*[\s\S]*?(?:\*\)|$)|^\{[\s\S]*?(?:\}|$)/, null],
- //updated to http://docwiki.embarcadero.com/RADStudio/XE3/en/Fundamental_Syntactic_Elements#Reserved_Words
- //directives not included
- [PR.PR_KEYWORD, /^(?:AND|ARRAY|AS|ASM|BEGIN|CASE|CLASS|CONST|CONSTRUCTOR|DESTRUCTOR|DISPINTERFACE|DIV|DO|DOWNTO|ELSE|END|EXCEPT|EXPORTS|FILE|FINALIZATION|FINALLY|FOR|FUNCTION|GOTO|IF|IMPLEMENTATION|IN|INHERITED|INITIALIZATION|INLINE|INTERFACE|IS|LABEL|LIBRARY|MOD|NIL|NOT|OBJECT|OF|OR|PACKED|PROCEDURE|PROGRAM|PROPERTY|RAISE|RECORD|REPEAT|RESOURCESTRING|SET|SHL|SHR|STRING|THEN|THREADVAR|TO|TRY|TYPE|UNIT|UNTIL|USES|VAR|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],
- ]),
- ['delphi']);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement