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

Side by Side Diff: lib/src/prism/components/prism-perl.js

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 1 month 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
1 Prism.languages.perl = { 1 Prism.languages.perl = {
2 'comment': [ 2 'comment': [
3 { 3 {
4 // POD 4 // POD
5 » » » pattern: /((?:^|\n)\s*)=\w+[\s\S]*?=cut.*/, 5 » » » pattern: /(^\s*)=\w+[\s\S]*?=cut.*/m,
6 lookbehind: true 6 lookbehind: true
7 }, 7 },
8 { 8 {
9 » » » pattern: /(^|[^\\$])#.*?(\r?\n|$)/, 9 » » » pattern: /(^|[^\\$])#.*/,
10 lookbehind: true 10 lookbehind: true
11 } 11 }
12 ], 12 ],
13 // TODO Could be nice to handle Heredoc too. 13 // TODO Could be nice to handle Heredoc too.
14 'string': [ 14 'string': [
15 // q/.../ 15 // q/.../
16 » » /\b(?:q|qq|qx|qw)\s*([^a-zA-Z0-9\s\{\(\[<])(\\?.)*?\s*\1/, 16 » » /\b(?:q|qq|qx|qw)\s*([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\ 1/,
17 17
18 // q a...a 18 // q a...a
19 » » /\b(?:q|qq|qx|qw)\s+([a-zA-Z0-9])(\\?.)*?\s*\1/, 19 » » /\b(?:q|qq|qx|qw)\s+([a-zA-Z0-9])(?:[^\\]|\\[\s\S])*?\1/,
20 20
21 // q(...) 21 // q(...)
22 » » /\b(?:q|qq|qx|qw)\s*\(([^()]|\\.)*\s*\)/, 22 » » /\b(?:q|qq|qx|qw)\s*\((?:[^()\\]|\\[\s\S])*\)/,
23 23
24 // q{...} 24 // q{...}
25 » » /\b(?:q|qq|qx|qw)\s*\{([^{}]|\\.)*\s*\}/, 25 » » /\b(?:q|qq|qx|qw)\s*\{(?:[^{}\\]|\\[\s\S])*\}/,
26 26
27 // q[...] 27 // q[...]
28 » » /\b(?:q|qq|qx|qw)\s*\[([^[\]]|\\.)*\s*\]/, 28 » » /\b(?:q|qq|qx|qw)\s*\[(?:[^[\]\\]|\\[\s\S])*\]/,
29 29
30 // q<...> 30 // q<...>
31 » » /\b(?:q|qq|qx|qw)\s*<([^<>]|\\.)*\s*>/, 31 » » /\b(?:q|qq|qx|qw)\s*<(?:[^<>\\]|\\[\s\S])*>/,
32 32
33 » » // "...", '...', `...` 33 » » // "...", `...`
34 » » /("|'|`)(\\?.)*?\1/ 34 » » /("|`)(?:[^\\]|\\[\s\S])*?\1/,
35
36 » » // '...'
37 » » // FIXME Multi-line single-quoted strings are not supported as t hey would break variables containing '
38 » » /'(?:[^'\\\r\n]|\\.)*'/
35 ], 39 ],
36 'regex': [ 40 'regex': [
37 // m/.../ 41 // m/.../
38 » » /\b(?:m|qr)\s*([^a-zA-Z0-9\s\{\(\[<])(\\?.)*?\s*\1[msixpodualgc] */, 42 » » /\b(?:m|qr)\s*([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1[msix podualngc]*/,
39 43
40 // m a...a 44 // m a...a
41 » » /\b(?:m|qr)\s+([a-zA-Z0-9])(\\?.)*?\s*\1[msixpodualgc]*/, 45 » » /\b(?:m|qr)\s+([a-zA-Z0-9])(?:[^\\]|\\.)*?\1[msixpodualngc]*/,
42 46
43 // m(...) 47 // m(...)
44 » » /\b(?:m|qr)\s*\(([^()]|\\.)*\s*\)[msixpodualgc]*/, 48 » » /\b(?:m|qr)\s*\((?:[^()\\]|\\[\s\S])*\)[msixpodualngc]*/,
45 49
46 // m{...} 50 // m{...}
47 » » /\b(?:m|qr)\s*\{([^{}]|\\.)*\s*\}[msixpodualgc]*/, 51 » » /\b(?:m|qr)\s*\{(?:[^{}\\]|\\[\s\S])*\}[msixpodualngc]*/,
48 52
49 // m[...] 53 // m[...]
50 » » /\b(?:m|qr)\s*\[([^[\]]|\\.)*\s*\][msixpodualgc]*/, 54 » » /\b(?:m|qr)\s*\[(?:[^[\]\\]|\\[\s\S])*\][msixpodualngc]*/,
51 55
52 // m<...> 56 // m<...>
53 » » /\b(?:m|qr)\s*<([^<>]|\\.)*\s*>[msixpodualgc]*/, 57 » » /\b(?:m|qr)\s*<(?:[^<>\\]|\\[\s\S])*>[msixpodualngc]*/,
54 » 58
59 » » // The lookbehinds prevent -s from breaking
60 » » // FIXME We don't handle change of separator like s(...)[...]
55 // s/.../.../ 61 // s/.../.../
56 » » /\b(?:s|tr|y)\s*([^a-zA-Z0-9\s\{\(\[<])(\\?.)*?\s*\1\s*((?!\1).| \\.)*\s*\1[msixpodualgcer]*/, 62 » » {
63 » » » pattern: /(^|[^-]\b)(?:s|tr|y)\s*([^a-zA-Z0-9\s\{\(\[<]) (?:[^\\]|\\[\s\S])*?\2(?:[^\\]|\\[\s\S])*?\2[msixpodualngcer]*/,
64 » » » lookbehind: true
65 » » },
57 66
58 // s a...a...a 67 // s a...a...a
59 » » /\b(?:s|tr|y)\s+([a-zA-Z0-9])(\\?.)*?\s*\1\s*((?!\1).|\\.)*\s*\1 [msixpodualgcer]*/, 68 » » {
69 » » » pattern: /(^|[^-]\b)(?:s|tr|y)\s+([a-zA-Z0-9])(?:[^\\]|\ \[\s\S])*?\2(?:[^\\]|\\[\s\S])*?\2[msixpodualngcer]*/,
70 » » » lookbehind: true
71 » » },
60 72
61 // s(...)(...) 73 // s(...)(...)
62 » » /\b(?:s|tr|y)\s*\(([^()]|\\.)*\s*\)\s*\(\s*([^()]|\\.)*\s*\)[msi xpodualgcer]*/, 74 » » {
75 » » » pattern: /(^|[^-]\b)(?:s|tr|y)\s*\((?:[^()\\]|\\[\s\S])* \)\s*\((?:[^()\\]|\\[\s\S])*\)[msixpodualngcer]*/,
76 » » » lookbehind: true
77 » » },
63 78
64 // s{...}{...} 79 // s{...}{...}
65 » » /\b(?:s|tr|y)\s*\{([^{}]|\\.)*\s*\}\s*\{\s*([^{}]|\\.)*\s*\}[msi xpodualgcer]*/, 80 » » {
81 » » » pattern: /(^|[^-]\b)(?:s|tr|y)\s*\{(?:[^{}\\]|\\[\s\S])* \}\s*\{(?:[^{}\\]|\\[\s\S])*\}[msixpodualngcer]*/,
82 » » » lookbehind: true
83 » » },
66 84
67 // s[...][...] 85 // s[...][...]
68 » » /\b(?:s|tr|y)\s*\[([^[\]]|\\.)*\s*\]\s*\[\s*([^[\]]|\\.)*\s*\][m sixpodualgcer]*/, 86 » » {
87 » » » pattern: /(^|[^-]\b)(?:s|tr|y)\s*\[(?:[^[\]\\]|\\[\s\S]) *\]\s*\[(?:[^[\]\\]|\\[\s\S])*\][msixpodualngcer]*/,
88 » » » lookbehind: true
89 » » },
69 90
70 // s<...><...> 91 // s<...><...>
71 » » /\b(?:s|tr|y)\s*<([^<>]|\\.)*\s*>\s*<\s*([^<>]|\\.)*\s*>[msixpod ualgcer]*/, 92 » » {
93 » » » pattern: /(^|[^-]\b)(?:s|tr|y)\s*<(?:[^<>\\]|\\[\s\S])*> \s*<(?:[^<>\\]|\\[\s\S])*>[msixpodualngcer]*/,
94 » » » lookbehind: true
95 » » },
72 96
73 // /.../ 97 // /.../
74 » » /\/(\[.+?]|\\.|[^\/\r\n])*\/[msixpodualgc]*(?=\s*($|[\r\n,.;})&| \-+*=~<>!?^]|(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|x)\b))/ 98 » » // The look-ahead tries to prevent two divisions on
99 » » // the same line from being highlighted as regex.
100 » » // This does not support multi-line regex.
101 » » /\/(?:[^\/\\\r\n]|\\.)*\/[msixpodualngc]*(?=\s*(?:$|[\r\n,.;})&| \-+*~<>!?^]|(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|x)\b))/
75 ], 102 ],
76 103
77 // FIXME Not sure about the handling of ::, ', and # 104 // FIXME Not sure about the handling of ::, ', and #
78 'variable': [ 105 'variable': [
79 // ${^POSTMATCH} 106 // ${^POSTMATCH}
80 » » /[&*\$@%]\{\^[A-Z]+\}/, 107 » » /[&*$@%]\{\^[A-Z]+\}/,
81 // $^V 108 // $^V
82 » » /[&*\$@%]\^[A-Z_]/, 109 » » /[&*$@%]\^[A-Z_]/,
83 // ${...} 110 // ${...}
84 » » /[&*\$@%]#?(?=\{)/, 111 » » /[&*$@%]#?(?=\{)/,
85 // $foo 112 // $foo
86 » » /[&*\$@%]#?((::)*'?(?!\d)[\w$]+)+(::)*/i, 113 » » /[&*$@%]#?((::)*'?(?!\d)[\w$]+)+(::)*/i,
87 // $1 114 // $1
88 » » /[&*\$@%]\d+/, 115 » » /[&*$@%]\d+/,
89 // $_, @_, %! 116 // $_, @_, %!
90 » » /[\$@%][!"#\$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/ 117 » » // The negative lookahead prevents from breaking the %= operator
118 » » /(?!%=)[$@%][!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/
91 ], 119 ],
92 'filehandle': { 120 'filehandle': {
93 // <>, <FOO>, _ 121 // <>, <FOO>, _
94 » » pattern: /<(?!=).*>|\b_\b/, 122 » » pattern: /<(?![<=])\S*>|\b_\b/,
95 alias: 'symbol' 123 alias: 'symbol'
96 }, 124 },
97 'vstring': { 125 'vstring': {
98 // v1.2, 1.2.3 126 // v1.2, 1.2.3
99 pattern: /v\d+(\.\d+)*|\d+(\.\d+){2,}/, 127 pattern: /v\d+(\.\d+)*|\d+(\.\d+){2,}/,
100 alias: 'string' 128 alias: 'string'
101 }, 129 },
102 'function': { 130 'function': {
103 pattern: /sub [a-z0-9_]+/i, 131 pattern: /sub [a-z0-9_]+/i,
104 inside: { 132 inside: {
105 keyword: /sub/ 133 keyword: /sub/
106 } 134 }
107 }, 135 },
108 'keyword': /\b(any|break|continue|default|delete|die|do|else|elsif|eval| for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|say| state|sub|switch|undef|unless|until|use|when|while)\b/, 136 'keyword': /\b(any|break|continue|default|delete|die|do|else|elsif|eval| for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|say| state|sub|switch|undef|unless|until|use|when|while)\b/,
109 » 'number': /(\n|\b)-?(0x[\dA-Fa-f](_?[\dA-Fa-f])*|0b[01](_?[01])*|(\d(_?\ d)*)?\.?\d(_?\d)*([Ee]-?\d+)?)\b/, 137 » 'number': /\b-?(0x[\dA-Fa-f](_?[\dA-Fa-f])*|0b[01](_?[01])*|(\d(_?\d)*)? \.?\d(_?\d)*([Ee][+-]?\d+)?)\b/,
110 » 'operator': /-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|[-+*=~\/|&]{1,2}|<=?|>=?|\ .{1,3}|[!?\\^]|\b(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|x)\b/, 138 » 'operator': /-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|\+[+=]?|-[-=>]?|\*\*?=?|\/ \/?=?|=[=~>]?|~[~=]?|\|\|?=?|&&?=?|<(?:=>?|<=?)?|>>?=?|![~=]?|[%^]=?|\.(?:=|\.\. ?)?|[\\?]|\bx(?:=|\b)|\b(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor)\b/,
111 'punctuation': /[{}[\];(),:]/ 139 'punctuation': /[{}[\];(),:]/
112 }; 140 };
OLDNEW
« no previous file with comments | « lib/src/prism/components/prism-pascal.min.js ('k') | lib/src/prism/components/prism-perl.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698