diff options
Diffstat (limited to 'imports/codemirror/mode/perl')
-rwxr-xr-x | imports/codemirror/mode/perl/LICENSE | 19 | ||||
-rwxr-xr-x | imports/codemirror/mode/perl/index.html | 62 | ||||
-rwxr-xr-x | imports/codemirror/mode/perl/perl.js | 816 |
3 files changed, 897 insertions, 0 deletions
diff --git a/imports/codemirror/mode/perl/LICENSE b/imports/codemirror/mode/perl/LICENSE new file mode 100755 index 00000000..96f4115a --- /dev/null +++ b/imports/codemirror/mode/perl/LICENSE | |||
@@ -0,0 +1,19 @@ | |||
1 | Copyright (C) 2011 by Sabaca <mail@sabaca.com> under the MIT license. | ||
2 | |||
3 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
4 | of this software and associated documentation files (the "Software"), to deal | ||
5 | in the Software without restriction, including without limitation the rights | ||
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
7 | copies of the Software, and to permit persons to whom the Software is | ||
8 | furnished to do so, subject to the following conditions: | ||
9 | |||
10 | The above copyright notice and this permission notice shall be included in | ||
11 | all copies or substantial portions of the Software. | ||
12 | |||
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
19 | THE SOFTWARE. | ||
diff --git a/imports/codemirror/mode/perl/index.html b/imports/codemirror/mode/perl/index.html new file mode 100755 index 00000000..5ef55d32 --- /dev/null +++ b/imports/codemirror/mode/perl/index.html | |||
@@ -0,0 +1,62 @@ | |||
1 | <!doctype html> | ||
2 | <html> | ||
3 | <head> | ||
4 | <title>CodeMirror: Perl mode</title> | ||
5 | <link rel="stylesheet" href="../../lib/codemirror.css"> | ||
6 | <script src="../../lib/codemirror.js"></script> | ||
7 | <script src="perl.js"></script> | ||
8 | <link rel="stylesheet" href="../../doc/docs.css"> | ||
9 | <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style> | ||
10 | </head> | ||
11 | <body> | ||
12 | <h1>CodeMirror: Perl mode</h1> | ||
13 | |||
14 | <div><textarea id="code" name="code"> | ||
15 | #!/usr/bin/perl | ||
16 | |||
17 | use Something qw(func1 func2); | ||
18 | |||
19 | # strings | ||
20 | my $s1 = qq'single line'; | ||
21 | our $s2 = q(multi- | ||
22 | line); | ||
23 | |||
24 | =item Something | ||
25 | Example. | ||
26 | =cut | ||
27 | |||
28 | my $html=<<'HTML' | ||
29 | <html> | ||
30 | <title>hi!</title> | ||
31 | </html> | ||
32 | HTML | ||
33 | |||
34 | print "first,".join(',', 'second', qq~third~); | ||
35 | |||
36 | if($s1 =~ m[(?<!\s)(l.ne)\z]o) { | ||
37 | $h->{$1}=$$.' predefined variables'; | ||
38 | $s2 =~ s/\-line//ox; | ||
39 | $s1 =~ s[ | ||
40 | line ] | ||
41 | [ | ||
42 | block | ||
43 | ]ox; | ||
44 | } | ||
45 | |||
46 | 1; # numbers and comments | ||
47 | |||
48 | __END__ | ||
49 | something... | ||
50 | |||
51 | </textarea></div> | ||
52 | |||
53 | <script> | ||
54 | var editor = CodeMirror.fromTextArea(document.getElementById("code"), { | ||
55 | lineNumbers: true, | ||
56 | matchBrackets: true | ||
57 | }); | ||
58 | </script> | ||
59 | |||
60 | <p><strong>MIME types defined:</strong> <code>text/x-perl</code>.</p> | ||
61 | </body> | ||
62 | </html> | ||
diff --git a/imports/codemirror/mode/perl/perl.js b/imports/codemirror/mode/perl/perl.js new file mode 100755 index 00000000..e2e1cbef --- /dev/null +++ b/imports/codemirror/mode/perl/perl.js | |||
@@ -0,0 +1,816 @@ | |||
1 | // CodeMirror2 mode/perl/perl.js (text/x-perl) beta 0.10 (2011-11-08) | ||
2 | // This is a part of CodeMirror from https://github.com/sabaca/CodeMirror_mode_perl (mail@sabaca.com) | ||
3 | CodeMirror.defineMode("perl",function(config,parserConfig){ | ||
4 | // http://perldoc.perl.org | ||
5 | var PERL={ // null - magic touch | ||
6 | // 1 - keyword | ||
7 | // 2 - def | ||
8 | // 3 - atom | ||
9 | // 4 - operator | ||
10 | // 5 - variable-2 (predefined) | ||
11 | // [x,y] - x=1,2,3; y=must be defined if x{...} | ||
12 | // PERL operators | ||
13 | '->' : 4, | ||
14 | '++' : 4, | ||
15 | '--' : 4, | ||
16 | '**' : 4, | ||
17 | // ! ~ \ and unary + and - | ||
18 | '=~' : 4, | ||
19 | '!~' : 4, | ||
20 | '*' : 4, | ||
21 | '/' : 4, | ||
22 | '%' : 4, | ||
23 | 'x' : 4, | ||
24 | '+' : 4, | ||
25 | '-' : 4, | ||
26 | '.' : 4, | ||
27 | '<<' : 4, | ||
28 | '>>' : 4, | ||
29 | // named unary operators | ||
30 | '<' : 4, | ||
31 | '>' : 4, | ||
32 | '<=' : 4, | ||
33 | '>=' : 4, | ||
34 | 'lt' : 4, | ||
35 | 'gt' : 4, | ||
36 | 'le' : 4, | ||
37 | 'ge' : 4, | ||
38 | '==' : 4, | ||
39 | '!=' : 4, | ||
40 | '<=>' : 4, | ||
41 | 'eq' : 4, | ||
42 | 'ne' : 4, | ||
43 | 'cmp' : 4, | ||
44 | '~~' : 4, | ||
45 | '&' : 4, | ||
46 | '|' : 4, | ||
47 | '^' : 4, | ||
48 | '&&' : 4, | ||
49 | '||' : 4, | ||
50 | '//' : 4, | ||
51 | '..' : 4, | ||
52 | '...' : 4, | ||
53 | '?' : 4, | ||
54 | ':' : 4, | ||
55 | '=' : 4, | ||
56 | '+=' : 4, | ||
57 | '-=' : 4, | ||
58 | '*=' : 4, // etc. ??? | ||
59 | ',' : 4, | ||
60 | '=>' : 4, | ||
61 | '::' : 4, | ||
62 | // list operators (rightward) | ||
63 | 'not' : 4, | ||
64 | 'and' : 4, | ||
65 | 'or' : 4, | ||
66 | 'xor' : 4, | ||
67 | // PERL predefined variables (I know, what this is a paranoid idea, but may be needed for people, who learn PERL, and for me as well, ...and may be for you?;) | ||
68 | 'BEGIN' : [5,1], | ||
69 | 'END' : [5,1], | ||
70 | 'PRINT' : [5,1], | ||
71 | 'PRINTF' : [5,1], | ||
72 | 'GETC' : [5,1], | ||
73 | 'READ' : [5,1], | ||
74 | 'READLINE' : [5,1], | ||
75 | 'DESTROY' : [5,1], | ||
76 | 'TIE' : [5,1], | ||
77 | 'TIEHANDLE' : [5,1], | ||
78 | 'UNTIE' : [5,1], | ||
79 | 'STDIN' : 5, | ||
80 | 'STDIN_TOP' : 5, | ||
81 | 'STDOUT' : 5, | ||
82 | 'STDOUT_TOP' : 5, | ||
83 | 'STDERR' : 5, | ||
84 | 'STDERR_TOP' : 5, | ||
85 | '$ARG' : 5, | ||
86 | '$_' : 5, | ||
87 | '@ARG' : 5, | ||
88 | '@_' : 5, | ||
89 | '$LIST_SEPARATOR' : 5, | ||
90 | '$"' : 5, | ||
91 | '$PROCESS_ID' : 5, | ||
92 | '$PID' : 5, | ||
93 | '$$' : 5, | ||
94 | '$REAL_GROUP_ID' : 5, | ||
95 | '$GID' : 5, | ||
96 | '$(' : 5, | ||
97 | '$EFFECTIVE_GROUP_ID' : 5, | ||
98 | '$EGID' : 5, | ||
99 | '$)' : 5, | ||
100 | '$PROGRAM_NAME' : 5, | ||
101 | '$0' : 5, | ||
102 | '$SUBSCRIPT_SEPARATOR' : 5, | ||
103 | '$SUBSEP' : 5, | ||
104 | '$;' : 5, | ||
105 | '$REAL_USER_ID' : 5, | ||
106 | '$UID' : 5, | ||
107 | '$<' : 5, | ||
108 | '$EFFECTIVE_USER_ID' : 5, | ||
109 | '$EUID' : 5, | ||
110 | '$>' : 5, | ||
111 | '$a' : 5, | ||
112 | '$b' : 5, | ||
113 | '$COMPILING' : 5, | ||
114 | '$^C' : 5, | ||
115 | '$DEBUGGING' : 5, | ||
116 | '$^D' : 5, | ||
117 | '${^ENCODING}' : 5, | ||
118 | '$ENV' : 5, | ||
119 | '%ENV' : 5, | ||
120 | '$SYSTEM_FD_MAX' : 5, | ||
121 | '$^F' : 5, | ||
122 | '@F' : 5, | ||
123 | '${^GLOBAL_PHASE}' : 5, | ||
124 | '$^H' : 5, | ||
125 | '%^H' : 5, | ||
126 | '@INC' : 5, | ||
127 | '%INC' : 5, | ||
128 | '$INPLACE_EDIT' : 5, | ||
129 | '$^I' : 5, | ||
130 | '$^M' : 5, | ||
131 | '$OSNAM |