aboutsummaryrefslogtreecommitdiff
path: root/js/codemirror/mode/python
diff options
context:
space:
mode:
Diffstat (limited to 'js/codemirror/mode/python')
-rw-r--r--js/codemirror/mode/python/LICENSE.txt21
-rw-r--r--js/codemirror/mode/python/index.html123
-rw-r--r--js/codemirror/mode/python/python.js321
3 files changed, 0 insertions, 465 deletions
diff --git a/js/codemirror/mode/python/LICENSE.txt b/js/codemirror/mode/python/LICENSE.txt
deleted file mode 100644
index 918866b4..00000000
--- a/js/codemirror/mode/python/LICENSE.txt
+++ /dev/null
@@ -1,21 +0,0 @@
1The MIT License
2
3Copyright (c) 2010 Timothy Farrell
4
5Permission is hereby granted, free of charge, to any person obtaining a copy
6of this software and associated documentation files (the "Software"), to deal
7in the Software without restriction, including without limitation the rights
8to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9copies of the Software, and to permit persons to whom the Software is
10furnished to do so, subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in
13all copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21THE SOFTWARE. \ No newline at end of file
diff --git a/js/codemirror/mode/python/index.html b/js/codemirror/mode/python/index.html
deleted file mode 100644
index 1c366438..00000000
--- a/js/codemirror/mode/python/index.html
+++ /dev/null
@@ -1,123 +0,0 @@
1<!doctype html>
2<html>
3 <head>
4 <title>CodeMirror 2: Python mode</title>
5 <link rel="stylesheet" href="../../lib/codemirror.css">
6 <script src="../../lib/codemirror.js"></script>
7 <script src="python.js"></script>
8 <link rel="stylesheet" href="../../theme/default.css">
9 <link rel="stylesheet" href="../../css/docs.css">
10 <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
11 </head>
12 <body>
13 <h1>CodeMirror 2: Python mode</h1>
14
15 <div><textarea id="code" name="code">
16# Literals
171234
180.0e101
19.123
200b01010011100
210o01234567
220x0987654321abcdef
237
242147483647
253L
2679228162514264337593543950336L
270x100000000L
2879228162514264337593543950336
290xdeadbeef
303.14j
3110.j
3210j
33.001j
341e100j
353.14e-10j
36
37
38# String Literals
39'For\''
40"God\""
41"""so loved
42the world"""
43'''that he gave
44his only begotten\' '''
45'that whosoever believeth \
46in him'
47''
48
49# Identifiers
50__a__
51a.b
52a.b.c
53
54# Operators
55+ - * / % & | ^ ~ < >
56== != <= >= <> << >> // **
57and or not in is
58
59# Delimiters
60() [] {} , : ` = ; @ . # Note that @ and . require the proper context.
61+= -= *= /= %= &= |= ^=
62//= >>= <<= **=
63
64# Keywords
65as assert break class continue def del elif else except
66finally for from global if import lambda pass raise
67return try while with yield
68
69# Python 2 Keywords (otherwise Identifiers)
70exec print
71
72# Python 3 Keywords (otherwise Identifiers)
73nonlocal
74
75# Types
76bool classmethod complex dict enumerate float frozenset int list object
77property reversed set slice staticmethod str super tuple type
78
79# Python 2 Types (otherwise Identifiers)
80basestring buffer file long unicode xrange
81
82# Python 3 Types (otherwise Identifiers)
83bytearray bytes filter map memoryview open range zip
84
85# Some Example code
86import os
87from package import ParentClass
88
89@nonsenseDecorator
90def doesNothing():
91 pass
92
93class ExampleClass(ParentClass):
94 @staticmethod
95 def example(inputStr):
96 a = list(inputStr)
97 a.reverse()
98 return ''.join(a)
99
100 def __init__(self, mixin = 'Hello'):
101 self.mixin = mixin
102
103</textarea></div>
104 <script>
105 var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
106 mode: {name: "python",
107 version: 2,
108 singleLineStringErrors: false},
109 lineNumbers: true,
110 indentUnit: 4,
111 tabMode: "shift",
112 matchBrackets: true
113 });
114 </script>
115 <h2>Configuration Options:</h2>
116 <ul>
117 <li>version - 2/3 - The version of Python to recognize. Default is 2.</li>
118 <li>singleLineStringErrors - true/false - If you have a single-line string that is not terminated at the end of the line, this will show subsequent lines as errors if true, otherwise it will consider the newline as the end of the string. Default is false.</li>
119 </ul>
120
121 <p><strong>MIME types defined:</strong> <code>text/x-python</code>.</p>
122 </body>
123</html>
diff --git a/js/codemirror/mode/python/python.js b/js/codemirror/mode/python/python.js
deleted file mode 100644
index baeec03c..00000000
--- a/js/codemirror/mode/python/python.js
+++ /dev/null
@@ -1,321 +0,0 @@
1CodeMirror.defineMode("python", function(conf) {
2 var ERRORCLASS = 'error';
3
4 function wordRegexp(words) {
5 return new RegExp("^((" + words.join(")|(") + "))\\b");
6 }
7
8 var singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!]");
9 var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]');
10 var doubleOperators = new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))");
11 var doubleDelimiters = new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))");
12 var tripleDelimiters = new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))");
13 var identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*");
14
15 var wordOperators = wordRegexp(['and', 'or', 'not', 'is', 'in']);
16 var commonkeywords = ['as', 'assert', 'break', 'class', 'continue',
17 'def', 'del', 'elif', 'else', 'except', 'finally',
18 'for', 'from', 'global', 'if', 'import',
19 'lambda', 'pass', 'raise', 'return',
20 'try', 'while', 'with', 'yield'];
21 var commontypes = ['bool', 'classmethod', 'complex', 'dict', 'enumerate',
22 'float', 'frozenset', 'int', 'list', 'object',
23 'property', 'reversed', 'set', 'slice', 'staticmethod',
24 'str', 'super', 'tuple', 'type'];
25 var py2 = {'types': ['basestring', 'buffer', 'file', 'long', 'unicode',
26 'xrange'],
27 'keywords': ['exec', 'print']};
28 var py3 = {'types': ['bytearray', 'bytes', 'filter', 'map', 'memoryview',
29 'open', 'range', 'zip'],
30 'keywords': ['nonlocal']};
31
32 if (!!conf.mode.version && parseInt(conf.mode.version, 10) === 3) {
33 commonkeywords = commonkeywords.concat(py3.keywords);
34 commontypes = commontypes.concat(py3.types);
35 var stringPrefixes = new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))", "i");
36 } else {
37 commonkeywords = commonkeywords.concat(py2.keywords);
38 commontypes = commontypes.concat(py2.types);
39 var stringPrefixes = new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
40 }
41 var keywords = wordRegexp(commonkeywords);
42 var types = wordRegexp(commontypes);
43
44 var indentInfo = null;
45
46 // tokenizers
47 function tokenBase(stream, state) {
48 // Handle scope changes
49 if (stream.sol()) {
50 var scopeOffset = state.scopes[0].offset;
51 if (stream.eatSpace()) {
52 var lineOffset = stream.indentation();
53 if (lineOffset > scopeOffset) {
54 indentInfo = 'indent';
55 } else if (lineOffset < scopeOffset) {
56 indentInfo = 'dedent';
57 }
58 return null;
59 } else {
60 if (scopeOffset > 0) {
61 dedent(stream, state);
62 }
63 }
64 }
65 if (stream.eatSpace()) {
66 return null;
67 }
68
69 var ch = stream.peek();
70
71 // Handle Comments
72 if (ch === '#') {
73 stream.skipToEnd();
74 return 'comment';
75 }
76
77 // Handle Number Literals
78 if (stream.match(/^[0-9\.]/, false)) {
79 var floatLiteral = false;
80 // Floats
81 if (stream.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; }
82