├── .gitignore
├── README.md
├── css
├── codemirror.css
├── images
│ ├── browse-icon.png
│ ├── changes-icon.png
│ ├── directory.png
│ ├── dot.png
│ ├── file.png
│ ├── folder_open.png
│ ├── glyphicons-halflings-white.png
│ ├── glyphicons-halflings.png
│ ├── history-icon.png
│ ├── log-arrow.png
│ ├── log-inset.png
│ ├── refresh-icon.png
│ ├── settings-icon.png
│ └── spinner.svg
├── jqueryFileTree.css
├── mergely.css
├── style.css
└── themes
│ ├── ambiance-mobile.css
│ ├── ambiance.css
│ ├── blackboard.css
│ ├── cobalt.css
│ ├── eclipse.css
│ ├── elegant.css
│ ├── erlang-dark.css
│ ├── lesser-dark.css
│ ├── monokai.css
│ ├── neat.css
│ ├── night.css
│ ├── rubyblue.css
│ ├── solarized.css
│ ├── twilight.css
│ ├── vibrant-ink.css
│ └── xq-dark.css
├── index.html
├── lib
├── addon
│ └── mode
│ │ └── loadmode.js
├── codemirror.js
├── codemirror.min.js
├── jquery-1.9.1.min.js
├── jqueryFileTree.js
├── mergely.js
├── mergely.min.js
└── mode
│ ├── apl
│ ├── apl.js
│ └── index.html
│ ├── asterisk
│ ├── asterisk.js
│ └── index.html
│ ├── clike
│ ├── clike.js
│ ├── index.html
│ └── scala.html
│ ├── clojure
│ ├── clojure.js
│ └── index.html
│ ├── coffeescript
│ ├── LICENSE
│ ├── coffeescript.js
│ └── index.html
│ ├── commonlisp
│ ├── commonlisp.js
│ └── index.html
│ ├── css
│ ├── css.js
│ ├── index.html
│ └── test.js
│ ├── d
│ ├── d.js
│ └── index.html
│ ├── diff
│ ├── diff.js
│ └── index.html
│ ├── ecl
│ ├── ecl.js
│ └── index.html
│ ├── erlang
│ ├── erlang.js
│ └── index.html
│ ├── gfm
│ ├── gfm.js
│ ├── index.html
│ └── test.js
│ ├── go
│ ├── go.js
│ └── index.html
│ ├── groovy
│ ├── groovy.js
│ └── index.html
│ ├── haskell
│ ├── haskell.js
│ └── index.html
│ ├── haxe
│ ├── haxe.js
│ └── index.html
│ ├── htmlembedded
│ ├── htmlembedded.js
│ └── index.html
│ ├── htmlmixed
│ ├── htmlmixed.js
│ └── index.html
│ ├── http
│ ├── http.js
│ └── index.html
│ ├── javascript
│ ├── index.html
│ ├── javascript.js
│ └── typescript.html
│ ├── jinja2
│ ├── index.html
│ └── jinja2.js
│ ├── less
│ ├── index.html
│ └── less.js
│ ├── lua
│ ├── index.html
│ └── lua.js
│ ├── markdown
│ ├── index.html
│ ├── markdown.js
│ └── test.js
│ ├── meta.js
│ ├── mysql
│ ├── index.html
│ └── mysql.js
│ ├── ntriples
│ ├── index.html
│ └── ntriples.js
│ ├── ocaml
│ ├── index.html
│ └── ocaml.js
│ ├── pascal
│ ├── LICENSE
│ ├── index.html
│ └── pascal.js
│ ├── perl
│ ├── LICENSE
│ ├── index.html
│ └── perl.js
│ ├── php
│ ├── index.html
│ └── php.js
│ ├── pig
│ ├── index.html
│ └── pig.js
│ ├── plsql
│ ├── index.html
│ └── plsql.js
│ ├── properties
│ ├── index.html
│ └── properties.js
│ ├── python
│ ├── LICENSE.txt
│ ├── index.html
│ └── python.js
│ ├── q
│ ├── index.html
│ └── q.js
│ ├── r
│ ├── LICENSE
│ ├── index.html
│ └── r.js
│ ├── rpm
│ ├── changes
│ │ ├── changes.js
│ │ └── index.html
│ └── spec
│ │ ├── index.html
│ │ ├── spec.css
│ │ └── spec.js
│ ├── rst
│ ├── index.html
│ └── rst.js
│ ├── ruby
│ ├── LICENSE
│ ├── index.html
│ └── ruby.js
│ ├── rust
│ ├── index.html
│ └── rust.js
│ ├── sass
│ ├── index.html
│ └── sass.js
│ ├── scheme
│ ├── index.html
│ └── scheme.js
│ ├── shell
│ ├── index.html
│ └── shell.js
│ ├── sieve
│ ├── LICENSE
│ ├── index.html
│ └── sieve.js
│ ├── smalltalk
│ ├── index.html
│ └── smalltalk.js
│ ├── smarty
│ ├── index.html
│ └── smarty.js
│ ├── sparql
│ ├── index.html
│ └── sparql.js
│ ├── sql
│ ├── index.html
│ └── sql.js
│ ├── stex
│ ├── index.html
│ ├── stex.js
│ └── test.js
│ ├── tiddlywiki
│ ├── index.html
│ ├── tiddlywiki.css
│ └── tiddlywiki.js
│ ├── tiki
│ ├── index.html
│ ├── tiki.css
│ └── tiki.js
│ ├── turtle
│ ├── index.html
│ └── turtle.js
│ ├── vb
│ ├── LICENSE.txt
│ ├── index.html
│ └── vb.js
│ ├── vbscript
│ ├── index.html
│ └── vbscript.js
│ ├── velocity
│ ├── index.html
│ └── velocity.js
│ ├── verilog
│ ├── index.html
│ └── verilog.js
│ ├── xml
│ ├── index.html
│ └── xml.js
│ ├── xquery
│ ├── LICENSE
│ ├── index.html
│ ├── test.js
│ └── xquery.js
│ ├── yaml
│ ├── index.html
│ └── yaml.js
│ └── z80
│ ├── index.html
│ └── z80.js
├── package.json
├── release
└── svn.app.zip
├── run.sh
├── screenshots
├── changes.png
├── diff.png
├── history.png
└── repositories.png
└── src
├── app.js
├── router.js
├── settingsProvider.js
├── svn.js
└── widget
├── browse.js
├── changeItem.js
├── changeList.js
├── diffViewer.js
├── framebar.js
├── logItem.js
├── logList.js
├── navigation.js
├── popup.js
├── proplist.js
├── repoList.js
├── settings.js
├── statusBar.js
└── toolbar.js
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | .idea/
3 | *.iml
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 | 
3 | 
4 | 
5 |
--------------------------------------------------------------------------------
/css/images/browse-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/browse-icon.png
--------------------------------------------------------------------------------
/css/images/changes-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/changes-icon.png
--------------------------------------------------------------------------------
/css/images/directory.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/directory.png
--------------------------------------------------------------------------------
/css/images/dot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/dot.png
--------------------------------------------------------------------------------
/css/images/file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/file.png
--------------------------------------------------------------------------------
/css/images/folder_open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/folder_open.png
--------------------------------------------------------------------------------
/css/images/glyphicons-halflings-white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/glyphicons-halflings-white.png
--------------------------------------------------------------------------------
/css/images/glyphicons-halflings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/glyphicons-halflings.png
--------------------------------------------------------------------------------
/css/images/history-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/history-icon.png
--------------------------------------------------------------------------------
/css/images/log-arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/log-arrow.png
--------------------------------------------------------------------------------
/css/images/log-inset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/log-inset.png
--------------------------------------------------------------------------------
/css/images/refresh-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/refresh-icon.png
--------------------------------------------------------------------------------
/css/images/settings-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/css/images/settings-icon.png
--------------------------------------------------------------------------------
/css/images/spinner.svg:
--------------------------------------------------------------------------------
1 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/css/mergely.css:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2013 by Jamie Peabody, http://www.mergely.com
3 | * All rights reserved.
4 | * Version: 3.2 2013-02-24
5 | */
6 | /* required */
7 | .mergely-column textarea { width: 80px; height: 200px; }
8 | .mergely-column { float: left; }
9 | .mergely-margin { float: left; }
10 | .mergely-canvas { float: left; width: 28px; }
11 |
12 | /* resizeable */
13 | .mergely-resizer { width: 100%; height: 100%; }
14 |
15 | /* style configuration */
16 | /*.mergely-column { border: 1px solid #ccc; }*/
17 | .mergely-active { border: 1px solid #a3d1ff; }
18 |
19 | .mergely.a.rhs.start { border-top: 1px solid #a3d1ff; }
20 | .mergely.a.lhs.start.end,
21 | .mergely.a.rhs.end { border-bottom: 1px solid #a3d1ff; }
22 | .mergely.a.rhs { background-color: #ddeeff; }
23 |
24 | .mergely.d.lhs { background-color: #edc0c0; }
25 | .mergely.d.lhs.end,
26 | .mergely.d.rhs.start.end { border-bottom: 1px solid #ff7f7f; }
27 | .mergely.d.rhs.start.end.first { border-bottom: 0; border-top: 1px solid #ff7f7f; }
28 | .mergely.d.lhs.start { border-top: 1px solid #ff7f7f; }
29 |
30 | .mergely.c.lhs,
31 | .mergely.c.rhs { background-color: #fafafa; }
32 | .mergely.c.lhs.start,
33 | .mergely.c.rhs.start { border-top: 1px solid #a3a3a3; }
34 | .mergely.c.lhs.end,
35 | .mergely.c.rhs.end { border-bottom: 1px solid #a3a3a3; }
36 |
37 | .mergely.ch.a.rhs { background-color: #ddeeff; }
38 | .mergely.ch.d.lhs { background-color: #edc0c0; text-decoration: line-through; color: #888; }
39 |
--------------------------------------------------------------------------------
/css/themes/ambiance-mobile.css:
--------------------------------------------------------------------------------
1 | .cm-s-ambiance.CodeMirror {
2 | -webkit-box-shadow: none;
3 | -moz-box-shadow: none;
4 | -o-box-shadow: none;
5 | box-shadow: none;
6 | }
7 |
--------------------------------------------------------------------------------
/css/themes/blackboard.css:
--------------------------------------------------------------------------------
1 | /* Port of TextMate's Blackboard theme */
2 |
3 | .cm-s-blackboard.CodeMirror { background: #0C1021; color: #F8F8F8; }
4 | .cm-s-blackboard .CodeMirror-selected { background: #253B76 !important; }
5 | .cm-s-blackboard .CodeMirror-gutters { background: #0C1021; border-right: 0; }
6 | .cm-s-blackboard .CodeMirror-linenumber { color: #888; }
7 | .cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; }
8 |
9 | .cm-s-blackboard .cm-keyword { color: #FBDE2D; }
10 | .cm-s-blackboard .cm-atom { color: #D8FA3C; }
11 | .cm-s-blackboard .cm-number { color: #D8FA3C; }
12 | .cm-s-blackboard .cm-def { color: #8DA6CE; }
13 | .cm-s-blackboard .cm-variable { color: #FF6400; }
14 | .cm-s-blackboard .cm-operator { color: #FBDE2D;}
15 | .cm-s-blackboard .cm-comment { color: #AEAEAE; }
16 | .cm-s-blackboard .cm-string { color: #61CE3C; }
17 | .cm-s-blackboard .cm-string-2 { color: #61CE3C; }
18 | .cm-s-blackboard .cm-meta { color: #D8FA3C; }
19 | .cm-s-blackboard .cm-error { background: #9D1E15; color: #F8F8F8; }
20 | .cm-s-blackboard .cm-builtin { color: #8DA6CE; }
21 | .cm-s-blackboard .cm-tag { color: #8DA6CE; }
22 | .cm-s-blackboard .cm-attribute { color: #8DA6CE; }
23 | .cm-s-blackboard .cm-header { color: #FF6400; }
24 | .cm-s-blackboard .cm-hr { color: #AEAEAE; }
25 | .cm-s-blackboard .cm-link { color: #8DA6CE; }
26 |
--------------------------------------------------------------------------------
/css/themes/cobalt.css:
--------------------------------------------------------------------------------
1 | .cm-s-cobalt.CodeMirror { background: #002240; color: white; }
2 | .cm-s-cobalt div.CodeMirror-selected { background: #b36539 !important; }
3 | .cm-s-cobalt .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
4 | .cm-s-cobalt .CodeMirror-linenumber { color: #d0d0d0; }
5 | .cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; }
6 |
7 | .cm-s-cobalt span.cm-comment { color: #08f; }
8 | .cm-s-cobalt span.cm-atom { color: #845dc4; }
9 | .cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; }
10 | .cm-s-cobalt span.cm-keyword { color: #ffee80; }
11 | .cm-s-cobalt span.cm-string { color: #3ad900; }
12 | .cm-s-cobalt span.cm-meta { color: #ff9d00; }
13 | .cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; }
14 | .cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; }
15 | .cm-s-cobalt span.cm-error { color: #9d1e15; }
16 | .cm-s-cobalt span.cm-bracket { color: #d8d8d8; }
17 | .cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; }
18 | .cm-s-cobalt span.cm-link { color: #845dc4; }
19 |
--------------------------------------------------------------------------------
/css/themes/eclipse.css:
--------------------------------------------------------------------------------
1 | .cm-s-eclipse span.cm-meta {color: #FF1717;}
2 | .cm-s-eclipse span.cm-keyword { line-height: 1em; font-weight: bold; color: #7F0055; }
3 | .cm-s-eclipse span.cm-atom {color: #219;}
4 | .cm-s-eclipse span.cm-number {color: #164;}
5 | .cm-s-eclipse span.cm-def {color: #00f;}
6 | .cm-s-eclipse span.cm-variable {color: black;}
7 | .cm-s-eclipse span.cm-variable-2 {color: #0000C0;}
8 | .cm-s-eclipse span.cm-variable-3 {color: #0000C0;}
9 | .cm-s-eclipse span.cm-property {color: black;}
10 | .cm-s-eclipse span.cm-operator {color: black;}
11 | .cm-s-eclipse span.cm-comment {color: #3F7F5F;}
12 | .cm-s-eclipse span.cm-string {color: #2A00FF;}
13 | .cm-s-eclipse span.cm-string-2 {color: #f50;}
14 | .cm-s-eclipse span.cm-error {color: #f00;}
15 | .cm-s-eclipse span.cm-qualifier {color: #555;}
16 | .cm-s-eclipse span.cm-builtin {color: #30a;}
17 | .cm-s-eclipse span.cm-bracket {color: #cc7;}
18 | .cm-s-eclipse span.cm-tag {color: #170;}
19 | .cm-s-eclipse span.cm-attribute {color: #00c;}
20 | .cm-s-eclipse span.cm-link {color: #219;}
21 |
22 | .cm-s-eclipse .CodeMirror-matchingbracket {
23 | border:1px solid grey;
24 | color:black !important;;
25 | }
26 |
--------------------------------------------------------------------------------
/css/themes/elegant.css:
--------------------------------------------------------------------------------
1 | .cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;}
2 | .cm-s-elegant span.cm-comment {color: #262; font-style: italic; line-height: 1em;}
3 | .cm-s-elegant span.cm-meta {color: #555; font-style: italic; line-height: 1em;}
4 | .cm-s-elegant span.cm-variable {color: black;}
5 | .cm-s-elegant span.cm-variable-2 {color: #b11;}
6 | .cm-s-elegant span.cm-qualifier {color: #555;}
7 | .cm-s-elegant span.cm-keyword {color: #730;}
8 | .cm-s-elegant span.cm-builtin {color: #30a;}
9 | .cm-s-elegant span.cm-error {background-color: #fdd;}
10 | .cm-s-elegant span.cm-link {color: #762;}
11 |
--------------------------------------------------------------------------------
/css/themes/erlang-dark.css:
--------------------------------------------------------------------------------
1 | .cm-s-erlang-dark.CodeMirror { background: #002240; color: white; }
2 | .cm-s-erlang-dark div.CodeMirror-selected { background: #b36539 !important; }
3 | .cm-s-erlang-dark .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
4 | .cm-s-erlang-dark .CodeMirror-linenumber { color: #d0d0d0; }
5 | .cm-s-erlang-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
6 |
7 | .cm-s-erlang-dark span.cm-atom { color: #845dc4; }
8 | .cm-s-erlang-dark span.cm-attribute { color: #ff80e1; }
9 | .cm-s-erlang-dark span.cm-bracket { color: #ff9d00; }
10 | .cm-s-erlang-dark span.cm-builtin { color: #eeaaaa; }
11 | .cm-s-erlang-dark span.cm-comment { color: #7777ff; }
12 | .cm-s-erlang-dark span.cm-def { color: #ee77aa; }
13 | .cm-s-erlang-dark span.cm-error { color: #9d1e15; }
14 | .cm-s-erlang-dark span.cm-keyword { color: #ffee80; }
15 | .cm-s-erlang-dark span.cm-meta { color: #50fefe; }
16 | .cm-s-erlang-dark span.cm-number { color: #ffd0d0; }
17 | .cm-s-erlang-dark span.cm-operator { color: #dd1111; }
18 | .cm-s-erlang-dark span.cm-string { color: #3ad900; }
19 | .cm-s-erlang-dark span.cm-tag { color: #9effff; }
20 | .cm-s-erlang-dark span.cm-variable { color: #50fe50; }
21 | .cm-s-erlang-dark span.cm-variable-2 { color: #ee00ee; }
22 |
--------------------------------------------------------------------------------
/css/themes/lesser-dark.css:
--------------------------------------------------------------------------------
1 | /*
2 | http://lesscss.org/ dark theme
3 | Ported to CodeMirror by Peter Kroon
4 | */
5 | .cm-s-lesser-dark {
6 | line-height: 1.3em;
7 | }
8 | .cm-s-lesser-dark {
9 | font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', 'Monaco', Courier, monospace !important;
10 | }
11 |
12 | .cm-s-lesser-dark.CodeMirror { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; }
13 | .cm-s-lesser-dark div.CodeMirror-selected {background: #45443B !important;} /* 33322B*/
14 | .cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
15 | .cm-s-lesser-dark pre { padding: 0 8px; }/*editable code holder*/
16 |
17 | div.CodeMirror span.CodeMirror-matchingbracket { color: #7EFC7E; }/*65FC65*/
18 |
19 | .cm-s-lesser-dark .CodeMirror-gutters { background: #262626; border-right:1px solid #aaa; }
20 | .cm-s-lesser-dark .CodeMirror-linenumber { color: #777; }
21 |
22 | .cm-s-lesser-dark span.cm-keyword { color: #599eff; }
23 | .cm-s-lesser-dark span.cm-atom { color: #C2B470; }
24 | .cm-s-lesser-dark span.cm-number { color: #B35E4D; }
25 | .cm-s-lesser-dark span.cm-def {color: white;}
26 | .cm-s-lesser-dark span.cm-variable { color:#D9BF8C; }
27 | .cm-s-lesser-dark span.cm-variable-2 { color: #669199; }
28 | .cm-s-lesser-dark span.cm-variable-3 { color: white; }
29 | .cm-s-lesser-dark span.cm-property {color: #92A75C;}
30 | .cm-s-lesser-dark span.cm-operator {color: #92A75C;}
31 | .cm-s-lesser-dark span.cm-comment { color: #666; }
32 | .cm-s-lesser-dark span.cm-string { color: #BCD279; }
33 | .cm-s-lesser-dark span.cm-string-2 {color: #f50;}
34 | .cm-s-lesser-dark span.cm-meta { color: #738C73; }
35 | .cm-s-lesser-dark span.cm-error { color: #9d1e15; }
36 | .cm-s-lesser-dark span.cm-qualifier {color: #555;}
37 | .cm-s-lesser-dark span.cm-builtin { color: #ff9e59; }
38 | .cm-s-lesser-dark span.cm-bracket { color: #EBEFE7; }
39 | .cm-s-lesser-dark span.cm-tag { color: #669199; }
40 | .cm-s-lesser-dark span.cm-attribute {color: #00c;}
41 | .cm-s-lesser-dark span.cm-header {color: #a0a;}
42 | .cm-s-lesser-dark span.cm-quote {color: #090;}
43 | .cm-s-lesser-dark span.cm-hr {color: #999;}
44 | .cm-s-lesser-dark span.cm-link {color: #00c;}
45 |
--------------------------------------------------------------------------------
/css/themes/monokai.css:
--------------------------------------------------------------------------------
1 | /* Based on Sublime Text's Monokai theme */
2 |
3 | .cm-s-monokai.CodeMirror {background: #272822; color: #f8f8f2;}
4 | .cm-s-monokai div.CodeMirror-selected {background: #49483E !important;}
5 | .cm-s-monokai .CodeMirror-gutters {background: #272822; border-right: 0px;}
6 | .cm-s-monokai .CodeMirror-linenumber {color: #d0d0d0;}
7 | .cm-s-monokai .CodeMirror-cursor {border-left: 1px solid #f8f8f0 !important;}
8 |
9 | .cm-s-monokai span.cm-comment {color: #75715e;}
10 | .cm-s-monokai span.cm-atom {color: #ae81ff;}
11 | .cm-s-monokai span.cm-number {color: #ae81ff;}
12 |
13 | .cm-s-monokai span.cm-property, .cm-s-monokai span.cm-attribute {color: #a6e22e;}
14 | .cm-s-monokai span.cm-keyword {color: #f92672;}
15 | .cm-s-monokai span.cm-string {color: #e6db74;}
16 |
17 | .cm-s-monokai span.cm-variable {color: #a6e22e;}
18 | .cm-s-monokai span.cm-variable-2 {color: #9effff;}
19 | .cm-s-monokai span.cm-def {color: #fd971f;}
20 | .cm-s-monokai span.cm-error {background: #f92672; color: #f8f8f0;}
21 | .cm-s-monokai span.cm-bracket {color: #f8f8f2;}
22 | .cm-s-monokai span.cm-tag {color: #f92672;}
23 | .cm-s-monokai span.cm-link {color: #ae81ff;}
24 |
25 | .cm-s-monokai .CodeMirror-matchingbracket {
26 | text-decoration: underline;
27 | color: white !important;
28 | }
29 |
--------------------------------------------------------------------------------
/css/themes/neat.css:
--------------------------------------------------------------------------------
1 | .cm-s-neat span.cm-comment { color: #a86; }
2 | .cm-s-neat span.cm-keyword { line-height: 1em; font-weight: bold; color: blue; }
3 | .cm-s-neat span.cm-string { color: #a22; }
4 | .cm-s-neat span.cm-builtin { line-height: 1em; font-weight: bold; color: #077; }
5 | .cm-s-neat span.cm-special { line-height: 1em; font-weight: bold; color: #0aa; }
6 | .cm-s-neat span.cm-variable { color: black; }
7 | .cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; }
8 | .cm-s-neat span.cm-meta {color: #555;}
9 | .cm-s-neat span.cm-link { color: #3a3; }
10 |
--------------------------------------------------------------------------------
/css/themes/night.css:
--------------------------------------------------------------------------------
1 | /* Loosely based on the Midnight Textmate theme */
2 |
3 | .cm-s-night.CodeMirror { background: #0a001f; color: #f8f8f8; }
4 | .cm-s-night div.CodeMirror-selected { background: #447 !important; }
5 | .cm-s-night .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; }
6 | .cm-s-night .CodeMirror-linenumber { color: #f8f8f8; }
7 | .cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; }
8 |
9 | .cm-s-night span.cm-comment { color: #6900a1; }
10 | .cm-s-night span.cm-atom { color: #845dc4; }
11 | .cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; }
12 | .cm-s-night span.cm-keyword { color: #599eff; }
13 | .cm-s-night span.cm-string { color: #37f14a; }
14 | .cm-s-night span.cm-meta { color: #7678e2; }
15 | .cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; }
16 | .cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; }
17 | .cm-s-night span.cm-error { color: #9d1e15; }
18 | .cm-s-night span.cm-bracket { color: #8da6ce; }
19 | .cm-s-night span.cm-comment { color: #6900a1; }
20 | .cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; }
21 | .cm-s-night span.cm-link { color: #845dc4; }
22 |
--------------------------------------------------------------------------------
/css/themes/rubyblue.css:
--------------------------------------------------------------------------------
1 | .cm-s-rubyblue { font:13px/1.4em Trebuchet, Verdana, sans-serif; } /* - customized editor font - */
2 |
3 | .cm-s-rubyblue.CodeMirror { background: #112435; color: white; }
4 | .cm-s-rubyblue div.CodeMirror-selected { background: #38566F !important; }
5 | .cm-s-rubyblue .CodeMirror-gutters { background: #1F4661; border-right: 7px solid #3E7087; }
6 | .cm-s-rubyblue .CodeMirror-linenumber { color: white; }
7 | .cm-s-rubyblue .CodeMirror-cursor { border-left: 1px solid white !important; }
8 |
9 | .cm-s-rubyblue span.cm-comment { color: #999; font-style:italic; line-height: 1em; }
10 | .cm-s-rubyblue span.cm-atom { color: #F4C20B; }
11 | .cm-s-rubyblue span.cm-number, .cm-s-rubyblue span.cm-attribute { color: #82C6E0; }
12 | .cm-s-rubyblue span.cm-keyword { color: #F0F; }
13 | .cm-s-rubyblue span.cm-string { color: #F08047; }
14 | .cm-s-rubyblue span.cm-meta { color: #F0F; }
15 | .cm-s-rubyblue span.cm-variable-2, .cm-s-rubyblue span.cm-tag { color: #7BD827; }
16 | .cm-s-rubyblue span.cm-variable-3, .cm-s-rubyblue span.cm-def { color: white; }
17 | .cm-s-rubyblue span.cm-error { color: #AF2018; }
18 | .cm-s-rubyblue span.cm-bracket { color: #F0F; }
19 | .cm-s-rubyblue span.cm-link { color: #F4C20B; }
20 | .cm-s-rubyblue span.CodeMirror-matchingbracket { color:#F0F !important; }
21 | .cm-s-rubyblue span.cm-builtin, .cm-s-rubyblue span.cm-special { color: #FF9D00; }
22 |
--------------------------------------------------------------------------------
/css/themes/twilight.css:
--------------------------------------------------------------------------------
1 | .cm-s-twilight.CodeMirror { background: #141414; color: #f7f7f7; } /**/
2 | .cm-s-twilight .CodeMirror-selected { background: #323232 !important; } /**/
3 |
4 | .cm-s-twilight .CodeMirror-gutters { background: #222; border-right: 1px solid #aaa; }
5 | .cm-s-twilight .CodeMirror-linenumber { color: #aaa; }
6 | .cm-s-twilight .CodeMirror-cursor { border-left: 1px solid white !important; }
7 |
8 | .cm-s-twilight .cm-keyword { color: #f9ee98; } /**/
9 | .cm-s-twilight .cm-atom { color: #FC0; }
10 | .cm-s-twilight .cm-number { color: #ca7841; } /**/
11 | .cm-s-twilight .cm-def { color: #8DA6CE; }
12 | .cm-s-twilight span.cm-variable-2, .cm-s-twilight span.cm-tag { color: #607392; } /**/
13 | .cm-s-twilight span.cm-variable-3, .cm-s-twilight span.cm-def { color: #607392; } /**/
14 | .cm-s-twilight .cm-operator { color: #cda869; } /**/
15 | .cm-s-twilight .cm-comment { color:#777; font-style:italic; font-weight:normal; } /**/
16 | .cm-s-twilight .cm-string { color:#8f9d6a; font-style:italic; } /**/
17 | .cm-s-twilight .cm-string-2 { color:#bd6b18 } /*?*/
18 | .cm-s-twilight .cm-meta { background-color:#141414; color:#f7f7f7; } /*?*/
19 | .cm-s-twilight .cm-error { border-bottom: 1px solid red; }
20 | .cm-s-twilight .cm-builtin { color: #cda869; } /*?*/
21 | .cm-s-twilight .cm-tag { color: #997643; } /**/
22 | .cm-s-twilight .cm-attribute { color: #d6bb6d; } /*?*/
23 | .cm-s-twilight .cm-header { color: #FF6400; }
24 | .cm-s-twilight .cm-hr { color: #AEAEAE; }
25 | .cm-s-twilight .cm-link { color:#ad9361; font-style:italic; text-decoration:none; } /**/
26 |
27 |
--------------------------------------------------------------------------------
/css/themes/vibrant-ink.css:
--------------------------------------------------------------------------------
1 | /* Taken from the popular Visual Studio Vibrant Ink Schema */
2 |
3 | .cm-s-vibrant-ink.CodeMirror { background: black; color: white; }
4 | .cm-s-vibrant-ink .CodeMirror-selected { background: #35493c !important; }
5 |
6 | .cm-s-vibrant-ink .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
7 | .cm-s-vibrant-ink .CodeMirror-linenumber { color: #d0d0d0; }
8 | .cm-s-vibrant-ink .CodeMirror-cursor { border-left: 1px solid white !important; }
9 |
10 | .cm-s-vibrant-ink .cm-keyword { color: #CC7832; }
11 | .cm-s-vibrant-ink .cm-atom { color: #FC0; }
12 | .cm-s-vibrant-ink .cm-number { color: #FFEE98; }
13 | .cm-s-vibrant-ink .cm-def { color: #8DA6CE; }
14 | .cm-s-vibrant-ink span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #FFC66D }
15 | .cm-s-vibrant-ink span.cm-variable-3, .cm-s-cobalt span.cm-def { color: #FFC66D }
16 | .cm-s-vibrant-ink .cm-operator { color: #888; }
17 | .cm-s-vibrant-ink .cm-comment { color: gray; font-weight: bold; }
18 | .cm-s-vibrant-ink .cm-string { color: #A5C25C }
19 | .cm-s-vibrant-ink .cm-string-2 { color: red }
20 | .cm-s-vibrant-ink .cm-meta { color: #D8FA3C; }
21 | .cm-s-vibrant-ink .cm-error { border-bottom: 1px solid red; }
22 | .cm-s-vibrant-ink .cm-builtin { color: #8DA6CE; }
23 | .cm-s-vibrant-ink .cm-tag { color: #8DA6CE; }
24 | .cm-s-vibrant-ink .cm-attribute { color: #8DA6CE; }
25 | .cm-s-vibrant-ink .cm-header { color: #FF6400; }
26 | .cm-s-vibrant-ink .cm-hr { color: #AEAEAE; }
27 | .cm-s-vibrant-ink .cm-link { color: blue; }
28 |
--------------------------------------------------------------------------------
/css/themes/xq-dark.css:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2011 by MarkLogic Corporation
3 | Author: Mike Brevoort
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 | */
23 | .cm-s-xq-dark.CodeMirror { background: #0a001f; color: #f8f8f8; }
24 | .cm-s-xq-dark span.CodeMirror-selected { background: #a8f !important; }
25 | .cm-s-xq-dark .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; }
26 | .cm-s-xq-dark .CodeMirror-linenumber { color: #f8f8f8; }
27 | .cm-s-xq-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
28 |
29 | .cm-s-xq-dark span.cm-keyword {color: #FFBD40;}
30 | .cm-s-xq-dark span.cm-atom {color: #6C8CD5;}
31 | .cm-s-xq-dark span.cm-number {color: #164;}
32 | .cm-s-xq-dark span.cm-def {color: #FFF; text-decoration:underline;}
33 | .cm-s-xq-dark span.cm-variable {color: #FFF;}
34 | .cm-s-xq-dark span.cm-variable-2 {color: #EEE;}
35 | .cm-s-xq-dark span.cm-variable-3 {color: #DDD;}
36 | .cm-s-xq-dark span.cm-property {}
37 | .cm-s-xq-dark span.cm-operator {}
38 | .cm-s-xq-dark span.cm-comment {color: gray;}
39 | .cm-s-xq-dark span.cm-string {color: #9FEE00;}
40 | .cm-s-xq-dark span.cm-meta {color: yellow;}
41 | .cm-s-xq-dark span.cm-error {color: #f00;}
42 | .cm-s-xq-dark span.cm-qualifier {color: #FFF700;}
43 | .cm-s-xq-dark span.cm-builtin {color: #30a;}
44 | .cm-s-xq-dark span.cm-bracket {color: #cc7;}
45 | .cm-s-xq-dark span.cm-tag {color: #FFBD40;}
46 | .cm-s-xq-dark span.cm-attribute {color: #FFF700;}
47 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SVN
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/lib/addon/mode/loadmode.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js";
3 |
4 | var loading = {};
5 | function splitCallback(cont, n) {
6 | var countDown = n;
7 | return function() { if (--countDown == 0) cont(); };
8 | }
9 | function ensureDeps(mode, cont) {
10 | var deps = CodeMirror.modes[mode].dependencies;
11 | if (!deps) return cont();
12 | var missing = [];
13 | for (var i = 0; i < deps.length; ++i) {
14 | if (!CodeMirror.modes.hasOwnProperty(deps[i]))
15 | missing.push(deps[i]);
16 | }
17 | if (!missing.length) return cont();
18 | var split = splitCallback(cont, missing.length);
19 | for (var i = 0; i < missing.length; ++i)
20 | CodeMirror.requireMode(missing[i], split);
21 | }
22 |
23 | CodeMirror.requireMode = function(mode, cont) {
24 | if (typeof mode != "string") mode = mode.name;
25 | if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont);
26 | if (loading.hasOwnProperty(mode)) return loading[mode].push(cont);
27 |
28 | var script = document.createElement("script");
29 | script.src = CodeMirror.modeURL.replace(/%N/g, mode);
30 | var others = document.getElementsByTagName("script")[0];
31 | others.parentNode.insertBefore(script, others);
32 | var list = loading[mode] = [cont];
33 | var count = 0, poll = setInterval(function() {
34 | if (++count > 100) return clearInterval(poll);
35 | if (CodeMirror.modes.hasOwnProperty(mode)) {
36 | clearInterval(poll);
37 | loading[mode] = null;
38 | ensureDeps(mode, function() {
39 | for (var i = 0; i < list.length; ++i) list[i]();
40 | });
41 | }
42 | }, 200);
43 | };
44 |
45 | CodeMirror.autoLoadMode = function(instance, mode) {
46 | if (!CodeMirror.modes.hasOwnProperty(mode))
47 | CodeMirror.requireMode(mode, function() {
48 | instance.setOption("mode", instance.getOption("mode"));
49 | });
50 | };
51 | }());
52 |
--------------------------------------------------------------------------------
/lib/mode/apl/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: APL mode
6 |
7 |
8 |
9 |
10 |
11 |
14 |
15 |
16 | CodeMirror: APL mode
17 |
18 |
44 |
45 |
52 |
53 | Simple mode that tries to handle APL as well as it can.
54 | It attempts to label functions/operators based upon
55 | monadic/dyadic usage (but this is far from fully fleshed out).
56 | This means there are meaningful classnames so hover states can
57 | have popups etc.
58 |
59 | MIME types defined: text/apl
(APL code)
60 |
61 |
62 |
--------------------------------------------------------------------------------
/lib/mode/clike/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: C-like mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | CodeMirror: C-like mode
15 |
16 |
17 | /* C demo code */
18 |
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | typedef struct {
28 | void* arg_socket;
29 | zmq_msg_t* arg_msg;
30 | char* arg_string;
31 | unsigned long arg_len;
32 | int arg_int, arg_command;
33 |
34 | int signal_fd;
35 | int pad;
36 | void* context;
37 | sem_t sem;
38 | } acl_zmq_context;
39 |
40 | #define p(X) (context->arg_##X)
41 |
42 | void* zmq_thread(void* context_pointer) {
43 | acl_zmq_context* context = (acl_zmq_context*)context_pointer;
44 | char ok = 'K', err = 'X';
45 | int res;
46 |
47 | while (1) {
48 | while ((res = sem_wait(&context->sem)) == EINTR);
49 | if (res) {write(context->signal_fd, &err, 1); goto cleanup;}
50 | switch(p(command)) {
51 | case 0: goto cleanup;
52 | case 1: p(socket) = zmq_socket(context->context, p(int)); break;
53 | case 2: p(int) = zmq_close(p(socket)); break;
54 | case 3: p(int) = zmq_bind(p(socket), p(string)); break;
55 | case 4: p(int) = zmq_connect(p(socket), p(string)); break;
56 | case 5: p(int) = zmq_getsockopt(p(socket), p(int), (void*)p(string), &p(len)); break;
57 | case 6: p(int) = zmq_setsockopt(p(socket), p(int), (void*)p(string), p(len)); break;
58 | case 7: p(int) = zmq_send(p(socket), p(msg), p(int)); break;
59 | case 8: p(int) = zmq_recv(p(socket), p(msg), p(int)); break;
60 | case 9: p(int) = zmq_poll(p(socket), p(int), p(len)); break;
61 | }
62 | p(command) = errno;
63 | write(context->signal_fd, &ok, 1);
64 | }
65 | cleanup:
66 | close(context->signal_fd);
67 | free(context_pointer);
68 | return 0;
69 | }
70 |
71 | void* zmq_thread_init(void* zmq_context, int signal_fd) {
72 | acl_zmq_context* context = malloc(sizeof(acl_zmq_context));
73 | pthread_t thread;
74 |
75 | context->context = zmq_context;
76 | context->signal_fd = signal_fd;
77 | sem_init(&context->sem, 1, 0);
78 | pthread_create(&thread, 0, &zmq_thread, context);
79 | pthread_detach(thread);
80 | return context;
81 | }
82 |
83 |
84 |
91 |
92 | Simple mode that tries to handle C-like languages as well as it
93 | can. Takes two configuration parameters: keywords
, an
94 | object whose property names are the keywords in the language,
95 | and useCPP
, which determines whether C preprocessor
96 | directives are recognized.
97 |
98 | MIME types defined: text/x-csrc
99 | (C code), text/x-c++src
(C++
100 | code), text/x-java
(Java
101 | code), text/x-csharp
(C#).
102 |
103 |
104 |
--------------------------------------------------------------------------------
/lib/mode/clojure/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: Clojure mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: Clojure mode
14 |
15 | ; Conway's Game of Life, based on the work of:
16 | ;; Laurent Petit https://gist.github.com/1200343
17 | ;; Christophe Grand http://clj-me.cgrand.net/2011/08/19/conways-game-of-life
18 |
19 | (ns ^{:doc "Conway's Game of Life."}
20 | game-of-life)
21 |
22 | ;; Core game of life's algorithm functions
23 |
24 | (defn neighbours
25 | "Given a cell's coordinates, returns the coordinates of its neighbours."
26 | [[x y]]
27 | (for [dx [-1 0 1] dy (if (zero? dx) [-1 1] [-1 0 1])]
28 | [(+ dx x) (+ dy y)]))
29 |
30 | (defn step
31 | "Given a set of living cells, computes the new set of living cells."
32 | [cells]
33 | (set (for [[cell n] (frequencies (mapcat neighbours cells))
34 | :when (or (= n 3) (and (= n 2) (cells cell)))]
35 | cell)))
36 |
37 | ;; Utility methods for displaying game on a text terminal
38 |
39 | (defn print-board
40 | "Prints a board on *out*, representing a step in the game."
41 | [board w h]
42 | (doseq [x (range (inc w)) y (range (inc h))]
43 | (if (= y 0) (print "\n"))
44 | (print (if (board [x y]) "[X]" " . "))))
45 |
46 | (defn display-grids
47 | "Prints a squence of boards on *out*, representing several steps."
48 | [grids w h]
49 | (doseq [board grids]
50 | (print-board board w h)
51 | (print "\n")))
52 |
53 | ;; Launches an example board
54 |
55 | (def
56 | ^{:doc "board represents the initial set of living cells"}
57 | board #{[2 1] [2 2] [2 3]})
58 |
59 | (display-grids (take 3 (iterate step board)) 5 5)
60 |
63 |
64 | MIME types defined: text/x-clojure
.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/lib/mode/coffeescript/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright (c) 2011 Jeff Pickhardt
4 | Modified from the Python CodeMirror mode, Copyright (c) 2010 Timothy Farrell
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
--------------------------------------------------------------------------------
/lib/mode/commonlisp/commonlisp.js:
--------------------------------------------------------------------------------
1 | CodeMirror.defineMode("commonlisp", function (config) {
2 | var assumeBody = /^with|^def|^do|^prog|case$|^cond$|bind$|when$|unless$/;
3 | var numLiteral = /^(?:[+\-]?(?:\d+|\d*\.\d+)(?:[efd][+\-]?\d+)?|[+\-]?\d+(?:\/[+\-]?\d+)?|#b[+\-]?[01]+|#o[+\-]?[0-7]+|#x[+\-]?[\da-f]+)/;
4 | var symbol = /[^\s'`,@()\[\]";]/;
5 | var type;
6 |
7 | function readSym(stream) {
8 | var ch;
9 | while (ch = stream.next()) {
10 | if (ch == "\\") stream.next();
11 | else if (!symbol.test(ch)) { stream.backUp(1); break; }
12 | }
13 | return stream.current();
14 | }
15 |
16 | function base(stream, state) {
17 | if (stream.eatSpace()) {type = "ws"; return null;}
18 | if (stream.match(numLiteral)) return "number";
19 | var ch = stream.next();
20 | if (ch == "\\") ch = stream.next();
21 |
22 | if (ch == '"') return (state.tokenize = inString)(stream, state);
23 | else if (ch == "(") { type = "open"; return "bracket"; }
24 | else if (ch == ")" || ch == "]") { type = "close"; return "bracket"; }
25 | else if (ch == ";") { stream.skipToEnd(); type = "ws"; return "comment"; }
26 | else if (/['`,@]/.test(ch)) return null;
27 | else if (ch == "|") {
28 | if (stream.skipTo("|")) { stream.next(); return "symbol"; }
29 | else { stream.skipToEnd(); return "error"; }
30 | } else if (ch == "#") {
31 | var ch = stream.next();
32 | if (ch == "[") { type = "open"; return "bracket"; }
33 | else if (/[+\-=\.']/.test(ch)) return null;
34 | else if (/\d/.test(ch) && stream.match(/^\d*#/)) return null;
35 | else if (ch == "|") return (state.tokenize = inComment)(stream, state);
36 | else if (ch == ":") { readSym(stream); return "meta"; }
37 | else return "error";
38 | } else {
39 | var name = readSym(stream);
40 | if (name == ".") return null;
41 | type = "symbol";
42 | if (name == "nil" || name == "t") return "atom";
43 | if (name.charAt(0) == ":") return "keyword";
44 | if (name.charAt(0) == "&") return "variable-2";
45 | return "variable";
46 | }
47 | }
48 |
49 | function inString(stream, state) {
50 | var escaped = false, next;
51 | while (next = stream.next()) {
52 | if (next == '"' && !escaped) { state.tokenize = base; break; }
53 | escaped = !escaped && next == "\\";
54 | }
55 | return "string";
56 | }
57 |
58 | function inComment(stream, state) {
59 | var next, last;
60 | while (next = stream.next()) {
61 | if (next == "#" && last == "|") { state.tokenize = base; break; }
62 | last = next;
63 | }
64 | type = "ws";
65 | return "comment";
66 | }
67 |
68 | return {
69 | startState: function () {
70 | return {ctx: {prev: null, start: 0, indentTo: 0}, tokenize: base};
71 | },
72 |
73 | token: function (stream, state) {
74 | if (stream.sol() && typeof state.ctx.indentTo != "number")
75 | state.ctx.indentTo = state.ctx.start + 1;
76 |
77 | type = null;
78 | var style = state.tokenize(stream, state);
79 | if (type != "ws") {
80 | if (state.ctx.indentTo == null) {
81 | if (type == "symbol" && assumeBody.test(stream.current()))
82 | state.ctx.indentTo = state.ctx.start + config.indentUnit;
83 | else
84 | state.ctx.indentTo = "next";
85 | } else if (state.ctx.indentTo == "next") {
86 | state.ctx.indentTo = stream.column();
87 | }
88 | }
89 | if (type == "open") state.ctx = {prev: state.ctx, start: stream.column(), indentTo: null};
90 | else if (type == "close") state.ctx = state.ctx.prev || state.ctx;
91 | return style;
92 | },
93 |
94 | indent: function (state, _textAfter) {
95 | var i = state.ctx.indentTo;
96 | return typeof i == "number" ? i : state.ctx.start + 1;
97 | }
98 | };
99 | });
100 |
101 | CodeMirror.defineMIME("text/x-common-lisp", "commonlisp");
102 |
--------------------------------------------------------------------------------
/lib/mode/css/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: CSS mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: CSS mode
14 |
15 | /* Some example CSS */
16 |
17 | @import url("something.css");
18 |
19 | body {
20 | margin: 0;
21 | padding: 3em 6em;
22 | font-family: tahoma, arial, sans-serif;
23 | color: #000;
24 | }
25 |
26 | #navigation a {
27 | font-weight: bold;
28 | text-decoration: none !important;
29 | }
30 |
31 | h1 {
32 | font-size: 2.5em;
33 | }
34 |
35 | h2 {
36 | font-size: 1.7em;
37 | }
38 |
39 | h1:before, h2:before {
40 | content: "::";
41 | }
42 |
43 | code {
44 | font-family: courier, monospace;
45 | font-size: 80%;
46 | color: #418A8A;
47 | }
48 |
49 |
52 |
53 | MIME types defined: text/css
.
54 |
55 | Parsing/Highlighting Tests: normal , verbose .
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/lib/mode/diff/diff.js:
--------------------------------------------------------------------------------
1 | CodeMirror.defineMode("diff", function() {
2 |
3 | var TOKEN_NAMES = {
4 | '+': 'positive',
5 | '-': 'negative',
6 | '@': 'meta'
7 | };
8 |
9 | return {
10 | token: function(stream) {
11 | var tw_pos = stream.string.search(/[\t ]+?$/);
12 |
13 | if (!stream.sol() || tw_pos === 0) {
14 | stream.skipToEnd();
15 | return ("error " + (
16 | TOKEN_NAMES[stream.string.charAt(0)] || '')).replace(/ $/, '');
17 | }
18 |
19 | var token_name = TOKEN_NAMES[stream.peek()] || stream.skipToEnd();
20 |
21 | if (tw_pos === -1) {
22 | stream.skipToEnd();
23 | } else {
24 | stream.pos = tw_pos;
25 | }
26 |
27 | return token_name;
28 | }
29 | };
30 | });
31 |
32 | CodeMirror.defineMIME("text/x-diff", "diff");
33 |
--------------------------------------------------------------------------------
/lib/mode/ecl/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CodeMirror: ECL mode
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | CodeMirror: ECL mode
13 |
14 | /*
15 | sample useless code to demonstrate ecl syntax highlighting
16 | this is a multiline comment!
17 | */
18 |
19 | // this is a singleline comment!
20 |
21 | import ut;
22 | r :=
23 | record
24 | string22 s1 := '123';
25 | integer4 i1 := 123;
26 | end;
27 | #option('tmp', true);
28 | d := dataset('tmp::qb', r, thor);
29 | output(d);
30 |
31 |
34 |
35 | Based on CodeMirror's clike mode. For more information see HPCC Systems web site.
36 | MIME types defined: text/x-ecl
.
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/lib/mode/erlang/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: Erlang mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | CodeMirror: Erlang mode
16 |
17 |
18 | %% -*- mode: erlang; erlang-indent-level: 2 -*-
19 | %%% Created : 7 May 2012 by mats cronqvist
20 |
21 | %% @doc
22 | %% Demonstrates how to print a record.
23 | %% @end
24 |
25 | -module('ex').
26 | -author('mats cronqvist').
27 | -export([demo/0,
28 | rec_info/1]).
29 |
30 | -record(demo,{a="One",b="Two",c="Three",d="Four"}).
31 |
32 | rec_info(demo) -> record_info(fields,demo).
33 |
34 | demo() -> expand_recs(?MODULE,#demo{a="A",b="BB"}).
35 |
36 | expand_recs(M,List) when is_list(List) ->
37 | [expand_recs(M,L)||L<-List];
38 | expand_recs(M,Tup) when is_tuple(Tup) ->
39 | case tuple_size(Tup) of
40 | L when L < 1 -> Tup;
41 | L ->
42 | try Fields = M:rec_info(element(1,Tup)),
43 | L = length(Fields)+1,
44 | lists:zip(Fields,expand_recs(M,tl(tuple_to_list(Tup))))
45 | catch _:_ ->
46 | list_to_tuple(expand_recs(M,tuple_to_list(Tup)))
47 | end
48 | end;
49 | expand_recs(_,Term) ->
50 | Term.
51 |
52 |
53 |
61 |
62 | MIME types defined: text/x-erlang
.
63 |
64 |
65 |
--------------------------------------------------------------------------------
/lib/mode/gfm/gfm.js:
--------------------------------------------------------------------------------
1 | CodeMirror.defineMode("gfm", function(config) {
2 | var codeDepth = 0;
3 | function blankLine(state) {
4 | state.code = false;
5 | return null;
6 | }
7 | var gfmOverlay = {
8 | startState: function() {
9 | return {
10 | code: false,
11 | codeBlock: false,
12 | ateSpace: false
13 | };
14 | },
15 | copyState: function(s) {
16 | return {
17 | code: s.code,
18 | codeBlock: s.codeBlock,
19 | ateSpace: s.ateSpace
20 | };
21 | },
22 | token: function(stream, state) {
23 | // Hack to prevent formatting override inside code blocks (block and inline)
24 | if (state.codeBlock) {
25 | if (stream.match(/^```/)) {
26 | state.codeBlock = false;
27 | return null;
28 | }
29 | stream.skipToEnd();
30 | return null;
31 | }
32 | if (stream.sol()) {
33 | state.code = false;
34 | }
35 | if (stream.sol() && stream.match(/^```/)) {
36 | stream.skipToEnd();
37 | state.codeBlock = true;
38 | return null;
39 | }
40 | // If this block is changed, it may need to be updated in Markdown mode
41 | if (stream.peek() === '`') {
42 | stream.next();
43 | var before = stream.pos;
44 | stream.eatWhile('`');
45 | var difference = 1 + stream.pos - before;
46 | if (!state.code) {
47 | codeDepth = difference;
48 | state.code = true;
49 | } else {
50 | if (difference === codeDepth) { // Must be exact
51 | state.code = false;
52 | }
53 | }
54 | return null;
55 | } else if (state.code) {
56 | stream.next();
57 | return null;
58 | }
59 | // Check if space. If so, links can be formatted later on
60 | if (stream.eatSpace()) {
61 | state.ateSpace = true;
62 | return null;
63 | }
64 | if (stream.sol() || state.ateSpace) {
65 | state.ateSpace = false;
66 | if(stream.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/)) {
67 | // User/Project@SHA
68 | // User@SHA
69 | // SHA
70 | return "link";
71 | } else if (stream.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/)) {
72 | // User/Project#Num
73 | // User#Num
74 | // #Num
75 | return "link";
76 | }
77 | }
78 | if (stream.match(/^((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/i)) {
79 | // URLs
80 | // Taken from http://daringfireball.net/2010/07/improved_regex_for_matching_urls
81 | // And then (issue #1160) simplified to make it not crash the Chrome Regexp engine
82 | return "link";
83 | }
84 | stream.next();
85 | return null;
86 | },
87 | blankLine: blankLine
88 | };
89 | CodeMirror.defineMIME("gfmBase", {
90 | name: "markdown",
91 | underscoresBreakWords: false,
92 | fencedCodeBlocks: true
93 | });
94 | return CodeMirror.overlayMode(CodeMirror.getMode(config, "gfmBase"), gfmOverlay);
95 | }, "markdown");
96 |
--------------------------------------------------------------------------------
/lib/mode/gfm/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: GFM mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | CodeMirror: GFM mode
24 |
25 |
26 | GitHub Flavored Markdown
27 | ========================
28 |
29 | Everything from markdown plus GFM features:
30 |
31 | ## URL autolinking
32 |
33 | Underscores_are_allowed_between_words.
34 |
35 | ## Fenced code blocks (and syntax highlighting)
36 |
37 | ```javascript
38 | for (var i = 0; i < items.length; i++) {
39 | console.log(items[i], i); // log them
40 | }
41 | ```
42 |
43 | ## A bit of GitHub spice
44 |
45 | * SHA: be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
46 | * User@SHA ref: mojombo@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
47 | * User/Project@SHA: mojombo/god@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
48 | * \#Num: #1
49 | * User/#Num: mojombo#1
50 | * User/Project#Num: mojombo/god#1
51 |
52 | See http://github.github.com/github-flavored-markdown/.
53 |
54 |
55 |
56 |
63 |
64 | Optionally depends on other modes for properly highlighted code blocks.
65 |
66 | Parsing/Highlighting Tests: normal , verbose .
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/lib/mode/gfm/test.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | var mode = CodeMirror.getMode({tabSize: 4}, "gfm");
3 | function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
4 |
5 | MT("emInWordAsterisk",
6 | "foo[em *bar*]hello");
7 |
8 | MT("emInWordUnderscore",
9 | "foo_bar_hello");
10 |
11 | MT("emStrongUnderscore",
12 | "[strong __][emstrong _foo__][em _] bar");
13 |
14 | MT("fencedCodeBlocks",
15 | "[comment ```]",
16 | "[comment foo]",
17 | "",
18 | "[comment ```]",
19 | "bar");
20 |
21 | MT("fencedCodeBlockModeSwitching",
22 | "[comment ```javascript]",
23 | "[variable foo]",
24 | "",
25 | "[comment ```]",
26 | "bar");
27 |
28 | MT("SHA",
29 | "foo [link be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2] bar");
30 |
31 | MT("shortSHA",
32 | "foo [link be6a8cc] bar");
33 |
34 | MT("tooShortSHA",
35 | "foo be6a8c bar");
36 |
37 | MT("longSHA",
38 | "foo be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd22 bar");
39 |
40 | MT("badSHA",
41 | "foo be6a8cc1c1ecfe9489fb51e4869af15a13fc2cg2 bar");
42 |
43 | MT("userSHA",
44 | "foo [link bar@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2] hello");
45 |
46 | MT("userProjectSHA",
47 | "foo [link bar/hello@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2] world");
48 |
49 | MT("num",
50 | "foo [link #1] bar");
51 |
52 | MT("badNum",
53 | "foo #1bar hello");
54 |
55 | MT("userNum",
56 | "foo [link bar#1] hello");
57 |
58 | MT("userProjectNum",
59 | "foo [link bar/hello#1] world");
60 |
61 | MT("vanillaLink",
62 | "foo [link http://www.example.com/] bar");
63 |
64 | MT("vanillaLinkPunctuation",
65 | "foo [link http://www.example.com/]. bar");
66 |
67 | MT("vanillaLinkExtension",
68 | "foo [link http://www.example.com/index.html] bar");
69 |
70 | MT("notALink",
71 | "[comment ```css]",
72 | "[tag foo] {[property color][operator :][keyword black];}",
73 | "[comment ```][link http://www.example.com/]");
74 |
75 | MT("notALink",
76 | "[comment ``foo `bar` http://www.example.com/``] hello");
77 |
78 | MT("notALink",
79 | "[comment `foo]",
80 | "[link http://www.example.com/]",
81 | "[comment `foo]",
82 | "",
83 | "[link http://www.example.com/]");
84 | })();
85 |
--------------------------------------------------------------------------------
/lib/mode/go/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: Go mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | CodeMirror: Go mode
16 |
17 |
18 | // Prime Sieve in Go.
19 | // Taken from the Go specification.
20 | // Copyright © The Go Authors.
21 |
22 | package main
23 |
24 | import "fmt"
25 |
26 | // Send the sequence 2, 3, 4, ... to channel 'ch'.
27 | func generate(ch chan<- int) {
28 | for i := 2; ; i++ {
29 | ch <- i // Send 'i' to channel 'ch'
30 | }
31 | }
32 |
33 | // Copy the values from channel 'src' to channel 'dst',
34 | // removing those divisible by 'prime'.
35 | func filter(src <-chan int, dst chan<- int, prime int) {
36 | for i := range src { // Loop over values received from 'src'.
37 | if i%prime != 0 {
38 | dst <- i // Send 'i' to channel 'dst'.
39 | }
40 | }
41 | }
42 |
43 | // The prime sieve: Daisy-chain filter processes together.
44 | func sieve() {
45 | ch := make(chan int) // Create a new channel.
46 | go generate(ch) // Start generate() as a subprocess.
47 | for {
48 | prime := <-ch
49 | fmt.Print(prime, "\n")
50 | ch1 := make(chan int)
51 | go filter(ch, ch1, prime)
52 | ch = ch1
53 | }
54 | }
55 |
56 | func main() {
57 | sieve()
58 | }
59 |
60 |
61 |
71 |
72 | MIME type: text/x-go
73 |
74 |
75 |
--------------------------------------------------------------------------------
/lib/mode/groovy/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: Groovy mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | CodeMirror: Groovy mode
15 |
16 |
17 | //Pattern for groovy script
18 | def p = ~/.*\.groovy/
19 | new File( 'd:\\scripts' ).eachFileMatch(p) {f ->
20 | // imports list
21 | def imports = []
22 | f.eachLine {
23 | // condition to detect an import instruction
24 | ln -> if ( ln =~ '^import .*' ) {
25 | imports << "${ln - 'import '}"
26 | }
27 | }
28 | // print thmen
29 | if ( ! imports.empty ) {
30 | println f
31 | imports.each{ println " $it" }
32 | }
33 | }
34 |
35 | /* Coin changer demo code from http://groovy.codehaus.org */
36 |
37 | enum UsCoin {
38 | quarter(25), dime(10), nickel(5), penny(1)
39 | UsCoin(v) { value = v }
40 | final value
41 | }
42 |
43 | enum OzzieCoin {
44 | fifty(50), twenty(20), ten(10), five(5)
45 | OzzieCoin(v) { value = v }
46 | final value
47 | }
48 |
49 | def plural(word, count) {
50 | if (count == 1) return word
51 | word[-1] == 'y' ? word[0..-2] + "ies" : word + "s"
52 | }
53 |
54 | def change(currency, amount) {
55 | currency.values().inject([]){ list, coin ->
56 | int count = amount / coin.value
57 | amount = amount % coin.value
58 | list += "$count ${plural(coin.toString(), count)}"
59 | }
60 | }
61 |
62 |
63 |
70 |
71 | MIME types defined: text/x-groovy
72 |
73 |
74 |
--------------------------------------------------------------------------------
/lib/mode/haskell/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: Haskell mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | CodeMirror: Haskell mode
16 |
17 |
18 | module UniquePerms (
19 | uniquePerms
20 | )
21 | where
22 |
23 | -- | Find all unique permutations of a list where there might be duplicates.
24 | uniquePerms :: (Eq a) => [a] -> [[a]]
25 | uniquePerms = permBag . makeBag
26 |
27 | -- | An unordered collection where duplicate values are allowed,
28 | -- but represented with a single value and a count.
29 | type Bag a = [(a, Int)]
30 |
31 | makeBag :: (Eq a) => [a] -> Bag a
32 | makeBag [] = []
33 | makeBag (a:as) = mix a $ makeBag as
34 | where
35 | mix a [] = [(a,1)]
36 | mix a (bn@(b,n):bs) | a == b = (b,n+1):bs
37 | | otherwise = bn : mix a bs
38 |
39 | permBag :: Bag a -> [[a]]
40 | permBag [] = [[]]
41 | permBag bs = concatMap (\(f,cs) -> map (f:) $ permBag cs) . oneOfEach $ bs
42 | where
43 | oneOfEach [] = []
44 | oneOfEach (an@(a,n):bs) =
45 | let bs' = if n == 1 then bs else (a,n-1):bs
46 | in (a,bs') : mapSnd (an:) (oneOfEach bs)
47 |
48 | apSnd f (a,b) = (a, f b)
49 | mapSnd = map . apSnd
50 |
51 |
52 |
59 |
60 | MIME types defined: text/x-haskell
.
61 |
62 |
63 |
--------------------------------------------------------------------------------
/lib/mode/haxe/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: Haxe mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: Haxe mode
14 |
15 |
16 | import one.two.Three;
17 |
18 | @attr("test")
19 | class Foo<T> extends Three
20 | {
21 | public function new()
22 | {
23 | noFoo = 12;
24 | }
25 |
26 | public static inline function doFoo(obj:{k:Int, l:Float}):Int
27 | {
28 | for(i in 0...10)
29 | {
30 | obj.k++;
31 | trace(i);
32 | var var1 = new Array();
33 | if(var1.length > 1)
34 | throw "Error";
35 | }
36 | // The following line should not be colored, the variable is scoped out
37 | var1;
38 | /* Multi line
39 | * Comment test
40 | */
41 | return obj.k;
42 | }
43 | private function bar():Void
44 | {
45 | #if flash
46 | var t1:String = "1.21";
47 | #end
48 | try {
49 | doFoo({k:3, l:1.2});
50 | }
51 | catch (e : String) {
52 | trace(e);
53 | }
54 | var t2:Float = cast(3.2);
55 | var t3:haxe.Timer = new haxe.Timer();
56 | var t4 = {k:Std.int(t2), l:Std.parseFloat(t1)};
57 | var t5 = ~/123+.*$/i;
58 | doFoo(t4);
59 | untyped t1 = 4;
60 | bob = new Foo<Int>
61 | }
62 | public var okFoo(default, never):Float;
63 | var noFoo(getFoo, null):Int;
64 | function getFoo():Int {
65 | return noFoo;
66 | }
67 |
68 | public var three:Int;
69 | }
70 | enum Color
71 | {
72 | red;
73 | green;
74 | blue;
75 | grey( v : Int );
76 | rgb (r:Int,g:Int,b:Int);
77 | }
78 |
79 |
80 |
87 |
88 | MIME types defined: text/x-haxe
.
89 |
90 |
91 |
--------------------------------------------------------------------------------
/lib/mode/htmlembedded/htmlembedded.js:
--------------------------------------------------------------------------------
1 | CodeMirror.defineMode("htmlembedded", function(config, parserConfig) {
2 |
3 | //config settings
4 | var scriptStartRegex = parserConfig.scriptStartRegex || /^<%/i,
5 | scriptEndRegex = parserConfig.scriptEndRegex || /^%>/i;
6 |
7 | //inner modes
8 | var scriptingMode, htmlMixedMode;
9 |
10 | //tokenizer when in html mode
11 | function htmlDispatch(stream, state) {
12 | if (stream.match(scriptStartRegex, false)) {
13 | state.token=scriptingDispatch;
14 | return scriptingMode.token(stream, state.scriptState);
15 | }
16 | else
17 | return htmlMixedMode.token(stream, state.htmlState);
18 | }
19 |
20 | //tokenizer when in scripting mode
21 | function scriptingDispatch(stream, state) {
22 | if (stream.match(scriptEndRegex, false)) {
23 | state.token=htmlDispatch;
24 | return htmlMixedMode.token(stream, state.htmlState);
25 | }
26 | else
27 | return scriptingMode.token(stream, state.scriptState);
28 | }
29 |
30 |
31 | return {
32 | startState: function() {
33 | scriptingMode = scriptingMode || CodeMirror.getMode(config, parserConfig.scriptingModeSpec);
34 | htmlMixedMode = htmlMixedMode || CodeMirror.getMode(config, "htmlmixed");
35 | return {
36 | token : parserConfig.startOpen ? scriptingDispatch : htmlDispatch,
37 | htmlState : CodeMirror.startState(htmlMixedMode),
38 | scriptState : CodeMirror.startState(scriptingMode)
39 | };
40 | },
41 |
42 | token: function(stream, state) {
43 | return state.token(stream, state);
44 | },
45 |
46 | indent: function(state, textAfter) {
47 | if (state.token == htmlDispatch)
48 | return htmlMixedMode.indent(state.htmlState, textAfter);
49 | else if (scriptingMode.indent)
50 | return scriptingMode.indent(state.scriptState, textAfter);
51 | },
52 |
53 | copyState: function(state) {
54 | return {
55 | token : state.token,
56 | htmlState : CodeMirror.copyState(htmlMixedMode, state.htmlState),
57 | scriptState : CodeMirror.copyState(scriptingMode, state.scriptState)
58 | };
59 | },
60 |
61 | electricChars: "/{}:",
62 |
63 | innerMode: function(state) {
64 | if (state.token == scriptingDispatch) return {state: state.scriptState, mode: scriptingMode};
65 | else return {state: state.htmlState, mode: htmlMixedMode};
66 | }
67 | };
68 | }, "htmlmixed");
69 |
70 | CodeMirror.defineMIME("application/x-ejs", { name: "htmlembedded", scriptingModeSpec:"javascript"});
71 | CodeMirror.defineMIME("application/x-aspx", { name: "htmlembedded", scriptingModeSpec:"text/x-csharp"});
72 | CodeMirror.defineMIME("application/x-jsp", { name: "htmlembedded", scriptingModeSpec:"text/x-java"});
73 | CodeMirror.defineMIME("application/x-erb", { name: "htmlembedded", scriptingModeSpec:"ruby"});
74 |
--------------------------------------------------------------------------------
/lib/mode/htmlembedded/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: Html Embedded Scripts mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | CodeMirror: Html Embedded Scripts mode
18 |
19 |
20 | <%
21 | function hello(who) {
22 | return "Hello " + who;
23 | }
24 | %>
25 | This is an example of EJS (embedded javascript)
26 | The program says <%= hello("world") %>.
27 |
30 |
31 |
32 |
42 |
43 | Mode for html embedded scripts like JSP and ASP.NET. Depends on HtmlMixed which in turn depends on
44 | JavaScript, CSS and XML. Other dependancies include those of the scriping language chosen.
45 |
46 | MIME types defined: application/x-aspx
(ASP.NET),
47 | application/x-ejs
(Embedded Javascript), application/x-jsp
(JavaServer Pages)
48 |
49 |
50 |
--------------------------------------------------------------------------------
/lib/mode/htmlmixed/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: HTML mixed mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | CodeMirror: HTML mixed mode
18 |
19 |
20 |
21 |
22 | Mixed HTML Example
23 |
31 |
32 |
33 | Mixed HTML Example
34 |
39 |
40 |
41 |
42 |
54 |
55 | The HTML mixed mode depends on the XML, JavaScript, and CSS modes.
56 |
57 | It takes an optional mode configuration
58 | option, scriptTypes
, which can be used to add custom
59 | behavior for specific <script type="...">
tags. If
60 | given, it should hold an array of {matches, mode}
61 | objects, where matches
is a string or regexp that
62 | matches the script type, and mode
is
63 | either null
, for script types that should stay in
64 | HTML mode, or a mode
65 | spec corresponding to the mode that should be used for the
66 | script.
67 |
68 | MIME types defined: text/html
69 | (redefined, only takes effect if you load this parser after the
70 | XML parser).
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/lib/mode/http/http.js:
--------------------------------------------------------------------------------
1 | CodeMirror.defineMode("http", function() {
2 | function failFirstLine(stream, state) {
3 | stream.skipToEnd();
4 | state.cur = header;
5 | return "error";
6 | }
7 |
8 | function start(stream, state) {
9 | if (stream.match(/^HTTP\/\d\.\d/)) {
10 | state.cur = responseStatusCode;
11 | return "keyword";
12 | } else if (stream.match(/^[A-Z]+/) && /[ \t]/.test(stream.peek())) {
13 | state.cur = requestPath;
14 | return "keyword";
15 | } else {
16 | return failFirstLine(stream, state);
17 | }
18 | }
19 |
20 | function responseStatusCode(stream, state) {
21 | var code = stream.match(/^\d+/);
22 | if (!code) return failFirstLine(stream, state);
23 |
24 | state.cur = responseStatusText;
25 | var status = Number(code[0]);
26 | if (status >= 100 && status < 200) {
27 | return "positive informational";
28 | } else if (status >= 200 && status < 300) {
29 | return "positive success";
30 | } else if (status >= 300 && status < 400) {
31 | return "positive redirect";
32 | } else if (status >= 400 && status < 500) {
33 | return "negative client-error";
34 | } else if (status >= 500 && status < 600) {
35 | return "negative server-error";
36 | } else {
37 | return "error";
38 | }
39 | }
40 |
41 | function responseStatusText(stream, state) {
42 | stream.skipToEnd();
43 | state.cur = header;
44 | return null;
45 | }
46 |
47 | function requestPath(stream, state) {
48 | stream.eatWhile(/\S/);
49 | state.cur = requestProtocol;
50 | return "string-2";
51 | }
52 |
53 | function requestProtocol(stream, state) {
54 | if (stream.match(/^HTTP\/\d\.\d$/)) {
55 | state.cur = header;
56 | return "keyword";
57 | } else {
58 | return failFirstLine(stream, state);
59 | }
60 | }
61 |
62 | function header(stream) {
63 | if (stream.sol() && !stream.eat(/[ \t]/)) {
64 | if (stream.match(/^.*?:/)) {
65 | return "atom";
66 | } else {
67 | stream.skipToEnd();
68 | return "error";
69 | }
70 | } else {
71 | stream.skipToEnd();
72 | return "string";
73 | }
74 | }
75 |
76 | function body(stream) {
77 | stream.skipToEnd();
78 | return null;
79 | }
80 |
81 | return {
82 | token: function(stream, state) {
83 | var cur = state.cur;
84 | if (cur != header && cur != body && stream.eatSpace()) return null;
85 | return cur(stream, state);
86 | },
87 |
88 | blankLine: function(state) {
89 | state.cur = body;
90 | },
91 |
92 | startState: function() {
93 | return {cur: start};
94 | }
95 | };
96 | });
97 |
98 | CodeMirror.defineMIME("message/http", "http");
99 |
--------------------------------------------------------------------------------
/lib/mode/http/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: HTTP mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: HTTP mode
14 |
15 |
16 | POST /somewhere HTTP/1.1
17 | Host: example.com
18 | If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
19 | Content-Type: application/x-www-form-urlencoded;
20 | charset=utf-8
21 | User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.11 (KHTML, like Gecko) Ubuntu/12.04 Chromium/20.0.1132.47 Chrome/20.0.1132.47 Safari/536.11
22 |
23 | This is the request body!
24 |
25 |
26 |
29 |
30 | MIME types defined: message/http
.
31 |
32 |
33 |
--------------------------------------------------------------------------------
/lib/mode/javascript/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: JavaScript mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | CodeMirror: JavaScript mode
16 |
17 |
18 | // Demo code (the actual new parser character stream implementation)
19 |
20 | function StringStream(string) {
21 | this.pos = 0;
22 | this.string = string;
23 | }
24 |
25 | StringStream.prototype = {
26 | done: function() {return this.pos >= this.string.length;},
27 | peek: function() {return this.string.charAt(this.pos);},
28 | next: function() {
29 | if (this.pos < this.string.length)
30 | return this.string.charAt(this.pos++);
31 | },
32 | eat: function(match) {
33 | var ch = this.string.charAt(this.pos);
34 | if (typeof match == "string") var ok = ch == match;
35 | else var ok = ch && match.test ? match.test(ch) : match(ch);
36 | if (ok) {this.pos++; return ch;}
37 | },
38 | eatWhile: function(match) {
39 | var start = this.pos;
40 | while (this.eat(match));
41 | if (this.pos > start) return this.string.slice(start, this.pos);
42 | },
43 | backUp: function(n) {this.pos -= n;},
44 | column: function() {return this.pos;},
45 | eatSpace: function() {
46 | var start = this.pos;
47 | while (/\s/.test(this.string.charAt(this.pos))) this.pos++;
48 | return this.pos - start;
49 | },
50 | match: function(pattern, consume, caseInsensitive) {
51 | if (typeof pattern == "string") {
52 | function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
53 | if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
54 | if (consume !== false) this.pos += str.length;
55 | return true;
56 | }
57 | }
58 | else {
59 | var match = this.string.slice(this.pos).match(pattern);
60 | if (match && consume !== false) this.pos += match[0].length;
61 | return match;
62 | }
63 | }
64 | };
65 |
66 |
67 |
74 |
75 |
76 | JavaScript mode supports a two configuration
77 | options:
78 |
79 | json
which will set the mode to expect JSON data rather than a JavaScript program.
80 |
81 | typescript
which will activate additional syntax highlighting and some other things for TypeScript code (demo ).
82 |
83 |
84 |
85 |
86 | MIME types defined: text/javascript
, application/json
, text/typescript
, application/typescript
.
87 |
88 |
89 |
--------------------------------------------------------------------------------
/lib/mode/javascript/typescript.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: TypeScript mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: TypeScript mode
14 |
15 |
16 | class Greeter {
17 | greeting: string;
18 | constructor (message: string) {
19 | this.greeting = message;
20 | }
21 | greet() {
22 | return "Hello, " + this.greeting;
23 | }
24 | }
25 |
26 | var greeter = new Greeter("world");
27 |
28 | var button = document.createElement('button')
29 | button.innerText = "Say Hello"
30 | button.onclick = function() {
31 | alert(greeter.greet())
32 | }
33 |
34 | document.body.appendChild(button)
35 |
36 |
37 |
38 |
45 |
46 | This is a specialization of the JavaScript mode .
47 |
48 |
49 |
--------------------------------------------------------------------------------
/lib/mode/jinja2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: Jinja2 mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: Jinja2 mode
14 |
15 | <html style="color: green">
16 | <!-- this is a comment -->
17 | <head>
18 | <title>Jinja2 Example</title>
19 | </head>
20 | <body>
21 | <ul>
22 | {# this is a comment #}
23 | {%- for item in li -%}
24 | <li>
25 | {{ item.label }}
26 | </li>
27 | {% endfor -%}
28 | </ul>
29 | </body>
30 | </html>
31 |
32 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/lib/mode/jinja2/jinja2.js:
--------------------------------------------------------------------------------
1 | CodeMirror.defineMode("jinja2", function() {
2 | var keywords = ["block", "endblock", "for", "endfor", "in", "true", "false",
3 | "loop", "none", "self", "super", "if", "as", "not", "and",
4 | "else", "import", "with", "without", "context"];
5 | keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b");
6 |
7 | function tokenBase (stream, state) {
8 | var ch = stream.next();
9 | if (ch == "{") {
10 | if (ch = stream.eat(/\{|%|#/)) {
11 | stream.eat("-");
12 | state.tokenize = inTag(ch);
13 | return "tag";
14 | }
15 | }
16 | }
17 | function inTag (close) {
18 | if (close == "{") {
19 | close = "}";
20 | }
21 | return function (stream, state) {
22 | var ch = stream.next();
23 | if ((ch == close || (ch == "-" && stream.eat(close)))
24 | && stream.eat("}")) {
25 | state.tokenize = tokenBase;
26 | return "tag";
27 | }
28 | if (stream.match(keywords)) {
29 | return "keyword";
30 | }
31 | return close == "#" ? "comment" : "string";
32 | };
33 | }
34 | return {
35 | startState: function () {
36 | return {tokenize: tokenBase};
37 | },
38 | token: function (stream, state) {
39 | return state.tokenize(stream, state);
40 | }
41 | };
42 | });
43 |
--------------------------------------------------------------------------------
/lib/mode/lua/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: Lua mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | CodeMirror: Lua mode
16 |
17 | --[[
18 | example useless code to show lua syntax highlighting
19 | this is multiline comment
20 | ]]
21 |
22 | function blahblahblah(x)
23 |
24 | local table = {
25 | "asd" = 123,
26 | "x" = 0.34,
27 | }
28 | if x ~= 3 then
29 | print( x )
30 | elseif x == "string"
31 | my_custom_function( 0x34 )
32 | else
33 | unknown_function( "some string" )
34 | end
35 |
36 | --single line comment
37 |
38 | end
39 |
40 | function blablabla3()
41 |
42 | for k,v in ipairs( table ) do
43 | --abcde..
44 | y=[=[
45 | x=[[
46 | x is a multi line string
47 | ]]
48 | but its definition is iside a highest level string!
49 | ]=]
50 | print(" \"\" ")
51 |
52 | s = math.sin( x )
53 | end
54 |
55 | end
56 |
57 |
64 |
65 | Loosely based on Franciszek
66 | Wawrzak's CodeMirror
67 | 1 mode . One configuration parameter is
68 | supported, specials
, to which you can provide an
69 | array of strings to have those identifiers highlighted with
70 | the lua-special
style.
71 | MIME types defined: text/x-lua
.
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/lib/mode/mysql/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: MySQL mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: MySQL mode
14 |
15 | -- Comment for the code
16 | -- MySQL Mode for CodeMirror2 by MySQLTools http://github.com/partydroid/MySQL-Tools
17 | SELECT UNIQUE `var1` as `variable`,
18 | MAX(`var5`) as `max`,
19 | MIN(`var5`) as `min`,
20 | STDEV(`var5`) as `dev`
21 | FROM `table`
22 |
23 | LEFT JOIN `table2` ON `var2` = `variable`
24 |
25 | ORDER BY `var3` DESC
26 | GROUP BY `groupvar`
27 |
28 | LIMIT 0,30;
29 |
30 |
31 |
37 |
38 | !! This mode is deprecated in favor of the generic SQL mode (which can be configured to handle MySQL).
39 |
40 | MIME types defined: text/x-mysql
.
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/lib/mode/ntriples/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: NTriples mode
6 |
7 |
8 |
9 |
10 |
15 |
16 |
17 | CodeMirror: NTriples mode
18 |
19 |
20 | .
21 | "literal 1" .
22 | _:bnode3 .
23 | _:bnode4 "literal 2"@lang .
24 | _:bnode5 "literal 3"^^ .
25 |
26 |
27 |
28 |
31 | MIME types defined: text/n-triples
.
32 |
33 |
34 |
--------------------------------------------------------------------------------
/lib/mode/ocaml/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | CodeMirror: OCaml mode
4 |
5 |
6 |
7 |
8 |
11 |
12 |
13 |
14 |
15 |
16 | CodeMirror: OCaml mode
17 |
18 |
19 | (* Summing a list of integers *)
20 | let rec sum xs =
21 | match xs with
22 | | [] -> 0
23 | | x :: xs' -> x + sum xs'
24 |
25 | (* Quicksort *)
26 | let rec qsort = function
27 | | [] -> []
28 | | pivot :: rest ->
29 | let is_less x = x < pivot in
30 | let left, right = List.partition is_less rest in
31 | qsort left @ [pivot] @ qsort right
32 |
33 | (* Fibonacci Sequence *)
34 | let rec fib_aux n a b =
35 | match n with
36 | | 0 -> a
37 | | _ -> fib_aux (n - 1) (a + b) a
38 | let fib n = fib_aux n 0 1
39 |
40 | (* Birthday paradox *)
41 | let year_size = 365.
42 |
43 | let rec birthday_paradox prob people =
44 | let prob' = (year_size -. float people) /. year_size *. prob in
45 | if prob' < 0.5 then
46 | Printf.printf "answer = %d\n" (people+1)
47 | else
48 | birthday_paradox prob' (people+1) ;;
49 |
50 | birthday_paradox 1.0 1
51 |
52 | (* Church numerals *)
53 | let zero f x = x
54 | let succ n f x = f (n f x)
55 | let one = succ zero
56 | let two = succ (succ zero)
57 | let add n1 n2 f x = n1 f (n2 f x)
58 | let to_string n = n (fun k -> "S" ^ k) "0"
59 | let _ = to_string (add (succ two) two)
60 |
61 | (* Elementary functions *)
62 | let square x = x * x;;
63 | let rec fact x =
64 | if x <= 1 then 1 else x * fact (x - 1);;
65 |
66 | (* Automatic memory management *)
67 | let l = 1 :: 2 :: 3 :: [];;
68 | [1; 2; 3];;
69 | 5 :: l;;
70 |
71 | (* Polymorphism: sorting lists *)
72 | let rec sort = function
73 | | [] -> []
74 | | x :: l -> insert x (sort l)
75 |
76 | and insert elem = function
77 | | [] -> [elem]
78 | | x :: l ->
79 | if elem < x then elem :: x :: l else x :: insert elem l;;
80 |
81 | (* Imperative features *)
82 | let add_polynom p1 p2 =
83 | let n1 = Array.length p1
84 | and n2 = Array.length p2 in
85 | let result = Array.create (max n1 n2) 0 in
86 | for i = 0 to n1 - 1 do result.(i) <- p1.(i) done;
87 | for i = 0 to n2 - 1 do result.(i) <- result.(i) + p2.(i) done;
88 | result;;
89 | add_polynom [| 1; 2 |] [| 1; 2; 3 |];;
90 |
91 | (* We may redefine fact using a reference cell and a for loop *)
92 | let fact n =
93 | let result = ref 1 in
94 | for i = 2 to n do
95 | result := i * !result
96 | done;
97 | !result;;
98 | fact 5;;
99 |
100 | (* Triangle (graphics) *)
101 | let () =
102 | ignore( Glut.init Sys.argv );
103 | Glut.initDisplayMode ~double_buffer:true ();
104 | ignore (Glut.createWindow ~title:"OpenGL Demo");
105 | let angle t = 10. *. t *. t in
106 | let render () =
107 | GlClear.clear [ `color ];
108 | GlMat.load_identity ();
109 | GlMat.rotate ~angle: (angle (Sys.time ())) ~z:1. ();
110 | GlDraw.begins `triangles;
111 | List.iter GlDraw.vertex2 [-1., -1.; 0., 1.; 1., -1.];
112 | GlDraw.ends ();
113 | Glut.swapBuffers () in
114 | GlMat.mode `modelview;
115 | Glut.displayFunc ~cb:render;
116 | Glut.idleFunc ~cb:(Some Glut.postRedisplay);
117 | Glut.mainLoop ()
118 |
119 | (* A Hundred Lines of Caml - http://caml.inria.fr/about/taste.en.html *)
120 | (* OCaml page on Wikipedia - http://en.wikipedia.org/wiki/OCaml *)
121 |
122 |
123 |
130 |
131 | MIME types defined: text/x-ocaml
.
132 |
--------------------------------------------------------------------------------
/lib/mode/ocaml/ocaml.js:
--------------------------------------------------------------------------------
1 | CodeMirror.defineMode('ocaml', function() {
2 |
3 | var words = {
4 | 'true': 'atom',
5 | 'false': 'atom',
6 | 'let': 'keyword',
7 | 'rec': 'keyword',
8 | 'in': 'keyword',
9 | 'of': 'keyword',
10 | 'and': 'keyword',
11 | 'succ': 'keyword',
12 | 'if': 'keyword',
13 | 'then': 'keyword',
14 | 'else': 'keyword',
15 | 'for': 'keyword',
16 | 'to': 'keyword',
17 | 'while': 'keyword',
18 | 'do': 'keyword',
19 | 'done': 'keyword',
20 | 'fun': 'keyword',
21 | 'function': 'keyword',
22 | 'val': 'keyword',
23 | 'type': 'keyword',
24 | 'mutable': 'keyword',
25 | 'match': 'keyword',
26 | 'with': 'keyword',
27 | 'try': 'keyword',
28 | 'raise': 'keyword',
29 | 'begin': 'keyword',
30 | 'end': 'keyword',
31 | 'open': 'builtin',
32 | 'trace': 'builtin',
33 | 'ignore': 'builtin',
34 | 'exit': 'builtin',
35 | 'print_string': 'builtin',
36 | 'print_endline': 'builtin'
37 | };
38 |
39 | function tokenBase(stream, state) {
40 | var ch = stream.next();
41 |
42 | if (ch === '"') {
43 | state.tokenize = tokenString;
44 | return state.tokenize(stream, state);
45 | }
46 | if (ch === '(') {
47 | if (stream.eat('*')) {
48 | state.commentLevel++;
49 | state.tokenize = tokenComment;
50 | return state.tokenize(stream, state);
51 | }
52 | }
53 | if (ch === '~') {
54 | stream.eatWhile(/\w/);
55 | return 'variable-2';
56 | }
57 | if (ch === '`') {
58 | stream.eatWhile(/\w/);
59 | return 'quote';
60 | }
61 | if (/\d/.test(ch)) {
62 | stream.eatWhile(/[\d]/);
63 | if (stream.eat('.')) {
64 | stream.eatWhile(/[\d]/);
65 | }
66 | return 'number';
67 | }
68 | if ( /[+\-*&%=<>!?|]/.test(ch)) {
69 | return 'operator';
70 | }
71 | stream.eatWhile(/\w/);
72 | var cur = stream.current();
73 | return words[cur] || 'variable';
74 | }
75 |
76 | function tokenString(stream, state) {
77 | var next, end = false, escaped = false;
78 | while ((next = stream.next()) != null) {
79 | if (next === '"' && !escaped) {
80 | end = true;
81 | break;
82 | }
83 | escaped = !escaped && next === '\\';
84 | }
85 | if (end && !escaped) {
86 | state.tokenize = tokenBase;
87 | }
88 | return 'string';
89 | };
90 |
91 | function tokenComment(stream, state) {
92 | var prev, next;
93 | while(state.commentLevel > 0 && (next = stream.next()) != null) {
94 | if (prev === '(' && next === '*') state.commentLevel++;
95 | if (prev === '*' && next === ')') state.commentLevel--;
96 | prev = next;
97 | }
98 | if (state.commentLevel <= 0) {
99 | state.tokenize = tokenBase;
100 | }
101 | return 'comment';
102 | }
103 |
104 | return {
105 | startState: function() {return {tokenize: tokenBase, commentLevel: 0};},
106 | token: function(stream, state) {
107 | if (stream.eatSpace()) return null;
108 | return state.tokenize(stream, state);
109 | }
110 | };
111 | });
112 |
113 | CodeMirror.defineMIME('text/x-ocaml', 'ocaml');
114 |
--------------------------------------------------------------------------------
/lib/mode/pascal/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011 souceLair
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
--------------------------------------------------------------------------------
/lib/mode/pascal/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: Pascal mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: Pascal mode
14 |
15 |
16 | (* Example Pascal code *)
17 |
18 | while a <> b do writeln('Waiting');
19 |
20 | if a > b then
21 | writeln('Condition met')
22 | else
23 | writeln('Condition not met');
24 |
25 | for i := 1 to 10 do
26 | writeln('Iteration: ', i:1);
27 |
28 | repeat
29 | a := a + 1
30 | until a = 10;
31 |
32 | case i of
33 | 0: write('zero');
34 | 1: write('one');
35 | 2: write('two')
36 | end;
37 |
38 |
39 |
45 |
46 | MIME types defined: text/x-pascal
.
47 |
48 |
49 |
--------------------------------------------------------------------------------
/lib/mode/pascal/pascal.js:
--------------------------------------------------------------------------------
1 | CodeMirror.defineMode("pascal", function() {
2 | function words(str) {
3 | var obj = {}, words = str.split(" ");
4 | for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
5 | return obj;
6 | }
7 | var keywords = words("and array begin case const div do downto else end file for forward integer " +
8 | "boolean char function goto if in label mod nil not of or packed procedure " +
9 | "program record repeat set string then to type until var while with");
10 | var atoms = {"null": true};
11 |
12 | var isOperatorChar = /[+\-*&%=<>!?|\/]/;
13 |
14 | function tokenBase(stream, state) {
15 | var ch = stream.next();
16 | if (ch == "#" && state.startOfLine) {
17 | stream.skipToEnd();
18 | return "meta";
19 | }
20 | if (ch == '"' || ch == "'") {
21 | state.tokenize = tokenString(ch);
22 | return state.tokenize(stream, state);
23 | }
24 | if (ch == "(" && stream.eat("*")) {
25 | state.tokenize = tokenComment;
26 | return tokenComment(stream, state);
27 | }
28 | if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
29 | return null;
30 | }
31 | if (/\d/.test(ch)) {
32 | stream.eatWhile(/[\w\.]/);
33 | return "number";
34 | }
35 | if (ch == "/") {
36 | if (stream.eat("/")) {
37 | stream.skipToEnd();
38 | return "comment";
39 | }
40 | }
41 | if (isOperatorChar.test(ch)) {
42 | stream.eatWhile(isOperatorChar);
43 | return "operator";
44 | }
45 | stream.eatWhile(/[\w\$_]/);
46 | var cur = stream.current();
47 | if (keywords.propertyIsEnumerable(cur)) return "keyword";
48 | if (atoms.propertyIsEnumerable(cur)) return "atom";
49 | return "variable";
50 | }
51 |
52 | function tokenString(quote) {
53 | return function(stream, state) {
54 | var escaped = false, next, end = false;
55 | while ((next = stream.next()) != null) {
56 | if (next == quote && !escaped) {end = true; break;}
57 | escaped = !escaped && next == "\\";
58 | }
59 | if (end || !escaped) state.tokenize = null;
60 | return "string";
61 | };
62 | }
63 |
64 | function tokenComment(stream, state) {
65 | var maybeEnd = false, ch;
66 | while (ch = stream.next()) {
67 | if (ch == ")" && maybeEnd) {
68 | state.tokenize = null;
69 | break;
70 | }
71 | maybeEnd = (ch == "*");
72 | }
73 | return "comment";
74 | }
75 |
76 | // Interface
77 |
78 | return {
79 | startState: function() {
80 | return {tokenize: null};
81 | },
82 |
83 | token: function(stream, state) {
84 | if (stream.eatSpace()) return null;
85 | var style = (state.tokenize || tokenBase)(stream, state);
86 | if (style == "comment" || style == "meta") return style;
87 | return style;
88 | },
89 |
90 | electricChars: "{}"
91 | };
92 | });
93 |
94 | CodeMirror.defineMIME("text/x-pascal", "pascal");
95 |
--------------------------------------------------------------------------------
/lib/mode/perl/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (C) 2011 by Sabaca 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.
20 |
--------------------------------------------------------------------------------
/lib/mode/perl/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: Perl mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: Perl mode
14 |
15 |
16 | #!/usr/bin/perl
17 |
18 | use Something qw(func1 func2);
19 |
20 | # strings
21 | my $s1 = qq'single line';
22 | our $s2 = q(multi-
23 | line);
24 |
25 | =item Something
26 | Example.
27 | =cut
28 |
29 | my $html=<<'HTML'
30 |
31 | hi!
32 |
33 | HTML
34 |
35 | print "first,".join(',', 'second', qq~third~);
36 |
37 | if($s1 =~ m[(?{$1}=$$.' predefined variables';
39 | $s2 =~ s/\-line//ox;
40 | $s1 =~ s[
41 | line ]
42 | [
43 | block
44 | ]ox;
45 | }
46 |
47 | 1; # numbers and comments
48 |
49 | __END__
50 | something...
51 |
52 |
53 |
54 |
59 |
60 | MIME types defined: text/x-perl
.
61 |
62 |
63 |
--------------------------------------------------------------------------------
/lib/mode/php/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: PHP mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | CodeMirror: PHP mode
20 |
21 |
22 |
27 | The program says = hello("World") ?>.
28 |
31 |
32 |
33 |
44 |
45 | Simple HTML/PHP mode based on
46 | the C-like mode. Depends on XML,
47 | JavaScript, CSS, HTMLMixed, and C-like modes.
48 |
49 | MIME types defined: application/x-httpd-php
(HTML with PHP code), text/x-php
(plain, non-wrapped PHP code).
50 |
51 |
52 |
--------------------------------------------------------------------------------
/lib/mode/pig/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: Pig Latin mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: Pig Latin mode
14 |
15 |
16 | -- Apache Pig (Pig Latin Language) Demo
17 | /*
18 | This is a multiline comment.
19 | */
20 | a = LOAD "\path\to\input" USING PigStorage('\t') AS (x:long, y:chararray, z:bytearray);
21 | b = GROUP a BY (x,y,3+4);
22 | c = FOREACH b GENERATE flatten(group) as (x,y), SUM(group.$2) as z;
23 | STORE c INTO "\path\to\output";
24 |
25 | --
26 |
27 |
28 |
35 |
36 |
37 | Simple mode that handles Pig Latin language.
38 |
39 |
40 | MIME type defined: text/x-pig
41 | (PIG code)
42 |
43 |
--------------------------------------------------------------------------------
/lib/mode/plsql/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: Oracle PL/SQL mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: Oracle PL/SQL mode
14 |
15 |
16 | -- Oracle PL/SQL Code Demo
17 | /*
18 | based on c-like mode, adapted to PL/SQL by Peter Raganitsch ( http://www.oracle-and-apex.com/ )
19 | April 2011
20 | */
21 | DECLARE
22 | vIdx NUMBER;
23 | vString VARCHAR2(100);
24 | cText CONSTANT VARCHAR2(100) := 'That''s it! Have fun with CodeMirror 2';
25 | BEGIN
26 | vIdx := 0;
27 | --
28 | FOR rDATA IN
29 | ( SELECT *
30 | FROM EMP
31 | ORDER BY EMPNO
32 | )
33 | LOOP
34 | vIdx := vIdx + 1;
35 | vString := rDATA.EMPNO || ' - ' || rDATA.ENAME;
36 | --
37 | UPDATE EMP
38 | SET SAL = SAL * 101/100
39 | WHERE EMPNO = rDATA.EMPNO
40 | ;
41 | END LOOP;
42 | --
43 | SYS.DBMS_OUTPUT.Put_Line (cText);
44 | END;
45 | --
46 |
47 |
48 |
55 |
56 | !! This mode is deprecated in favor of the generic SQL mode (which can be configured to handle PL/SQL).
57 |
58 |
59 | Simple mode that handles Oracle PL/SQL language (and Oracle SQL, of course).
60 |
61 |
62 | MIME type defined: text/x-plsql
63 | (PLSQL code)
64 |
65 |
--------------------------------------------------------------------------------
/lib/mode/properties/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: Properties files mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: Properties files mode
14 |
15 | # This is a properties file
16 | a.key = A value
17 | another.key = http://example.com
18 | ! Exclamation mark as comment
19 | but.not=Within ! A value # indeed
20 | # Spaces at the beginning of a line
21 | spaces.before.key=value
22 | backslash=Used for multi\
23 | line entries,\
24 | that's convenient.
25 | # Unicode sequences
26 | unicode.key=This is \u0020 Unicode
27 | no.multiline=here
28 | # Colons
29 | colons : can be used too
30 | # Spaces
31 | spaces\ in\ keys=Not very common...
32 |
33 |
36 |
37 | MIME types defined: text/x-properties
,
38 | text/x-ini
.
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/lib/mode/properties/properties.js:
--------------------------------------------------------------------------------
1 | CodeMirror.defineMode("properties", function() {
2 | return {
3 | token: function(stream, state) {
4 | var sol = stream.sol() || state.afterSection;
5 | var eol = stream.eol();
6 |
7 | state.afterSection = false;
8 |
9 | if (sol) {
10 | if (state.nextMultiline) {
11 | state.inMultiline = true;
12 | state.nextMultiline = false;
13 | } else {
14 | state.position = "def";
15 | }
16 | }
17 |
18 | if (eol && ! state.nextMultiline) {
19 | state.inMultiline = false;
20 | state.position = "def";
21 | }
22 |
23 | if (sol) {
24 | while(stream.eatSpace());
25 | }
26 |
27 | var ch = stream.next();
28 |
29 | if (sol && (ch === "#" || ch === "!" || ch === ";")) {
30 | state.position = "comment";
31 | stream.skipToEnd();
32 | return "comment";
33 | } else if (sol && ch === "[") {
34 | state.afterSection = true;
35 | stream.skipTo("]"); stream.eat("]");
36 | return "header";
37 | } else if (ch === "=" || ch === ":") {
38 | state.position = "quote";
39 | return null;
40 | } else if (ch === "\\" && state.position === "quote") {
41 | if (stream.next() !== "u") { // u = Unicode sequence \u1234
42 | // Multiline value
43 | state.nextMultiline = true;
44 | }
45 | }
46 |
47 | return state.position;
48 | },
49 |
50 | startState: function() {
51 | return {
52 | position : "def", // Current position, "def", "quote" or "comment"
53 | nextMultiline : false, // Is the next line multiline value
54 | inMultiline : false, // Is the current line a multiline value
55 | afterSection : false // Did we just open a section
56 | };
57 | }
58 |
59 | };
60 | });
61 |
62 | CodeMirror.defineMIME("text/x-properties", "properties");
63 | CodeMirror.defineMIME("text/x-ini", "properties");
64 |
--------------------------------------------------------------------------------
/lib/mode/python/LICENSE.txt:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright (c) 2010 Timothy Farrell
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/lib/mode/r/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011, Ubalo, Inc.
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 | * Redistributions of source code must retain the above copyright
7 | notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | * Neither the name of the Ubalo, Inc nor the names of its
12 | contributors may be used to endorse or promote products derived
13 | from this software without specific prior written permission.
14 |
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 | DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY
19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 |
--------------------------------------------------------------------------------
/lib/mode/r/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: R mode
6 |
7 |
8 |
9 |
16 |
17 |
18 |
19 | CodeMirror: R mode
20 |
21 | # Code from http://www.mayin.org/ajayshah/KB/R/
22 |
23 | # FIRST LEARN ABOUT LISTS --
24 | X = list(height=5.4, weight=54)
25 | print("Use default printing --")
26 | print(X)
27 | print("Accessing individual elements --")
28 | cat("Your height is ", X$height, " and your weight is ", X$weight, "\n")
29 |
30 | # FUNCTIONS --
31 | square <- function(x) {
32 | return(x*x)
33 | }
34 | cat("The square of 3 is ", square(3), "\n")
35 |
36 | # default value of the arg is set to 5.
37 | cube <- function(x=5) {
38 | return(x*x*x);
39 | }
40 | cat("Calling cube with 2 : ", cube(2), "\n") # will give 2^3
41 | cat("Calling cube : ", cube(), "\n") # will default to 5^3.
42 |
43 | # LEARN ABOUT FUNCTIONS THAT RETURN MULTIPLE OBJECTS --
44 | powers <- function(x) {
45 | parcel = list(x2=x*x, x3=x*x*x, x4=x*x*x*x);
46 | return(parcel);
47 | }
48 |
49 | X = powers(3);
50 | print("Showing powers of 3 --"); print(X);
51 |
52 | # WRITING THIS COMPACTLY (4 lines instead of 7)
53 |
54 | powerful <- function(x) {
55 | return(list(x2=x*x, x3=x*x*x, x4=x*x*x*x));
56 | }
57 | print("Showing powers of 3 --"); print(powerful(3));
58 |
59 | # In R, the last expression in a function is, by default, what is
60 | # returned. So you could equally just say:
61 | powerful <- function(x) {list(x2=x*x, x3=x*x*x, x4=x*x*x*x)}
62 |
63 |
66 |
67 | MIME types defined: text/x-rsrc
.
68 |
69 | Development of the CodeMirror R mode was kindly sponsored
70 | by Ubalo , who hold
71 | the license .
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/lib/mode/rpm/changes/changes.js:
--------------------------------------------------------------------------------
1 | CodeMirror.defineMode("changes", function() {
2 | var headerSeperator = /^-+$/;
3 | var headerLine = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /;
4 | var simpleEmail = /^[\w+.-]+@[\w.-]+/;
5 |
6 | return {
7 | token: function(stream) {
8 | if (stream.sol()) {
9 | if (stream.match(headerSeperator)) { return 'tag'; }
10 | if (stream.match(headerLine)) { return 'tag'; }
11 | }
12 | if (stream.match(simpleEmail)) { return 'string'; }
13 | stream.next();
14 | return null;
15 | }
16 | };
17 | });
18 |
19 | CodeMirror.defineMIME("text/x-rpm-changes", "changes");
20 |
--------------------------------------------------------------------------------
/lib/mode/rpm/changes/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: RPM changes mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: RPM changes mode
14 |
15 |
16 | -------------------------------------------------------------------
17 | Tue Oct 18 13:58:40 UTC 2011 - misterx@example.com
18 |
19 | - Update to r60.3
20 | - Fixes bug in the reflect package
21 | * disallow Interface method on Value obtained via unexported name
22 |
23 | -------------------------------------------------------------------
24 | Thu Oct 6 08:14:24 UTC 2011 - misterx@example.com
25 |
26 | - Update to r60.2
27 | - Fixes memory leak in certain map types
28 |
29 | -------------------------------------------------------------------
30 | Wed Oct 5 14:34:10 UTC 2011 - misterx@example.com
31 |
32 | - Tweaks for gdb debugging
33 | - go.spec changes:
34 | - move %go_arch definition to %prep section
35 | - pass correct location of go specific gdb pretty printer and
36 | functions to cpp as HOST_EXTRA_CFLAGS macro
37 | - install go gdb functions & printer
38 | - gdb-printer.patch
39 | - patch linker (src/cmd/ld/dwarf.c) to emit correct location of go
40 | gdb functions and pretty printer
41 |
42 |
50 |
51 | MIME types defined: text/x-rpm-changes
.
52 |
53 |
54 |
--------------------------------------------------------------------------------
/lib/mode/rpm/spec/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: RPM spec mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | CodeMirror: RPM spec mode
15 |
16 |
17 | #
18 | # spec file for package minidlna
19 | #
20 | # Copyright (c) 2011, Sascha Peilicke
21 | #
22 | # All modifications and additions to the file contributed by third parties
23 | # remain the property of their copyright owners, unless otherwise agreed
24 | # upon. The license for this file, and modifications and additions to the
25 | # file, is the same license as for the pristine package itself (unless the
26 | # license for the pristine package is not an Open Source License, in which
27 | # case the license is the MIT License). An "Open Source License" is a
28 | # license that conforms to the Open Source Definition (Version 1.9)
29 | # published by the Open Source Initiative.
30 |
31 |
32 | Name: libupnp6
33 | Version: 1.6.13
34 | Release: 0
35 | Summary: Portable Universal Plug and Play (UPnP) SDK
36 | Group: System/Libraries
37 | License: BSD-3-Clause
38 | Url: http://sourceforge.net/projects/pupnp/
39 | Source0: http://downloads.sourceforge.net/pupnp/libupnp-%{version}.tar.bz2
40 | BuildRoot: %{_tmppath}/%{name}-%{version}-build
41 |
42 | %description
43 | The portable Universal Plug and Play (UPnP) SDK provides support for building
44 | UPnP-compliant control points, devices, and bridges on several operating
45 | systems.
46 |
47 | %package -n libupnp-devel
48 | Summary: Portable Universal Plug and Play (UPnP) SDK
49 | Group: Development/Libraries/C and C++
50 | Provides: pkgconfig(libupnp)
51 | Requires: %{name} = %{version}
52 |
53 | %description -n libupnp-devel
54 | The portable Universal Plug and Play (UPnP) SDK provides support for building
55 | UPnP-compliant control points, devices, and bridges on several operating
56 | systems.
57 |
58 | %prep
59 | %setup -n libupnp-%{version}
60 |
61 | %build
62 | %configure --disable-static
63 | make %{?_smp_mflags}
64 |
65 | %install
66 | %makeinstall
67 | find %{buildroot} -type f -name '*.la' -exec rm -f {} ';'
68 |
69 | %post -p /sbin/ldconfig
70 |
71 | %postun -p /sbin/ldconfig
72 |
73 | %files
74 | %defattr(-,root,root,-)
75 | %doc ChangeLog NEWS README TODO
76 | %{_libdir}/libixml.so.*
77 | %{_libdir}/libthreadutil.so.*
78 | %{_libdir}/libupnp.so.*
79 |
80 | %files -n libupnp-devel
81 | %defattr(-,root,root,-)
82 | %{_libdir}/pkgconfig/libupnp.pc
83 | %{_libdir}/libixml.so
84 | %{_libdir}/libthreadutil.so
85 | %{_libdir}/libupnp.so
86 | %{_includedir}/upnp/
87 |
88 | %changelog
89 |
96 |
97 | MIME types defined: text/x-rpm-spec
.
98 |
99 |
100 |
--------------------------------------------------------------------------------
/lib/mode/rpm/spec/spec.css:
--------------------------------------------------------------------------------
1 | .cm-s-default span.cm-preamble {color: #b26818; font-weight: bold;}
2 | .cm-s-default span.cm-macro {color: #b218b2;}
3 | .cm-s-default span.cm-section {color: green; font-weight: bold;}
4 | .cm-s-default span.cm-script {color: red;}
5 | .cm-s-default span.cm-issue {color: yellow;}
6 |
--------------------------------------------------------------------------------
/lib/mode/rpm/spec/spec.js:
--------------------------------------------------------------------------------
1 | // Quick and dirty spec file highlighting
2 |
3 | CodeMirror.defineMode("spec", function() {
4 | var arch = /^(i386|i586|i686|x86_64|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/;
5 |
6 | var preamble = /^(Name|Version|Release|License|Summary|Url|Group|Source|BuildArch|BuildRequires|BuildRoot|AutoReqProv|Provides|Requires(\(\w+\))?|Obsoletes|Conflicts|Recommends|Source\d*|Patch\d*|ExclusiveArch|NoSource|Supplements):/;
7 | var section = /^%(debug_package|package|description|prep|build|install|files|clean|changelog|preun|postun|pre|post|triggerin|triggerun|pretrans|posttrans|verifyscript|check|triggerpostun|triggerprein|trigger)/;
8 | var control_flow_complex = /^%(ifnarch|ifarch|if)/; // rpm control flow macros
9 | var control_flow_simple = /^%(else|endif)/; // rpm control flow macros
10 | var operators = /^(\!|\?|\<\=|\<|\>\=|\>|\=\=|\&\&|\|\|)/; // operators in control flow macros
11 |
12 | return {
13 | startState: function () {
14 | return {
15 | controlFlow: false,
16 | macroParameters: false,
17 | section: false
18 | };
19 | },
20 | token: function (stream, state) {
21 | var ch = stream.peek();
22 | if (ch == "#") { stream.skipToEnd(); return "comment"; }
23 |
24 | if (stream.sol()) {
25 | if (stream.match(preamble)) { return "preamble"; }
26 | if (stream.match(section)) { return "section"; }
27 | }
28 |
29 | if (stream.match(/^\$\w+/)) { return "def"; } // Variables like '$RPM_BUILD_ROOT'
30 | if (stream.match(/^\$\{\w+\}/)) { return "def"; } // Variables like '${RPM_BUILD_ROOT}'
31 |
32 | if (stream.match(control_flow_simple)) { return "keyword"; }
33 | if (stream.match(control_flow_complex)) {
34 | state.controlFlow = true;
35 | return "keyword";
36 | }
37 | if (state.controlFlow) {
38 | if (stream.match(operators)) { return "operator"; }
39 | if (stream.match(/^(\d+)/)) { return "number"; }
40 | if (stream.eol()) { state.controlFlow = false; }
41 | }
42 |
43 | if (stream.match(arch)) { return "number"; }
44 |
45 | // Macros like '%make_install' or '%attr(0775,root,root)'
46 | if (stream.match(/^%[\w]+/)) {
47 | if (stream.match(/^\(/)) { state.macroParameters = true; }
48 | return "macro";
49 | }
50 | if (state.macroParameters) {
51 | if (stream.match(/^\d+/)) { return "number";}
52 | if (stream.match(/^\)/)) {
53 | state.macroParameters = false;
54 | return "macro";
55 | }
56 | }
57 | if (stream.match(/^%\{\??[\w \-]+\}/)) { return "macro"; } // Macros like '%{defined fedora}'
58 |
59 | //TODO: Include bash script sub-parser (CodeMirror supports that)
60 | stream.next();
61 | return null;
62 | }
63 | };
64 | });
65 |
66 | CodeMirror.defineMIME("text/x-rpm-spec", "spec");
67 |
--------------------------------------------------------------------------------
/lib/mode/ruby/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011, Ubalo, Inc.
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 | * Redistributions of source code must retain the above copyright
7 | notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | * Neither the name of the Ubalo, Inc. nor the names of its
12 | contributors may be used to endorse or promote products derived
13 | from this software without specific prior written permission.
14 |
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 | DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY
19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 |
--------------------------------------------------------------------------------
/lib/mode/rust/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: Rust mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: Rust mode
14 |
15 |
16 | // Demo code.
17 |
18 | type foo = int;
19 | enum bar {
20 | some(int, foo),
21 | none
22 | }
23 |
24 | fn check_crate(x: int) {
25 | let v = 10;
26 | alt foo {
27 | 1 to 3 {
28 | print_foo();
29 | if x {
30 | blah() + 10;
31 | }
32 | }
33 | (x, y) { "bye" }
34 | _ { "hi" }
35 | }
36 | }
37 |
38 |
39 |
45 |
46 | MIME types defined: text/x-rustsrc
.
47 |
48 |
49 |
--------------------------------------------------------------------------------
/lib/mode/sass/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: Sass mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | CodeMirror: Sass mode
15 | // Variable Definitions
16 |
17 | $page-width: 800px
18 | $sidebar-width: 200px
19 | $primary-color: #eeeeee
20 |
21 | // Global Attributes
22 |
23 | body
24 | font:
25 | family: sans-serif
26 | size: 30em
27 | weight: bold
28 |
29 | // Scoped Styles
30 |
31 | #contents
32 | width: $page-width
33 | #sidebar
34 | float: right
35 | width: $sidebar-width
36 | #main
37 | width: $page-width - $sidebar-width
38 | background: $primary-color
39 | h2
40 | color: blue
41 |
42 | #footer
43 | height: 200px
44 |
45 |
51 |
52 | MIME types defined: text/x-sass
.
53 |
54 |
55 |
--------------------------------------------------------------------------------
/lib/mode/scheme/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: Scheme mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: Scheme mode
14 |
15 | ; See if the input starts with a given symbol.
16 | (define (match-symbol input pattern)
17 | (cond ((null? (remain input)) #f)
18 | ((eqv? (car (remain input)) pattern) (r-cdr input))
19 | (else #f)))
20 |
21 | ; Allow the input to start with one of a list of patterns.
22 | (define (match-or input pattern)
23 | (cond ((null? pattern) #f)
24 | ((match-pattern input (car pattern)))
25 | (else (match-or input (cdr pattern)))))
26 |
27 | ; Allow a sequence of patterns.
28 | (define (match-seq input pattern)
29 | (if (null? pattern)
30 | input
31 | (let ((match (match-pattern input (car pattern))))
32 | (if match (match-seq match (cdr pattern)) #f))))
33 |
34 | ; Match with the pattern but no problem if it does not match.
35 | (define (match-opt input pattern)
36 | (let ((match (match-pattern input (car pattern))))
37 | (if match match input)))
38 |
39 | ; Match anything (other than '()), until pattern is found. The rather
40 | ; clumsy form of requiring an ending pattern is needed to decide where
41 | ; the end of the match is. If none is given, this will match the rest
42 | ; of the sentence.
43 | (define (match-any input pattern)
44 | (cond ((null? (remain input)) #f)
45 | ((null? pattern) (f-cons (remain input) (clear-remain input)))
46 | (else
47 | (let ((accum-any (collector)))
48 | (define (match-pattern-any input pattern)
49 | (cond ((null? (remain input)) #f)
50 | (else (accum-any (car (remain input)))
51 | (cond ((match-pattern (r-cdr input) pattern))
52 | (else (match-pattern-any (r-cdr input) pattern))))))
53 | (let ((retval (match-pattern-any input (car pattern))))
54 | (if retval
55 | (f-cons (accum-any) retval)
56 | #f))))))
57 |
58 |
61 |
62 | MIME types defined: text/x-scheme
.
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/lib/mode/shell/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | CodeMirror: Shell mode
4 |
5 |
6 |
7 |
8 |
11 |
12 |
13 |
14 |
15 |
16 | CodeMirror: Shell mode
17 |
18 |
19 | #!/bin/bash
20 |
21 | # clone the repository
22 | git clone http://github.com/garden/tree
23 |
24 | # generate HTTPS credentials
25 | cd tree
26 | openssl genrsa -aes256 -out https.key 1024
27 | openssl req -new -nodes -key https.key -out https.csr
28 | openssl x509 -req -days 365 -in https.csr -signkey https.key -out https.crt
29 | cp https.key{,.orig}
30 | openssl rsa -in https.key.orig -out https.key
31 |
32 | # start the server in HTTPS mode
33 | cd web
34 | sudo node ../server.js 443 'yes' >> ../node.log &
35 |
36 | # here is how to stop the server
37 | for pid in `ps aux | grep 'node ../server.js' | awk '{print $2}'` ; do
38 | sudo kill -9 $pid 2> /dev/null
39 | done
40 |
41 | exit 0
42 |
43 |
50 |
51 | MIME types defined: text/x-sh
.
52 |
--------------------------------------------------------------------------------
/lib/mode/shell/shell.js:
--------------------------------------------------------------------------------
1 | CodeMirror.defineMode('shell', function() {
2 |
3 | var words = {};
4 | function define(style, string) {
5 | var split = string.split(' ');
6 | for(var i = 0; i < split.length; i++) {
7 | words[split[i]] = style;
8 | }
9 | };
10 |
11 | // Atoms
12 | define('atom', 'true false');
13 |
14 | // Keywords
15 | define('keyword', 'if then do else elif while until for in esac fi fin ' +
16 | 'fil done exit set unset export function');
17 |
18 | // Commands
19 | define('builtin', 'ab awk bash beep cat cc cd chown chmod chroot clear cp ' +
20 | 'curl cut diff echo find gawk gcc get git grep kill killall ln ls make ' +
21 | 'mkdir openssl mv nc node npm ping ps restart rm rmdir sed service sh ' +
22 | 'shopt shred source sort sleep ssh start stop su sudo tee telnet top ' +
23 | 'touch vi vim wall wc wget who write yes zsh');
24 |
25 | function tokenBase(stream, state) {
26 |
27 | var sol = stream.sol();
28 | var ch = stream.next();
29 |
30 | if (ch === '\'' || ch === '"' || ch === '`') {
31 | state.tokens.unshift(tokenString(ch));
32 | return tokenize(stream, state);
33 | }
34 | if (ch === '#') {
35 | if (sol && stream.eat('!')) {
36 | stream.skipToEnd();
37 | return 'meta'; // 'comment'?
38 | }
39 | stream.skipToEnd();
40 | return 'comment';
41 | }
42 | if (ch === '$') {
43 | state.tokens.unshift(tokenDollar);
44 | return tokenize(stream, state);
45 | }
46 | if (ch === '+' || ch === '=') {
47 | return 'operator';
48 | }
49 | if (ch === '-') {
50 | stream.eat('-');
51 | stream.eatWhile(/\w/);
52 | return 'attribute';
53 | }
54 | if (/\d/.test(ch)) {
55 | stream.eatWhile(/\d/);
56 | if(!/\w/.test(stream.peek())) {
57 | return 'number';
58 | }
59 | }
60 | stream.eatWhile(/\w/);
61 | var cur = stream.current();
62 | if (stream.peek() === '=' && /\w+/.test(cur)) return 'def';
63 | return words.hasOwnProperty(cur) ? words[cur] : null;
64 | }
65 |
66 | function tokenString(quote) {
67 | return function(stream, state) {
68 | var next, end = false, escaped = false;
69 | while ((next = stream.next()) != null) {
70 | if (next === quote && !escaped) {
71 | end = true;
72 | break;
73 | }
74 | if (next === '$' && !escaped && quote !== '\'') {
75 | escaped = true;
76 | stream.backUp(1);
77 | state.tokens.unshift(tokenDollar);
78 | break;
79 | }
80 | escaped = !escaped && next === '\\';
81 | }
82 | if (end || !escaped) {
83 | state.tokens.shift();
84 | }
85 | return (quote === '`' || quote === ')' ? 'quote' : 'string');
86 | };
87 | };
88 |
89 | var tokenDollar = function(stream, state) {
90 | if (state.tokens.length > 1) stream.eat('$');
91 | var ch = stream.next(), hungry = /\w/;
92 | if (ch === '{') hungry = /[^}]/;
93 | if (ch === '(') {
94 | state.tokens[0] = tokenString(')');
95 | return tokenize(stream, state);
96 | }
97 | if (!/\d/.test(ch)) {
98 | stream.eatWhile(hungry);
99 | stream.eat('}');
100 | }
101 | state.tokens.shift();
102 | return 'def';
103 | };
104 |
105 | function tokenize(stream, state) {
106 | return (state.tokens[0] || tokenBase) (stream, state);
107 | };
108 |
109 | return {
110 | startState: function() {return {tokens:[]};},
111 | token: function(stream, state) {
112 | if (stream.eatSpace()) return null;
113 | return tokenize(stream, state);
114 | }
115 | };
116 | });
117 |
118 | CodeMirror.defineMIME('text/x-sh', 'shell');
119 |
--------------------------------------------------------------------------------
/lib/mode/sieve/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (C) 2012 Thomas Schmid
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.
20 |
--------------------------------------------------------------------------------
/lib/mode/sieve/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: Sieve (RFC5228) mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: Sieve (RFC5228) mode
14 |
15 | #
16 | # Example Sieve Filter
17 | # Declare any optional features or extension used by the script
18 | #
19 |
20 | require ["fileinto", "reject"];
21 |
22 | #
23 | # Reject any large messages (note that the four leading dots get
24 | # "stuffed" to three)
25 | #
26 | if size :over 1M
27 | {
28 | reject text:
29 | Please do not send me large attachments.
30 | Put your file on a server and send me the URL.
31 | Thank you.
32 | .... Fred
33 | .
34 | ;
35 | stop;
36 | }
37 |
38 | #
39 | # Handle messages from known mailing lists
40 | # Move messages from IETF filter discussion list to filter folder
41 | #
42 | if header :is "Sender" "owner-ietf-mta-filters@imc.org"
43 | {
44 | fileinto "filter"; # move to "filter" folder
45 | }
46 | #
47 | # Keep all messages to or from people in my company
48 | #
49 | elsif address :domain :is ["From", "To"] "example.com"
50 | {
51 | keep; # keep in "In" folder
52 | }
53 |
54 | #
55 | # Try and catch unsolicited email. If a message is not to me,
56 | # or it contains a subject known to be spam, file it away.
57 | #
58 | elsif anyof (not address :all :contains
59 | ["To", "Cc", "Bcc"] "me@example.com",
60 | header :matches "subject"
61 | ["*make*money*fast*", "*university*dipl*mas*"])
62 | {
63 | # If message header does not contain my address,
64 | # it's from a list.
65 | fileinto "spam"; # move to "spam" folder
66 | }
67 | else
68 | {
69 | # Move all other (non-company) mail to "personal"
70 | # folder.
71 | fileinto "personal";
72 | }
73 |
74 |
77 |
78 | MIME types defined: application/sieve
.
79 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/lib/mode/smalltalk/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: Smalltalk mode
6 |
7 |
8 |
9 |
10 |
11 |
16 |
17 |
18 | CodeMirror: Smalltalk mode
19 |
20 |
21 | "
22 | This is a test of the Smalltalk code
23 | "
24 | Seaside.WAComponent subclass: #MyCounter [
25 | | count |
26 | MyCounter class >> canBeRoot [ ^true ]
27 |
28 | initialize [
29 | super initialize.
30 | count := 0.
31 | ]
32 | states [ ^{ self } ]
33 | renderContentOn: html [
34 | html heading: count.
35 | html anchor callback: [ count := count + 1 ]; with: '++'.
36 | html space.
37 | html anchor callback: [ count := count - 1 ]; with: '--'.
38 | ]
39 | ]
40 |
41 | MyCounter registerAsApplication: 'mycounter'
42 |
43 |
44 |
52 |
53 | Simple Smalltalk mode.
54 |
55 | MIME types defined: text/x-stsrc
.
56 |
57 |
58 |
--------------------------------------------------------------------------------
/lib/mode/smalltalk/smalltalk.js:
--------------------------------------------------------------------------------
1 | CodeMirror.defineMode('smalltalk', function(config) {
2 |
3 | var specialChars = /[+\-/\\*~<>=@%|&?!.:;^]/;
4 | var keywords = /true|false|nil|self|super|thisContext/;
5 |
6 | var Context = function(tokenizer, parent) {
7 | this.next = tokenizer;
8 | this.parent = parent;
9 | };
10 |
11 | var Token = function(name, context, eos) {
12 | this.name = name;
13 | this.context = context;
14 | this.eos = eos;
15 | };
16 |
17 | var State = function() {
18 | this.context = new Context(next, null);
19 | this.expectVariable = true;
20 | this.indentation = 0;
21 | this.userIndentationDelta = 0;
22 | };
23 |
24 | State.prototype.userIndent = function(indentation) {
25 | this.userIndentationDelta = indentation > 0 ? (indentation / config.indentUnit - this.indentation) : 0;
26 | };
27 |
28 | var next = function(stream, context, state) {
29 | var token = new Token(null, context, false);
30 | var aChar = stream.next();
31 |
32 | if (aChar === '"') {
33 | token = nextComment(stream, new Context(nextComment, context));
34 |
35 | } else if (aChar === '\'') {
36 | token = nextString(stream, new Context(nextString, context));
37 |
38 | } else if (aChar === '#') {
39 | stream.eatWhile(/[^ .]/);
40 | token.name = 'string-2';
41 |
42 | } else if (aChar === '$') {
43 | stream.eatWhile(/[^ ]/);
44 | token.name = 'string-2';
45 |
46 | } else if (aChar === '|' && state.expectVariable) {
47 | token.context = new Context(nextTemporaries, context);
48 |
49 | } else if (/[\[\]{}()]/.test(aChar)) {
50 | token.name = 'bracket';
51 | token.eos = /[\[{(]/.test(aChar);
52 |
53 | if (aChar === '[') {
54 | state.indentation++;
55 | } else if (aChar === ']') {
56 | state.indentation = Math.max(0, state.indentation - 1);
57 | }
58 |
59 | } else if (specialChars.test(aChar)) {
60 | stream.eatWhile(specialChars);
61 | token.name = 'operator';
62 | token.eos = aChar !== ';'; // ; cascaded message expression
63 |
64 | } else if (/\d/.test(aChar)) {
65 | stream.eatWhile(/[\w\d]/);
66 | token.name = 'number';
67 |
68 | } else if (/[\w_]/.test(aChar)) {
69 | stream.eatWhile(/[\w\d_]/);
70 | token.name = state.expectVariable ? (keywords.test(stream.current()) ? 'keyword' : 'variable') : null;
71 |
72 | } else {
73 | token.eos = state.expectVariable;
74 | }
75 |
76 | return token;
77 | };
78 |
79 | var nextComment = function(stream, context) {
80 | stream.eatWhile(/[^"]/);
81 | return new Token('comment', stream.eat('"') ? context.parent : context, true);
82 | };
83 |
84 | var nextString = function(stream, context) {
85 | stream.eatWhile(/[^']/);
86 | return new Token('string', stream.eat('\'') ? context.parent : context, false);
87 | };
88 |
89 | var nextTemporaries = function(stream, context) {
90 | var token = new Token(null, context, false);
91 | var aChar = stream.next();
92 |
93 | if (aChar === '|') {
94 | token.context = context.parent;
95 | token.eos = true;
96 |
97 | } else {
98 | stream.eatWhile(/[^|]/);
99 | token.name = 'variable';
100 | }
101 |
102 | return token;
103 | };
104 |
105 | return {
106 | startState: function() {
107 | return new State;
108 | },
109 |
110 | token: function(stream, state) {
111 | state.userIndent(stream.indentation());
112 |
113 | if (stream.eatSpace()) {
114 | return null;
115 | }
116 |
117 | var token = state.context.next(stream, state.context, state);
118 | state.context = token.context;
119 | state.expectVariable = token.eos;
120 |
121 | state.lastToken = token;
122 | return token.name;
123 | },
124 |
125 | blankLine: function(state) {
126 | state.userIndent(0);
127 | },
128 |
129 | indent: function(state, textAfter) {
130 | var i = state.context.next === next && textAfter && textAfter.charAt(0) === ']' ? -1 : state.userIndentationDelta;
131 | return (state.indentation + i) * config.indentUnit;
132 | },
133 |
134 | electricChars: ']'
135 | };
136 |
137 | });
138 |
139 | CodeMirror.defineMIME('text/x-stsrc', {name: 'smalltalk'});
--------------------------------------------------------------------------------
/lib/mode/smarty/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: Smarty mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: Smarty mode
14 |
15 |
16 | {extends file="parent.tpl"}
17 | {include file="template.tpl"}
18 |
19 | {* some example Smarty content *}
20 | {if isset($name) && $name == 'Blog'}
21 | This is a {$var}.
22 | {$integer = 451}, {$array[] = "a"}, {$stringvar = "string"}
23 | {assign var='bob' value=$var.prop}
24 | {elseif $name == $foo}
25 | {function name=menu level=0}
26 | {foreach $data as $entry}
27 | {if is_array($entry)}
28 | - {$entry@key}
29 | {menu data=$entry level=$level+1}
30 | {else}
31 | {$entry}
32 | {/if}
33 | {/foreach}
34 | {/function}
35 | {/if}
36 |
37 |
43 |
44 |
45 |
46 |
47 | {--extends file="parent.tpl"--}
48 | {--include file="template.tpl"--}
49 |
50 | {--* some example Smarty content *--}
51 | {--if isset($name) && $name == 'Blog'--}
52 | This is a {--$var--}.
53 | {--$integer = 451--}, {--$array[] = "a"--}, {--$stringvar = "string"--}
54 | {--assign var='bob' value=$var.prop--}
55 | {--elseif $name == $foo--}
56 | {--function name=menu level=0--}
57 | {--foreach $data as $entry--}
58 | {--if is_array($entry)--}
59 | - {--$entry@key--}
60 | {--menu data=$entry level=$level+1--}
61 | {--else--}
62 | {--$entry--}
63 | {--/if--}
64 | {--/foreach--}
65 | {--/function--}
66 | {--/if--}
67 |
68 |
78 |
79 | A plain text/Smarty mode which allows for custom delimiter tags (defaults to { and } ).
80 |
81 | MIME types defined: text/x-smarty
82 |
83 |
84 |
--------------------------------------------------------------------------------
/lib/mode/sparql/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: SPARQL mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | CodeMirror: SPARQL mode
15 |
16 | PREFIX a: <http://www.w3.org/2000/10/annotation-ns#>
17 | PREFIX dc: <http://purl.org/dc/elements/1.1/>
18 | PREFIX foaf: <http://xmlns.com/foaf/0.1/>
19 |
20 | # Comment!
21 |
22 | SELECT ?given ?family
23 | WHERE {
24 | ?annot a:annotates <http://www.w3.org/TR/rdf-sparql-query/> .
25 | ?annot dc:creator ?c .
26 | OPTIONAL {?c foaf:given ?given ;
27 | foaf:family ?family } .
28 | FILTER isBlank(?c)
29 | }
30 |
31 |
38 |
39 | MIME types defined: application/x-sparql-query
.
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/lib/mode/sql/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SQL Mode for CodeMirror
6 |
7 |
8 |
9 |
10 |
11 |
17 |
18 |
37 |
38 |
39 | SQL Mode for CodeMirror
40 |
41 | -- SQL Mode for CodeMirror
42 | SELECT SQL_NO_CACHE DISTINCT
43 | @var1 AS `val1`, @'val2', @global.'sql_mode',
44 | 1.1 AS `float_val`, .14 AS `another_float`, 0.09e3 AS `int_with_esp`,
45 | 0xFA5 AS `hex`, x'fa5' AS `hex2`, 0b101 AS `bin`, b'101' AS `bin2`,
46 | DATE '1994-01-01' AS `sql_date`, { T "1994-01-01" } AS `odbc_date`,
47 | 'myString', UNKNOWN
48 | FROM DUAL
49 | -- space needed after '--'
50 | # 1 line comment
51 | /* multiline
52 | comment! */
53 | LIMIT 1 OFFSET 0;
54 |
55 |
56 | MIME types defined:
57 | text/x-sql
,
58 | text/x-mysql
,
59 | text/x-mariadb
,
60 | text/x-plsql
.
61 |
62 |
63 | Tests:
64 | normal ,
65 | verbose .
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/lib/mode/stex/test.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | var mode = CodeMirror.getMode({tabSize: 4}, "stex");
3 | function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
4 |
5 | MT("word",
6 | "foo");
7 |
8 | MT("twoWords",
9 | "foo bar");
10 |
11 | MT("beginEndDocument",
12 | "[tag \\begin][bracket {][atom document][bracket }]",
13 | "[tag \\end][bracket {][atom document][bracket }]");
14 |
15 | MT("beginEndEquation",
16 | "[tag \\begin][bracket {][atom equation][bracket }]",
17 | " E=mc^2",
18 | "[tag \\end][bracket {][atom equation][bracket }]");
19 |
20 | MT("beginModule",
21 | "[tag \\begin][bracket {][atom module][bracket }[[]]]");
22 |
23 | MT("beginModuleId",
24 | "[tag \\begin][bracket {][atom module][bracket }[[]id=bbt-size[bracket ]]]");
25 |
26 | MT("importModule",
27 | "[tag \\importmodule][bracket [[][string b-b-t][bracket ]]{][builtin b-b-t][bracket }]");
28 |
29 | MT("importModulePath",
30 | "[tag \\importmodule][bracket [[][tag \\KWARCslides][bracket {][string dmath/en/cardinality][bracket }]]{][builtin card][bracket }]");
31 |
32 | MT("psForPDF",
33 | "[tag \\PSforPDF][bracket [[][atom 1][bracket ]]{]#1[bracket }]");
34 |
35 | MT("comment",
36 | "[comment % foo]");
37 |
38 | MT("tagComment",
39 | "[tag \\item][comment % bar]");
40 |
41 | MT("commentTag",
42 | " [comment % \\item]");
43 |
44 | MT("commentLineBreak",
45 | "[comment %]",
46 | "foo");
47 |
48 | MT("tagErrorCurly",
49 | "[tag \\begin][error }][bracket {]");
50 |
51 | MT("tagErrorSquare",
52 | "[tag \\item][error ]]][bracket {]");
53 |
54 | MT("commentCurly",
55 | "[comment % }]");
56 |
57 | MT("tagHash",
58 | "the [tag \\#] key");
59 |
60 | MT("tagNumber",
61 | "a [tag \\$][atom 5] stetson");
62 |
63 | MT("tagPercent",
64 | "[atom 100][tag \\%] beef");
65 |
66 | MT("tagAmpersand",
67 | "L [tag \\&] N");
68 |
69 | MT("tagUnderscore",
70 | "foo[tag \\_]bar");
71 |
72 | MT("tagBracketOpen",
73 | "[tag \\emph][bracket {][tag \\{][bracket }]");
74 |
75 | MT("tagBracketClose",
76 | "[tag \\emph][bracket {][tag \\}][bracket }]");
77 |
78 | MT("tagLetterNumber",
79 | "section [tag \\S][atom 1]");
80 |
81 | MT("textTagNumber",
82 | "para [tag \\P][atom 2]");
83 |
84 | MT("thinspace",
85 | "x[tag \\,]y");
86 |
87 | MT("thickspace",
88 | "x[tag \\;]y");
89 |
90 | MT("negativeThinspace",
91 | "x[tag \\!]y");
92 |
93 | MT("periodNotSentence",
94 | "J.\\ L.\\ is");
95 |
96 | MT("periodSentence",
97 | "X[tag \\@]. The");
98 |
99 | MT("italicCorrection",
100 | "[bracket {][tag \\em] If[tag \\/][bracket }] I");
101 |
102 | MT("tagBracket",
103 | "[tag \\newcommand][bracket {][tag \\pop][bracket }]");
104 | })();
105 |
--------------------------------------------------------------------------------
/lib/mode/tiddlywiki/tiddlywiki.css:
--------------------------------------------------------------------------------
1 | span.cm-underlined {
2 | text-decoration: underline;
3 | }
4 | span.cm-strikethrough {
5 | text-decoration: line-through;
6 | }
7 | span.cm-brace {
8 | color: #170;
9 | font-weight: bold;
10 | }
11 | span.cm-table {
12 | color: blue;
13 | font-weight: bold;
14 | }
15 |
--------------------------------------------------------------------------------
/lib/mode/tiki/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CodeMirror: Tiki wiki mode
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: Tiki wiki mode
14 |
15 |
16 | Headings
17 | !Header 1
18 | !!Header 2
19 | !!!Header 3
20 | !!!!Header 4
21 | !!!!!Header 5
22 | !!!!!!Header 6
23 |
24 | Styling
25 | -=titlebar=-
26 | ^^ Box on multi
27 | lines
28 | of content^^
29 | __bold__
30 | ''italic''
31 | ===underline===
32 | ::center::
33 | --Line Through--
34 |
35 | Operators
36 | ~np~No parse~/np~
37 |
38 | Link
39 | [link|desc|nocache]
40 |
41 | Wiki
42 | ((Wiki))
43 | ((Wiki|desc))
44 | ((Wiki|desc|timeout))
45 |
46 | Table
47 | ||row1 col1|row1 col2|row1 col3
48 | row2 col1|row2 col2|row2 col3
49 | row3 col1|row3 col2|row3 col3||
50 |
51 | Lists:
52 | *bla
53 | **bla-1
54 | ++continue-bla-1
55 | ***bla-2
56 | ++continue-bla-1
57 | *bla
58 | +continue-bla
59 | #bla
60 | ** tra-la-la
61 | +continue-bla
62 | #bla
63 |
64 | Plugin (standard):
65 | {PLUGIN(attr="my attr")}
66 | Plugin Body
67 | {PLUGIN}
68 |
69 | Plugin (inline):
70 | {plugin attr="my attr"}
71 |
72 |
73 |
79 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/lib/mode/tiki/tiki.css:
--------------------------------------------------------------------------------
1 | .cm-tw-syntaxerror {
2 | color: #FFFFFF;
3 | background-color: #990000;
4 | }
5 |
6 | .cm-tw-deleted {
7 | text-decoration: line-through;
8 | }
9 |
10 | .cm-tw-header5 {
11 | font-weight: bold;
12 | }
13 | .cm-tw-listitem:first-child { /*Added first child to fix duplicate padding when highlighting*/
14 | padding-left: 10px;
15 | }
16 |
17 | .cm-tw-box {
18 | border-top-width: 0px ! important;
19 | border-style: solid;
20 | border-width: 1px;
21 | border-color: inherit;
22 | }
23 |
24 | .cm-tw-underline {
25 | text-decoration: underline;
26 | }
--------------------------------------------------------------------------------
/lib/mode/turtle/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: Turtle mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: Turtle mode
14 |
15 | @prefix foaf: .
16 | @prefix geo: .
17 | @prefix rdf: .
18 |
19 |
20 | a foaf:Person;
21 | foaf:interest ;
22 | foaf:based_near [
23 | geo:lat "34.0736111" ;
24 | geo:lon "-118.3994444"
25 | ]
26 |
27 |
28 |
35 |
36 | MIME types defined: text/turtle
.
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/lib/mode/vb/LICENSE.txt:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright (c) 2012 Codility Limited, 107 Cheapside, London EC2V 6DN, UK
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/lib/mode/vb/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CodeMirror: VB.NET mode
5 |
6 |
7 |
8 |
9 |
10 |
15 |
16 |
17 |
18 | CodeMirror: VB.NET mode
19 |
80 |
81 |
82 |
83 |
84 |
85 |
86 | MIME type defined: text/x-vb
.
87 |
88 |
89 |
--------------------------------------------------------------------------------
/lib/mode/vbscript/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: VBScript mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: VBScript mode
14 |
15 |
16 | ' Pete Guhl
17 | ' 03-04-2012
18 | '
19 | ' Basic VBScript support for codemirror2
20 |
21 | Const ForReading = 1, ForWriting = 2, ForAppending = 8
22 |
23 | Call Sub020_PostBroadcastToUrbanAirship(strUserName, strPassword, intTransmitID, strResponse)
24 |
25 | If Not IsNull(strResponse) AND Len(strResponse) = 0 Then
26 | boolTransmitOkYN = False
27 | Else
28 | ' WScript.Echo "Oh Happy Day! Oh Happy DAY!"
29 | boolTransmitOkYN = True
30 | End If
31 |
32 |
33 |
38 |
39 | MIME types defined: text/vbscript
.
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/lib/mode/vbscript/vbscript.js:
--------------------------------------------------------------------------------
1 | CodeMirror.defineMode("vbscript", function() {
2 | var regexVBScriptKeyword = /^(?:Call|Case|CDate|Clear|CInt|CLng|Const|CStr|Description|Dim|Do|Each|Else|ElseIf|End|Err|Error|Exit|False|For|Function|If|LCase|Loop|LTrim|Next|Nothing|Now|Number|On|Preserve|Quit|ReDim|Resume|RTrim|Select|Set|Sub|Then|To|Trim|True|UBound|UCase|Until|VbCr|VbCrLf|VbLf|VbTab)$/im;
3 |
4 | return {
5 | token: function(stream) {
6 | if (stream.eatSpace()) return null;
7 | var ch = stream.next();
8 | if (ch == "'") {
9 | stream.skipToEnd();
10 | return "comment";
11 | }
12 | if (ch == '"') {
13 | stream.skipTo('"');
14 | return "string";
15 | }
16 |
17 | if (/\w/.test(ch)) {
18 | stream.eatWhile(/\w/);
19 | if (regexVBScriptKeyword.test(stream.current())) return "keyword";
20 | }
21 | return null;
22 | }
23 | };
24 | });
25 |
26 | CodeMirror.defineMIME("text/vbscript", "vbscript");
27 |
--------------------------------------------------------------------------------
/lib/mode/velocity/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: Velocity mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | CodeMirror: Velocity mode
15 |
16 | ## Velocity Code Demo
17 | #*
18 | based on PL/SQL mode by Peter Raganitsch, adapted to Velocity by Steve O'Hara ( http://www.pivotal-solutions.co.uk )
19 | August 2011
20 | *#
21 |
22 | #*
23 | This is a multiline comment.
24 | This is the second line
25 | *#
26 |
27 | #[[ hello steve
28 | This has invalid syntax that would normally need "poor man's escaping" like:
29 |
30 | #define()
31 |
32 | ${blah
33 | ]]#
34 |
35 | #include( "disclaimer.txt" "opinion.txt" )
36 | #include( $foo $bar )
37 |
38 | #parse( "lecorbusier.vm" )
39 | #parse( $foo )
40 |
41 | #evaluate( 'string with VTL #if(true)will be displayed#end' )
42 |
43 | #define( $hello ) Hello $who #end #set( $who = "World!") $hello ## displays Hello World!
44 |
45 | #foreach( $customer in $customerList )
46 |
47 | $foreach.count $customer.Name
48 |
49 | #if( $foo == ${bar})
50 | it's true!
51 | #break
52 | #{else}
53 | it's not!
54 | #stop
55 | #end
56 |
57 | #if ($foreach.parent.hasNext)
58 | $velocityCount
59 | #end
60 | #end
61 |
62 | $someObject.getValues("this is a string split
63 | across lines")
64 |
65 | #macro( tablerows $color $somelist )
66 | #foreach( $something in $somelist )
67 | $something
68 | #end
69 | #end
70 |
71 | #tablerows("red" ["dadsdf","dsa"])
72 |
73 | Variable reference: #set( $monkey = $bill )
74 | String literal: #set( $monkey.Friend = 'monica' )
75 | Property reference: #set( $monkey.Blame = $whitehouse.Leak )
76 | Method reference: #set( $monkey.Plan = $spindoctor.weave($web) )
77 | Number literal: #set( $monkey.Number = 123 )
78 | Range operator: #set( $monkey.Numbers = [1..3] )
79 | Object list: #set( $monkey.Say = ["Not", $my, "fault"] )
80 | Object map: #set( $monkey.Map = {"banana" : "good", "roast beef" : "bad"})
81 |
82 | The RHS can also be a simple arithmetic expression, such as:
83 | Addition: #set( $value = $foo + 1 )
84 | Subtraction: #set( $value = $bar - 1 )
85 | Multiplication: #set( $value = $foo * $bar )
86 | Division: #set( $value = $foo / $bar )
87 | Remainder: #set( $value = $foo % $bar )
88 |
89 |
90 |
99 |
100 | MIME types defined: text/velocity
.
101 |
102 |
103 |
104 |
--------------------------------------------------------------------------------
/lib/mode/xml/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: XML mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: XML mode
14 |
15 | <html style="color: green">
16 | <!-- this is a comment -->
17 | <head>
18 | <title>HTML Example</title>
19 | </head>
20 | <body>
21 | The indentation tries to be <em>somewhat "do what
22 | I mean"</em>... but might not match your style.
23 | </body>
24 | </html>
25 |
26 |
32 | The XML mode supports two configuration parameters:
33 |
34 | htmlMode (boolean)
35 | This switches the mode to parse HTML instead of XML. This
36 | means attributes do not have to be quoted, and some elements
37 | (such as br
) do not require a closing tag.
38 | alignCDATA (boolean)
39 | Setting this to true will force the opening tag of CDATA
40 | blocks to not be indented.
41 |
42 |
43 | MIME types defined: application/xml
, text/html
.
44 |
45 |
46 |
--------------------------------------------------------------------------------
/lib/mode/xquery/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (C) 2011 by MarkLogic Corporation
2 | Author: Mike Brevoort
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
--------------------------------------------------------------------------------
/lib/mode/yaml/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: YAML mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: YAML mode
14 |
15 | --- # Favorite movies
16 | - Casablanca
17 | - North by Northwest
18 | - The Man Who Wasn't There
19 | --- # Shopping list
20 | [milk, pumpkin pie, eggs, juice]
21 | --- # Indented Blocks, common in YAML data files, use indentation and new lines to separate the key: value pairs
22 | name: John Smith
23 | age: 33
24 | --- # Inline Blocks, common in YAML data streams, use commas to separate the key: value pairs between braces
25 | {name: John Smith, age: 33}
26 | ---
27 | receipt: Oz-Ware Purchase Invoice
28 | date: 2007-08-06
29 | customer:
30 | given: Dorothy
31 | family: Gale
32 |
33 | items:
34 | - part_no: A4786
35 | descrip: Water Bucket (Filled)
36 | price: 1.47
37 | quantity: 4
38 |
39 | - part_no: E1628
40 | descrip: High Heeled "Ruby" Slippers
41 | size: 8
42 | price: 100.27
43 | quantity: 1
44 |
45 | bill-to: &id001
46 | street: |
47 | 123 Tornado Alley
48 | Suite 16
49 | city: East Centerville
50 | state: KS
51 |
52 | ship-to: *id001
53 |
54 | specialDelivery: >
55 | Follow the Yellow Brick
56 | Road to the Emerald City.
57 | Pay no attention to the
58 | man behind the curtain.
59 | ...
60 |
61 |
64 |
65 | MIME types defined: text/x-yaml
.
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/lib/mode/yaml/yaml.js:
--------------------------------------------------------------------------------
1 | CodeMirror.defineMode("yaml", function() {
2 |
3 | var cons = ['true', 'false', 'on', 'off', 'yes', 'no'];
4 | var keywordRegex = new RegExp("\\b(("+cons.join(")|(")+"))$", 'i');
5 |
6 | return {
7 | token: function(stream, state) {
8 | var ch = stream.peek();
9 | var esc = state.escaped;
10 | state.escaped = false;
11 | /* comments */
12 | if (ch == "#") { stream.skipToEnd(); return "comment"; }
13 | if (state.literal && stream.indentation() > state.keyCol) {
14 | stream.skipToEnd(); return "string";
15 | } else if (state.literal) { state.literal = false; }
16 | if (stream.sol()) {
17 | state.keyCol = 0;
18 | state.pair = false;
19 | state.pairStart = false;
20 | /* document start */
21 | if(stream.match(/---/)) { return "def"; }
22 | /* document end */
23 | if (stream.match(/\.\.\./)) { return "def"; }
24 | /* array list item */
25 | if (stream.match(/\s*-\s+/)) { return 'meta'; }
26 | }
27 | /* pairs (associative arrays) -> key */
28 | if (!state.pair && stream.match(/^\s*([a-z0-9\._-])+(?=\s*:)/i)) {
29 | state.pair = true;
30 | state.keyCol = stream.indentation();
31 | return "atom";
32 | }
33 | if (state.pair && stream.match(/^:\s*/)) { state.pairStart = true; return 'meta'; }
34 |
35 | /* inline pairs/lists */
36 | if (stream.match(/^(\{|\}|\[|\])/)) {
37 | if (ch == '{')
38 | state.inlinePairs++;
39 | else if (ch == '}')
40 | state.inlinePairs--;
41 | else if (ch == '[')
42 | state.inlineList++;
43 | else
44 | state.inlineList--;
45 | return 'meta';
46 | }
47 |
48 | /* list seperator */
49 | if (state.inlineList > 0 && !esc && ch == ',') {
50 | stream.next();
51 | return 'meta';
52 | }
53 | /* pairs seperator */
54 | if (state.inlinePairs > 0 && !esc && ch == ',') {
55 | state.keyCol = 0;
56 | state.pair = false;
57 | state.pairStart = false;
58 | stream.next();
59 | return 'meta';
60 | }
61 |
62 | /* start of value of a pair */
63 | if (state.pairStart) {
64 | /* block literals */
65 | if (stream.match(/^\s*(\||\>)\s*/)) { state.literal = true; return 'meta'; };
66 | /* references */
67 | if (stream.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i)) { return 'variable-2'; }
68 | /* numbers */
69 | if (state.inlinePairs == 0 && stream.match(/^\s*-?[0-9\.\,]+\s?$/)) { return 'number'; }
70 | if (state.inlinePairs > 0 && stream.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/)) { return 'number'; }
71 | /* keywords */
72 | if (stream.match(keywordRegex)) { return 'keyword'; }
73 | }
74 |
75 | /* nothing found, continue */
76 | state.pairStart = false;
77 | state.escaped = (ch == '\\');
78 | stream.next();
79 | return null;
80 | },
81 | startState: function() {
82 | return {
83 | pair: false,
84 | pairStart: false,
85 | keyCol: 0,
86 | inlinePairs: 0,
87 | inlineList: 0,
88 | literal: false,
89 | escaped: false
90 | };
91 | }
92 | };
93 | });
94 |
95 | CodeMirror.defineMIME("text/x-yaml", "yaml");
96 |
--------------------------------------------------------------------------------
/lib/mode/z80/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: Z80 assembly mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: Z80 assembly mode
14 |
15 |
16 | #include "ti83plus.inc"
17 | #define progStart $9D95
18 | .org progStart-2
19 | .db $BB,$6D
20 | bcall(_ClrLCDFull)
21 | ld HL, 0
22 | ld (PenCol), HL
23 | ld HL, Message
24 | bcall(_PutS) ; Displays the string
25 | bcall(_NewLine)
26 | ret
27 | Message:
28 | .db "Hello world!",0
29 |
30 |
31 |
36 |
37 | MIME type defined: text/x-z80
.
38 |
39 |
40 |
--------------------------------------------------------------------------------
/lib/mode/z80/z80.js:
--------------------------------------------------------------------------------
1 | CodeMirror.defineMode('z80', function()
2 | {
3 | var keywords1 = /^(exx?|(ld|cp|in)([di]r?)?|pop|push|ad[cd]|cpl|daa|dec|inc|neg|sbc|sub|and|bit|[cs]cf|x?or|res|set|r[lr]c?a?|r[lr]d|s[lr]a|srl|djnz|nop|rst|[de]i|halt|im|ot[di]r|out[di]?)\b/i;
4 | var keywords2 = /^(call|j[pr]|ret[in]?)\b/i;
5 | var keywords3 = /^b_?(call|jump)\b/i;
6 | var variables1 = /^(af?|bc?|c|de?|e|hl?|l|i[xy]?|r|sp)\b/i;
7 | var variables2 = /^(n?[zc]|p[oe]?|m)\b/i;
8 | var errors = /^([hl][xy]|i[xy][hl]|slia|sll)\b/i;
9 | var numbers = /^([\da-f]+h|[0-7]+o|[01]+b|\d+)\b/i;
10 |
11 | return {startState: function()
12 | {
13 | return {context: 0};
14 | }, token: function(stream, state)
15 | {
16 | if (!stream.column())
17 | state.context = 0;
18 |
19 | if (stream.eatSpace())
20 | return null;
21 |
22 | var w;
23 |
24 | if (stream.eatWhile(/\w/))
25 | {
26 | w = stream.current();
27 |
28 | if (stream.indentation())
29 | {
30 | if (state.context == 1 && variables1.test(w))
31 | return 'variable-2';
32 |
33 | if (state.context == 2 && variables2.test(w))
34 | return 'variable-3';
35 |
36 | if (keywords1.test(w))
37 | {
38 | state.context = 1;
39 | return 'keyword';
40 | }
41 | else if (keywords2.test(w))
42 | {
43 | state.context = 2;
44 | return 'keyword';
45 | }
46 | else if (keywords3.test(w))
47 | {
48 | state.context = 3;
49 | return 'keyword';
50 | }
51 |
52 | if (errors.test(w))
53 | return 'error';
54 | }
55 | else if (numbers.test(w))
56 | {
57 | return 'number';
58 | }
59 | else
60 | {
61 | return null;
62 | }
63 | }
64 | else if (stream.eat(';'))
65 | {
66 | stream.skipToEnd();
67 | return 'comment';
68 | }
69 | else if (stream.eat('"'))
70 | {
71 | while (w = stream.next())
72 | {
73 | if (w == '"')
74 | break;
75 |
76 | if (w == '\\')
77 | stream.next();
78 | }
79 |
80 | return 'string';
81 | }
82 | else if (stream.eat('\''))
83 | {
84 | if (stream.match(/\\?.'/))
85 | return 'number';
86 | }
87 | else if (stream.eat('.') || stream.sol() && stream.eat('#'))
88 | {
89 | state.context = 4;
90 |
91 | if (stream.eatWhile(/\w/))
92 | return 'def';
93 | }
94 | else if (stream.eat('$'))
95 | {
96 | if (stream.eatWhile(/[\da-f]/i))
97 | return 'number';
98 | }
99 | else if (stream.eat('%'))
100 | {
101 | if (stream.eatWhile(/[01]/))
102 | return 'number';
103 | }
104 | else
105 | {
106 | stream.next();
107 | }
108 |
109 | return null;
110 | }};
111 | });
112 |
113 | CodeMirror.defineMIME("text/x-z80", "z80");
114 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "node-svn-webkit",
3 | "description": "Simple svn client",
4 | "version": "0.1.0",
5 | "main": "index.html",
6 | "window": {
7 | "toolbar": false,
8 | "frame": true,
9 | "width": 1000,
10 | "height": 800
11 | },
12 | "dependencies": {
13 | "buffer-encoding": "0.0.1",
14 | "bufferhelper": "^0.2.0",
15 | "date-utils": "*",
16 | "underscore": "*"
17 | }
18 | }
--------------------------------------------------------------------------------
/release/svn.app.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/release/svn.app.zip
--------------------------------------------------------------------------------
/run.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | open -n -a node-webkit ./
--------------------------------------------------------------------------------
/screenshots/changes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/screenshots/changes.png
--------------------------------------------------------------------------------
/screenshots/diff.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/screenshots/diff.png
--------------------------------------------------------------------------------
/screenshots/history.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/screenshots/history.png
--------------------------------------------------------------------------------
/screenshots/repositories.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmathews/node-svn-webkit/15334c2475c279cb839c2620c7d5e9c53affa826/screenshots/repositories.png
--------------------------------------------------------------------------------
/src/router.js:
--------------------------------------------------------------------------------
1 | var EventEmitter = require("events").EventEmitter;
2 | var util = require('util');
3 | var _ = require("underscore");
4 |
5 | var Router = function (app) {
6 | var _this = this;
7 | this.app = app;
8 | this.doPushHistory = true;
9 | };
10 |
11 | util.inherits(Router, EventEmitter);
12 |
13 | var current = -1;
14 | var historyStack = [];
15 | var historySize = 10;
16 |
17 | Router.prototype._pushHistory = function (func, args) {
18 | if (this.doPushHistory) { //simple protection when going back/forward
19 | historyStack.push({
20 | func: func,
21 | args: args || []
22 | });
23 |
24 | //trim to historySize
25 | if (current < historySize - 1) {
26 | current += 1;
27 | historyStack = historyStack.slice(0, current + 1); //clear forwards
28 | } else {
29 | historyStack = _.last(historyStack, historySize);
30 | }
31 | }
32 | this.emit("statechange", current > 0, current < historyStack.length - 1);
33 | };
34 |
35 | Router.prototype._execHistory = function (cur) {
36 | this.doPushHistory = false;
37 | var item = historyStack[cur];
38 | item.func.apply(this, item.args);
39 | this.doPushHistory = true;
40 | };
41 |
42 | Router.prototype.back = function () {
43 | if (current > 0) {
44 | current -= 1;
45 | this._execHistory(current);
46 | }
47 | };
48 |
49 | Router.prototype.forward = function () {
50 | if (current !== historyStack.length - 1) {
51 | current += 1;
52 | this._execHistory(current);
53 | }
54 | };
55 |
56 | Router.prototype.showRepo = function (repo) {
57 | this.app.setRepo(repo);
58 | this._pushHistory(this.showRepo, [repo]);
59 | };
60 |
61 | Router.prototype.showRepositories = function () {
62 | this.app.hideMenu();
63 | this.app.showRepositories();
64 | this._pushHistory(this.showRepositories);
65 | };
66 |
67 | Router.prototype.newRepository = function () {
68 | this.app.hideMenu();
69 | this.app.showNewRepository();
70 | this._pushHistory(this.newRepository);
71 | };
72 |
73 | Router.prototype.openRepository = function (repo) {
74 | this.showHistory();
75 | this._pushHistory(this.openRepository, [repo]);
76 | };
77 |
78 | Router.prototype.editRepository = function (repo) {
79 | this.app.hideMenu();
80 | this.app.editRepository(repo);
81 | this._pushHistory(this.editRepository, [repo]);
82 | };
83 |
84 | Router.prototype.showHistory = function (path, revision) {
85 | this.app.showMenu();
86 | this.app.showHistory(path, revision);
87 | this._pushHistory(this.showHistory, [path, revision]);
88 | this.emit("route:history");
89 | };
90 |
91 | Router.prototype.showDiffExternal = function (path, revision) {
92 | this.app.showMenu();
93 | this.app.showDiffExternal(path, revision);
94 | this._pushHistory(this.showDiffExternal, [path, revision]);
95 | this.emit("route:history");
96 | };
97 |
98 | Router.prototype.showChanges = function () {
99 | this.app.showMenu();
100 | this.app.showChanges();
101 | this._pushHistory(this.showChanges);
102 | this.emit("route:changes");
103 | };
104 |
105 | Router.prototype.showDiffLocal = function (path) {
106 | this.app.showMenu();
107 | this.app.showDiffLocal(path);
108 | this._pushHistory(this.showDiffLocal, [path]);
109 | this.emit("route:changes");
110 | };
111 |
112 | Router.prototype.showSettings = function () {
113 | this.app.hideMenu();
114 | this.app.showSettings();
115 | this._pushHistory(this.showSettings);
116 | };
117 |
118 | Router.prototype.showBrowse = function () {
119 | this.app.showMenu();
120 | this.app.showBrowse();
121 | this._pushHistory(this.showBrowse);
122 | this.emit("route:browse");
123 | };
124 |
125 | Router.prototype.setChangeList = function (changes) {
126 | this.emit("changes", changes);
127 | };
128 |
129 | module.exports = function (app) {
130 | return new Router(app);
131 | };
--------------------------------------------------------------------------------
/src/settingsProvider.js:
--------------------------------------------------------------------------------
1 | var _ = require('underscore');
2 | require('date-utils');
3 | var util = require('util');
4 |
5 | var SettingsProvider = function () { };
6 |
7 | SettingsProvider.prototype.getValue = function (key, def) {
8 | var val = window.localStorage[key];
9 | return val !== undefined ? JSON.parse(val) : def;
10 | };
11 |
12 | SettingsProvider.prototype.setValue = function (key, value) {
13 | return (window.localStorage[key] = JSON.stringify(value));
14 | };
15 |
16 | module.exports = new SettingsProvider();
--------------------------------------------------------------------------------
/src/widget/browse.js:
--------------------------------------------------------------------------------
1 | var _ = require('underscore');
2 | require('date-utils');
3 | var EventEmitter = require("events").EventEmitter;
4 | var util = require('util');
5 | var Popup = require("./popup");
6 | var PropList = require("./proplist");
7 | var pathUtil = require("path");
8 |
9 | var Browse = function (svn) {
10 | this.svn = svn;
11 | var _this = this;
12 | this.domNode = $("");
13 |
14 | var tree = $('
');
15 |
16 | tree.fileTree({ root: svn.repoRoot }, function (path) {
17 | }, function (path, evt) {
18 | _this.handlePathContextMenu(path, evt);
19 | });
20 |
21 | this.domNode.append(tree);
22 | };
23 |
24 | util.inherits(Browse, EventEmitter);
25 |
26 | Browse.prototype.handlePathContextMenu = function (path, evt) {
27 | var _this = this;
28 | var menu = new gui.Menu();
29 |
30 | menu.append(new gui.MenuItem({
31 | label: 'Show History',
32 | click: function () {
33 | var relPath = path.replace(_this.svn.repoRoot, "");
34 | global.App.router.showHistory(relPath);
35 | }
36 | }));
37 |
38 | menu.append(new gui.MenuItem({
39 | label: 'Show Properties',
40 | click: function () {
41 | _this.svn.getProperties(path, function(err, props) {
42 | if (!err) {
43 | var propList = new PropList(props);
44 | new Popup("Properties", null, function (doSave) {
45 | if (doSave) {
46 | var newProps = propList.getProperties();
47 | for (var prop in newProps) {
48 | _this.svn.setProperty(path, prop, newProps[prop]);
49 | }
50 | for (prop in props) {
51 | if (!newProps[prop]) {
52 | _this.svn.setProperty(path, prop, null);
53 | }
54 | }
55 | }
56 | propList.domNode.remove();
57 | }, {
58 | okMessage: "Save",
59 | html: propList.domNode
60 | });
61 | }
62 | });
63 | }
64 | }));
65 |
66 | menu.append(new gui.MenuItem({
67 | type: "separator"
68 | }));
69 |
70 | menu.append(new gui.MenuItem({
71 | label: 'Reveal File',
72 | click: function () {
73 | // Open a file in file explorer.
74 | gui.Shell.showItemInFolder(path);
75 | }
76 | }));
77 |
78 | menu.append(new gui.MenuItem({
79 | label: 'Edit File',
80 | click: function () {
81 | // Open a text file with default text editor.
82 | gui.Shell.openItem(path);
83 | }
84 | }));
85 |
86 | menu.popup(evt.clientX, evt.clientY);
87 | };
88 |
89 | module.exports = function (svn) {
90 | return new Browse(svn);
91 | };
--------------------------------------------------------------------------------
/src/widget/changeItem.js:
--------------------------------------------------------------------------------
1 | var _ = require('underscore');
2 | require('date-utils');
3 | var EventEmitter = require("events").EventEmitter;
4 | var util = require('util');
5 |
6 | var ChangeItem = function (change) {
7 | var status = change.status, path = change.path, checkBox, _this = this;
8 | this.domNode = $("
");
9 | checkBox = this.checkBox = $("
");
10 | this.domNode.append(this.checkBox);
11 | this.domNode.append($("
" + status + " ")[0]);
12 | this.domNode.append($("
" + path + " "));
13 |
14 | checkBox.on('click', function (evt) {
15 | evt.stopPropagation();
16 | });
17 |
18 | this.path = path;
19 |
20 | this.domNode.on('click', function (evt) {
21 | _this.handleChangeClick(evt, path);
22 | });
23 |
24 | this.domNode.on('contextmenu', function (evt) {
25 | _this.handleContextMenu(evt, change);
26 | });
27 | };
28 |
29 | util.inherits(ChangeItem, EventEmitter);
30 |
31 | ChangeItem.prototype.handleChangeClick = function (evt, path) {
32 | this.emit("changeClick", path);
33 | };
34 |
35 | ChangeItem.prototype.handleContextMenu = function (evt, change) {
36 | this.emit("contextMenu", evt, change);
37 | };
38 |
39 | ChangeItem.prototype.setChecked = function (checked) {
40 | this.checkBox[0].checked = checked;
41 | };
42 |
43 | ChangeItem.prototype.getChecked = function (checked) {
44 | return this.checkBox[0].checked;
45 | };
46 |
47 | module.exports = function (change) {
48 | return new ChangeItem(change);
49 | };
--------------------------------------------------------------------------------
/src/widget/diffViewer.js:
--------------------------------------------------------------------------------
1 | var _ = require('underscore');
2 | require('date-utils');
3 | var EventEmitter = require("events").EventEmitter;
4 | var util = require('util');
5 | var SettingsProvider = require('../settingsProvider.js');
6 | var path = require('path');
7 |
8 | var modeMap = {
9 | 'apl': 'apl',
10 | 'ast': 'asterisk',
11 | 'c': 'clike',
12 | 'cpp': 'clike',
13 | 'java': 'clike',
14 | 'cs': 'clike',
15 | 'scaler': 'clike',
16 | 'clj': 'clojure',
17 | 'coffee': 'coffeescript',
18 | 'lisp': 'commonlisp',
19 | 'css': 'css',
20 | 'd': 'd',
21 | 'diff': 'diff',
22 | 'ecl': 'ecl',
23 | 'erlang': 'erlang',
24 | 'gfm': 'gfm',
25 | 'go': 'go',
26 | 'groovy': 'groovy',
27 | 'haskell': 'haskell',
28 | 'asp': 'htmlembedded',
29 | 'html': 'htmlembedded',
30 | 'htm': 'htmlembedded',
31 | 'jsp': 'htmlmixed',
32 | 'http': 'http',
33 | 'js': 'javascript',
34 | 'json': 'javascript',
35 | 'ts': 'javascript',
36 | 'jinja': 'jinja2',
37 | 'less': 'less',
38 | 'lua': 'lua',
39 | 'md': 'markdown',
40 | 'nt': 'ntriples',
41 | 'ocaml': 'ocaml',
42 | 'pascal': 'pascal',
43 | 'ext': 'perl',
44 | 'php': 'php',
45 | 'properties': 'clike',
46 | 'py': 'python',
47 | 'r': 'r',
48 | 'rst': 'rst',
49 | 'rb': 'ruby',
50 | 'rust': 'rust',
51 | 'sass': 'sass',
52 | 'scheme': 'scheme',
53 | 'sh': 'shell',
54 | 'sql': 'sql',
55 | 'vb': 'vb',
56 | 'vbs': 'vbscript',
57 | 'xml': 'xml',
58 | 'xquery': 'xquery',
59 | 'yaml': 'yaml',
60 | 'z80': 'z80'
61 | };
62 |
63 |
64 | var DiffViewer = function () {
65 | this.domNode = $("
");
66 | };
67 |
68 | util.inherits(DiffViewer, EventEmitter);
69 |
70 | DiffViewer.prototype.show = function (ext, file1, file2, editable) {
71 | var mergely = $("
");
72 | this.domNode.append(mergely);
73 |
74 | mergely.mergely({
75 | rhs_cmsettings: {
76 | readOnly: true //editable !== false
77 | },
78 | cmsettings: {
79 | readOnly: true,
80 | lineWrapping: false,
81 | autoresize: false,
82 | theme: SettingsProvider.getValue("editorTheme", "default"),
83 | modeURL: "./lib/mode/%N/%N.js",
84 | mode: modeMap[ext]
85 | },
86 | resize: function () {
87 | var w = $(mergely).parent().width();
88 | var h = $(mergely).parent().height();
89 | var content_width = w / 2.0 - 2 * 8 - 8;
90 | var content_height = h;
91 | var self = $(mergely);
92 | self.find('.mergely-column').css({ 'width': content_width + 'px' });
93 | self.find('.mergely-column, .mergely-canvas, .mergely-margin, .mergely-column textarea, .CodeMirror-scroll, .CodeMirror').css({ 'height': content_height + 'px' });
94 | self.find('.mergely-canvas').css({ 'height': content_height + 'px' });
95 | self.find('.mergely-column textarea').css({ 'width': content_width + 'px' });
96 | self.css({ 'width': w + 'px', 'height': h + 'px' });
97 | if (self.css('display') == 'none') {
98 | if (this.fadein !== false) self.fadeIn(this.fadein);
99 | else self.show();
100 | if (this.loaded) this.loaded();
101 | }
102 | if (this.resized) this.resized();
103 | }
104 | });
105 |
106 | mergely.mergely('lhs', file1);
107 | mergely.mergely('rhs', file2);
108 | };
109 |
110 |
111 |
112 |
113 | module.exports = function () {
114 | return new DiffViewer();
115 | };
--------------------------------------------------------------------------------
/src/widget/framebar.js:
--------------------------------------------------------------------------------
1 | var _ = require('underscore');
2 | var util = require('util');
3 | var EventEmitter = require("events").EventEmitter;
4 | require('date-utils');
5 |
6 | var FrameBar = function () {
7 | var _this = this,
8 | win = gui.Window.get(),
9 | container = $('