aboutsummaryrefslogtreecommitdiff
path: root/imports/codemirror/mode/clike
diff options
context:
space:
mode:
authorValerio Virgillito2012-07-17 11:28:39 -0700
committerValerio Virgillito2012-07-17 11:28:39 -0700
commit4f737b24c19ddc02d20f9783b8b080fc6ef11142 (patch)
tree212d164c0f83d80394e34f1df532ea0461ad328d /imports/codemirror/mode/clike
parent5146f224258929415adf4a8022e492454b4e2476 (diff)
parent0e04fff0ea80fa5cbe96b8354db38bd334aea83a (diff)
downloadninja-4f737b24c19ddc02d20f9783b8b080fc6ef11142.tar.gz
Merge pull request #396 from ananyasen/codemirror2.3-upgrade
upgrade to codemirror 2.3
Diffstat (limited to 'imports/codemirror/mode/clike')
-rw-r--r--imports/codemirror/mode/clike/clike.js39
-rw-r--r--imports/codemirror/mode/clike/scala.html765
2 files changed, 803 insertions, 1 deletions
diff --git a/imports/codemirror/mode/clike/clike.js b/imports/codemirror/mode/clike/clike.js
index 66443fb8..0e7f48b6 100644
--- a/imports/codemirror/mode/clike/clike.js
+++ b/imports/codemirror/mode/clike/clike.js
@@ -21,7 +21,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
21 } 21 }
22 if (/[\[\]{}\(\),;\:\.]/.test(ch)) { 22 if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
23 curPunc = ch; 23 curPunc = ch;
24 return null 24 return null;
25 } 25 }
26 if (/\d/.test(ch)) { 26 if (/\d/.test(ch)) {
27 stream.eatWhile(/[\w\.]/); 27 stream.eatWhile(/[\w\.]/);
@@ -231,4 +231,41 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
231 } 231 }
232 } 232 }
233 }); 233 });
234 CodeMirror.defineMIME("text/x-scala", {
235 name: "clike",
236 keywords: words(
237
238 /* scala */
239 "abstract case catch class def do else extends false final finally for forSome if " +
240 "implicit import lazy match new null object override package private protected return " +
241 "sealed super this throw trait try trye type val var while with yield _ : = => <- <: " +
242 "<% >: # @ " +
243
244 /* package scala */
245 "assert assume require print println printf readLine readBoolean readByte readShort " +
246 "readChar readInt readLong readFloat readDouble " +
247
248 "AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either " +
249 "Enumeration Equiv Error Exception Fractional Function IndexedSeq Integral Iterable " +
250 "Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering " +
251 "Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder " +
252 "StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector :: #:: " +
253
254 /* package java.lang */
255 "Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " +
256 "Compiler Double Exception Float Integer Long Math Number Object Package Pair Process " +
257 "Runtime Runnable SecurityManager Short StackTraceElement StrictMath String " +
258 "StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"
259
260
261 ),
262 blockKeywords: words("catch class do else finally for forSome if match switch try while"),
263 atoms: words("true false null"),
264 hooks: {
265 "@": function(stream, state) {
266 stream.eatWhile(/[\w\$_]/);
267 return "meta";
268 }
269 }
270 });
234}()); 271}());
diff --git a/imports/codemirror/mode/clike/scala.html b/imports/codemirror/mode/clike/scala.html
new file mode 100644
index 00000000..5fdd84ed
--- /dev/null
+++ b/imports/codemirror/mode/clike/scala.html
@@ -0,0 +1,765 @@
1<!doctype html>
2<html>
3 <head>
4 <title>CodeMirror: C-like mode</title>
5 <link rel="stylesheet" href="../../lib/codemirror.css">
6 <link rel="stylesheet" href="../../theme/ambiance.css">
7 <script src="../../lib/codemirror.js"></script>
8 <script src="clike.js"></script>
9 <link rel="stylesheet" href="../../doc/docs.css">
10 <style>
11 body
12 {
13 margin: 0;
14 padding: 0;
15 max-width:inherit;
16 height: 100%;
17 }
18 html, form, .CodeMirror, .CodeMirror-scroll
19 {
20 height: 100%;
21 }
22 </style>
23 </head>
24 <body>
25<form>
26<textarea id="code" name="code">
27
28 /* __ *\
29 ** ________ ___ / / ___ Scala API **
30 ** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL **
31 ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
32 ** /____/\___/_/ |_/____/_/ | | **
33 ** |/ **
34 \* */
35
36 package scala.collection
37
38 import generic._
39 import mutable.{ Builder, ListBuffer }
40 import annotation.{tailrec, migration, bridge}
41 import annotation.unchecked.{ uncheckedVariance => uV }
42 import parallel.ParIterable
43
44 /** A template trait for traversable collections of type `Traversable[A]`.
45 *
46 * $traversableInfo
47 * @define mutability
48 * @define traversableInfo
49 * This is a base trait of all kinds of $mutability Scala collections. It
50 * implements the behavior common to all collections, in terms of a method
51 * `foreach` with signature:
52 * {{{
53 * def foreach[U](f: Elem => U): Unit
54 * }}}
55 * Collection classes mixing in this trait provide a concrete
56 * `foreach` method which traverses all the
57 * elements contained in the collection, applying a given function to each.
58 * They also need to provide a method `newBuilder`
59 * which creates a builder for collections of the same kind.
60 *
61 * A traversable class might or might not have two properties: strictness
62 * and orderedness. Neither is represented as a type.
63 *
64 * The instances of a strict collection class have all their elements
65 * computed before they can be used as values. By contrast, instances of
66 * a non-strict collection class may defer computation of some of their
67 * elements until after the instance is available as a value.
68 * A typical example of a non-strict collection class is a
69 * <a href="../immutable/Stream.html" target="ContentFrame">
70 * `scala.collection.immutable.Stream`</a>.
71 * A more general class of examples are `TraversableViews`.
72 *
73 * If a collection is an instance of an ordered collection class, traversing
74 * its elements with `foreach` will always visit elements in the
75 * same order, even for different runs of the program. If the class is not
76 * ordered, `foreach` can visit elements in different orders for
77 * different runs (but it will keep the same order in the same run).'
78 *
79 * A typical example of a collection class which is not ordered is a
80 * `HashMap` of objects. The traversal order for hash maps will
81 * depend on the hash codes of its elements, and these hash codes might
82 * differ from one run to the next. By contrast, a `LinkedHashMap`
83 * is ordered because it's `foreach` method visits elements in the
84 * order they were inserted into the `HashMap`.
85 *
86 * @author Martin Odersky
87 * @version 2.8
88 * @since 2.8
89 * @tparam A the element type of the collection
90 * @tparam Repr the type of the actual collection containing the elements.
91 *
92 * @define Coll Traversable
93 * @define coll traversable collection
94 */
95 trait TraversableLike[+A, +Repr] extends HasNewBuilder[A, Repr]
96 with FilterMonadic[A, Repr]
97 with TraversableOnce[A]
98 with GenTraversableLike[A, Repr]
99 with Parallelizable[A, ParIterable[A]]
100 {
101 self =>
102
103 import Traversable.breaks._
104
105 /** The type implementing this traversable */
106 protected type Self = Repr
107
108 /** The collection of type $coll underlying this `TraversableLike` object.
109 * By default this is implemented as the `TraversableLike` object itself,
110 * but this can be overridden.
111 */
112 def repr: Repr = this.asInstanceOf[Repr]
113
114 /** The underlying collection seen as an instance of `$Coll`.
115 * By default this is implemented as the current collection object itself,
116 * but this can be overridden.
117 */
118 protected[this] def thisCollection: Traversable[A] = this.asInstanceOf[Traversable[A]]
119
120 /** A conversion from collections of type `Repr` to `$Coll` objects.
121 * By default this is implemented as just a cast, but this can be overridden.
122 */
123 protected[this] def toCollection(repr: Repr): Traversable[A] = repr.asInstanceOf[Traversable[A]]
124
125 /** Creates a new builder for this collection type.
126 */
127 protected[this] def newBuilder: Builder[A, Repr]
128
129 protected[this] def parCombiner = ParIterable.newCombiner[A]
130
131 /** Applies a function `f` to all elements of this $coll.
132 *
133 * Note: this method underlies the implementation of most other bulk operations.
134 * It's important to implement this method in an efficient way.
135 *
136 *
137 * @param f the function that is applied for its side-effect to every element.
138 * The result of function `f` is discarded.
139 *
140 * @tparam U the type parameter describing the result of function `f`.
141 * This result will always be ignored. Typically `U` is `Unit`,
142 * but this is not necessary.
143 *
144 * @usecase def foreach(f: A => Unit): Unit
145 */
146 def foreach[U](f: A => U): Unit
147
148 /** Tests whether this $coll is empty.
149 *
150 * @return `true` if the $coll contain no elements, `false` otherwise.
151 */
152 def isEmpty: Boolean = {
153 var result = true
154 breakable {
155 for (x <- this) {
156 result = false
157 break
158 }
159 }
160 result
161 }
162