aboutsummaryrefslogtreecommitdiff
path: root/source/languages
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2019-02-17 21:53:36 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2019-02-17 21:53:36 +0100
commit8e9ef5ba62b8bee028428384ad5666e245eb854c (patch)
treeb382c5b40f122b2a152da2226006abab34abe105 /source/languages
parentad974810d43e1d5f70bca269665c25230e6a3221 (diff)
downloadmitjafelicijan.com-8e9ef5ba62b8bee028428384ad5666e245eb854c.tar.gz
content update
Diffstat (limited to 'source/languages')
-rw-r--r--source/languages/prism-bash.js84
-rw-r--r--source/languages/prism-c.js33
-rw-r--r--source/languages/prism-css.js52
-rw-r--r--source/languages/prism-go.js12
-rw-r--r--source/languages/prism-javascript.js56
-rw-r--r--source/languages/prism-json.js14
-rw-r--r--source/languages/prism-nginx.js11
-rw-r--r--source/languages/prism-pascal.js55
-rw-r--r--source/languages/prism-python.js29
9 files changed, 346 insertions, 0 deletions
diff --git a/source/languages/prism-bash.js b/source/languages/prism-bash.js
new file mode 100644
index 0000000..5093ffd
--- /dev/null
+++ b/source/languages/prism-bash.js
@@ -0,0 +1,84 @@
1(function(Prism) {
2 var insideString = {
3 variable: [
4 // Arithmetic Environment
5 {
6 pattern: /\$?\(\([\s\S]+?\)\)/,
7 inside: {
8 // If there is a $ sign at the beginning highlight $(( and )) as variable
9 variable: [{
10 pattern: /(^\$\(\([\s\S]+)\)\)/,
11 lookbehind: true
12 },
13 /^\$\(\(/
14 ],
15 number: /\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee]-?\d+)?/,
16 // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
17 operator: /--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/,
18 // If there is no $ sign at the beginning highlight (( and )) as punctuation
19 punctuation: /\(\(?|\)\)?|,|;/
20 }
21 },
22 // Command Substitution
23 {
24 pattern: /\$\([^)]+\)|`[^`]+`/,
25 greedy: true,
26 inside: {
27 variable: /^\$\(|^`|\)$|`$/
28 }
29 },
30 /\$(?:[\w#?*!@]+|\{[^}]+\})/i
31 ]
32 };
33
34 Prism.languages.bash = {
35 'shebang': {
36 pattern: /^#!\s*\/bin\/bash|^#!\s*\/bin\/sh/,
37 alias: 'important'
38 },
39 'comment': {
40 pattern: /(^|[^"{\\])#.*/,
41 lookbehind: true
42 },
43 'string': [
44 //Support for Here-Documents https://en.wikipedia.org/wiki/Here_document
45 {
46 pattern: /((?:^|[^<])<<\s*)["']?(\w+?)["']?\s*\r?\n(?:[\s\S])*?\r?\n\2/,
47 lookbehind: true,
48 greedy: true,
49 inside: insideString
50 },
51 {
52 pattern: /(["'])(?:\\[\s\S]|\$\([^)]+\)|`[^`]+`|(?!\1)[^\\])*\1/,
53 greedy: true,
54 inside: insideString
55 }
56 ],
57 'variable': insideString.variable,
58 // Originally based on http://ss64.com/bash/
59 'function': {
60 pattern: /(^|[\s;|&])(?:alias|apropos|apt-get|aptitude|aspell|awk|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chmod|chown|chroot|chkconfig|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|grep|groupadd|groupdel|groupmod|groups|gzip|hash|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|npm|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)(?=$|[\s;|&])/,
61 lookbehind: true
62 },
63 'keyword': {
64 pattern: /(^|[\s;|&])(?:let|:|\.|if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)(?=$|[\s;|&])/,
65 lookbehind: true
66 },
67 'boolean': {
68 pattern: /(^|[\s;|&])(?:true|false)(?=$|[\s;|&])/,
69 lookbehind: true
70 },
71 'operator': /&&?|\|\|?|==?|!=?|<<<?|>>|<=?|>=?|=~/,
72 'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];]/
73 };
74
75 var inside = insideString.variable[1].inside;
76 inside.string = Prism.languages.bash.string;
77 inside['function'] = Prism.languages.bash['function'];
78 inside.keyword = Prism.languages.bash.keyword;
79 inside['boolean'] = Prism.languages.bash['boolean'];
80 inside.operator = Prism.languages.bash.operator;
81 inside.punctuation = Prism.languages.bash.punctuation;
82
83 Prism.languages.shell = Prism.languages.bash;
84})(Prism);
diff --git a/source/languages/prism-c.js b/source/languages/prism-c.js
new file mode 100644
index 0000000..86ffac0
--- /dev/null
+++ b/source/languages/prism-c.js
@@ -0,0 +1,33 @@
1Prism.languages.c = Prism.languages.extend('clike', {
2 'keyword': /\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,
3 'operator': /-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/]/,
4 'number': /(?:\b0x[\da-f]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i
5});
6
7Prism.languages.insertBefore('c', 'string', {
8 'macro': {
9 // allow for multiline macro definitions
10 // spaces after the # character compile fine with gcc
11 pattern: /(^\s*)#\s*[a-z]+(?:[^\r\n\\]|\\(?:\r\n|[\s\S]))*/im,
12 lookbehind: true,
13 alias: 'property',
14 inside: {
15 // highlight the path of the include statement as a string
16 'string': {
17 pattern: /(#\s*include\s*)(?:<.+?>|("|')(?:\\?.)+?\2)/,
18 lookbehind: true
19 },
20 // highlight macro directives as keywords
21 'directive': {
22 pattern: /(#\s*)\b(?:define|defined|elif|else|endif|error|ifdef|ifndef|if|import|include|line|pragma|undef|using)\b/,
23 lookbehind: true,
24 alias: 'keyword'
25 }
26 }
27 },
28 // highlight predefined macros as constants
29 'constant': /\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/
30});
31
32delete Prism.languages.c['class-name'];
33delete Prism.languages.c['boolean'];
diff --git a/source/languages/prism-css.js b/source/languages/prism-css.js
new file mode 100644
index 0000000..e6fdf6f
--- /dev/null
+++ b/source/languages/prism-css.js
@@ -0,0 +1,52 @@
1Prism.languages.css = {
2 'comment': /\/\*[\s\S]*?\*\//,
3 'atrule': {
4 pattern: /@[\w-]+?.*?(?:;|(?=\s*\{))/i,
5 inside: {
6 'rule': /@[\w-]+/
7 // See rest below
8 }
9 },
10 'url': /url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,
11 'selector': /[^{}\s][^{};]*?(?=\s*\{)/,
12 'string': {
13 pattern: /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
14 greedy: true
15 },
16 'property': /[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,
17 'important': /\B!important\b/i,
18 'function': /[-a-z0-9]+(?=\()/i,
19 'punctuation': /[(){};:]/
20};
21
22Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
23
24if (Prism.languages.markup) {
25 Prism.languages.insertBefore('markup', 'tag', {
26 'style': {
27 pattern: /(<style[\s\S]*?>)[\s\S]*?(?=<\/style>)/i,
28 lookbehind: true,
29 inside: Prism.languages.css,
30 alias: 'language-css',
31 greedy: true
32 }
33 });
34
35 Prism.languages.insertBefore('inside', 'attr-value', {
36 'style-attr': {
37 pattern: /\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,
38 inside: {
39 'attr-name': {
40 pattern: /^\s*style/i,
41 inside: Prism.languages.markup.tag.inside
42 },
43 'punctuation': /^\s*=\s*['"]|['"]\s*$/,
44 'attr-value': {
45 pattern: /.+/i,
46 inside: Prism.languages.css
47 }
48 },
49 alias: 'language-css'
50 }
51 }, Prism.languages.markup.tag);
52} \ No newline at end of file
diff --git a/source/languages/prism-go.js b/source/languages/prism-go.js
new file mode 100644
index 0000000..cc792a0
--- /dev/null
+++ b/source/languages/prism-go.js
@@ -0,0 +1,12 @@
1Prism.languages.go = Prism.languages.extend('clike', {
2 'keyword': /\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,
3 'builtin': /\b(?:bool|byte|complex(?:64|128)|error|float(?:32|64)|rune|string|u?int(?:8|16|32|64)?|uintptr|append|cap|close|complex|copy|delete|imag|len|make|new|panic|print(?:ln)?|real|recover)\b/,
4 'boolean': /\b(?:_|iota|nil|true|false)\b/,
5 'operator': /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,
6 'number': /(?:\b0x[a-f\d]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[-+]?\d+)?)i?/i,
7 'string': {
8 pattern: /(["'`])(\\[\s\S]|(?!\1)[^\\])*\1/,
9 greedy: true
10 }
11});
12delete Prism.languages.go['class-name'];
diff --git a/source/languages/prism-javascript.js b/source/languages/prism-javascript.js
new file mode 100644
index 0000000..7800a7d
--- /dev/null
+++ b/source/languages/prism-javascript.js
@@ -0,0 +1,56 @@
1Prism.languages.javascript = Prism.languages.extend('clike', {
2 'keyword': /\b(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,
3 'number': /\b(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/,
4 // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
5 'function': /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i,
6 'operator': /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/
7});
8
9Prism.languages.insertBefore('javascript', 'keyword', {
10 'regex': {
11 pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[[^\]\r\n]+]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})\]]))/,
12 lookbehind: true,
13 greedy: true
14 },
15 // This must be declared before keyword because we use "function" inside the look-forward
16 'function-variable': {
17 pattern: /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i,
18 alias: 'function'
19 },
20 'constant': /\b[A-Z][A-Z\d_]*\b/
21});
22
23Prism.languages.insertBefore('javascript', 'string', {
24 'template-string': {
25 pattern: /`(?:\\[\s\S]|\${[^}]+}|[^\\`])*`/,
26 greedy: true,
27 inside: {
28 'interpolation': {
29 pattern: /\${[^}]+}/,
30 inside: {
31 'interpolation-punctuation': {
32 pattern: /^\${|}$/,
33 alias: 'punctuation'
34 },
35 rest: null // See below
36 }
37 },
38 'string': /[\s\S]+/
39 }
40 }
41});
42Prism.languages.javascript['template-string'].inside['interpolation'].inside.rest = Prism.languages.javascript;
43
44if (Prism.languages.markup) {
45 Prism.languages.insertBefore('markup', 'tag', {
46 'script': {
47 pattern: /(<script[\s\S]*?>)[\s\S]*?(?=<\/script>)/i,
48 lookbehind: true,
49 inside: Prism.languages.javascript,
50 alias: 'language-javascript',
51 greedy: true
52 }
53 });
54}
55
56Prism.languages.js = Prism.languages.javascript;
diff --git a/source/languages/prism-json.js b/source/languages/prism-json.js
new file mode 100644
index 0000000..06e847e
--- /dev/null
+++ b/source/languages/prism-json.js
@@ -0,0 +1,14 @@
1Prism.languages.json = {
2 'property': /"(?:\\.|[^\\"\r\n])*"(?=\s*:)/i,
3 'string': {
4 pattern: /"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
5 greedy: true
6 },
7 'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/,
8 'punctuation': /[{}[\]);,]/,
9 'operator': /:/g,
10 'boolean': /\b(?:true|false)\b/i,
11 'null': /\bnull\b/i
12};
13
14Prism.languages.jsonp = Prism.languages.json;
diff --git a/source/languages/prism-nginx.js b/source/languages/prism-nginx.js
new file mode 100644
index 0000000..c3fea0c
--- /dev/null
+++ b/source/languages/prism-nginx.js
@@ -0,0 +1,11 @@
1Prism.languages.nginx = Prism.languages.extend('clike', {
2 'comment': {
3 pattern: /(^|[^"{\\])#.*/,
4 lookbehind: true
5 },
6 'keyword': /\b(?:CONTENT_|DOCUMENT_|GATEWAY_|HTTP_|HTTPS|if_not_empty|PATH_|QUERY_|REDIRECT_|REMOTE_|REQUEST_|SCGI|SCRIPT_|SERVER_|http|events|accept_mutex|accept_mutex_delay|access_log|add_after_body|add_before_body|add_header|addition_types|aio|alias|allow|ancient_browser|ancient_browser_value|auth|auth_basic|auth_basic_user_file|auth_http|auth_http_header|auth_http_timeout|autoindex|autoindex_exact_size|autoindex_localtime|break|charset|charset_map|charset_types|chunked_transfer_encoding|client_body_buffer_size|client_body_in_file_only|client_body_in_single_buffer|client_body_temp_path|client_body_timeout|client_header_buffer_size|client_header_timeout|client_max_body_size|connection_pool_size|create_full_put_path|daemon|dav_access|dav_methods|debug_connection|debug_points|default_type|deny|devpoll_changes|devpoll_events|directio|directio_alignment|disable_symlinks|empty_gif|env|epoll_events|error_log|error_page|expires|fastcgi_buffer_size|fastcgi_buffers|fastcgi_busy_buffers_size|fastcgi_cache|fastcgi_cache_bypass|fastcgi_cache_key|fastcgi_cache_lock|fastcgi_cache_lock_timeout|fastcgi_cache_methods|fastcgi_cache_min_uses|fastcgi_cache_path|fastcgi_cache_purge|fastcgi_cache_use_stale|fastcgi_cache_valid|fastcgi_connect_timeout|fastcgi_hide_header|fastcgi_ignore_client_abort|fastcgi_ignore_headers|fastcgi_index|fastcgi_intercept_errors|fastcgi_keep_conn|fastcgi_max_temp_file_size|fastcgi_next_upstream|fastcgi_no_cache|fastcgi_param|fastcgi_pass|fastcgi_pass_header|fastcgi_read_timeout|fastcgi_redirect_errors|fastcgi_send_timeout|fastcgi_split_path_info|fastcgi_store|fastcgi_store_access|fastcgi_temp_file_write_size|fastcgi_temp_path|flv|geo|geoip_city|geoip_country|google_perftools_profiles|gzip|gzip_buffers|gzip_comp_level|gzip_disable|gzip_http_version|gzip_min_length|gzip_proxied|gzip_static|gzip_types|gzip_vary|if|if_modified_since|ignore_invalid_headers|image_filter|image_filter_buffer|image_filter_jpeg_quality|image_filter_sharpen|image_filter_transparency|imap_capabilities|imap_client_buffer|include|index|internal|ip_hash|keepalive|keepalive_disable|keepalive_requests|keepalive_timeout|kqueue_changes|kqueue_events|large_client_header_buffers|limit_conn|limit_conn_log_level|limit_conn_zone|limit_except|limit_rate|limit_rate_after|limit_req|limit_req_log_level|limit_req_zone|limit_zone|lingering_close|lingering_time|lingering_timeout|listen|location|lock_file|log_format|log_format_combined|log_not_found|log_subrequest|map|map_hash_bucket_size|map_hash_max_size|master_process|max_ranges|memcached_buffer_size|memcached_connect_timeout|memcached_next_upstream|memcached_pass|memcached_read_timeout|memcached_send_timeout|merge_slashes|min_delete_depth|modern_browser|modern_browser_value|mp4|mp4_buffer_size|mp4_max_buffer_size|msie_padding|msie_refresh|multi_accept|open_file_cache|open_file_cache_errors|open_file_cache_min_uses|open_file_cache_valid|open_log_file_cache|optimize_server_names|override_charset|pcre_jit|perl|perl_modules|perl_require|perl_set|pid|pop3_auth|pop3_capabilities|port_in_redirect|post_action|postpone_output|protocol|proxy|proxy_buffer|proxy_buffer_size|proxy_buffering|proxy_buffers|proxy_busy_buffers_size|proxy_cache|proxy_cache_bypass|proxy_cache_key|proxy_cache_lock|proxy_cache_lock_timeout|proxy_cache_methods|proxy_cache_min_uses|proxy_cache_path|proxy_cache_use_stale|proxy_cache_valid|proxy_connect_timeout|proxy_cookie_domain|proxy_cookie_path|proxy_headers_hash_bucket_size|proxy_headers_hash_max_size|proxy_hide_header|proxy_http_version|proxy_ignore_client_abort|proxy_ignore_headers|proxy_intercept_errors|proxy_max_temp_file_size|proxy_method|proxy_next_upstream|proxy_no_cache|proxy_pass|proxy_pass_error_message|proxy_pass_header|proxy_pass_request_body|proxy_pass_request_headers|proxy_read_timeout|proxy_redirect|proxy_redirect_errors|proxy_send_lowat|proxy_send_timeout|proxy_set_body|proxy_set_header|proxy_ssl_session_reuse|proxy_store|proxy_store_access|proxy_temp_file_write_size|proxy_temp_path|proxy_timeout|proxy_upstream_fail_timeout|proxy_upstream_max_fails|random_index|read_ahead|real_ip_header|recursive_error_pages|request_pool_size|reset_timedout_connection|resolver|resolver_timeout|return|rewrite|root|rtsig_overflow_events|rtsig_overflow_test|rtsig_overflow_threshold|rtsig_signo|satisfy|satisfy_any|secure_link_secret|send_lowat|send_timeout|sendfile|sendfile_max_chunk|server|server_name|server_name_in_redirect|server_names_hash_bucket_size|server_names_hash_max_size|server_tokens|set|set_real_ip_from|smtp_auth|smtp_capabilities|so_keepalive|source_charset|split_clients|ssi|ssi_silent_errors|ssi_types|ssi_value_length|ssl|ssl_certificate|ssl_certificate_key|ssl_ciphers|ssl_client_certificate|ssl_crl|ssl_dhparam|ssl_engine|ssl_prefer_server_ciphers|ssl_protocols|ssl_session_cache|ssl_session_timeout|ssl_verify_client|ssl_verify_depth|starttls|stub_status|sub_filter|sub_filter_once|sub_filter_types|tcp_nodelay|tcp_nopush|timeout|timer_resolution|try_files|types|types_hash_bucket_size|types_hash_max_size|underscores_in_headers|uninitialized_variable_warn|upstream|use|user|userid|userid_domain|userid_expires|userid_name|userid_p3p|userid_path|userid_service|valid_referers|variables_hash_bucket_size|variables_hash_max_size|worker_connections|worker_cpu_affinity|worker_priority|worker_processes|worker_rlimit_core|worker_rlimit_nofile|worker_rlimit_sigpending|working_directory|xclient|xml_entities|xslt_entities|xslt_stylesheet|xslt_types)\b/i
7});
8
9Prism.languages.insertBefore('nginx', 'keyword', {
10 'variable': /\$[a-z_]+/i
11}); \ No newline at end of file
diff --git a/source/languages/prism-pascal.js b/source/languages/prism-pascal.js
new file mode 100644
index 0000000..bc7a283
--- /dev/null
+++ b/source/languages/prism-pascal.js
@@ -0,0 +1,55 @@
1// Based on Free Pascal
2
3/* TODO
4 Support inline asm ?
5*/
6
7Prism.languages.pascal = {
8 'comment': [
9 /\(\*[\s\S]+?\*\)/,
10 /\{[\s\S]+?\}/,
11 /\/\/.*/
12 ],
13 'string': {
14 pattern: /(?:'(?:''|[^'\r\n])*'|#[&$%]?[a-f\d]+)+|\^[a-z]/i,
15 greedy: true
16 },
17 'keyword': [
18 {
19 // Turbo Pascal
20 pattern: /(^|[^&])\b(?:absolute|array|asm|begin|case|const|constructor|destructor|do|downto|else|end|file|for|function|goto|if|implementation|inherited|inline|interface|label|nil|object|of|operator|packed|procedure|program|record|reintroduce|repeat|self|set|string|then|to|type|unit|until|uses|var|while|with)\b/i,
21 lookbehind: true
22 },
23 {
24 // Free Pascal
25 pattern: /(^|[^&])\b(?:dispose|exit|false|new|true)\b/i,
26 lookbehind: true
27 },
28 {
29 // Object Pascal
30 pattern: /(^|[^&])\b(?:class|dispinterface|except|exports|finalization|finally|initialization|inline|library|on|out|packed|property|raise|resourcestring|threadvar|try)\b/i,
31 lookbehind: true
32 },
33 {
34 // Modifiers
35 pattern: /(^|[^&])\b(?:absolute|abstract|alias|assembler|bitpacked|break|cdecl|continue|cppdecl|cvar|default|deprecated|dynamic|enumerator|experimental|export|external|far|far16|forward|generic|helper|implements|index|interrupt|iochecks|local|message|name|near|nodefault|noreturn|nostackframe|oldfpccall|otherwise|overload|override|pascal|platform|private|protected|public|published|read|register|reintroduce|result|safecall|saveregisters|softfloat|specialize|static|stdcall|stored|strict|unaligned|unimplemented|varargs|virtual|write)\b/i,
36 lookbehind: true
37 }
38 ],
39 'number': [
40 // Hexadecimal, octal and binary
41 /(?:[&%]\d+|\$[a-f\d]+)/i,
42 // Decimal
43 /\b\d+(?:\.\d+)?(?:e[+-]?\d+)?/i
44 ],
45 'operator': [
46 /\.\.|\*\*|:=|<[<=>]?|>[>=]?|[+\-*\/]=?|[@^=]/i,
47 {
48 pattern: /(^|[^&])\b(?:and|as|div|exclude|in|include|is|mod|not|or|shl|shr|xor)\b/,
49 lookbehind: true
50 }
51 ],
52 'punctuation': /\(\.|\.\)|[()\[\]:;,.]/
53};
54
55Prism.languages.objectpascal = Prism.languages.pascal; \ No newline at end of file
diff --git a/source/languages/prism-python.js b/source/languages/prism-python.js
new file mode 100644
index 0000000..ecad408
--- /dev/null
+++ b/source/languages/prism-python.js
@@ -0,0 +1,29 @@
1Prism.languages.python = {
2 'comment': {
3 pattern: /(^|[^\\])#.*/,
4 lookbehind: true
5 },
6 'triple-quoted-string': {
7 pattern: /("""|''')[\s\S]+?\1/,
8 greedy: true,
9 alias: 'string'
10 },
11 'string': {
12 pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
13 greedy: true
14 },
15 'function': {
16 pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
17 lookbehind: true
18 },
19 'class-name': {
20 pattern: /(\bclass\s+)\w+/i,
21 lookbehind: true
22 },
23 'keyword': /\b(?:as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|pass|print|raise|return|try|while|with|yield)\b/,
24 'builtin':/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
25 'boolean': /\b(?:True|False|None)\b/,
26 'number': /(?:\b(?=\d)|\B(?=\.))(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,
27 'operator': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/,
28 'punctuation': /[{}[\];(),.:]/
29};