aboutsummaryrefslogtreecommitdiff
path: root/imports/codemirror/mode/python/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'imports/codemirror/mode/python/index.html')
-rwxr-xr-ximports/codemirror/mode/python/index.html122
1 files changed, 122 insertions, 0 deletions
diff --git a/imports/codemirror/mode/python/index.html b/imports/codemirror/mode/python/index.html
new file mode 100755
index 00000000..47e0e9d0
--- /dev/null
+++ b/imports/codemirror/mode/python/index.html
@@ -0,0 +1,122 @@
1<!doctype html>
2<html>
3 <head>
4 <title>CodeMirror: 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="../../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: Python mode</h1>
13
14 <div><textarea id="code" name="code">
15# Literals
161234
170.0e101
18.123
190b01010011100
200o01234567
210x0987654321abcdef
227
232147483647
243L
2579228162514264337593543950336L
260x100000000L
2779228162514264337593543950336
280xdeadbeef
293.14j
3010.j
3110j
32.001j
331e100j
343.14e-10j
35
36
37# String Literals
38'For\''
39"God\""
40"""so loved
41the world"""
42'''that he gave
43his only begotten\' '''
44'that whosoever believeth \
45in him'
46''
47
48# Identifiers
49__a__
50a.b
51a.b.c
52
53# Operators
54+ - * / % & | ^ ~ < >
55== != <= >= <> << >> // **
56and or not in is
57
58# Delimiters
59() [] {} , : ` = ; @ . # Note that @ and . require the proper context.
60+= -= *= /= %= &= |= ^=
61//= >>= <<= **=
62
63# Keywords
64as assert break class continue def del elif else except
65finally for from global if import lambda pass raise
66return try while with yield
67
68# Python 2 Keywords (otherwise Identifiers)
69exec print
70
71# Python 3 Keywords (otherwise Identifiers)
72nonlocal
73
74# Types
75bool classmethod complex dict enumerate float frozenset int list object
76property reversed set slice staticmethod str super tuple type
77
78# Python 2 Types (otherwise Identifiers)
79basestring buffer file long unicode xrange
80
81# Python 3 Types (otherwise Identifiers)
82bytearray bytes filter map memoryview open range zip
83
84# Some Example code
85import os
86from package import ParentClass
87
88@nonsenseDecorator
89def doesNothing():
90 pass
91
92class ExampleClass(ParentClass):
93 @staticmethod
94 def example(inputStr):
95 a = list(inputStr)
96 a.reverse()
97 return ''.join(a)
98
99 def __init__(self, mixin = 'Hello'):
100 self.mixin = mixin
101
102</textarea></div>
103 <script>
104 var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
105 mode: {name: "python",
106 version: 2,
107 singleLineStringErrors: false},
108 lineNumbers: true,
109 indentUnit: 4,
110 tabMode: "shift",
111 matchBrackets: true
112 });
113 </script>
114 <h2>Configuration Options:</h2>
115 <ul>
116 <li>version - 2/3 - The version of Python to recognize. Default is 2.</li>
117 <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>
118 </ul>
119
120 <p><strong>MIME types defined:</strong> <code>text/x-python</code>.</p>
121 </body>
122</html>