4 | {% endblock %}
--------------------------------------------------------------------------------
/site/templates/script.html:
--------------------------------------------------------------------------------
1 | {% extends 'base.html' %}
2 | {% block content %}
3 |
7 |
12 | {% endblock %}
--------------------------------------------------------------------------------
/site/templates/new.html:
--------------------------------------------------------------------------------
1 | {% extends 'base.html' %}
2 | {% block content %}
3 |
7 |
13 | {% endblock %}
--------------------------------------------------------------------------------
/site/app.yaml:
--------------------------------------------------------------------------------
1 | application: scriptletsapp
2 | version: 2
3 | runtime: python
4 | api_version: 1
5 |
6 | handlers:
7 | - url: /favicon.ico
8 | static_files: static/favicon.ico
9 | upload: static/favicon.ico
10 | - url: /robots.txt
11 | static_files: static/robots.txt
12 | upload: static/robots.txt
13 | - url: /static
14 | static_dir: static
15 | - url: /view.*
16 | script: legacy.py
17 | - url: /code.*
18 | script: legacy.py
19 | - url: /run.*
20 | script: legacy.py
21 | - url: /.*
22 | script: main.py
23 |
--------------------------------------------------------------------------------
/site/index.yaml:
--------------------------------------------------------------------------------
1 | indexes:
2 |
3 | # AUTOGENERATED
4 |
5 | # This index.yaml is automatically updated whenever the dev_appserver
6 | # detects that a new type of query is run. If you want to manage the
7 | # index.yaml file manually, remove the above marker line (the line
8 | # saying "# AUTOGENERATED"). If you want to manage some indexes
9 | # manually, move them above the marker line. The index.yaml file is
10 | # automatically uploaded to the admin console when you next deploy
11 | # your application using appcfg.py.
12 |
--------------------------------------------------------------------------------
/site/static/css/sparqlcolors.css:
--------------------------------------------------------------------------------
1 | .editbox {
2 | margin: .4em;
3 | padding: 0;
4 | font-family: monospace;
5 | font-size: 10pt;
6 | color: black;
7 | }
8 |
9 | .editbox p {
10 | margin: 0;
11 | }
12 |
13 | span.sp-keyword {
14 | color: #708;
15 | }
16 |
17 | span.sp-prefixed {
18 | color: #5d1;
19 | }
20 |
21 | span.sp-var {
22 | color: #00c;
23 | }
24 |
25 | span.sp-comment {
26 | color: #a70;
27 | }
28 |
29 | span.sp-literal {
30 | color: #a22;
31 | }
32 |
33 | span.sp-uri {
34 | color: #292;
35 | }
36 |
37 | span.sp-operator {
38 | color: #088;
39 | }
40 |
--------------------------------------------------------------------------------
/site/static/style.css:
--------------------------------------------------------------------------------
1 | body { font-family: Helvetica,Arial,sans-serif; font-size: smaller;}
2 | #header h1 { display: block; margin: 0;}
3 | #header { border-bottom: 2px solid darkblue; padding: 5px; padding-bottom: 1px; background-color: lightblue;}
4 | #wrapper { margin-left: auto; margin-right: auto; width: 800px;}
5 | #content { margin: 10px; }
6 | pre { font-size: larger;}
7 | ul { padding-left: 20px;}
8 | #make-form { margin: 20px; text-align: center; margin-right: 80px;}
9 | #make-form input { font-size: larger;}
10 | #footer {
11 | margin-top: 20px;
12 | border-top: 1px solid darkblue;
13 | background-color: lightblue;
14 | padding: 5px;
15 | padding-left: 10px;
16 | }
17 | #footer a:visited { color: blue;}
--------------------------------------------------------------------------------
/site/static/css/csscolors.css:
--------------------------------------------------------------------------------
1 | .editbox {
2 | margin: .4em;
3 | padding: 0;
4 | font-family: monospace;
5 | font-size: 10pt;
6 | color: black;
7 | }
8 |
9 | pre.code, .editbox {
10 | color: #666666;
11 | }
12 |
13 | .editbox p {
14 | margin: 0;
15 | }
16 |
17 | span.css-at {
18 | color: #770088;
19 | }
20 |
21 | span.css-unit {
22 | color: #228811;
23 | }
24 |
25 | span.css-value {
26 | color: #770088;
27 | }
28 |
29 | span.css-identifier {
30 | color: black;
31 | }
32 |
33 | span.css-important {
34 | color: #0000FF;
35 | }
36 |
37 | span.css-colorcode {
38 | color: #004499;
39 | }
40 |
41 | span.css-comment {
42 | color: #AA7700;
43 | }
44 |
45 | span.css-string {
46 | color: #AA2222;
47 | }
48 |
--------------------------------------------------------------------------------
/site/static/css/docs.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | padding: 3em 6em;
4 | color: black;
5 | max-width: 50em;
6 | }
7 |
8 | h1 {
9 | font-size: 22pt;
10 | }
11 |
12 | .underline {
13 | border-bottom: 3px solid #C44;
14 | }
15 |
16 | h2 {
17 | font-size: 14pt;
18 | }
19 |
20 | p.rel {
21 | padding-left: 2em;
22 | text-indent: -2em;
23 | }
24 |
25 | div.border {
26 | border: 1px solid black;
27 | padding: 3px;
28 | }
29 |
30 | code {
31 | font-family: courier, monospace;
32 | font-size: 90%;
33 | color: #144;
34 | }
35 |
36 | pre.code {
37 | margin: 1.1em 12px;
38 | border: 1px solid #CCCCCC;
39 | color: black;
40 | padding: .4em;
41 | font-family: courier, monospace;
42 | }
43 |
44 | .warn {
45 | color: #C00;
46 | }
47 |
--------------------------------------------------------------------------------
/site/static/css/xmlcolors.css:
--------------------------------------------------------------------------------
1 | .editbox {
2 | margin: .4em;
3 | padding: 0;
4 | font-family: monospace;
5 | font-size: 10pt;
6 | color: black;
7 | }
8 |
9 | .editbox p {
10 | margin: 0;
11 | }
12 |
13 | span.xml-tagname {
14 | color: #A0B;
15 | }
16 |
17 | span.xml-attribute {
18 | color: #281;
19 | }
20 |
21 | span.xml-punctuation {
22 | color: black;
23 | }
24 |
25 | span.xml-attname {
26 | color: #00F;
27 | }
28 |
29 | span.xml-comment {
30 | color: #A70;
31 | }
32 |
33 | span.xml-cdata {
34 | color: #48A;
35 | }
36 |
37 | span.xml-processing {
38 | color: #999;
39 | }
40 |
41 | span.xml-entity {
42 | color: #A22;
43 | }
44 |
45 | span.xml-error {
46 | color: #F00;
47 | }
48 |
49 | span.xml-text {
50 | color: black;
51 | }
52 |
--------------------------------------------------------------------------------
/site/static/css/jscolors.css:
--------------------------------------------------------------------------------
1 | .editbox {
2 | margin: .4em;
3 | padding: 0;
4 | font-family: monospace;
5 | font-size: 10pt;
6 | color: black;
7 | }
8 |
9 | pre.code, .editbox {
10 | color: #666666;
11 | }
12 |
13 | .editbox p {
14 | margin: 0;
15 | }
16 |
17 | span.js-punctuation {
18 | color: #666666;
19 | }
20 |
21 | span.js-operator {
22 | color: #666666;
23 | }
24 |
25 | span.js-keyword {
26 | color: #770088;
27 | }
28 |
29 | span.js-atom {
30 | color: #228811;
31 | }
32 |
33 | span.js-variable {
34 | color: black;
35 | }
36 |
37 | span.js-variabledef {
38 | color: #0000FF;
39 | }
40 |
41 | span.js-localvariable {
42 | color: #004499;
43 | }
44 |
45 | span.js-property {
46 | color: black;
47 | }
48 |
49 | span.js-comment {
50 | color: #AA7700;
51 | }
52 |
53 | span.js-string {
54 | color: #AA2222;
55 | }
56 |
--------------------------------------------------------------------------------
/site/static/contrib/python/css/pythoncolors.css:
--------------------------------------------------------------------------------
1 | .editbox {
2 | padding: .4em;
3 | margin: 0;
4 | font-family: monospace;
5 | font-size: 10pt;
6 | line-height: 1.1em;
7 | color: black;
8 | }
9 |
10 | pre.code, .editbox {
11 | color: #666666;
12 | }
13 |
14 | .editbox p {
15 | margin: 0;
16 | }
17 |
18 | span.py-delimiter, span.py-special {
19 | color: #666666;
20 | }
21 |
22 | span.py-operator {
23 | color: #666666;
24 | }
25 |
26 | span.py-error {
27 | background-color: #660000;
28 | color: #FFFFFF;
29 | }
30 |
31 | span.py-keyword {
32 | color: #770088;
33 | font-weight: bold;
34 | }
35 |
36 | span.py-literal {
37 | color: #228811;
38 | }
39 |
40 | span.py-identifier, span.py-func {
41 | color: black;
42 | }
43 |
44 | span.py-type, span.py-decorator {
45 | color: #0000FF;
46 | }
47 |
48 | span.py-comment {
49 | color: #AA7700;
50 | }
51 |
52 | span.py-string, span.py-bytes, span.py-raw, span.py-unicode {
53 | color: #AA2222;
54 | }
55 |
--------------------------------------------------------------------------------
/site/static/js/parsedummy.js:
--------------------------------------------------------------------------------
1 | var DummyParser = Editor.Parser = (function() {
2 | function tokenizeDummy(source) {
3 | while (!source.endOfLine()) source.next();
4 | return "text";
5 | }
6 | function parseDummy(source) {
7 | function indentTo(n) {return function() {return n;}}
8 | source = tokenizer(source, tokenizeDummy);
9 | var space = 0;
10 |
11 | var iter = {
12 | next: function() {
13 | var tok = source.next();
14 | if (tok.type == "whitespace") {
15 | if (tok.value == "\n") tok.indentation = indentTo(space);
16 | else space = tok.value.length;
17 | }
18 | return tok;
19 | },
20 | copy: function() {
21 | var _space = space;
22 | return function(_source) {
23 | space = _space;
24 | source = tokenizer(_source, tokenizeDummy);
25 | return iter;
26 | };
27 | }
28 | };
29 | return iter;
30 | }
31 | return {make: parseDummy};
32 | })();
33 |
--------------------------------------------------------------------------------
/site/legacy.py:
--------------------------------------------------------------------------------
1 | import wsgiref.handlers
2 | from google.appengine.ext import webapp
3 | from google.appengine.api import urlfetch
4 | import urllib
5 |
6 | LEGACY_URL = "http://1.latest.scriptletsapp.appspot.com"
7 |
8 | class LegacyAdaptor(webapp.RequestHandler):
9 | def get(self):
10 | self.redirect('%s%s' % (LEGACY_URL, self.request.path))
11 |
12 | def post(self):
13 | payload = dict(self.request.POST)
14 | headers = dict(self.request.headers)
15 | self.response.out.write(urlfetch.fetch(
16 | url='%s%s' % (LEGACY_URL, self.request.path),
17 | payload=urllib.urlencode(payload) if len(payload) else None,
18 | method=self.request.method,
19 | headers=headers,
20 | deadline=10).content)
21 |
22 | def main():
23 | application = webapp.WSGIApplication([
24 | ('/view/.*', LegacyAdaptor),
25 | ('/code/.*', LegacyAdaptor),
26 | ('/run/.*', LegacyAdaptor),
27 | ], debug=True)
28 | wsgiref.handlers.CGIHandler().run(application)
29 |
30 |
31 | if __name__ == '__main__':
32 | main()
--------------------------------------------------------------------------------
/site/models.py:
--------------------------------------------------------------------------------
1 | import time
2 | from google.appengine.ext import db
3 |
4 | def baseN(num,b=62,numerals="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"):
5 | return ((num == 0) and "0" ) or (baseN(num // b, b).lstrip("0") + numerals[num % b])
6 |
7 | class Script(db.Model):
8 | user = db.UserProperty(auto_current_user_add=True)
9 | id = db.StringProperty(required=True)
10 | name = db.StringProperty()
11 | private = db.BooleanProperty(default=False)
12 | latest_version = db.ReferenceProperty()
13 |
14 | created = db.DateTimeProperty(auto_now_add=True)
15 | edited = db.DateTimeProperty()
16 | executed = db.DateTimeProperty()
17 | run_count = db.IntegerProperty(default=0)
18 |
19 | # Legacy fields
20 | name = db.StringProperty()
21 | code = db.TextProperty()
22 | language = db.StringProperty()
23 |
24 | def __init__(self, *args, **kwargs):
25 | kwargs['id'] = kwargs.get('id', baseN(abs(hash(time.time()))))
26 | super(Script, self).__init__(*args, **kwargs)
27 |
28 | class Version(db.Model):
29 | script = db.ReferenceProperty(Script)
30 | id = db.StringProperty(required=True)
31 | body = db.TextProperty()
32 |
33 | created = db.DateTimeProperty(auto_now_add=True)
34 | executed = db.DateTimeProperty()
35 | run_count = db.IntegerProperty(default=0)
36 |
37 | def __init__(self, *args, **kwargs):
38 | kwargs['id'] = kwargs.get('id', str(abs(hash(time.time()))))
39 | super(Version, self).__init__(*args, **kwargs)
--------------------------------------------------------------------------------
/site/static/contrib/python/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2009, Timothy Farrell
2 | All rights reserved.
3 |
4 | This software is provided for use in connection with the
5 | CodeMirror suite of modules and utilities, hosted and maintained
6 | at http://marijn.haverbeke.nl/codemirror/.
7 |
8 | Redistribution and use of this software in source and binary forms,
9 | with or without modification, are permitted provided that the
10 | following conditions are met:
11 |
12 | * Redistributions of source code must retain the above
13 | copyright notice, this list of conditions and the
14 | following disclaimer.
15 |
16 | * Redistributions in binary form must reproduce the above
17 | copyright notice, this list of conditions and the
18 | following disclaimer in the documentation and/or other
19 | materials provided with the distribution.
20 |
21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 | POSSIBILITY OF SUCH DAMAGE.
33 |
--------------------------------------------------------------------------------
/site/static/contrib/php/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2008-2009, Yahoo! Inc.
2 | All rights reserved.
3 |
4 | This software is provided for use in connection with the
5 | CodeMirror suite of modules and utilities, hosted and maintained
6 | at http://marijn.haverbeke.nl/codemirror/.
7 |
8 | Redistribution and use of this software in source and binary forms,
9 | with or without modification, are permitted provided that the
10 | following conditions are met:
11 |
12 | * Redistributions of source code must retain the above
13 | copyright notice, this list of conditions and the
14 | following disclaimer.
15 |
16 | * Redistributions in binary form must reproduce the above
17 | copyright notice, this list of conditions and the
18 | following disclaimer in the documentation and/or other
19 | materials provided with the distribution.
20 |
21 | * Neither the name of Yahoo! Inc. nor the names of its
22 | contributors may be used to endorse or promote products
23 | derived from this software without specific prior
24 | written permission of Yahoo! Inc.
25 |
26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
29 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
30 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
31 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
32 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
33 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
34 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
36 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 | POSSIBILITY OF SUCH DAMAGE.
38 |
--------------------------------------------------------------------------------
/site/static/js/tokenize.js:
--------------------------------------------------------------------------------
1 | // A framework for simple tokenizers. Takes care of newlines and
2 | // white-space, and of getting the text from the source stream into
3 | // the token object. A state is a function of two arguments -- a
4 | // string stream and a setState function. The second can be used to
5 | // change the tokenizer's state, and can be ignored for stateless
6 | // tokenizers. This function should advance the stream over a token
7 | // and return a string or object containing information about the next
8 | // token, or null to pass and have the (new) state be called to finish
9 | // the token. When a string is given, it is wrapped in a {style, type}
10 | // object. In the resulting object, the characters consumed are stored
11 | // under the content property. Any whitespace following them is also
12 | // automatically consumed, and added to the value property. (Thus,
13 | // content is the actual meaningful part of the token, while value
14 | // contains all the text it spans.)
15 |
16 | function tokenizer(source, state) {
17 | // Newlines are always a separate token.
18 | function isWhiteSpace(ch) {
19 | // The messy regexp is because IE's regexp matcher is of the
20 | // opinion that non-breaking spaces are no whitespace.
21 | return ch != "\n" && /^[\s\u00a0]*$/.test(ch);
22 | }
23 |
24 | var tokenizer = {
25 | state: state,
26 |
27 | take: function(type) {
28 | if (typeof(type) == "string")
29 | type = {style: type, type: type};
30 |
31 | type.content = (type.content || "") + source.get();
32 | if (!/\n$/.test(type.content))
33 | source.nextWhile(isWhiteSpace);
34 | type.value = type.content + source.get();
35 | return type;
36 | },
37 |
38 | next: function () {
39 | if (!source.more()) throw StopIteration;
40 |
41 | var type;
42 | if (source.equals("\n")) {
43 | source.next();
44 | return this.take("whitespace");
45 | }
46 |
47 | if (source.applies(isWhiteSpace))
48 | type = "whitespace";
49 | else
50 | while (!type)
51 | type = this.state(source, function(s) {tokenizer.state = s;});
52 |
53 | return this.take(type);
54 | }
55 | };
56 | return tokenizer;
57 | }
58 |
--------------------------------------------------------------------------------
/site/templates/base.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | {% block title %}Scriptlets - Quick web scripts{% endblock %}
4 |
5 |
6 |
7 |
10 | {% block head %}{% endblock %}
11 |
12 |
13 |
14 |
15 | {% if user %}
16 | {{ user.nickname }} | Logout
17 | {% else %}
18 | Not logged in. Login?
19 | {% endif %}
20 |
21 |
Scriptlets
22 |
23 |
24 | {% block content %}{% endblock %}
25 |
26 |
31 |
38 |
42 |
54 |
55 |
--------------------------------------------------------------------------------
/site/static/js/mirrorframe.js:
--------------------------------------------------------------------------------
1 | /* Demonstration of embedding CodeMirror in a bigger application. The
2 | * interface defined here is a mess of prompts and confirms, and
3 | * should probably not be used in a real project.
4 | */
5 |
6 | function MirrorFrame(place, options) {
7 | this.home = document.createElement("DIV");
8 | if (place.appendChild)
9 | place.appendChild(this.home);
10 | else
11 | place(this.home);
12 |
13 | var self = this;
14 | function makeButton(name, action) {
15 | var button = document.createElement("INPUT");
16 | button.type = "button";
17 | button.value = name;
18 | self.home.appendChild(button);
19 | button.onclick = function(){self[action].call(self);};
20 | }
21 |
22 | makeButton("Search", "search");
23 | makeButton("Replace", "replace");
24 | makeButton("Current line", "line");
25 | makeButton("Jump to line", "jump");
26 | makeButton("Insert constructor", "macro");
27 | makeButton("Indent all", "reindent");
28 |
29 | this.mirror = new CodeMirror(this.home, options);
30 | }
31 |
32 | MirrorFrame.prototype = {
33 | search: function() {
34 | var text = prompt("Enter search term:", "");
35 | if (!text) return;
36 |
37 | var first = true;
38 | do {
39 | var cursor = this.mirror.getSearchCursor(text, first);
40 | first = false;
41 | while (cursor.findNext()) {
42 | cursor.select();
43 | if (!confirm("Search again?"))
44 | return;
45 | }
46 | } while (confirm("End of document reached. Start over?"));
47 | },
48 |
49 | replace: function() {
50 | // This is a replace-all, but it is possible to implement a
51 | // prompting replace.
52 | var from = prompt("Enter search string:", ""), to;
53 | if (from) to = prompt("What should it be replaced with?", "");
54 | if (to == null) return;
55 |
56 | var cursor = this.mirror.getSearchCursor(from, false);
57 | while (cursor.findNext())
58 | cursor.replace(to);
59 | },
60 |
61 | jump: function() {
62 | var line = prompt("Jump to line:", "");
63 | if (line && !isNaN(Number(line)))
64 | this.mirror.jumpToLine(Number(line));
65 | },
66 |
67 | line: function() {
68 | alert("The cursor is currently at line " + this.mirror.currentLine());
69 | this.mirror.focus();
70 | },
71 |
72 | macro: function() {
73 | var name = prompt("Name your constructor:", "");
74 | if (name)
75 | this.mirror.replaceSelection("function " + name + "() {\n \n}\n\n" + name + ".prototype = {\n \n};\n");
76 | },
77 |
78 | reindent: function() {
79 | this.mirror.reindent();
80 | }
81 | };
82 |
--------------------------------------------------------------------------------
/site/static/js/parsehtmlmixed.js:
--------------------------------------------------------------------------------
1 | var HTMLMixedParser = Editor.Parser = (function() {
2 | if (!(CSSParser && JSParser && XMLParser))
3 | throw new Error("CSS, JS, and XML parsers must be loaded for HTML mixed mode to work.");
4 | XMLParser.configure({useHTMLKludges: true});
5 |
6 | function parseMixed(stream) {
7 | var htmlParser = XMLParser.make(stream), localParser = null, inTag = false;
8 | var iter = {next: top, copy: copy};
9 |
10 | function top() {
11 | var token = htmlParser.next();
12 | if (token.content == "<")
13 | inTag = true;
14 | else if (token.style == "xml-tagname" && inTag === true)
15 | inTag = token.content.toLowerCase();
16 | else if (token.content == ">") {
17 | if (inTag == "script")
18 | iter.next = local(JSParser, "
7 | */
8 |
9 | .editbox {
10 | margin: .4em;
11 | padding: 0;
12 | font-family: monospace;
13 | font-size: 10pt;
14 | }
15 |
16 | /*We should define specific styles for every element of the syntax.
17 | the setting below will cause some annoying color to show through if we missed
18 | defining a style for a token. This is also the "color" of the whitespace and
19 | of the cursor.
20 | */
21 | pre.code, .editbox {
22 | color: red;
23 | }
24 |
25 | .editbox p {
26 | margin: 0;
27 | }
28 |
29 | span.php-punctuation {
30 | color: blue;
31 | }
32 |
33 | span.php-keyword {
34 | color: #770088;
35 | font-weight: bold;
36 | }
37 |
38 | span.php-operator {
39 | color: blue;
40 | }
41 |
42 | /* __FILE__ etc.; http://php.net/manual/en/reserved.php */
43 | span.php-compile-time-constant {
44 | color: #776088;
45 | font-weight: bold;
46 | }
47 |
48 | /* output of get_defined_constants(). Differs from http://php.net/manual/en/reserved.constants.php */
49 | span.php-predefined-constant {
50 | color: darkgreen;
51 | font-weight: bold;
52 | }
53 |
54 | /* PHP reserved "language constructs"... echo() etc.; http://php.net/manual/en/reserved.php */
55 | span.php-reserved-language-construct {
56 | color: green;
57 | font-weight: bold;
58 | }
59 |
60 | /* PHP built-in functions: glob(), chr() etc.; output of get_defined_functions()["internal"] */
61 | span.php-predefined-function {
62 | color: green;
63 | }
64 |
65 | /* PHP predefined classes: PDO, Exception etc.; output of get_declared_classes() and different from http://php.net/manual/en/reserved.classes.php */
66 | span.php-predefined-class {
67 | color: green;
68 | }
69 |
70 | span.php-atom {
71 | color: #228811;
72 | }
73 |
74 | /* class, interface, namespace or function names, but not $variables */
75 | span.php-t_string {
76 | color: black;
77 | }
78 |
79 | span.php-variable {
80 | color: black;
81 | font-weight: bold;
82 | }
83 |
84 |
85 | span.js-localvariable {
86 | color: #004499;
87 | }
88 |
89 | span.php-comment {
90 | color: #AA7700;
91 | font-stretch: condensed;
92 | /* font-style: italic; This causes line height to slightly change, getting line numbers out of sync */
93 | }
94 |
95 | span.php-string-single-quoted {
96 | color: #AA2222;
97 | }
98 | /* double quoted strings allow interpolation */
99 | span.php-string-double-quoted {
100 | color: #AA2222;
101 | font-weight: bold;
102 | }
103 |
104 | span.syntax-error {
105 | background-color: red;
106 | }
107 |
108 | span.deprecated {
109 | font-size: smaller;
110 | }
111 |
--------------------------------------------------------------------------------
/site/static/contrib/php/js/parsephphtmlmixed.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008-2009 Yahoo! Inc. All rights reserved.
3 | The copyrights embodied in the content of this file are licensed by
4 | Yahoo! Inc. under the BSD (revised) open source license
5 |
6 | @author Dan Vlad Dascalescu
7 |
8 | Based on parsehtmlmixed.js by Marijn Haverbeke.
9 | */
10 |
11 | var PHPHTMLMixedParser = Editor.Parser = (function() {
12 | if (!(PHPParser && CSSParser && JSParser && XMLParser))
13 | throw new Error("PHP, CSS, JS, and XML parsers must be loaded for PHP+HTML mixed mode to work.");
14 | XMLParser.configure({useHTMLKludges: true});
15 |
16 | function parseMixed(stream) {
17 | var htmlParser = XMLParser.make(stream), localParser = null, inTag = false;
18 | var iter = {next: top, copy: copy};
19 |
20 | function top() {
21 | var token = htmlParser.next();
22 | if (token.content == "<")
23 | inTag = true;
24 | else if (token.style == "xml-tagname" && inTag === true)
25 | inTag = token.content.toLowerCase();
26 | else if (token.type == "xml-processing") {
27 | // dispatch on PHP
28 | if (token.content == "");
30 | }
31 | // "xml-processing" tokens are ignored, because they should be handled by a specific local parser
32 | else if (token.content == ">") {
33 | if (inTag == "script")
34 | iter.next = local(JSParser, "
2 |
3 |
4 | CodeMirror: Python demonstration
5 |
18 |
19 |
20 |
21 | This is a simple demonstration of the Python syntax highlighting module
22 | for CodeMirror.
23 |
24 |
25 | Features of this parser include:
26 |
27 |
28 |
Token-based syntax highlighting - currently very little lexical analysis happens. Few lexical errors will be detected.
29 |
Use the normal indentation mode to enforce regular indentation, otherwise the "shift" indentation mode will give you more flexibility.
30 |
Parser Options:
31 |
32 |
pythonVersion (Integer) - 2 or 3 to indicate which version of Python to parse. Default = 2
33 |
strictErrors (Bool) - true to highlight errors that may not be Python errors but cause confusion for this parser. Default = true
34 |
35 |
36 |
37 |
Written by Timothy Farrell (license). Special
38 | thanks to Adam Brand and Marijn Haverbeke for their help in debugging
39 | and providing for this parser.