Show More
@@ -3,13 +3,13 b'' | |||||
3 | <head> |
|
3 | <head> | |
4 | <meta charset="utf-8"> |
|
4 | <meta charset="utf-8"> | |
5 | <title>CodeMirror: APL mode</title> |
|
5 | <title>CodeMirror: APL mode</title> | |
6 |
<link rel="stylesheet" href="../../doc/docs.css"> |
|
6 | <link rel="stylesheet" href="../../doc/docs.css"> | |
7 |
<link rel="stylesheet" href="../../lib/codemirror.css"> |
|
7 | <link rel="stylesheet" href="../../lib/codemirror.css"> | |
8 | <script src="../../lib/codemirror.js"></script> |
|
8 | <script src="../../lib/codemirror.js"></script> | |
9 | <script src="../../addon/edit/matchbrackets.js"></script> |
|
9 | <script src="../../addon/edit/matchbrackets.js"></script> | |
10 | <script src="apl.js"></script> |
|
10 | <script src="apl.js"></script> | |
11 | <style> |
|
11 | <style> | |
12 |
|
|
12 | .CodeMirror { border: 2px inset #dee; } | |
13 | </style> |
|
13 | </style> | |
14 | </head> |
|
14 | </head> | |
15 | <body> |
|
15 | <body> |
@@ -52,66 +52,66 b' include => stdexten' | |||||
52 | ; |
|
52 | ; | |
53 | ; We start with what to do when a call first comes in. |
|
53 | ; We start with what to do when a call first comes in. | |
54 | ; |
|
54 | ; | |
55 |
exten => s,1,Wait(1) |
|
55 | exten => s,1,Wait(1) ; Wait a second, just for fun | |
56 |
same => n,Answer |
|
56 | same => n,Answer ; Answer the line | |
57 |
same => n,Set(TIMEOUT(digit)=5) |
|
57 | same => n,Set(TIMEOUT(digit)=5) ; Set Digit Timeout to 5 seconds | |
58 |
same => n,Set(TIMEOUT(response)=10) |
|
58 | same => n,Set(TIMEOUT(response)=10) ; Set Response Timeout to 10 seconds | |
59 |
same => n(restart),BackGround(demo-congrats) |
|
59 | same => n(restart),BackGround(demo-congrats) ; Play a congratulatory message | |
60 |
same => n(instruct),BackGround(demo-instruct) |
|
60 | same => n(instruct),BackGround(demo-instruct) ; Play some instructions | |
61 |
same => n,WaitExten |
|
61 | same => n,WaitExten ; Wait for an extension to be dialed. | |
62 |
|
62 | |||
63 |
exten => 2,1,BackGround(demo-moreinfo) |
|
63 | exten => 2,1,BackGround(demo-moreinfo) ; Give some more information. | |
64 | exten => 2,n,Goto(s,instruct) |
|
64 | exten => 2,n,Goto(s,instruct) | |
65 |
|
65 | |||
66 |
exten => 3,1,Set(LANGUAGE()=fr) |
|
66 | exten => 3,1,Set(LANGUAGE()=fr) ; Set language to french | |
67 |
exten => 3,n,Goto(s,restart) |
|
67 | exten => 3,n,Goto(s,restart) ; Start with the congratulations | |
68 |
|
68 | |||
69 | exten => 1000,1,Goto(default,s,1) |
|
69 | exten => 1000,1,Goto(default,s,1) | |
70 | ; |
|
70 | ; | |
71 | ; We also create an example user, 1234, who is on the console and has |
|
71 | ; We also create an example user, 1234, who is on the console and has | |
72 | ; voicemail, etc. |
|
72 | ; voicemail, etc. | |
73 | ; |
|
73 | ; | |
74 |
exten => 1234,1,Playback(transfer,skip) |
|
74 | exten => 1234,1,Playback(transfer,skip) ; "Please hold while..." | |
75 |
|
|
75 | ; (but skip if channel is not up) | |
76 | exten => 1234,n,Gosub(${EXTEN},stdexten(${GLOBAL(CONSOLE)})) |
|
76 | exten => 1234,n,Gosub(${EXTEN},stdexten(${GLOBAL(CONSOLE)})) | |
77 |
exten => 1234,n,Goto(default,s,1) |
|
77 | exten => 1234,n,Goto(default,s,1) ; exited Voicemail | |
78 |
|
78 | |||
79 |
exten => 1235,1,Voicemail(1234,u) |
|
79 | exten => 1235,1,Voicemail(1234,u) ; Right to voicemail | |
80 |
|
80 | |||
81 |
exten => 1236,1,Dial(Console/dsp) |
|
81 | exten => 1236,1,Dial(Console/dsp) ; Ring forever | |
82 |
exten => 1236,n,Voicemail(1234,b) |
|
82 | exten => 1236,n,Voicemail(1234,b) ; Unless busy | |
83 |
|
83 | |||
84 | ; |
|
84 | ; | |
85 | ; # for when they're done with the demo |
|
85 | ; # for when they're done with the demo | |
86 | ; |
|
86 | ; | |
87 |
exten => #,1,Playback(demo-thanks) |
|
87 | exten => #,1,Playback(demo-thanks) ; "Thanks for trying the demo" | |
88 |
exten => #,n,Hangup |
|
88 | exten => #,n,Hangup ; Hang them up. | |
89 |
|
89 | |||
90 | ; |
|
90 | ; | |
91 | ; A timeout and "invalid extension rule" |
|
91 | ; A timeout and "invalid extension rule" | |
92 | ; |
|
92 | ; | |
93 |
exten => t,1,Goto(#,1) |
|
93 | exten => t,1,Goto(#,1) ; If they take too long, give up | |
94 |
exten => i,1,Playback(invalid) |
|
94 | exten => i,1,Playback(invalid) ; "That's not valid, try again" | |
95 |
|
95 | |||
96 | ; |
|
96 | ; | |
97 | ; Create an extension, 500, for dialing the |
|
97 | ; Create an extension, 500, for dialing the | |
98 | ; Asterisk demo. |
|
98 | ; Asterisk demo. | |
99 | ; |
|
99 | ; | |
100 | exten => 500,1,Playback(demo-abouttotry); Let them know what's going on |
|
100 | exten => 500,1,Playback(demo-abouttotry); Let them know what's going on | |
101 |
exten => 500,n,Dial(IAX2/guest@pbx.digium.com/s@default) |
|
101 | exten => 500,n,Dial(IAX2/guest@pbx.digium.com/s@default) ; Call the Asterisk demo | |
102 |
exten => 500,n,Playback(demo-nogo) |
|
102 | exten => 500,n,Playback(demo-nogo) ; Couldn't connect to the demo site | |
103 |
exten => 500,n,Goto(s,6) |
|
103 | exten => 500,n,Goto(s,6) ; Return to the start over message. | |
104 |
|
104 | |||
105 | ; |
|
105 | ; | |
106 | ; Create an extension, 600, for evaluating echo latency. |
|
106 | ; Create an extension, 600, for evaluating echo latency. | |
107 | ; |
|
107 | ; | |
108 |
exten => 600,1,Playback(demo-echotest) |
|
108 | exten => 600,1,Playback(demo-echotest) ; Let them know what's going on | |
109 |
exten => 600,n,Echo |
|
109 | exten => 600,n,Echo ; Do the echo test | |
110 |
exten => 600,n,Playback(demo-echodone) |
|
110 | exten => 600,n,Playback(demo-echodone) ; Let them know it's over | |
111 |
exten => 600,n,Goto(s,6) |
|
111 | exten => 600,n,Goto(s,6) ; Start over | |
112 |
|
112 | |||
113 | ; |
|
113 | ; | |
114 |
; |
|
114 | ; You can use the Macro Page to intercom a individual user | |
115 | exten => 76245,1,Macro(page,SIP/Grandstream1) |
|
115 | exten => 76245,1,Macro(page,SIP/Grandstream1) | |
116 | ; or if your peernames are the same as extensions |
|
116 | ; or if your peernames are the same as extensions | |
117 | exten => _7XXX,1,Macro(page,SIP/${EXTEN}) |
|
117 | exten => _7XXX,1,Macro(page,SIP/${EXTEN}) |
@@ -19,7 +19,7 b'' | |||||
19 | } |
|
19 | } | |
20 | html, form, .CodeMirror, .CodeMirror-scroll |
|
20 | html, form, .CodeMirror, .CodeMirror-scroll | |
21 | { |
|
21 | { | |
22 |
height: 100%; |
|
22 | height: 100%; | |
23 | } |
|
23 | } | |
24 | </style> |
|
24 | </style> | |
25 | </head> |
|
25 | </head> | |
@@ -44,7 +44,7 b'' | |||||
44 | import parallel.ParIterable |
|
44 | import parallel.ParIterable | |
45 |
|
45 | |||
46 | /** A template trait for traversable collections of type `Traversable[A]`. |
|
46 | /** A template trait for traversable collections of type `Traversable[A]`. | |
47 |
* |
|
47 | * | |
48 | * $traversableInfo |
|
48 | * $traversableInfo | |
49 | * @define mutability |
|
49 | * @define mutability | |
50 | * @define traversableInfo |
|
50 | * @define traversableInfo | |
@@ -54,15 +54,15 b'' | |||||
54 | * {{{ |
|
54 | * {{{ | |
55 | * def foreach[U](f: Elem => U): Unit |
|
55 | * def foreach[U](f: Elem => U): Unit | |
56 | * }}} |
|
56 | * }}} | |
57 |
* Collection classes mixing in this trait provide a concrete |
|
57 | * Collection classes mixing in this trait provide a concrete | |
58 | * `foreach` method which traverses all the |
|
58 | * `foreach` method which traverses all the | |
59 | * elements contained in the collection, applying a given function to each. |
|
59 | * elements contained in the collection, applying a given function to each. | |
60 | * They also need to provide a method `newBuilder` |
|
60 | * They also need to provide a method `newBuilder` | |
61 | * which creates a builder for collections of the same kind. |
|
61 | * which creates a builder for collections of the same kind. | |
62 |
* |
|
62 | * | |
63 | * A traversable class might or might not have two properties: strictness |
|
63 | * A traversable class might or might not have two properties: strictness | |
64 | * and orderedness. Neither is represented as a type. |
|
64 | * and orderedness. Neither is represented as a type. | |
65 |
* |
|
65 | * | |
66 | * The instances of a strict collection class have all their elements |
|
66 | * The instances of a strict collection class have all their elements | |
67 | * computed before they can be used as values. By contrast, instances of |
|
67 | * computed before they can be used as values. By contrast, instances of | |
68 | * a non-strict collection class may defer computation of some of their |
|
68 | * a non-strict collection class may defer computation of some of their | |
@@ -71,13 +71,13 b'' | |||||
71 | * <a href="../immutable/Stream.html" target="ContentFrame"> |
|
71 | * <a href="../immutable/Stream.html" target="ContentFrame"> | |
72 | * `scala.collection.immutable.Stream`</a>. |
|
72 | * `scala.collection.immutable.Stream`</a>. | |
73 | * A more general class of examples are `TraversableViews`. |
|
73 | * A more general class of examples are `TraversableViews`. | |
74 |
* |
|
74 | * | |
75 | * If a collection is an instance of an ordered collection class, traversing |
|
75 | * If a collection is an instance of an ordered collection class, traversing | |
76 | * its elements with `foreach` will always visit elements in the |
|
76 | * its elements with `foreach` will always visit elements in the | |
77 | * same order, even for different runs of the program. If the class is not |
|
77 | * same order, even for different runs of the program. If the class is not | |
78 | * ordered, `foreach` can visit elements in different orders for |
|
78 | * ordered, `foreach` can visit elements in different orders for | |
79 | * different runs (but it will keep the same order in the same run).' |
|
79 | * different runs (but it will keep the same order in the same run).' | |
80 |
* |
|
80 | * | |
81 | * A typical example of a collection class which is not ordered is a |
|
81 | * A typical example of a collection class which is not ordered is a | |
82 | * `HashMap` of objects. The traversal order for hash maps will |
|
82 | * `HashMap` of objects. The traversal order for hash maps will | |
83 | * depend on the hash codes of its elements, and these hash codes might |
|
83 | * depend on the hash codes of its elements, and these hash codes might | |
@@ -94,7 +94,7 b'' | |||||
94 | * @define Coll Traversable |
|
94 | * @define Coll Traversable | |
95 | * @define coll traversable collection |
|
95 | * @define coll traversable collection | |
96 | */ |
|
96 | */ | |
97 |
trait TraversableLike[+A, +Repr] extends HasNewBuilder[A, Repr] |
|
97 | trait TraversableLike[+A, +Repr] extends HasNewBuilder[A, Repr] | |
98 | with FilterMonadic[A, Repr] |
|
98 | with FilterMonadic[A, Repr] | |
99 | with TraversableOnce[A] |
|
99 | with TraversableOnce[A] | |
100 | with GenTraversableLike[A, Repr] |
|
100 | with GenTraversableLike[A, Repr] | |
@@ -131,15 +131,15 b'' | |||||
131 | protected[this] def parCombiner = ParIterable.newCombiner[A] |
|
131 | protected[this] def parCombiner = ParIterable.newCombiner[A] | |
132 |
|
132 | |||
133 | /** Applies a function `f` to all elements of this $coll. |
|
133 | /** Applies a function `f` to all elements of this $coll. | |
134 |
* |
|
134 | * | |
135 | * Note: this method underlies the implementation of most other bulk operations. |
|
135 | * Note: this method underlies the implementation of most other bulk operations. | |
136 | * It's important to implement this method in an efficient way. |
|
136 | * It's important to implement this method in an efficient way. | |
137 |
* |
|
137 | * | |
138 | * |
|
138 | * | |
139 | * @param f the function that is applied for its side-effect to every element. |
|
139 | * @param f the function that is applied for its side-effect to every element. | |
140 | * The result of function `f` is discarded. |
|
140 | * The result of function `f` is discarded. | |
141 | * |
|
141 | * | |
142 |
* @tparam U the type parameter describing the result of function `f`. |
|
142 | * @tparam U the type parameter describing the result of function `f`. | |
143 | * This result will always be ignored. Typically `U` is `Unit`, |
|
143 | * This result will always be ignored. Typically `U` is `Unit`, | |
144 | * but this is not necessary. |
|
144 | * but this is not necessary. | |
145 | * |
|
145 | * | |
@@ -167,7 +167,7 b'' | |||||
167 | * such as `Stream`, the predicate returns `true` if all elements have been computed. |
|
167 | * such as `Stream`, the predicate returns `true` if all elements have been computed. | |
168 | * It returns `false` if the stream is not yet evaluated to the end. |
|
168 | * It returns `false` if the stream is not yet evaluated to the end. | |
169 | * |
|
169 | * | |
170 |
* Note: many collection methods will not work on collections of infinite sizes. |
|
170 | * Note: many collection methods will not work on collections of infinite sizes. | |
171 | * |
|
171 | * | |
172 | * @return `true` if this collection is known to have finite size, `false` otherwise. |
|
172 | * @return `true` if this collection is known to have finite size, `false` otherwise. | |
173 | */ |
|
173 | */ | |
@@ -188,16 +188,16 b'' | |||||
188 | /** Concatenates this $coll with the elements of a traversable collection. |
|
188 | /** Concatenates this $coll with the elements of a traversable collection. | |
189 | * It differs from ++ in that the right operand determines the type of the |
|
189 | * It differs from ++ in that the right operand determines the type of the | |
190 | * resulting collection rather than the left one. |
|
190 | * resulting collection rather than the left one. | |
191 |
* |
|
191 | * | |
192 | * @param that the traversable to append. |
|
192 | * @param that the traversable to append. | |
193 |
* @tparam B the element type of the returned collection. |
|
193 | * @tparam B the element type of the returned collection. | |
194 | * @tparam That $thatinfo |
|
194 | * @tparam That $thatinfo | |
195 | * @param bf $bfinfo |
|
195 | * @param bf $bfinfo | |
196 | * @return a new collection of type `That` which contains all elements |
|
196 | * @return a new collection of type `That` which contains all elements | |
197 | * of this $coll followed by all elements of `that`. |
|
197 | * of this $coll followed by all elements of `that`. | |
198 |
* |
|
198 | * | |
199 | * @usecase def ++:[B](that: TraversableOnce[B]): $Coll[B] |
|
199 | * @usecase def ++:[B](that: TraversableOnce[B]): $Coll[B] | |
200 |
* |
|
200 | * | |
201 | * @return a new $coll which contains all elements of this $coll |
|
201 | * @return a new $coll which contains all elements of this $coll | |
202 | * followed by all elements of `that`. |
|
202 | * followed by all elements of `that`. | |
203 | */ |
|
203 | */ | |
@@ -219,7 +219,7 b'' | |||||
219 |
|
219 | |||
220 | def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = { |
|
220 | def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = { | |
221 | val b = bf(repr) |
|
221 | val b = bf(repr) | |
222 |
b.sizeHint(this) |
|
222 | b.sizeHint(this) | |
223 | for (x <- this) b += f(x) |
|
223 | for (x <- this) b += f(x) | |
224 | b.result |
|
224 | b.result | |
225 | } |
|
225 | } | |
@@ -238,7 +238,7 b'' | |||||
238 | */ |
|
238 | */ | |
239 | def filter(p: A => Boolean): Repr = { |
|
239 | def filter(p: A => Boolean): Repr = { | |
240 | val b = newBuilder |
|
240 | val b = newBuilder | |
241 |
for (x <- this) |
|
241 | for (x <- this) | |
242 | if (p(x)) b += x |
|
242 | if (p(x)) b += x | |
243 | b.result |
|
243 | b.result | |
244 | } |
|
244 | } | |
@@ -269,14 +269,14 b'' | |||||
269 | * The order of the elements is preserved. |
|
269 | * The order of the elements is preserved. | |
270 | * |
|
270 | * | |
271 | * @usecase def filterMap[B](f: A => Option[B]): $Coll[B] |
|
271 | * @usecase def filterMap[B](f: A => Option[B]): $Coll[B] | |
272 |
* |
|
272 | * | |
273 | * @param pf the partial function which filters and maps the $coll. |
|
273 | * @param pf the partial function which filters and maps the $coll. | |
274 | * @return a new $coll resulting from applying the given option-valued function |
|
274 | * @return a new $coll resulting from applying the given option-valued function | |
275 | * `f` to each element and collecting all defined results. |
|
275 | * `f` to each element and collecting all defined results. | |
276 | * The order of the elements is preserved. |
|
276 | * The order of the elements is preserved. | |
277 | def filterMap[B, That](f: A => Option[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = { |
|
277 | def filterMap[B, That](f: A => Option[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = { | |
278 | val b = bf(repr) |
|
278 | val b = bf(repr) | |
279 |
for (x <- this) |
|
279 | for (x <- this) | |
280 | f(x) match { |
|
280 | f(x) match { | |
281 | case Some(y) => b += y |
|
281 | case Some(y) => b += y | |
282 | case _ => |
|
282 | case _ => | |
@@ -288,7 +288,7 b'' | |||||
288 | /** Partitions this $coll in two ${coll}s according to a predicate. |
|
288 | /** Partitions this $coll in two ${coll}s according to a predicate. | |
289 | * |
|
289 | * | |
290 | * @param p the predicate on which to partition. |
|
290 | * @param p the predicate on which to partition. | |
291 |
* @return a pair of ${coll}s: the first $coll consists of all elements that |
|
291 | * @return a pair of ${coll}s: the first $coll consists of all elements that | |
292 | * satisfy the predicate `p` and the second $coll consists of all elements |
|
292 | * satisfy the predicate `p` and the second $coll consists of all elements | |
293 | * that don't. The relative order of the elements in the resulting ${coll}s |
|
293 | * that don't. The relative order of the elements in the resulting ${coll}s | |
294 | * is the same as in the original $coll. |
|
294 | * is the same as in the original $coll. | |
@@ -348,7 +348,7 b'' | |||||
348 | } |
|
348 | } | |
349 |
|
349 | |||
350 | /** Finds the first element of the $coll satisfying a predicate, if any. |
|
350 | /** Finds the first element of the $coll satisfying a predicate, if any. | |
351 |
* |
|
351 | * | |
352 | * $mayNotTerminateInf |
|
352 | * $mayNotTerminateInf | |
353 | * $orderDependent |
|
353 | * $orderDependent | |
354 | * |
|
354 | * | |
@@ -419,7 +419,7 b'' | |||||
419 | * @return a $coll consisting of all elements of this $coll |
|
419 | * @return a $coll consisting of all elements of this $coll | |
420 | * except the first one. |
|
420 | * except the first one. | |
421 | * @throws `UnsupportedOperationException` if the $coll is empty. |
|
421 | * @throws `UnsupportedOperationException` if the $coll is empty. | |
422 |
*/ |
|
422 | */ | |
423 | override def tail: Repr = { |
|
423 | override def tail: Repr = { | |
424 | if (isEmpty) throw new UnsupportedOperationException("empty.tail") |
|
424 | if (isEmpty) throw new UnsupportedOperationException("empty.tail") | |
425 | drop(1) |
|
425 | drop(1) | |
@@ -465,7 +465,7 b'' | |||||
465 |
|
465 | |||
466 | def take(n: Int): Repr = slice(0, n) |
|
466 | def take(n: Int): Repr = slice(0, n) | |
467 |
|
467 | |||
468 |
def drop(n: Int): Repr = |
|
468 | def drop(n: Int): Repr = | |
469 | if (n <= 0) { |
|
469 | if (n <= 0) { | |
470 | val b = newBuilder |
|
470 | val b = newBuilder | |
471 | b.sizeHint(this) |
|
471 | b.sizeHint(this) | |
@@ -501,7 +501,7 b'' | |||||
501 | val b = newBuilder |
|
501 | val b = newBuilder | |
502 | if (until <= from) b.result |
|
502 | if (until <= from) b.result | |
503 | else { |
|
503 | else { | |
504 |
b.sizeHintBounded(until - from, this) |
|
504 | b.sizeHintBounded(until - from, this) | |
505 | sliceInternal(from, until, b) |
|
505 | sliceInternal(from, until, b) | |
506 | } |
|
506 | } | |
507 | } |
|
507 | } | |
@@ -555,7 +555,7 b'' | |||||
555 | * |
|
555 | * | |
556 | * @return an iterator over all the tails of this $coll |
|
556 | * @return an iterator over all the tails of this $coll | |
557 | * @example `List(1,2,3).tails = Iterator(List(1,2,3), List(2,3), List(3), Nil)` |
|
557 | * @example `List(1,2,3).tails = Iterator(List(1,2,3), List(2,3), List(3), Nil)` | |
558 |
*/ |
|
558 | */ | |
559 | def tails: Iterator[Repr] = iterateUntilEmpty(_.tail) |
|
559 | def tails: Iterator[Repr] = iterateUntilEmpty(_.tail) | |
560 |
|
560 | |||
561 | /** Iterates over the inits of this $coll. The first value will be this |
|
561 | /** Iterates over the inits of this $coll. The first value will be this | |
@@ -574,12 +574,12 b'' | |||||
574 | * or the end of the array is reached, or `len` elements have been copied. |
|
574 | * or the end of the array is reached, or `len` elements have been copied. | |
575 | * |
|
575 | * | |
576 | * $willNotTerminateInf |
|
576 | * $willNotTerminateInf | |
577 |
* |
|
577 | * | |
578 | * @param xs the array to fill. |
|
578 | * @param xs the array to fill. | |
579 | * @param start the starting index. |
|
579 | * @param start the starting index. | |
580 | * @param len the maximal number of elements to copy. |
|
580 | * @param len the maximal number of elements to copy. | |
581 |
* @tparam B the type of the elements of the array. |
|
581 | * @tparam B the type of the elements of the array. | |
582 |
* |
|
582 | * | |
583 | * |
|
583 | * | |
584 | * @usecase def copyToArray(xs: Array[A], start: Int, len: Int): Unit |
|
584 | * @usecase def copyToArray(xs: Array[A], start: Int, len: Int): Unit | |
585 | */ |
|
585 | */ | |
@@ -623,7 +623,7 b'' | |||||
623 | } |
|
623 | } | |
624 |
|
624 | |||
625 | /** Creates a non-strict view of this $coll. |
|
625 | /** Creates a non-strict view of this $coll. | |
626 |
* |
|
626 | * | |
627 | * @return a non-strict view of this $coll. |
|
627 | * @return a non-strict view of this $coll. | |
628 | */ |
|
628 | */ | |
629 | def view = new TraversableView[A, Repr] { |
|
629 | def view = new TraversableView[A, Repr] { | |
@@ -635,10 +635,10 b'' | |||||
635 | * |
|
635 | * | |
636 | * Note: the difference between `view` and `slice` is that `view` produces |
|
636 | * Note: the difference between `view` and `slice` is that `view` produces | |
637 | * a view of the current $coll, whereas `slice` produces a new $coll. |
|
637 | * a view of the current $coll, whereas `slice` produces a new $coll. | |
638 |
* |
|
638 | * | |
639 | * Note: `view(from, to)` is equivalent to `view.slice(from, to)` |
|
639 | * Note: `view(from, to)` is equivalent to `view.slice(from, to)` | |
640 | * $orderDependent |
|
640 | * $orderDependent | |
641 |
* |
|
641 | * | |
642 | * @param from the index of the first element of the view |
|
642 | * @param from the index of the first element of the view | |
643 | * @param until the index of the element following the view |
|
643 | * @param until the index of the element following the view | |
644 | * @return a non-strict view of a slice of this $coll, starting at index `from` |
|
644 | * @return a non-strict view of a slice of this $coll, starting at index `from` | |
@@ -653,7 +653,7 b'' | |||||
653 | * restricts the domain of subsequent `map`, `flatMap`, `foreach`, |
|
653 | * restricts the domain of subsequent `map`, `flatMap`, `foreach`, | |
654 | * and `withFilter` operations. |
|
654 | * and `withFilter` operations. | |
655 | * $orderDependent |
|
655 | * $orderDependent | |
656 |
* |
|
656 | * | |
657 | * @param p the predicate used to test elements. |
|
657 | * @param p the predicate used to test elements. | |
658 | * @return an object of class `WithFilter`, which supports |
|
658 | * @return an object of class `WithFilter`, which supports | |
659 | * `map`, `flatMap`, `foreach`, and `withFilter` operations. |
|
659 | * `map`, `flatMap`, `foreach`, and `withFilter` operations. | |
@@ -678,22 +678,22 b'' | |||||
678 | * the given function `f` to each element of the outer $coll |
|
678 | * the given function `f` to each element of the outer $coll | |
679 | * that satisfies predicate `p` and collecting the results. |
|
679 | * that satisfies predicate `p` and collecting the results. | |
680 | * |
|
680 | * | |
681 |
* @usecase def map[B](f: A => B): $Coll[B] |
|
681 | * @usecase def map[B](f: A => B): $Coll[B] | |
682 |
* |
|
682 | * | |
683 | * @return a new $coll resulting from applying the given function |
|
683 | * @return a new $coll resulting from applying the given function | |
684 | * `f` to each element of the outer $coll that satisfies |
|
684 | * `f` to each element of the outer $coll that satisfies | |
685 | * predicate `p` and collecting the results. |
|
685 | * predicate `p` and collecting the results. | |
686 | */ |
|
686 | */ | |
687 | def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = { |
|
687 | def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = { | |
688 | val b = bf(repr) |
|
688 | val b = bf(repr) | |
689 |
for (x <- self) |
|
689 | for (x <- self) | |
690 | if (p(x)) b += f(x) |
|
690 | if (p(x)) b += f(x) | |
691 | b.result |
|
691 | b.result | |
692 | } |
|
692 | } | |
693 |
|
693 | |||
694 | /** Builds a new collection by applying a function to all elements of the |
|
694 | /** Builds a new collection by applying a function to all elements of the | |
695 | * outer $coll containing this `WithFilter` instance that satisfy |
|
695 | * outer $coll containing this `WithFilter` instance that satisfy | |
696 |
* predicate `p` and concatenating the results. |
|
696 | * predicate `p` and concatenating the results. | |
697 | * |
|
697 | * | |
698 | * @param f the function to apply to each element. |
|
698 | * @param f the function to apply to each element. | |
699 | * @tparam B the element type of the returned collection. |
|
699 | * @tparam B the element type of the returned collection. | |
@@ -705,13 +705,13 b'' | |||||
705 | * concatenating the results. |
|
705 | * concatenating the results. | |
706 | * |
|
706 | * | |
707 | * @usecase def flatMap[B](f: A => TraversableOnce[B]): $Coll[B] |
|
707 | * @usecase def flatMap[B](f: A => TraversableOnce[B]): $Coll[B] | |
708 |
* |
|
708 | * | |
709 | * @return a new $coll resulting from applying the given collection-valued function |
|
709 | * @return a new $coll resulting from applying the given collection-valued function | |
710 | * `f` to each element of the outer $coll that satisfies predicate `p` and concatenating the results. |
|
710 | * `f` to each element of the outer $coll that satisfies predicate `p` and concatenating the results. | |
711 | */ |
|
711 | */ | |
712 | def flatMap[B, That](f: A => GenTraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = { |
|
712 | def flatMap[B, That](f: A => GenTraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = { | |
713 | val b = bf(repr) |
|
713 | val b = bf(repr) | |
714 |
for (x <- self) |
|
714 | for (x <- self) | |
715 | if (p(x)) b ++= f(x).seq |
|
715 | if (p(x)) b ++= f(x).seq | |
716 | b.result |
|
716 | b.result | |
717 | } |
|
717 | } | |
@@ -721,15 +721,15 b'' | |||||
721 | * |
|
721 | * | |
722 | * @param f the function that is applied for its side-effect to every element. |
|
722 | * @param f the function that is applied for its side-effect to every element. | |
723 | * The result of function `f` is discarded. |
|
723 | * The result of function `f` is discarded. | |
724 | * |
|
724 | * | |
725 |
* @tparam U the type parameter describing the result of function `f`. |
|
725 | * @tparam U the type parameter describing the result of function `f`. | |
726 | * This result will always be ignored. Typically `U` is `Unit`, |
|
726 | * This result will always be ignored. Typically `U` is `Unit`, | |
727 | * but this is not necessary. |
|
727 | * but this is not necessary. | |
728 | * |
|
728 | * | |
729 | * @usecase def foreach(f: A => Unit): Unit |
|
729 | * @usecase def foreach(f: A => Unit): Unit | |
730 |
*/ |
|
730 | */ | |
731 |
def foreach[U](f: A => U): Unit = |
|
731 | def foreach[U](f: A => U): Unit = | |
732 |
for (x <- self) |
|
732 | for (x <- self) | |
733 | if (p(x)) f(x) |
|
733 | if (p(x)) f(x) | |
734 |
|
734 | |||
735 | /** Further refines the filter for this $coll. |
|
735 | /** Further refines the filter for this $coll. | |
@@ -740,7 +740,7 b'' | |||||
740 | * All these operations apply to those elements of this $coll which |
|
740 | * All these operations apply to those elements of this $coll which | |
741 | * satisfy the predicate `q` in addition to the predicate `p`. |
|
741 | * satisfy the predicate `q` in addition to the predicate `p`. | |
742 | */ |
|
742 | */ | |
743 |
def withFilter(q: A => Boolean): WithFilter = |
|
743 | def withFilter(q: A => Boolean): WithFilter = | |
744 | new WithFilter(x => p(x) && q(x)) |
|
744 | new WithFilter(x => p(x) && q(x)) | |
745 | } |
|
745 | } | |
746 |
|
746 |
@@ -83,7 +83,7 b'' | |||||
83 | 12345678911234567892123456789312345678941234567895123456789612345678971234567898 |
|
83 | 12345678911234567892123456789312345678941234567895123456789612345678971234567898 | |
84 | 000010 IDENTIFICATION DIVISION. MODTGHERE |
|
84 | 000010 IDENTIFICATION DIVISION. MODTGHERE | |
85 | 000020 PROGRAM-ID. SAMPLE. |
|
85 | 000020 PROGRAM-ID. SAMPLE. | |
86 |
000030 AUTHOR. TEST SAM. |
|
86 | 000030 AUTHOR. TEST SAM. | |
87 | 000040 DATE-WRITTEN. 5 February 2013 |
|
87 | 000040 DATE-WRITTEN. 5 February 2013 | |
88 | 000041 |
|
88 | 000041 | |
89 | 000042* A sample program just to show the form. |
|
89 | 000042* A sample program just to show the form. | |
@@ -119,12 +119,12 b' 000280 01 DETAIL-LINE.' | |||||
119 | 000290 05 FILLER PIC X(7) VALUE SPACES. |
|
119 | 000290 05 FILLER PIC X(7) VALUE SPACES. | |
120 | 000300 05 RECORD-IMAGE PIC X(43). |
|
120 | 000300 05 RECORD-IMAGE PIC X(43). | |
121 | 000310 05 FILLER PIC X(30) VALUE SPACES. |
|
121 | 000310 05 FILLER PIC X(30) VALUE SPACES. | |
122 |
000311 |
|
122 | 000311 | |
123 | 000312 01 SUMMARY-LINE. |
|
123 | 000312 01 SUMMARY-LINE. | |
124 | 000313 05 FILLER PIC X(7) VALUE SPACES. |
|
124 | 000313 05 FILLER PIC X(7) VALUE SPACES. | |
125 | 000314 05 TOTAL-READ PIC 99. |
|
125 | 000314 05 TOTAL-READ PIC 99. | |
126 | 000315 05 FILLER PIC X VALUE SPACE. |
|
126 | 000315 05 FILLER PIC X VALUE SPACE. | |
127 |
000316 05 FILLER PIC X(17) |
|
127 | 000316 05 FILLER PIC X(17) | |
128 | 000317 VALUE 'Records were read'. |
|
128 | 000317 VALUE 'Records were read'. | |
129 | 000318 05 FILLER PIC X(53) VALUE SPACES. |
|
129 | 000318 05 FILLER PIC X(53) VALUE SPACES. | |
130 | 000319 |
|
130 | 000319 | |
@@ -151,12 +151,12 b' 000490 WRITE PRINT-LINE.' | |||||
151 | 000500 ADD 1 TO RECORDS-WRITTEN. |
|
151 | 000500 ADD 1 TO RECORDS-WRITTEN. | |
152 | 000510 READ STUDENT-FILE |
|
152 | 000510 READ STUDENT-FILE | |
153 | 000520 AT END MOVE 'NO' TO DATA-REMAINS-SWITCH |
|
153 | 000520 AT END MOVE 'NO' TO DATA-REMAINS-SWITCH | |
154 |
000530 END-READ. |
|
154 | 000530 END-READ. | |
155 | 000540 |
|
155 | 000540 | |
156 | 000550 PRINT-SUMMARY. |
|
156 | 000550 PRINT-SUMMARY. | |
157 | 000560 MOVE RECORDS-WRITTEN TO TOTAL-READ. |
|
157 | 000560 MOVE RECORDS-WRITTEN TO TOTAL-READ. | |
158 | 000570 MOVE SUMMARY-LINE TO PRINT-LINE. |
|
158 | 000570 MOVE SUMMARY-LINE TO PRINT-LINE. | |
159 |
000571 WRITE PRINT-LINE. |
|
159 | 000571 WRITE PRINT-LINE. | |
160 | 000572 |
|
160 | 000572 | |
161 | 000580 |
|
161 | 000580 | |
162 | </textarea> |
|
162 | </textarea> | |
@@ -167,7 +167,7 b' 000580' | |||||
167 | mode: "text/x-cobol", |
|
167 | mode: "text/x-cobol", | |
168 | theme : "twilight", |
|
168 | theme : "twilight", | |
169 | styleActiveLine: true, |
|
169 | styleActiveLine: true, | |
170 |
showCursorWhenSelecting : true, |
|
170 | showCursorWhenSelecting : true, | |
171 | }); |
|
171 | }); | |
172 | function selectTheme() { |
|
172 | function selectTheme() { | |
173 | var themeInput = document.getElementById("selectTheme"); |
|
173 | var themeInput = document.getElementById("selectTheme"); |
@@ -16,10 +16,10 b'' | |||||
16 | # Copyright (c) 2011 Jeff Pickhardt, released under |
|
16 | # Copyright (c) 2011 Jeff Pickhardt, released under | |
17 | # the MIT License. |
|
17 | # the MIT License. | |
18 | # |
|
18 | # | |
19 |
# Modified from the Python CodeMirror mode, which also is |
|
19 | # Modified from the Python CodeMirror mode, which also is | |
20 | # under the MIT License Copyright (c) 2010 Timothy Farrell. |
|
20 | # under the MIT License Copyright (c) 2010 Timothy Farrell. | |
21 | # |
|
21 | # | |
22 |
# The following script, Underscore.coffee, is used to |
|
22 | # The following script, Underscore.coffee, is used to | |
23 | # demonstrate CoffeeScript mode for CodeMirror. |
|
23 | # demonstrate CoffeeScript mode for CodeMirror. | |
24 | # |
|
24 | # | |
25 | # To download CoffeeScript mode for CodeMirror, go to: |
|
25 | # To download CoffeeScript mode for CodeMirror, go to: |
@@ -38,21 +38,21 b' index 04646a9..9a39cc7 100644' | |||||
38 | +++ b/lib/codemirror.js |
|
38 | +++ b/lib/codemirror.js | |
39 | @@ -399,10 +399,16 @@ var CodeMirror = (function() { |
|
39 | @@ -399,10 +399,16 @@ var CodeMirror = (function() { | |
40 | } |
|
40 | } | |
41 |
|
41 | |||
42 | function onMouseDown(e) { |
|
42 | function onMouseDown(e) { | |
43 |
- var start = posFromMouse(e), last = start; |
|
43 | - var start = posFromMouse(e), last = start; | |
44 | + var start = posFromMouse(e), last = start, target = e.target(); |
|
44 | + var start = posFromMouse(e), last = start, target = e.target(); | |
45 | if (!start) return; |
|
45 | if (!start) return; | |
46 | setCursor(start.line, start.ch, false); |
|
46 | setCursor(start.line, start.ch, false); | |
47 | if (e.button() != 1) return; |
|
47 | if (e.button() != 1) return; | |
48 |
+ if (target.parentNode == gutter) { |
|
48 | + if (target.parentNode == gutter) { | |
49 | + if (options.onGutterClick) |
|
49 | + if (options.onGutterClick) | |
50 | + options.onGutterClick(indexOf(gutter.childNodes, target) + showingFrom); |
|
50 | + options.onGutterClick(indexOf(gutter.childNodes, target) + showingFrom); | |
51 | + return; |
|
51 | + return; | |
52 | + } |
|
52 | + } | |
53 | + |
|
53 | + | |
54 | if (!focused) onFocus(); |
|
54 | if (!focused) onFocus(); | |
55 |
|
55 | |||
56 | e.stop(); |
|
56 | e.stop(); | |
57 | @@ -808,7 +814,7 @@ var CodeMirror = (function() { |
|
57 | @@ -808,7 +814,7 @@ var CodeMirror = (function() { | |
58 | for (var i = showingFrom; i < showingTo; ++i) { |
|
58 | for (var i = showingFrom; i < showingTo; ++i) { | |
@@ -78,7 +78,7 b' index 04646a9..9a39cc7 100644' | |||||
78 | undo: operation(undo), |
|
78 | undo: operation(undo), | |
79 | @@ -1402,7 +1406,8 @@ var CodeMirror = (function() { |
|
79 | @@ -1402,7 +1406,8 @@ var CodeMirror = (function() { | |
80 | replaceRange: operation(replaceRange), |
|
80 | replaceRange: operation(replaceRange), | |
81 |
|
81 | |||
82 | operation: function(f){return operation(f)();}, |
|
82 | operation: function(f){return operation(f)();}, | |
83 | - refresh: function(){updateDisplay([{from: 0, to: lines.length}]);} |
|
83 | - refresh: function(){updateDisplay([{from: 0, to: lines.length}]);} | |
84 | + refresh: function(){updateDisplay([{from: 0, to: lines.length}]);}, |
|
84 | + refresh: function(){updateDisplay([{from: 0, to: lines.length}]);}, |
@@ -19,7 +19,7 b' this is a multiline comment!' | |||||
19 | // this is a singleline comment! |
|
19 | // this is a singleline comment! | |
20 |
|
20 | |||
21 | import ut; |
|
21 | import ut; | |
22 |
r := |
|
22 | r := | |
23 | record |
|
23 | record | |
24 | string22 s1 := '123'; |
|
24 | string22 s1 := '123'; | |
25 | integer4 i1 := 123; |
|
25 | integer4 i1 := 123; |
@@ -32,7 +32,7 b'' | |||||
32 | rec_info(demo) -> record_info(fields,demo). |
|
32 | rec_info(demo) -> record_info(fields,demo). | |
33 |
|
33 | |||
34 | demo() -> expand_recs(?MODULE,#demo{a="A",b="BB"}). |
|
34 | demo() -> expand_recs(?MODULE,#demo{a="A",b="BB"}). | |
35 |
|
35 | |||
36 | expand_recs(M,List) when is_list(List) -> |
|
36 | expand_recs(M,List) when is_list(List) -> | |
37 | [expand_recs(M,L)||L<-List]; |
|
37 | [expand_recs(M,L)||L<-List]; | |
38 | expand_recs(M,Tup) when is_tuple(Tup) -> |
|
38 | expand_recs(M,Tup) when is_tuple(Tup) -> |
@@ -17,7 +17,7 b'' | |||||
17 | .syntax unified |
|
17 | .syntax unified | |
18 | .global main |
|
18 | .global main | |
19 |
|
19 | |||
20 |
/* |
|
20 | /* | |
21 | * A |
|
21 | * A | |
22 | * multi-line |
|
22 | * multi-line | |
23 | * comment. |
|
23 | * comment. |
@@ -9,13 +9,13 b'' | |||||
9 | <script src="../xml/xml.js"></script> |
|
9 | <script src="../xml/xml.js"></script> | |
10 | <script src="../markdown/markdown.js"></script> |
|
10 | <script src="../markdown/markdown.js"></script> | |
11 | <script src="gfm.js"></script> |
|
11 | <script src="gfm.js"></script> | |
12 |
|
12 | |||
13 | <!-- Code block highlighting modes --> |
|
13 | <!-- Code block highlighting modes --> | |
14 | <script src="../javascript/javascript.js"></script> |
|
14 | <script src="../javascript/javascript.js"></script> | |
15 | <script src="../css/css.js"></script> |
|
15 | <script src="../css/css.js"></script> | |
16 | <script src="../htmlmixed/htmlmixed.js"></script> |
|
16 | <script src="../htmlmixed/htmlmixed.js"></script> | |
17 | <script src="../clike/clike.js"></script> |
|
17 | <script src="../clike/clike.js"></script> | |
18 |
|
18 | |||
19 | <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style> |
|
19 | <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style> | |
20 | <link rel="stylesheet" href="../../doc/docs.css"> |
|
20 | <link rel="stylesheet" href="../../doc/docs.css"> | |
21 | </head> |
|
21 | </head> |
@@ -25,36 +25,36 b' import "fmt"' | |||||
25 |
|
25 | |||
26 | // Send the sequence 2, 3, 4, ... to channel 'ch'. |
|
26 | // Send the sequence 2, 3, 4, ... to channel 'ch'. | |
27 | func generate(ch chan<- int) { |
|
27 | func generate(ch chan<- int) { | |
28 |
|
|
28 | for i := 2; ; i++ { | |
29 |
|
|
29 | ch <- i // Send 'i' to channel 'ch' | |
30 | } |
|
30 | } | |
31 | } |
|
31 | } | |
32 |
|
32 | |||
33 | // Copy the values from channel 'src' to channel 'dst', |
|
33 | // Copy the values from channel 'src' to channel 'dst', | |
34 | // removing those divisible by 'prime'. |
|
34 | // removing those divisible by 'prime'. | |
35 | func filter(src <-chan int, dst chan<- int, prime int) { |
|
35 | func filter(src <-chan int, dst chan<- int, prime int) { | |
36 |
|
|
36 | for i := range src { // Loop over values received from 'src'. | |
37 |
|
|
37 | if i%prime != 0 { | |
38 |
|
|
38 | dst <- i // Send 'i' to channel 'dst'. | |
39 | } |
|
39 | } | |
40 | } |
|
40 | } | |
41 | } |
|
41 | } | |
42 |
|
42 | |||
43 | // The prime sieve: Daisy-chain filter processes together. |
|
43 | // The prime sieve: Daisy-chain filter processes together. | |
44 | func sieve() { |
|
44 | func sieve() { | |
45 |
|
|
45 | ch := make(chan int) // Create a new channel. | |
46 |
|
|
46 | go generate(ch) // Start generate() as a subprocess. | |
47 |
|
|
47 | for { | |
48 |
|
|
48 | prime := <-ch | |
49 |
|
|
49 | fmt.Print(prime, "\n") | |
50 |
|
|
50 | ch1 := make(chan int) | |
51 |
|
|
51 | go filter(ch, ch1, prime) | |
52 |
|
|
52 | ch = ch1 | |
53 | } |
|
53 | } | |
54 | } |
|
54 | } | |
55 |
|
55 | |||
56 | func main() { |
|
56 | func main() { | |
57 |
|
|
57 | sieve() | |
58 | } |
|
58 | } | |
59 | </textarea></form> |
|
59 | </textarea></form> | |
60 |
|
60 |
@@ -44,7 +44,7 b' permBag bs = concatMap (\\(f,cs) -> map (' | |||||
44 | oneOfEach (an@(a,n):bs) = |
|
44 | oneOfEach (an@(a,n):bs) = | |
45 | let bs' = if n == 1 then bs else (a,n-1):bs |
|
45 | let bs' = if n == 1 then bs else (a,n-1):bs | |
46 | in (a,bs') : mapSnd (an:) (oneOfEach bs) |
|
46 | in (a,bs') : mapSnd (an:) (oneOfEach bs) | |
47 |
|
47 | |||
48 | apSnd f (a,b) = (a, f b) |
|
48 | apSnd f (a,b) = (a, f b) | |
49 | mapSnd = map . apSnd |
|
49 | mapSnd = map . apSnd | |
50 | </textarea></form> |
|
50 | </textarea></form> |
@@ -18,62 +18,62 b' import one.two.Three;' | |||||
18 | @attr("test") |
|
18 | @attr("test") | |
19 | class Foo<T> extends Three |
|
19 | class Foo<T> extends Three | |
20 | { |
|
20 | { | |
21 |
|
|
21 | public function new() | |
22 | { |
|
22 | { | |
23 |
|
|
23 | noFoo = 12; | |
24 | } |
|
24 | } | |
25 |
|
25 | |||
26 |
|
|
26 | public static inline function doFoo(obj:{k:Int, l:Float}):Int | |
27 | { |
|
27 | { | |
28 |
|
|
28 | for(i in 0...10) | |
29 | { |
|
29 | { | |
30 | obj.k++; |
|
30 | obj.k++; | |
31 | trace(i); |
|
31 | trace(i); | |
32 |
|
|
32 | var var1 = new Array(); | |
33 |
|
|
33 | if(var1.length > 1) | |
34 | throw "Error"; |
|
34 | throw "Error"; | |
35 | } |
|
35 | } | |
36 |
|
|
36 | // The following line should not be colored, the variable is scoped out | |
37 | var1; |
|
37 | var1; | |
38 |
|
|
38 | /* Multi line | |
39 |
|
|
39 | * Comment test | |
40 | */ |
|
40 | */ | |
41 |
|
|
41 | return obj.k; | |
42 | } |
|
42 | } | |
43 |
|
|
43 | private function bar():Void | |
44 | { |
|
44 | { | |
45 |
|
|
45 | #if flash | |
46 |
|
|
46 | var t1:String = "1.21"; | |
47 | #end |
|
47 | #end | |
48 | try { |
|
48 | try { | |
49 |
|
|
49 | doFoo({k:3, l:1.2}); | |
50 | } |
|
50 | } | |
51 |
|
|
51 | catch (e : String) { | |
52 | trace(e); |
|
52 | trace(e); | |
53 | } |
|
53 | } | |
54 |
|
|
54 | var t2:Float = cast(3.2); | |
55 |
|
|
55 | var t3:haxe.Timer = new haxe.Timer(); | |
56 |
|
|
56 | var t4 = {k:Std.int(t2), l:Std.parseFloat(t1)}; | |
57 |
|
|
57 | var t5 = ~/123+.*$/i; | |
58 |
|
|
58 | doFoo(t4); | |
59 |
|
|
59 | untyped t1 = 4; | |
60 |
|
|
60 | bob = new Foo<Int> | |
61 | } |
|
61 | } | |
62 |
|
|
62 | public var okFoo(default, never):Float; | |
63 |
|
|
63 | var noFoo(getFoo, null):Int; | |
64 |
|
|
64 | function getFoo():Int { | |
65 |
|
|
65 | return noFoo; | |
66 | } |
|
66 | } | |
67 |
|
67 | |||
68 |
|
|
68 | public var three:Int; | |
69 | } |
|
69 | } | |
70 | enum Color |
|
70 | enum Color | |
71 | { |
|
71 | { | |
72 |
|
|
72 | red; | |
73 |
|
|
73 | green; | |
74 |
|
|
74 | blue; | |
75 |
|
|
75 | grey( v : Int ); | |
76 |
|
|
76 | rgb (r:Int,g:Int,b:Int); | |
77 | } |
|
77 | } | |
78 | </textarea></div> |
|
78 | </textarea></div> | |
79 |
|
79 |
@@ -19,13 +19,13 b'' | |||||
19 | <form><textarea id="code" name="code"> |
|
19 | <form><textarea id="code" name="code"> | |
20 | <% |
|
20 | <% | |
21 | function hello(who) { |
|
21 | function hello(who) { | |
22 |
|
|
22 | return "Hello " + who; | |
23 | } |
|
23 | } | |
24 | %> |
|
24 | %> | |
25 | This is an example of EJS (embedded javascript) |
|
25 | This is an example of EJS (embedded javascript) | |
26 | <p>The program says <%= hello("world") %>.</p> |
|
26 | <p>The program says <%= hello("world") %>.</p> | |
27 | <script> |
|
27 | <script> | |
28 |
|
|
28 | alert("And here is some normal JS code"); // also colored | |
29 | </script> |
|
29 | </script> | |
30 | </textarea></form> |
|
30 | </textarea></form> | |
31 |
|
31 | |||
@@ -43,7 +43,7 b' This is an example of EJS (embedded java' | |||||
43 | <p>Mode for html embedded scripts like JSP and ASP.NET. Depends on HtmlMixed which in turn depends on |
|
43 | <p>Mode for html embedded scripts like JSP and ASP.NET. Depends on HtmlMixed which in turn depends on | |
44 | JavaScript, CSS and XML.<br />Other dependancies include those of the scriping language chosen.</p> |
|
44 | JavaScript, CSS and XML.<br />Other dependancies include those of the scriping language chosen.</p> | |
45 |
|
45 | |||
46 |
<p><strong>MIME types defined:</strong> <code>application/x-aspx</code> (ASP.NET), |
|
46 | <p><strong>MIME types defined:</strong> <code>application/x-aspx</code> (ASP.NET), | |
47 | <code>application/x-ejs</code> (Embedded Javascript), <code>application/x-jsp</code> (JavaServer Pages)</p> |
|
47 | <code>application/x-ejs</code> (Embedded Javascript), <code>application/x-jsp</code> (JavaServer Pages)</p> | |
48 | </body> |
|
48 | </body> | |
49 | </html> |
|
49 | </html> |
@@ -17,7 +17,7 b' POST /somewhere HTTP/1.1' | |||||
17 | Host: example.com |
|
17 | Host: example.com | |
18 | If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT |
|
18 | If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT | |
19 | Content-Type: application/x-www-form-urlencoded; |
|
19 | Content-Type: application/x-www-form-urlencoded; | |
20 |
|
|
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 |
|
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 |
|
22 | |||
23 | This is the request body! |
|
23 | This is the request body! |
@@ -14,21 +14,21 b'' | |||||
14 |
|
14 | |||
15 | <div><textarea id="code" name="code"> |
|
15 | <div><textarea id="code" name="code"> | |
16 | class Greeter { |
|
16 | class Greeter { | |
17 |
|
|
17 | greeting: string; | |
18 |
|
|
18 | constructor (message: string) { | |
19 |
|
|
19 | this.greeting = message; | |
20 | } |
|
20 | } | |
21 |
|
|
21 | greet() { | |
22 |
|
|
22 | return "Hello, " + this.greeting; | |
23 | } |
|
23 | } | |
24 | } |
|
24 | } | |
25 |
|
25 | |||
26 | var greeter = new Greeter("world"); |
|
26 | var greeter = new Greeter("world"); | |
27 |
|
27 | |||
28 | var button = document.createElement('button') |
|
28 | var button = document.createElement('button') | |
29 | button.innerText = "Say Hello" |
|
29 | button.innerText = "Say Hello" | |
30 | button.onclick = function() { |
|
30 | button.onclick = function() { | |
31 |
|
|
31 | alert(greeter.greet()) | |
32 | } |
|
32 | } | |
33 |
|
33 | |||
34 | document.body.appendChild(button) |
|
34 | document.body.appendChild(button) |
@@ -127,12 +127,12 b' input::-moz-focus-inner { // Inner paddi' | |||||
127 | } |
|
127 | } | |
128 | fieldset span button, fieldset span input[type="file"] { |
|
128 | fieldset span button, fieldset span input[type="file"] { | |
129 | font-size:12px; |
|
129 | font-size:12px; | |
130 |
|
|
130 | font-family:Arial, Helvetica, sans-serif; | |
131 | } |
|
131 | } | |
132 | .el tr:nth-child(even):last-child td:first-child{ |
|
132 | .el tr:nth-child(even):last-child td:first-child{ | |
133 |
|
|
133 | -moz-border-radius-bottomleft:3px; | |
134 |
|
|
134 | -webkit-border-bottom-left-radius:3px; | |
135 |
|
|
135 | border-bottom-left-radius:3px; | |
136 | } |
|
136 | } | |
137 |
|
137 | |||
138 | /* Some LESS code */ |
|
138 | /* Some LESS code */ | |
@@ -347,7 +347,7 b' nav a, #dropdown li {' | |||||
347 | border: 2px solid transparent; |
|
347 | border: 2px solid transparent; | |
348 | border-width: 0 2px; |
|
348 | border-width: 0 2px; | |
349 | &:hover { |
|
349 | &:hover { | |
350 |
.dark-red; |
|
350 | .dark-red; | |
351 | text-decoration: none; |
|
351 | text-decoration: none; | |
352 | } |
|
352 | } | |
353 | } |
|
353 | } | |
@@ -400,7 +400,7 b' nav a, #dropdown li {' | |||||
400 | border-top-width: 0; |
|
400 | border-top-width: 0; | |
401 | background-color: darken(@medium, 10%); |
|
401 | background-color: darken(@medium, 10%); | |
402 | ul { |
|
402 | ul { | |
403 |
padding: 0px; |
|
403 | padding: 0px; | |
404 | } |
|
404 | } | |
405 | li { |
|
405 | li { | |
406 | font-size: 14px; |
|
406 | font-size: 14px; | |
@@ -410,9 +410,9 b' nav a, #dropdown li {' | |||||
410 | border: 0; |
|
410 | border: 0; | |
411 | a { |
|
411 | a { | |
412 | display: block; |
|
412 | display: block; | |
413 |
padding: 0px 15px; |
|
413 | padding: 0px 15px; | |
414 | text-decoration: none; |
|
414 | text-decoration: none; | |
415 |
color: white; |
|
415 | color: white; | |
416 | &:hover { |
|
416 | &:hover { | |
417 | background-color: darken(@medium, 15%); |
|
417 | background-color: darken(@medium, 15%); | |
418 | text-decoration: none; |
|
418 | text-decoration: none; | |
@@ -450,13 +450,13 b' nav a, #dropdown li {' | |||||
450 | #download img { display: inline-block} |
|
450 | #download img { display: inline-block} | |
451 | #download-info { |
|
451 | #download-info { | |
452 | code { |
|
452 | code { | |
453 |
font-size: 13px; |
|
453 | font-size: 13px; | |
454 | } |
|
454 | } | |
455 | color: @blue + #333; display: inline; float: left; margin: 36px 0 0 15px } |
|
455 | color: @blue + #333; display: inline; float: left; margin: 36px 0 0 15px } | |
456 | } |
|
456 | } | |
457 | h2 { |
|
457 | h2 { | |
458 | span { |
|
458 | span { | |
459 |
color: @medium; |
|
459 | color: @medium; | |
460 | } |
|
460 | } | |
461 | color: @blue; |
|
461 | color: @blue; | |
462 | margin: 20px 0; |
|
462 | margin: 20px 0; | |
@@ -526,7 +526,7 b' nav a, #dropdown li {' | |||||
526 | line-height: 26px; |
|
526 | line-height: 26px; | |
527 | padding: 0 60px; |
|
527 | padding: 0 60px; | |
528 | code { |
|
528 | code { | |
529 |
font-size: 16px; |
|
529 | font-size: 16px; | |
530 | } |
|
530 | } | |
531 | pre { |
|
531 | pre { | |
532 | border-width: 1px; |
|
532 | border-width: 1px; | |
@@ -599,18 +599,18 b' nav a, #dropdown li {' | |||||
599 | } |
|
599 | } | |
600 |
|
600 | |||
601 | td { |
|
601 | td { | |
602 |
padding-right: 30px; |
|
602 | padding-right: 30px; | |
603 | } |
|
603 | } | |
604 | #synopsis { |
|
604 | #synopsis { | |
605 | .box-shadow(0, 5px, 5px, 0.2); |
|
605 | .box-shadow(0, 5px, 5px, 0.2); | |
606 | } |
|
606 | } | |
607 | #synopsis, #about { |
|
607 | #synopsis, #about { | |
608 | h2 { |
|
608 | h2 { | |
609 |
font-size: 30px; |
|
609 | font-size: 30px; | |
610 | padding: 10px 0; |
|
610 | padding: 10px 0; | |
611 | } |
|
611 | } | |
612 | h1 + h2 { |
|
612 | h1 + h2 { | |
613 |
margin-top: 15px; |
|
613 | margin-top: 15px; | |
614 | } |
|
614 | } | |
615 | h3 { font-size: 22px } |
|
615 | h3 { font-size: 22px } | |
616 |
|
616 | |||
@@ -631,7 +631,7 b' td {' | |||||
631 | } |
|
631 | } | |
632 | .css-output { |
|
632 | .css-output { | |
633 | td { |
|
633 | td { | |
634 |
border-left: 0; |
|
634 | border-left: 0; | |
635 | } |
|
635 | } | |
636 | } |
|
636 | } | |
637 | .less-example { |
|
637 | .less-example { |
@@ -23,7 +23,7 b' function blahblahblah(x)' | |||||
23 |
|
23 | |||
24 | local table = { |
|
24 | local table = { | |
25 | "asd" = 123, |
|
25 | "asd" = 123, | |
26 |
"x" = 0.34, |
|
26 | "x" = 0.34, | |
27 | } |
|
27 | } | |
28 | if x ~= 3 then |
|
28 | if x ~= 3 then | |
29 | print( x ) |
|
29 | print( x ) | |
@@ -34,7 +34,7 b' function blahblahblah(x)' | |||||
34 | end |
|
34 | end | |
35 |
|
35 | |||
36 | --single line comment |
|
36 | --single line comment | |
37 |
|
37 | |||
38 | end |
|
38 | end | |
39 |
|
39 | |||
40 | function blablabla3() |
|
40 | function blablabla3() |
@@ -71,7 +71,7 b' Markdown:' | |||||
71 |
|
71 | |||
72 | A First Level Header |
|
72 | A First Level Header | |
73 | ==================== |
|
73 | ==================== | |
74 |
|
74 | |||
75 | A Second Level Header |
|
75 | A Second Level Header | |
76 | --------------------- |
|
76 | --------------------- | |
77 |
|
77 | |||
@@ -81,11 +81,11 b' Markdown:' | |||||
81 |
|
81 | |||
82 | The quick brown fox jumped over the lazy |
|
82 | The quick brown fox jumped over the lazy | |
83 | dog's back. |
|
83 | dog's back. | |
84 |
|
84 | |||
85 | ### Header 3 |
|
85 | ### Header 3 | |
86 |
|
86 | |||
87 | > This is a blockquote. |
|
87 | > This is a blockquote. | |
88 |
> |
|
88 | > | |
89 | > This is the second paragraph in the blockquote. |
|
89 | > This is the second paragraph in the blockquote. | |
90 | > |
|
90 | > | |
91 | > ## This is an H2 in a blockquote |
|
91 | > ## This is an H2 in a blockquote | |
@@ -94,23 +94,23 b' Markdown:' | |||||
94 | Output: |
|
94 | Output: | |
95 |
|
95 | |||
96 | <h1>A First Level Header</h1> |
|
96 | <h1>A First Level Header</h1> | |
97 |
|
97 | |||
98 | <h2>A Second Level Header</h2> |
|
98 | <h2>A Second Level Header</h2> | |
99 |
|
99 | |||
100 | <p>Now is the time for all good men to come to |
|
100 | <p>Now is the time for all good men to come to | |
101 | the aid of their country. This is just a |
|
101 | the aid of their country. This is just a | |
102 | regular paragraph.</p> |
|
102 | regular paragraph.</p> | |
103 |
|
103 | |||
104 | <p>The quick brown fox jumped over the lazy |
|
104 | <p>The quick brown fox jumped over the lazy | |
105 | dog's back.</p> |
|
105 | dog's back.</p> | |
106 |
|
106 | |||
107 | <h3>Header 3</h3> |
|
107 | <h3>Header 3</h3> | |
108 |
|
108 | |||
109 | <blockquote> |
|
109 | <blockquote> | |
110 | <p>This is a blockquote.</p> |
|
110 | <p>This is a blockquote.</p> | |
111 |
|
111 | |||
112 | <p>This is the second paragraph in the blockquote.</p> |
|
112 | <p>This is the second paragraph in the blockquote.</p> | |
113 |
|
113 | |||
114 | <h2>This is an H2 in a blockquote</h2> |
|
114 | <h2>This is an H2 in a blockquote</h2> | |
115 | </blockquote> |
|
115 | </blockquote> | |
116 |
|
116 | |||
@@ -124,7 +124,7 b' Markdown:' | |||||
124 |
|
124 | |||
125 | Some of these words *are emphasized*. |
|
125 | Some of these words *are emphasized*. | |
126 | Some of these words _are emphasized also_. |
|
126 | Some of these words _are emphasized also_. | |
127 |
|
127 | |||
128 | Use two asterisks for **strong emphasis**. |
|
128 | Use two asterisks for **strong emphasis**. | |
129 | Or, if you prefer, __use two underscores instead__. |
|
129 | Or, if you prefer, __use two underscores instead__. | |
130 |
|
130 | |||
@@ -132,10 +132,10 b' Output:' | |||||
132 |
|
132 | |||
133 | <p>Some of these words <em>are emphasized</em>. |
|
133 | <p>Some of these words <em>are emphasized</em>. | |
134 | Some of these words <em>are emphasized also</em>.</p> |
|
134 | Some of these words <em>are emphasized also</em>.</p> | |
135 |
|
135 | |||
136 | <p>Use two asterisks for <strong>strong emphasis</strong>. |
|
136 | <p>Use two asterisks for <strong>strong emphasis</strong>. | |
137 | Or, if you prefer, <strong>use two underscores instead</strong>.</p> |
|
137 | Or, if you prefer, <strong>use two underscores instead</strong>.</p> | |
138 |
|
138 | |||
139 |
|
139 | |||
140 |
|
140 | |||
141 | ## Lists ## |
|
141 | ## Lists ## | |
@@ -188,7 +188,7 b' list item text. You can create multi-par' | |||||
188 | the paragraphs by 4 spaces or 1 tab: |
|
188 | the paragraphs by 4 spaces or 1 tab: | |
189 |
|
189 | |||
190 | * A list item. |
|
190 | * A list item. | |
191 |
|
191 | |||
192 | With multiple paragraphs. |
|
192 | With multiple paragraphs. | |
193 |
|
193 | |||
194 | * Another item in the list. |
|
194 | * Another item in the list. | |
@@ -200,7 +200,7 b' Output:' | |||||
200 | <p>With multiple paragraphs.</p></li> |
|
200 | <p>With multiple paragraphs.</p></li> | |
201 | <li><p>Another item in the list.</p></li> |
|
201 | <li><p>Another item in the list.</p></li> | |
202 | </ul> |
|
202 | </ul> | |
203 |
|
203 | |||
204 |
|
204 | |||
205 |
|
205 | |||
206 | ### Links ### |
|
206 | ### Links ### | |
@@ -295,7 +295,7 b' Output:' | |||||
295 |
|
295 | |||
296 | <p>I strongly recommend against using any |
|
296 | <p>I strongly recommend against using any | |
297 | <code>&lt;blink&gt;</code> tags.</p> |
|
297 | <code>&lt;blink&gt;</code> tags.</p> | |
298 |
|
298 | |||
299 | <p>I wish SmartyPants used named entities like |
|
299 | <p>I wish SmartyPants used named entities like | |
300 | <code>&amp;mdash;</code> instead of decimal-encoded |
|
300 | <code>&amp;mdash;</code> instead of decimal-encoded | |
301 | entites like <code>&amp;#8212;</code>.</p> |
|
301 | entites like <code>&amp;#8212;</code>.</p> | |
@@ -318,7 +318,7 b' Output:' | |||||
318 |
|
318 | |||
319 | <p>If you want your page to validate under XHTML 1.0 Strict, |
|
319 | <p>If you want your page to validate under XHTML 1.0 Strict, | |
320 | you've got to put paragraph tags in your blockquotes:</p> |
|
320 | you've got to put paragraph tags in your blockquotes:</p> | |
321 |
|
321 | |||
322 | <pre><code>&lt;blockquote&gt; |
|
322 | <pre><code>&lt;blockquote&gt; | |
323 | &lt;p&gt;For example.&lt;/p&gt; |
|
323 | &lt;p&gt;For example.&lt;/p&gt; | |
324 | &lt;/blockquote&gt; |
|
324 | &lt;/blockquote&gt; |
@@ -135,9 +135,9 b' Raw 315:*: {' | |||||
135 | <script> |
|
135 | <script> | |
136 | var editor = CodeMirror.fromTextArea(document.getElementById("code"), { |
|
136 | var editor = CodeMirror.fromTextArea(document.getElementById("code"), { | |
137 | tabMode: "indent", |
|
137 | tabMode: "indent", | |
138 |
|
|
138 | theme: "twilight", | |
139 | lineNumbers: true, |
|
139 | lineNumbers: true, | |
140 |
|
|
140 | matchBrackets: true, | |
141 | indentUnit: 4, |
|
141 | indentUnit: 4, | |
142 | mode: "text/mirc" |
|
142 | mode: "text/mirc" | |
143 | }); |
|
143 | }); |
@@ -11,12 +11,12 b'' | |||||
11 | .CodeMirror { |
|
11 | .CodeMirror { | |
12 | border: 1px solid #eee; |
|
12 | border: 1px solid #eee; | |
13 | } |
|
13 | } | |
14 |
</style> |
|
14 | </style> | |
15 | </head> |
|
15 | </head> | |
16 | <body> |
|
16 | <body> | |
17 | <h1>CodeMirror: NTriples mode</h1> |
|
17 | <h1>CodeMirror: NTriples mode</h1> | |
18 | <form> |
|
18 | <form> | |
19 |
<textarea id="ntriples" name="ntriples"> |
|
19 | <textarea id="ntriples" name="ntriples"> | |
20 | <http://Sub1> <http://pred1> <http://obj> . |
|
20 | <http://Sub1> <http://pred1> <http://obj> . | |
21 | <http://Sub2> <http://pred2#an2> "literal 1" . |
|
21 | <http://Sub2> <http://pred2#an2> "literal 1" . | |
22 | <http://Sub3#an3> <http://pred3> _:bnode3 . |
|
22 | <http://Sub3#an3> <http://pred3> _:bnode3 . |
@@ -75,7 +75,7 b' let rec sort = function' | |||||
75 |
|
75 | |||
76 | and insert elem = function |
|
76 | and insert elem = function | |
77 | | [] -> [elem] |
|
77 | | [] -> [elem] | |
78 |
| x :: l -> |
|
78 | | x :: l -> | |
79 | if elem < x then elem :: x :: l else x :: insert elem l;; |
|
79 | if elem < x then elem :: x :: l else x :: insert elem l;; | |
80 |
|
80 | |||
81 | (* Imperative features *) |
|
81 | (* Imperative features *) |
@@ -16,19 +16,19 b'' | |||||
16 | (* Example Pascal code *) |
|
16 | (* Example Pascal code *) | |
17 |
|
17 | |||
18 | while a <> b do writeln('Waiting'); |
|
18 | while a <> b do writeln('Waiting'); | |
19 |
|
19 | |||
20 |
if a > b then |
|
20 | if a > b then | |
21 | writeln('Condition met') |
|
21 | writeln('Condition met') | |
22 |
else |
|
22 | else | |
23 | writeln('Condition not met'); |
|
23 | writeln('Condition not met'); | |
24 |
|
24 | |||
25 |
for i := 1 to 10 do |
|
25 | for i := 1 to 10 do | |
26 | writeln('Iteration: ', i:1); |
|
26 | writeln('Iteration: ', i:1); | |
27 |
|
27 | |||
28 | repeat |
|
28 | repeat | |
29 | a := a + 1 |
|
29 | a := a + 1 | |
30 | until a = 10; |
|
30 | until a = 10; | |
31 |
|
31 | |||
32 | case i of |
|
32 | case i of | |
33 | 0: write('zero'); |
|
33 | 0: write('zero'); | |
34 | 1: write('one'); |
|
34 | 1: write('one'); |
@@ -23,7 +23,7 b' our $s2 = q(multi-' | |||||
23 | line); |
|
23 | line); | |
24 |
|
24 | |||
25 | =item Something |
|
25 | =item Something | |
26 |
|
|
26 | Example. | |
27 | =cut |
|
27 | =cut | |
28 |
|
28 | |||
29 | my $html=<<'HTML' |
|
29 | my $html=<<'HTML' | |
@@ -35,13 +35,13 b' HTML' | |||||
35 | print "first,".join(',', 'second', qq~third~); |
|
35 | print "first,".join(',', 'second', qq~third~); | |
36 |
|
36 | |||
37 | if($s1 =~ m[(?<!\s)(l.ne)\z]o) { |
|
37 | if($s1 =~ m[(?<!\s)(l.ne)\z]o) { | |
38 |
|
|
38 | $h->{$1}=$$.' predefined variables'; | |
39 |
|
|
39 | $s2 =~ s/\-line//ox; | |
40 |
|
|
40 | $s1 =~ s[ | |
41 |
|
|
41 | line ] | |
42 | [ |
|
42 | [ | |
43 | block |
|
43 | block | |
44 | ]ox; |
|
44 | ]ox; | |
45 | } |
|
45 | } | |
46 |
|
46 | |||
47 | 1; # numbers and comments |
|
47 | 1; # numbers and comments |
@@ -21,12 +21,12 b'' | |||||
21 | <form><textarea id="code" name="code"> |
|
21 | <form><textarea id="code" name="code"> | |
22 | <?php |
|
22 | <?php | |
23 | function hello($who) { |
|
23 | function hello($who) { | |
24 |
|
|
24 | return "Hello " . $who; | |
25 | } |
|
25 | } | |
26 | ?> |
|
26 | ?> | |
27 | <p>The program says <?= hello("World") ?>.</p> |
|
27 | <p>The program says <?= hello("World") ?>.</p> | |
28 | <script> |
|
28 | <script> | |
29 |
|
|
29 | alert("And here is some JS code"); // also colored | |
30 | </script> |
|
30 | </script> | |
31 | </textarea></form> |
|
31 | </textarea></form> | |
32 |
|
32 |
@@ -14,7 +14,7 b'' | |||||
14 |
|
14 | |||
15 | <form><textarea id="code" name="code"> |
|
15 | <form><textarea id="code" name="code"> | |
16 | -- Apache Pig (Pig Latin Language) Demo |
|
16 | -- Apache Pig (Pig Latin Language) Demo | |
17 |
/* |
|
17 | /* | |
18 | This is a multiline comment. |
|
18 | This is a multiline comment. | |
19 | */ |
|
19 | */ | |
20 | a = LOAD "\path\to\input" USING PigStorage('\t') AS (x:long, y:chararray, z:bytearray); |
|
20 | a = LOAD "\path\to\input" USING PigStorage('\t') AS (x:long, y:chararray, z:bytearray); |
@@ -18,4 +18,4 b' FITNESS FOR A PARTICULAR PURPOSE AND NON' | |||||
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
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, |
|
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 |
|
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
21 | THE SOFTWARE. No newline at end of file |
|
21 | THE SOFTWARE. |
@@ -12,7 +12,7 b'' | |||||
12 | </head> |
|
12 | </head> | |
13 | <body> |
|
13 | <body> | |
14 | <h1>CodeMirror: Python mode</h1> |
|
14 | <h1>CodeMirror: Python mode</h1> | |
15 |
|
15 | |||
16 | <div><textarea id="code" name="code"> |
|
16 | <div><textarea id="code" name="code"> | |
17 | # Literals |
|
17 | # Literals | |
18 | 1234 |
|
18 | 1234 |
@@ -15,23 +15,23 b'' | |||||
15 |
|
15 | |||
16 | <div><textarea id="code" name="code"> |
|
16 | <div><textarea id="code" name="code"> | |
17 | / utilities to quickly load a csv file - for more exhaustive analysis of the csv contents see csvguess.q |
|
17 | / utilities to quickly load a csv file - for more exhaustive analysis of the csv contents see csvguess.q | |
18 |
/ 2009.09.20 - updated to match latest csvguess.q |
|
18 | / 2009.09.20 - updated to match latest csvguess.q | |
19 |
|
19 | |||
20 | / .csv.colhdrs[file] - return a list of colhdrs from file |
|
20 | / .csv.colhdrs[file] - return a list of colhdrs from file | |
21 | / info:.csv.info[file] - return a table of information about the file |
|
21 | / info:.csv.info[file] - return a table of information about the file | |
22 |
/ columns are: |
|
22 | / columns are: | |
23 |
/ |
|
23 | / c - column name; ci - column index; t - load type; mw - max width; | |
24 |
/ |
|
24 | / dchar - distinct characters in values; rule - rule that caught the type | |
25 |
/ |
|
25 | / maybe - needs checking, _could_ be say a date, but perhaps just a float? | |
26 | / .csv.info0[file;onlycols] - like .csv.info except that it only analyses <onlycols> |
|
26 | / .csv.info0[file;onlycols] - like .csv.info except that it only analyses <onlycols> | |
27 | / example: |
|
27 | / example: | |
28 |
/ |
|
28 | / info:.csv.info0[file;(.csv.colhdrs file)like"*price"] | |
29 |
/ |
|
29 | / info:.csv.infolike[file;"*price"] | |
30 |
/ |
|
30 | / show delete from info where t=" " | |
31 | / .csv.data[file;info] - use the info from .csv.info to read the data |
|
31 | / .csv.data[file;info] - use the info from .csv.info to read the data | |
32 | / .csv.data10[file;info] - like .csv.data but only returns the first 10 rows |
|
32 | / .csv.data10[file;info] - like .csv.data but only returns the first 10 rows | |
33 | / bulkload[file;info] - bulk loads file into table DATA (which must be already defined :: DATA:() ) |
|
33 | / bulkload[file;info] - bulk loads file into table DATA (which must be already defined :: DATA:() ) | |
34 |
/ .csv.read[file]/read10[file] - for when you don't care about checking/tweaking the <info> before reading |
|
34 | / .csv.read[file]/read10[file] - for when you don't care about checking/tweaking the <info> before reading | |
35 |
|
35 | |||
36 | \d .csv |
|
36 | \d .csv | |
37 | DELIM:"," |
|
37 | DELIM:"," | |
@@ -49,74 +49,74 b' k)fs2:{[f;s]((-7!s)>){[f;s;x]i:1+last@&0' | |||||
49 | cleanhdrs:{{$[ZAPHDRS;lower x except"_";x]}x where x in DELIM,.Q.an} |
|
49 | cleanhdrs:{{$[ZAPHDRS;lower x except"_";x]}x where x in DELIM,.Q.an} | |
50 | cancast:{nw:x$"";if[not x in"BXCS";nw:(min 0#;max 0#;::)@\:nw];$[not any nw in x$(11&count y)#y;$[11<count y;not any nw in x$y;1b];0b]} |
|
50 | cancast:{nw:x$"";if[not x in"BXCS";nw:(min 0#;max 0#;::)@\:nw];$[not any nw in x$(11&count y)#y;$[11<count y;not any nw in x$y;1b];0b]} | |
51 |
|
51 | |||
52 |
read:{[file]data[file;info[file]]} |
|
52 | read:{[file]data[file;info[file]]} | |
53 |
read10:{[file]data10[file;info[file]]} |
|
53 | read10:{[file]data10[file;info[file]]} | |
54 |
|
54 | |||
55 | colhdrs:{[file] |
|
55 | colhdrs:{[file] | |
56 |
|
|
56 | `$nameltrim DELIM vs cleanhdrs first read0(file;0;1+first where 0xa=read1(file;0;WIDTHHDR))} | |
57 | data:{[file;info] |
|
57 | data:{[file;info] | |
58 |
|
|
58 | (exec c from info where not t=" ")xcol(exec t from info;enlist DELIM)0:file} | |
59 | data10:{[file;info] |
|
59 | data10:{[file;info] | |
60 |
|
|
60 | data[;info](file;0;1+last 11#where 0xa=read1(file;0;15*WIDTHHDR))} | |
61 | info0:{[file;onlycols] |
|
61 | info0:{[file;onlycols] | |
62 |
|
|
62 | colhdrs:`$nameltrim DELIM vs cleanhdrs first head:read0(file;0;1+last where 0xa=read1(file;0;WIDTHHDR)); | |
63 |
|
|
63 | loadfmts:(count colhdrs)#"S";if[count onlycols;loadfmts[where not colhdrs in onlycols]:"C"]; | |
64 |
|
|
64 | breaks:where 0xa=read1(file;0;floor(10+READLINES)*WIDTHHDR%count head); | |
65 |
|
|
65 | nas:count as:colhdrs xcol(loadfmts;enlist DELIM)0:(file;0;1+last((1+READLINES)&count breaks)#breaks); | |
66 |
|
|
66 | info:([]c:key flip as;v:value flip as);as:(); | |
67 |
|
|
67 | reserved:key`.q;reserved,:.Q.res;reserved,:`i; | |
68 |
|
|
68 | info:update res:c in reserved from info; | |
69 |
|
|
69 | info:update ci:i,t:"?",ipa:0b,mdot:0,mw:0,rule:0,gr:0,ndv:0,maybe:0b,empty:0b,j10:0b,j12:0b from info; | |
70 |
|
|
70 | info:update ci:`s#ci from info; | |
71 |
|
|
71 | if[count onlycols;info:update t:" ",rule:10 from info where not c in onlycols]; | |
72 |
|
|
72 | info:update sdv:{string(distinct x)except`}peach v from info; | |
73 |
|
|
73 | info:update ndv:count each sdv from info; | |
74 |
|
|
74 | info:update gr:floor 0.5+100*ndv%nas,mw:{max count each x}peach sdv from info where 0<ndv; | |
75 |
|
|
75 | info:update t:"*",rule:20 from info where mw>.csv.FORCECHARWIDTH; / long values | |
76 |
|
|
76 | info:update t:"C "[.csv.DISCARDEMPTY],rule:30,empty:1b from info where t="?",mw=0; / empty columns | |
77 |
|
|
77 | info:update dchar:{asc distinct raze x}peach sdv from info where t="?"; | |
78 |
|
|
78 | info:update mdot:{max sum each"."=x}peach sdv from info where t="?",{"."in x}each dchar; | |
79 |
|
|
79 | info:update t:"n",rule:40 from info where t="?",{any x in"0123456789"}each dchar; / vaguely numeric.. | |
80 |
|
|
80 | info:update t:"I",rule:50,ipa:1b from info where t="n",mw within 7 15,mdot=3,{all x in".0123456789"}each dchar,.csv.cancast["I"]peach sdv; / ip-address | |
81 |
|
|
81 | info:update t:"J",rule:60 from info where t="n",mdot=0,{all x in"+-0123456789"}each dchar,.csv.cancast["J"]peach sdv; | |
82 |
|
|
82 | info:update t:"I",rule:70 from info where t="J",mw<12,.csv.cancast["I"]peach sdv; | |
83 |
|
|
83 | info:update t:"H",rule:80 from info where t="I",mw<7,.csv.cancast["H"]peach sdv; | |
84 |
|
|
84 | info:update t:"F",rule:90 from info where t="n",mdot<2,mw>1,.csv.cancast["F"]peach sdv; | |
85 |
|
|
85 | info:update t:"E",rule:100,maybe:1b from info where t="F",mw<9; | |
86 |
|
|
86 | info:update t:"M",rule:110,maybe:1b from info where t in"nIHEF",mdot<2,mw within 4 7,.csv.cancast["M"]peach sdv; | |
87 |
|
|
87 | info:update t:"D",rule:120,maybe:1b from info where t in"nI",mdot in 0 2,mw within 6 11,.csv.cancast["D"]peach sdv; | |
88 |
|
|
88 | info:update t:"V",rule:130,maybe:1b from info where t="I",mw in 5 6,7<count each dchar,{all x like"*[0-9][0-5][0-9][0-5][0-9]"}peach sdv,.csv.cancast["V"]peach sdv; / 235959 12345 | |
89 |
|
|
89 | info:update t:"U",rule:140,maybe:1b from info where t="H",mw in 3 4,7<count each dchar,{all x like"*[0-9][0-5][0-9]"}peach sdv,.csv.cancast["U"]peach sdv; /2359 | |
90 |
|
|
90 | info:update t:"U",rule:150,maybe:0b from info where t="n",mw in 4 5,mdot=0,{all x like"*[0-9]:[0-5][0-9]"}peach sdv,.csv.cancast["U"]peach sdv; | |
91 |
|
|
91 | info:update t:"T",rule:160,maybe:0b from info where t="n",mw within 7 12,mdot<2,{all x like"*[0-9]:[0-5][0-9]:[0-5][0-9]*"}peach sdv,.csv.cancast["T"]peach sdv; | |
92 |
|
|
92 | info:update t:"V",rule:170,maybe:0b from info where t="T",mw in 7 8,mdot=0,.csv.cancast["V"]peach sdv; | |
93 |
|
|
93 | info:update t:"T",rule:180,maybe:1b from info where t in"EF",mw within 7 10,mdot=1,{all x like"*[0-9][0-5][0-9][0-5][0-9].*"}peach sdv,.csv.cancast["T"]peach sdv; | |
94 |
|
|
94 | info:update t:"Z",rule:190,maybe:0b from info where t="n",mw within 11 24,mdot<4,.csv.cancast["Z"]peach sdv; | |
95 |
|
|
95 | info:update t:"P",rule:200,maybe:1b from info where t="n",mw within 12 29,mdot<4,{all x like"[12]*"}peach sdv,.csv.cancast["P"]peach sdv; | |
96 |
|
|
96 | info:update t:"N",rule:210,maybe:1b from info where t="n",mw within 3 28,mdot=1,.csv.cancast["N"]peach sdv; | |
97 |
|
|
97 | info:update t:"?",rule:220,maybe:0b from info where t="n"; / reset remaining maybe numeric | |
98 |
|
|
98 | info:update t:"C",rule:230,maybe:0b from info where t="?",mw=1; / char | |
99 |
|
|
99 | info:update t:"B",rule:240,maybe:0b from info where t in"HC",mw=1,mdot=0,{$[all x in"01tTfFyYnN";(any"0fFnN"in x)and any"1tTyY"in x;0b]}each dchar; / boolean | |
100 |
|
|
100 | info:update t:"B",rule:250,maybe:1b from info where t in"HC",mw=1,mdot=0,{all x in"01tTfFyYnN"}each dchar; / boolean | |
101 |
|
|
101 | info:update t:"X",rule:260,maybe:0b from info where t="?",mw=2,{$[all x in"0123456789abcdefABCDEF";(any .Q.n in x)and any"abcdefABCDEF"in x;0b]}each dchar; /hex | |
102 |
|
|
102 | info:update t:"S",rule:270,maybe:1b from info where t="?",mw<.csv.SYMMAXWIDTH,mw>1,gr<.csv.SYMMAXGR; / symbols (max width permitting) | |
103 |
|
|
103 | info:update t:"*",rule:280,maybe:0b from info where t="?"; / the rest as strings | |
104 |
|
|
104 | / flag those S/* columns which could be encoded to integers (.Q.j10/x10/j12/x12) to avoid symbols | |
105 |
|
|
105 | info:update j12:1b from info where t in"S*",mw<13,{all x in .Q.nA}each dchar; | |
106 |
|
|
106 | info:update j10:1b from info where t in"S*",mw<11,{all x in .Q.b6}each dchar; | |
107 |
|
|
107 | select c,ci,t,maybe,empty,res,j10,j12,ipa,mw,mdot,rule,gr,ndv,dchar from info} | |
108 | info:info0[;()] / by default don't restrict columns |
|
108 | info:info0[;()] / by default don't restrict columns | |
109 | infolike:{[file;pattern] info0[file;{x where x like y}[lower colhdrs[file];pattern]]} / .csv.infolike[file;"*time"] |
|
109 | infolike:{[file;pattern] info0[file;{x where x like y}[lower colhdrs[file];pattern]]} / .csv.infolike[file;"*time"] | |
110 |
|
110 | |||
111 | \d . |
|
111 | \d . | |
112 | / DATA:() |
|
112 | / DATA:() | |
113 | bulkload:{[file;info] |
|
113 | bulkload:{[file;info] | |
114 |
|
|
114 | if[not`DATA in system"v";'`DATA.not.defined]; | |
115 |
|
|
115 | if[count DATA;'`DATA.not.empty]; | |
116 |
|
|
116 | loadhdrs:exec c from info where not t=" ";loadfmts:exec t from info; | |
117 |
|
|
117 | .csv.fs2[{[file;loadhdrs;loadfmts] `DATA insert $[count DATA;flip loadhdrs!(loadfmts;.csv.DELIM)0:file;loadhdrs xcol(loadfmts;enlist .csv.DELIM)0:file]}[file;loadhdrs;loadfmts]]; | |
118 |
|
|
118 | count DATA} | |
119 |
@[.:;"\\l csvutil.custom.q";::]; / save your custom settings in csvutil.custom.q to override those set at the beginning of the file |
|
119 | @[.:;"\\l csvutil.custom.q";::]; / save your custom settings in csvutil.custom.q to override those set at the beginning of the file | |
120 | </textarea></div> |
|
120 | </textarea></div> | |
121 |
|
121 | |||
122 | <script> |
|
122 | <script> |
@@ -11,7 +11,7 b'' | |||||
11 | </head> |
|
11 | </head> | |
12 | <body> |
|
12 | <body> | |
13 | <h1>CodeMirror: RPM changes mode</h1> |
|
13 | <h1>CodeMirror: RPM changes mode</h1> | |
14 |
|
14 | |||
15 | <div><textarea id="code" name="code"> |
|
15 | <div><textarea id="code" name="code"> | |
16 | ------------------------------------------------------------------- |
|
16 | ------------------------------------------------------------------- | |
17 | Tue Oct 18 13:58:40 UTC 2011 - misterx@example.com |
|
17 | Tue Oct 18 13:58:40 UTC 2011 - misterx@example.com |
@@ -12,7 +12,7 b'' | |||||
12 | </head> |
|
12 | </head> | |
13 | <body> |
|
13 | <body> | |
14 | <h1>CodeMirror: RPM spec mode</h1> |
|
14 | <h1>CodeMirror: RPM spec mode</h1> | |
15 |
|
15 | |||
16 | <div><textarea id="code" name="code"> |
|
16 | <div><textarea id="code" name="code"> | |
17 | # |
|
17 | # | |
18 | # spec file for package minidlna |
|
18 | # spec file for package minidlna |
@@ -18,4 +18,4 b' FITNESS FOR A PARTICULAR PURPOSE AND NON' | |||||
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
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, |
|
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 |
|
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
21 | THE SOFTWARE. No newline at end of file |
|
21 | THE SOFTWARE. |
@@ -521,4 +521,3 b' There are some problems one commonly run' | |||||
521 | <p><strong>MIME types defined:</strong> <code>text/x-rst</code>.</p> |
|
521 | <p><strong>MIME types defined:</strong> <code>text/x-rst</code>.</p> | |
522 | </body> |
|
522 | </body> | |
523 | </html> |
|
523 | </html> | |
524 |
|
@@ -50,7 +50,7 b' def readints(prompt)' | |||||
50 | print prompt |
|
50 | print prompt | |
51 | line = readline.chomp |
|
51 | line = readline.chomp | |
52 | raise EOFError.new if line == 'quit' # You can also use a real EOF. |
|
52 | raise EOFError.new if line == 'quit' # You can also use a real EOF. | |
53 |
|
53 | |||
54 | # Go through each item on the line, converting each one and adding it |
|
54 | # Go through each item on the line, converting each one and adding it | |
55 | # to retval. |
|
55 | # to retval. | |
56 | retval = [ ] |
|
56 | retval = [ ] | |
@@ -99,16 +99,16 b' def polystr(p)' | |||||
99 | result = (if p[0][0] < 0 then "-" else "" end) + term_to_str(*p[0]) |
|
99 | result = (if p[0][0] < 0 then "-" else "" end) + term_to_str(*p[0]) | |
100 |
|
100 | |||
101 | # Convert the rest of the terms, in each case adding the appropriate |
|
101 | # Convert the rest of the terms, in each case adding the appropriate | |
102 |
# + or - separating them. |
|
102 | # + or - separating them. | |
103 | for term in p[1...p.length] |
|
103 | for term in p[1...p.length] | |
104 | # Add the separator then the rep. of the term. |
|
104 | # Add the separator then the rep. of the term. | |
105 |
result += (if term[0] < 0 then " - " else " + " end) + |
|
105 | result += (if term[0] < 0 then " - " else " + " end) + | |
106 | term_to_str(*term) |
|
106 | term_to_str(*term) | |
107 | end |
|
107 | end | |
108 |
|
108 | |||
109 | return result |
|
109 | return result | |
110 | end |
|
110 | end | |
111 |
|
111 | |||
112 | # |
|
112 | # | |
113 | # Run until some kind of endfile. |
|
113 | # Run until some kind of endfile. | |
114 | begin |
|
114 | begin |
@@ -15,21 +15,21 b'' | |||||
15 | ; See if the input starts with a given symbol. |
|
15 | ; See if the input starts with a given symbol. | |
16 | (define (match-symbol input pattern) |
|
16 | (define (match-symbol input pattern) | |
17 | (cond ((null? (remain input)) #f) |
|
17 | (cond ((null? (remain input)) #f) | |
18 |
|
|
18 | ((eqv? (car (remain input)) pattern) (r-cdr input)) | |
19 |
|
|
19 | (else #f))) | |
20 |
|
20 | |||
21 | ; Allow the input to start with one of a list of patterns. |
|
21 | ; Allow the input to start with one of a list of patterns. | |
22 | (define (match-or input pattern) |
|
22 | (define (match-or input pattern) | |
23 | (cond ((null? pattern) #f) |
|
23 | (cond ((null? pattern) #f) | |
24 |
|
|
24 | ((match-pattern input (car pattern))) | |
25 |
|
|
25 | (else (match-or input (cdr pattern))))) | |
26 |
|
26 | |||
27 | ; Allow a sequence of patterns. |
|
27 | ; Allow a sequence of patterns. | |
28 | (define (match-seq input pattern) |
|
28 | (define (match-seq input pattern) | |
29 | (if (null? pattern) |
|
29 | (if (null? pattern) | |
30 | input |
|
30 | input | |
31 | (let ((match (match-pattern input (car pattern)))) |
|
31 | (let ((match (match-pattern input (car pattern)))) | |
32 |
|
|
32 | (if match (match-seq match (cdr pattern)) #f)))) | |
33 |
|
33 | |||
34 | ; Match with the pattern but no problem if it does not match. |
|
34 | ; Match with the pattern but no problem if it does not match. | |
35 | (define (match-opt input pattern) |
|
35 | (define (match-opt input pattern) | |
@@ -42,18 +42,18 b'' | |||||
42 | ; of the sentence. |
|
42 | ; of the sentence. | |
43 | (define (match-any input pattern) |
|
43 | (define (match-any input pattern) | |
44 | (cond ((null? (remain input)) #f) |
|
44 | (cond ((null? (remain input)) #f) | |
45 |
|
|
45 | ((null? pattern) (f-cons (remain input) (clear-remain input))) | |
46 |
|
|
46 | (else | |
47 |
|
|
47 | (let ((accum-any (collector))) | |
48 |
|
|
48 | (define (match-pattern-any input pattern) | |
49 |
|
|
49 | (cond ((null? (remain input)) #f) | |
50 |
|
|
50 | (else (accum-any (car (remain input))) | |
51 |
|
|
51 | (cond ((match-pattern (r-cdr input) pattern)) | |
52 |
|
|
52 | (else (match-pattern-any (r-cdr input) pattern)))))) | |
53 |
|
|
53 | (let ((retval (match-pattern-any input (car pattern)))) | |
54 |
|
|
54 | (if retval | |
55 |
|
|
55 | (f-cons (accum-any) retval) | |
56 |
|
|
56 | #f)))))) | |
57 | </textarea></form> |
|
57 | </textarea></form> | |
58 | <script> |
|
58 | <script> | |
59 | var editor = CodeMirror.fromTextArea(document.getElementById("code"), {}); |
|
59 | var editor = CodeMirror.fromTextArea(document.getElementById("code"), {}); |
@@ -18,7 +18,7 b'' | |||||
18 | <h1>CodeMirror: Smalltalk mode</h1> |
|
18 | <h1>CodeMirror: Smalltalk mode</h1> | |
19 |
|
19 | |||
20 | <form><textarea id="code" name="code"> |
|
20 | <form><textarea id="code" name="code"> | |
21 |
" |
|
21 | " | |
22 | This is a test of the Smalltalk code |
|
22 | This is a test of the Smalltalk code | |
23 | " |
|
23 | " | |
24 | Seaside.WAComponent subclass: #MyCounter [ |
|
24 | Seaside.WAComponent subclass: #MyCounter [ |
@@ -12,7 +12,7 b'' | |||||
12 | <body> |
|
12 | <body> | |
13 | <h1>CodeMirror: Smarty mode</h1> |
|
13 | <h1>CodeMirror: Smarty mode</h1> | |
14 |
|
14 | |||
15 |
|
|
15 | <h3>Default settings (Smarty 2, <b>{</b> and <b>}</b> delimiters)</h3> | |
16 | <form><textarea id="code" name="code"> |
|
16 | <form><textarea id="code" name="code"> | |
17 | {extends file="parent.tpl"} |
|
17 | {extends file="parent.tpl"} | |
18 | {include file="template.tpl"} |
|
18 | {include file="template.tpl"} | |
@@ -44,7 +44,7 b'' | |||||
44 |
|
44 | |||
45 | <br /> |
|
45 | <br /> | |
46 |
|
46 | |||
47 |
|
|
47 | <h3>Smarty 2, custom delimiters</h3> | |
48 | <form><textarea id="code2" name="code2"> |
|
48 | <form><textarea id="code2" name="code2"> | |
49 | {--extends file="parent.tpl"--} |
|
49 | {--extends file="parent.tpl"--} | |
50 | {--include file="template.tpl"--} |
|
50 | {--include file="template.tpl"--} | |
@@ -78,16 +78,16 b'' | |||||
78 | }); |
|
78 | }); | |
79 | </script> |
|
79 | </script> | |
80 |
|
80 | |||
81 |
|
|
81 | <br /> | |
82 |
|
82 | |||
83 |
|
|
83 | <h3>Smarty 3</h3> | |
84 |
|
84 | |||
85 |
|
|
85 | <textarea id="code3" name="code3"> | |
86 | Nested tags {$foo={counter one=1 two={inception}}+3} are now valid in Smarty 3. |
|
86 | Nested tags {$foo={counter one=1 two={inception}}+3} are now valid in Smarty 3. | |
87 |
|
87 | |||
88 | <script> |
|
88 | <script> | |
89 | function test() { |
|
89 | function test() { | |
90 |
|
|
90 | console.log("Smarty 3 permits single curly braces followed by whitespace to NOT slip into Smarty mode."); | |
91 | } |
|
91 | } | |
92 | </script> |
|
92 | </script> | |
93 |
|
93 | |||
@@ -110,13 +110,13 b' Smarty "dot" syntax (note: embedded {} a' | |||||
110 |
|
110 | |||
111 | {$object->method1($x)->method2($y)}</textarea> |
|
111 | {$object->method1($x)->method2($y)}</textarea> | |
112 |
|
112 | |||
113 |
|
|
113 | <script> | |
114 |
|
|
114 | var editor = CodeMirror.fromTextArea(document.getElementById("code3"), { | |
115 |
|
|
115 | lineNumbers: true, | |
116 |
|
|
116 | mode: "smarty", | |
117 |
|
|
117 | smartyVersion: 3 | |
118 | }); |
|
118 | }); | |
119 |
|
|
119 | </script> | |
120 |
|
120 | |||
121 |
|
121 | |||
122 | <p>A plain text/Smarty version 2 or 3 mode, which allows for custom delimiter tags.</p> |
|
122 | <p>A plain text/Smarty version 2 or 3 mode, which allows for custom delimiter tags.</p> |
@@ -38,21 +38,21 b' var init = function() {' | |||||
38 | <form> |
|
38 | <form> | |
39 | <textarea id="code" name="code">-- SQL Mode for CodeMirror |
|
39 | <textarea id="code" name="code">-- SQL Mode for CodeMirror | |
40 | SELECT SQL_NO_CACHE DISTINCT |
|
40 | SELECT SQL_NO_CACHE DISTINCT | |
41 |
|
|
41 | @var1 AS `val1`, @'val2', @global.'sql_mode', | |
42 |
|
|
42 | 1.1 AS `float_val`, .14 AS `another_float`, 0.09e3 AS `int_with_esp`, | |
43 |
|
|
43 | 0xFA5 AS `hex`, x'fa5' AS `hex2`, 0b101 AS `bin`, b'101' AS `bin2`, | |
44 |
|
|
44 | DATE '1994-01-01' AS `sql_date`, { T "1994-01-01" } AS `odbc_date`, | |
45 |
|
|
45 | 'my string', _utf8'your string', N'her string', | |
46 | TRUE, FALSE, UNKNOWN |
|
46 | TRUE, FALSE, UNKNOWN | |
47 |
|
|
47 | FROM DUAL | |
48 |
|
|
48 | -- space needed after '--' | |
49 |
|
|
49 | # 1 line comment | |
50 |
|
|
50 | /* multiline | |
51 |
|
|
51 | comment! */ | |
52 |
|
|
52 | LIMIT 1 OFFSET 0; | |
53 | </textarea> |
|
53 | </textarea> | |
54 | </form> |
|
54 | </form> | |
55 |
<p><strong>MIME types defined:</strong> |
|
55 | <p><strong>MIME types defined:</strong> | |
56 | <code><a href="?mime=text/x-sql">text/x-sql</a></code>, |
|
56 | <code><a href="?mime=text/x-sql">text/x-sql</a></code>, | |
57 | <code><a href="?mime=text/x-mysql">text/x-mysql</a></code>, |
|
57 | <code><a href="?mime=text/x-mysql">text/x-mysql</a></code>, | |
58 | <code><a href="?mime=text/x-mariadb">text/x-mariadb</a></code>, |
|
58 | <code><a href="?mime=text/x-mariadb">text/x-mariadb</a></code>, |
@@ -20,11 +20,11 b'' | |||||
20 | \frametitle{Size Lemma for Balanced Trees} |
|
20 | \frametitle{Size Lemma for Balanced Trees} | |
21 | \begin{itemize} |
|
21 | \begin{itemize} | |
22 | \item |
|
22 | \item | |
23 |
\begin{assertion}[id=size-lemma,type=lemma] |
|
23 | \begin{assertion}[id=size-lemma,type=lemma] | |
24 |
Let $G=\tup{V,E}$ be a \termref[cd=binary-trees]{balanced binary tree} |
|
24 | Let $G=\tup{V,E}$ be a \termref[cd=binary-trees]{balanced binary tree} | |
25 | of \termref[cd=graph-depth,name=vertex-depth]{depth}$n>i$, then the set |
|
25 | of \termref[cd=graph-depth,name=vertex-depth]{depth}$n>i$, then the set | |
26 | $\defeq{\livar{V}i}{\setst{\inset{v}{V}}{\gdepth{v} = i}}$ of |
|
26 | $\defeq{\livar{V}i}{\setst{\inset{v}{V}}{\gdepth{v} = i}}$ of | |
27 |
\termref[cd=graphs-intro,name=node]{nodes} at |
|
27 | \termref[cd=graphs-intro,name=node]{nodes} at | |
28 | \termref[cd=graph-depth,name=vertex-depth]{depth} $i$ has |
|
28 | \termref[cd=graph-depth,name=vertex-depth]{depth} $i$ has | |
29 | \termref[cd=cardinality,name=cardinality]{cardinality} $\power2i$. |
|
29 | \termref[cd=cardinality,name=cardinality]{cardinality} $\power2i$. | |
30 | \end{assertion} |
|
30 | \end{assertion} | |
@@ -39,7 +39,7 b'' | |||||
39 | \end{spfcase} |
|
39 | \end{spfcase} | |
40 | \begin{spfcase}{$i>0$} |
|
40 | \begin{spfcase}{$i>0$} | |
41 | \begin{spfstep}[display=flow] |
|
41 | \begin{spfstep}[display=flow] | |
42 |
then $\livar{V}{i-1}$ contains $\power2{i-1}$ vertexes |
|
42 | then $\livar{V}{i-1}$ contains $\power2{i-1}$ vertexes | |
43 | \begin{justification}[method=byIH](IH)\end{justification} |
|
43 | \begin{justification}[method=byIH](IH)\end{justification} | |
44 | \end{spfstep} |
|
44 | \end{spfstep} | |
45 | \begin{spfstep} |
|
45 | \begin{spfstep} | |
@@ -57,8 +57,8 b'' | |||||
57 | \end{spfcase} |
|
57 | \end{spfcase} | |
58 | \end{spfcases} |
|
58 | \end{spfcases} | |
59 | \end{sproof} |
|
59 | \end{sproof} | |
60 |
\item |
|
60 | \item | |
61 |
\begin{assertion}[id=fbbt,type=corollary] |
|
61 | \begin{assertion}[id=fbbt,type=corollary] | |
62 | A fully balanced tree of depth $d$ has $\power2{d+1}-1$ nodes. |
|
62 | A fully balanced tree of depth $d$ has $\power2{d+1}-1$ nodes. | |
63 | \end{assertion} |
|
63 | \end{assertion} | |
64 | \item |
|
64 | \item | |
@@ -81,7 +81,7 b'' | |||||
81 | \end{note} |
|
81 | \end{note} | |
82 | \end{module} |
|
82 | \end{module} | |
83 |
|
83 | |||
84 |
%%% Local Variables: |
|
84 | %%% Local Variables: | |
85 | %%% mode: LaTeX |
|
85 | %%% mode: LaTeX | |
86 | %%% TeX-master: "all" |
|
86 | %%% TeX-master: "all" | |
87 | %%% End: \end{document} |
|
87 | %%% End: \end{document} |
@@ -63,13 +63,13 b' namespace eval whois {' | |||||
63 | proc whois::311 {from key text} { |
|
63 | proc whois::311 {from key text} { | |
64 | if {[regexp -- {^[^\s]+\s(.+?)\s(.+?)\s(.+?)\s\*\s\:(.+)$} $text wholematch nick ident host realname]} { |
|
64 | if {[regexp -- {^[^\s]+\s(.+?)\s(.+?)\s(.+?)\s\*\s\:(.+)$} $text wholematch nick ident host realname]} { | |
65 | putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Host:${whois::textf} \ |
|
65 | putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Host:${whois::textf} \ | |
66 |
|
|
66 | $nick \(${ident}@${host}\) ${whois::tagf}Realname:${whois::textf} $realname" | |
67 | } |
|
67 | } | |
68 | } |
|
68 | } | |
69 | proc whois::multi {from key text} { |
|
69 | proc whois::multi {from key text} { | |
70 | if {[regexp {\:(.*)$} $text match $key]} { |
|
70 | if {[regexp {\:(.*)$} $text match $key]} { | |
71 | putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Note:${whois::textf} [subst $$key]" |
|
71 | putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Note:${whois::textf} [subst $$key]" | |
72 |
|
|
72 | return 1 | |
73 | } |
|
73 | } | |
74 | } |
|
74 | } | |
75 | proc whois::312 {from key text} { |
|
75 | proc whois::312 {from key text} { | |
@@ -84,7 +84,7 b' proc whois::319 {from key text} {' | |||||
84 | proc whois::317 {from key text} { |
|
84 | proc whois::317 {from key text} { | |
85 | if {[regexp -- {.*\s(\d+)\s(\d+)\s\:} $text wholematch idle signon]} { |
|
85 | if {[regexp -- {.*\s(\d+)\s(\d+)\s\:} $text wholematch idle signon]} { | |
86 | putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Connected:${whois::textf} \ |
|
86 | putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Connected:${whois::textf} \ | |
87 |
|
|
87 | [ctime $signon] ${whois::tagf}Idle:${whois::textf} [duration $idle]" | |
88 | } |
|
88 | } | |
89 | } |
|
89 | } | |
90 | proc whois::301 {from key text} { |
|
90 | proc whois::301 {from key text} { | |
@@ -94,7 +94,7 b' proc whois::301 {from key text} {' | |||||
94 | } |
|
94 | } | |
95 | proc whois::318 {from key text} { |
|
95 | proc whois::318 {from key text} { | |
96 | namespace eval whois { |
|
96 | namespace eval whois { | |
97 |
|
|
97 | variable channel "" | |
98 | } |
|
98 | } | |
99 | variable whois::channel "" |
|
99 | variable whois::channel "" | |
100 | } |
|
100 | } | |
@@ -104,8 +104,8 b' proc whois::307 {from key text} {' | |||||
104 | proc whois::list {nick host hand chan text} { |
|
104 | proc whois::list {nick host hand chan text} { | |
105 | if {[lsearch -exact [channel info $chan] "+${whois::command}"] != -1} { |
|
105 | if {[lsearch -exact [channel info $chan] "+${whois::command}"] != -1} { | |
106 | namespace eval whois { |
|
106 | namespace eval whois { | |
107 |
|
|
107 | variable channel "" | |
108 | } |
|
108 | } | |
109 | variable whois::channel $chan |
|
109 | variable whois::channel $chan | |
110 | putserv "WHOIS $text" |
|
110 | putserv "WHOIS $text" | |
111 | } |
|
111 | } | |
@@ -116,7 +116,7 b' Ford_Lawnmower irc.GeekShed.net #Script-' | |||||
116 | <script> |
|
116 | <script> | |
117 | var editor = CodeMirror.fromTextArea(document.getElementById("code"), { |
|
117 | var editor = CodeMirror.fromTextArea(document.getElementById("code"), { | |
118 | tabMode: "indent", |
|
118 | tabMode: "indent", | |
119 |
|
|
119 | theme: "night", | |
120 | lineNumbers: true, |
|
120 | lineNumbers: true, | |
121 | indentUnit: 2, |
|
121 | indentUnit: 2, | |
122 | mode: "text/x-tcl" |
|
122 | mode: "text/x-tcl" |
@@ -128,7 +128,7 b' cf. [[TiddlyWiki.com|http://www.tiddlywi' | |||||
128 |
|
128 | |||
129 | <script> |
|
129 | <script> | |
130 | var editor = CodeMirror.fromTextArea(document.getElementById("code"), { |
|
130 | var editor = CodeMirror.fromTextArea(document.getElementById("code"), { | |
131 |
mode: 'tiddlywiki', |
|
131 | mode: 'tiddlywiki', | |
132 | lineNumbers: true, |
|
132 | lineNumbers: true, | |
133 | enterMode: 'keep', |
|
133 | enterMode: 'keep', | |
134 | matchBrackets: true |
|
134 | matchBrackets: true |
@@ -71,8 +71,8 b' Plugin (inline):' | |||||
71 | </textarea></div> |
|
71 | </textarea></div> | |
72 |
|
72 | |||
73 | <script type="text/javascript"> |
|
73 | <script type="text/javascript"> | |
74 |
|
|
74 | var editor = CodeMirror.fromTextArea(document.getElementById("code"), { | |
75 |
mode: 'tiki', |
|
75 | mode: 'tiki', | |
76 | lineNumbers: true |
|
76 | lineNumbers: true | |
77 | }); |
|
77 | }); | |
78 | </script> |
|
78 | </script> |
@@ -1,26 +1,26 b'' | |||||
1 | .cm-tw-syntaxerror { |
|
1 | .cm-tw-syntaxerror { | |
2 |
|
|
2 | color: #FFF; | |
3 |
|
|
3 | background-color: #900; | |
4 | } |
|
4 | } | |
5 |
|
5 | |||
6 | .cm-tw-deleted { |
|
6 | .cm-tw-deleted { | |
7 |
|
|
7 | text-decoration: line-through; | |
8 | } |
|
8 | } | |
9 |
|
9 | |||
10 | .cm-tw-header5 { |
|
10 | .cm-tw-header5 { | |
11 |
|
|
11 | font-weight: bold; | |
12 | } |
|
12 | } | |
13 | .cm-tw-listitem:first-child { /*Added first child to fix duplicate padding when highlighting*/ |
|
13 | .cm-tw-listitem:first-child { /*Added first child to fix duplicate padding when highlighting*/ | |
14 |
|
|
14 | padding-left: 10px; | |
15 | } |
|
15 | } | |
16 |
|
16 | |||
17 | .cm-tw-box { |
|
17 | .cm-tw-box { | |
18 |
|
|
18 | border-top-width: 0px ! important; | |
19 |
|
|
19 | border-style: solid; | |
20 |
|
|
20 | border-width: 1px; | |
21 |
|
|
21 | border-color: inherit; | |
22 | } |
|
22 | } | |
23 |
|
23 | |||
24 | .cm-tw-underline { |
|
24 | .cm-tw-underline { | |
25 |
|
|
25 | text-decoration: underline; | |
26 | } No newline at end of file |
|
26 | } |
@@ -16,7 +16,7 b'' | |||||
16 | @prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> . |
|
16 | @prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> . | |
17 | @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . |
|
17 | @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | |
18 |
|
18 | |||
19 |
<http://purl.org/net/bsletten> |
|
19 | <http://purl.org/net/bsletten> | |
20 | a foaf:Person; |
|
20 | a foaf:Person; | |
21 | foaf:interest <http://www.w3.org/2000/01/sw/>; |
|
21 | foaf:interest <http://www.w3.org/2000/01/sw/>; | |
22 | foaf:based_near [ |
|
22 | foaf:based_near [ |
@@ -11,7 +11,7 b'' | |||||
11 | .CodeMirror {border: 1px solid #aaa; height:210px; height: auto;} |
|
11 | .CodeMirror {border: 1px solid #aaa; height:210px; height: auto;} | |
12 | .CodeMirror-scroll { overflow-x: auto; overflow-y: hidden;} |
|
12 | .CodeMirror-scroll { overflow-x: auto; overflow-y: hidden;} | |
13 | .CodeMirror pre { font-family: Inconsolata; font-size: 14px} |
|
13 | .CodeMirror pre { font-family: Inconsolata; font-size: 14px} | |
14 |
</style> |
|
14 | </style> | |
15 | <script type="text/javascript" src="../../addon/runmode/runmode.js"></script> |
|
15 | <script type="text/javascript" src="../../addon/runmode/runmode.js"></script> | |
16 | </head> |
|
16 | </head> | |
17 | <body onload="init()"> |
|
17 | <body onload="init()"> | |
@@ -21,7 +21,7 b' function test(golden, text) {' | |||||
21 | var ok = true; |
|
21 | var ok = true; | |
22 | var i = 0; |
|
22 | var i = 0; | |
23 | function callback(token, style, lineNo, pos){ |
|
23 | function callback(token, style, lineNo, pos){ | |
24 |
|
|
24 | //console.log(String(token) + " " + String(style) + " " + String(lineNo) + " " + String(pos)); | |
25 | var result = [String(token), String(style)]; |
|
25 | var result = [String(token), String(style)]; | |
26 | if (golden[i][0] != result[0] || golden[i][1] != result[1]){ |
|
26 | if (golden[i][0] != result[0] || golden[i][1] != result[1]){ | |
27 | return "Error, expected: " + String(golden[i]) + ", got: " + String(result); |
|
27 | return "Error, expected: " + String(golden[i]) + ", got: " + String(result); | |
@@ -29,7 +29,7 b' function test(golden, text) {' | |||||
29 | } |
|
29 | } | |
30 | i++; |
|
30 | i++; | |
31 | } |
|
31 | } | |
32 |
CodeMirror.runMode(text, "text/x-vb",callback); |
|
32 | CodeMirror.runMode(text, "text/x-vb",callback); | |
33 |
|
33 | |||
34 | if (ok) return "Tests OK"; |
|
34 | if (ok) return "Tests OK"; | |
35 | } |
|
35 | } | |
@@ -72,9 +72,9 b' function init() {' | |||||
72 | runTest(); |
|
72 | runTest(); | |
73 | } |
|
73 | } | |
74 | function runTest() { |
|
74 | function runTest() { | |
75 |
|
|
75 | document.getElementById('testresult').innerHTML = testAll(); | |
76 | initText(editor); |
|
76 | initText(editor); | |
77 |
|
77 | |||
78 | } |
|
78 | } | |
79 | </script> |
|
79 | </script> | |
80 |
|
80 |
@@ -23,10 +23,10 b' Const ForReading = 1, ForWriting = 2, Fo' | |||||
23 | Call Sub020_PostBroadcastToUrbanAirship(strUserName, strPassword, intTransmitID, strResponse) |
|
23 | Call Sub020_PostBroadcastToUrbanAirship(strUserName, strPassword, intTransmitID, strResponse) | |
24 |
|
24 | |||
25 | If Not IsNull(strResponse) AND Len(strResponse) = 0 Then |
|
25 | If Not IsNull(strResponse) AND Len(strResponse) = 0 Then | |
26 |
|
|
26 | boolTransmitOkYN = False | |
27 | Else |
|
27 | Else | |
28 |
|
|
28 | ' WScript.Echo "Oh Happy Day! Oh Happy DAY!" | |
29 |
|
|
29 | boolTransmitOkYN = True | |
30 | End If |
|
30 | End If | |
31 | </textarea></div> |
|
31 | </textarea></div> | |
32 |
|
32 | |||
@@ -39,4 +39,3 b' End If' | |||||
39 | <p><strong>MIME types defined:</strong> <code>text/vbscript</code>.</p> |
|
39 | <p><strong>MIME types defined:</strong> <code>text/vbscript</code>.</p> | |
40 | </body> |
|
40 | </body> | |
41 | </html> |
|
41 | </html> | |
42 |
|
@@ -72,7 +72,7 b' module butterfly' | |||||
72 | assign ya_im = xa_im_z + xbw_im; |
|
72 | assign ya_im = xa_im_z + xbw_im; | |
73 | assign yb_re = xa_re_z - xbw_re; |
|
73 | assign yb_re = xa_re_z - xbw_re; | |
74 | assign yb_im = xa_im_z - xbw_im; |
|
74 | assign yb_im = xa_im_z - xbw_im; | |
75 |
|
75 | |||
76 | // Create the multiply module. |
|
76 | // Create the multiply module. | |
77 | multiply_complex #(WIDTH) multiply_complex_0 |
|
77 | multiply_complex #(WIDTH) multiply_complex_0 | |
78 | (.clk(clk), |
|
78 | (.clk(clk), | |
@@ -101,7 +101,7 b' module butterfly' | |||||
101 | end |
|
101 | end | |
102 | end |
|
102 | end | |
103 | end |
|
103 | end | |
104 |
|
104 | |||
105 | endmodule |
|
105 | endmodule | |
106 | </textarea></form> |
|
106 | </textarea></form> | |
107 |
|
107 |
@@ -1,5 +1,5 b'' | |||||
1 |
<!doctype html> |
|
1 | <!doctype html> | |
2 |
<html> |
|
2 | <html> | |
3 | <!-- |
|
3 | <!-- | |
4 | /* |
|
4 | /* | |
5 | Copyright (C) 2011 by MarkLogic Corporation |
|
5 | Copyright (C) 2011 by MarkLogic Corporation | |
@@ -24,39 +24,39 b' OUT OF OR IN CONNECTION WITH THE SOFTWAR' | |||||
24 | THE SOFTWARE. |
|
24 | THE SOFTWARE. | |
25 | */ |
|
25 | */ | |
26 | --> |
|
26 | --> | |
27 |
<head> |
|
27 | <head> | |
28 | <meta charset="utf-8"> |
|
28 | <meta charset="utf-8"> | |
29 |
<title>CodeMirror: XQuery mode</title> |
|
29 | <title>CodeMirror: XQuery mode</title> | |
30 |
<link rel="stylesheet" href="../../lib/codemirror.css"> |
|
30 | <link rel="stylesheet" href="../../lib/codemirror.css"> | |
31 |
<script src="../../lib/codemirror.js"></script> |
|
31 | <script src="../../lib/codemirror.js"></script> | |
32 |
<script src="xquery.js"></script> |
|
32 | <script src="xquery.js"></script> | |
33 |
<link rel="stylesheet" href="../../doc/docs.css"> |
|
33 | <link rel="stylesheet" href="../../doc/docs.css"> | |
34 |
<link rel="stylesheet" href="../../theme/xq-dark.css"> |
|
34 | <link rel="stylesheet" href="../../theme/xq-dark.css"> | |
35 | <style type="text/css"> |
|
35 | <style type="text/css"> | |
36 |
|
|
36 | .CodeMirror { | |
37 |
|
|
37 | border-top: 1px solid black; border-bottom: 1px solid black; | |
38 |
|
|
38 | height:400px; | |
39 | } |
|
39 | } | |
40 |
</style> |
|
40 | </style> | |
41 |
</head> |
|
41 | </head> | |
42 |
<body> |
|
42 | <body> | |
43 |
<h1>CodeMirror: XQuery mode</h1> |
|
43 | <h1>CodeMirror: XQuery mode</h1> | |
44 |
|
44 | |||
45 |
<div class="cm-s-default"> |
|
45 | <div class="cm-s-default"> | |
46 |
|
|
46 | <textarea id="code" name="code"> | |
47 | xquery version "1.0-ml"; |
|
47 | xquery version "1.0-ml"; | |
48 | (: this is |
|
48 | (: this is | |
49 |
: a |
|
49 | : a | |
50 | "comment" :) |
|
50 | "comment" :) | |
51 | let $let := <x attr="value">"test"<func>function() $var {function()} {$var}</func></x> |
|
51 | let $let := <x attr="value">"test"<func>function() $var {function()} {$var}</func></x> | |
52 | let $joe:=1 |
|
52 | let $joe:=1 | |
53 | return element element { |
|
53 | return element element { | |
54 |
|
|
54 | attribute attribute { 1 }, | |
55 |
|
|
55 | element test { 'a' }, | |
56 |
|
|
56 | attribute foo { "bar" }, | |
57 |
|
|
57 | fn:doc()[ foo/@bar eq $let ], | |
58 | //x } |
|
58 | //x } | |
59 |
|
59 | |||
60 | (: a more 'evil' test :) |
|
60 | (: a more 'evil' test :) | |
61 | (: Modified Blakeley example (: with nested comment :) ... :) |
|
61 | (: Modified Blakeley example (: with nested comment :) ... :) | |
62 | declare private function local:declare() {()}; |
|
62 | declare private function local:declare() {()}; | |
@@ -65,11 +65,11 b' declare private function local:function(' | |||||
65 | declare private function local:local() {()}; |
|
65 | declare private function local:local() {()}; | |
66 | let $let := <let>let $let := "let"</let> |
|
66 | let $let := <let>let $let := "let"</let> | |
67 | return element element { |
|
67 | return element element { | |
68 |
|
|
68 | attribute attribute { try { xdmp:version() } catch($e) { xdmp:log($e) } }, | |
69 |
|
|
69 | attribute fn:doc { "bar" castable as xs:string }, | |
70 |
|
|
70 | element text { text { "text" } }, | |
71 |
|
|
71 | fn:doc()[ child::eq/(@bar | attribute::attribute) eq $let ], | |
72 |
|
|
72 | //fn:doc | |
73 | } |
|
73 | } | |
74 |
|
74 | |||
75 |
|
75 | |||
@@ -193,29 +193,29 b' declare function json:print-name-value($' | |||||
193 |
|
193 | |||
194 | @author Jason Hunter |
|
194 | @author Jason Hunter | |
195 | @version 1.0.1 |
|
195 | @version 1.0.1 | |
196 |
|
196 | |||
197 | Ported to xquery 1.0-ml; double escaped backslashes in json:escape |
|
197 | Ported to xquery 1.0-ml; double escaped backslashes in json:escape | |
198 | :) |
|
198 | :) | |
199 | declare function json:serialize($x as element()) as xs:string { |
|
199 | declare function json:serialize($x as element()) as xs:string { | |
200 | string-join(('{', json:print-name-value($x), '}'), "") |
|
200 | string-join(('{', json:print-name-value($x), '}'), "") | |
201 | }; |
|
201 | }; | |
202 |
</textarea> |
|
202 | </textarea> | |
203 |
</div> |
|
203 | </div> | |
204 |
|
204 | |||
205 |
<script> |
|
205 | <script> | |
206 | var editor = CodeMirror.fromTextArea(document.getElementById("code"), { |
|
206 | var editor = CodeMirror.fromTextArea(document.getElementById("code"), { | |
207 | lineNumbers: true, |
|
207 | lineNumbers: true, | |
208 | matchBrackets: true, |
|
208 | matchBrackets: true, | |
209 | theme: "xq-dark" |
|
209 | theme: "xq-dark" | |
210 | }); |
|
210 | }); | |
211 |
</script> |
|
211 | </script> | |
212 |
|
212 | |||
213 |
<p><strong>MIME types defined:</strong> <code>application/xquery</code>.</p> |
|
213 | <p><strong>MIME types defined:</strong> <code>application/xquery</code>.</p> | |
214 |
|
214 | |||
215 |
<p>Development of the CodeMirror XQuery mode was sponsored by |
|
215 | <p>Development of the CodeMirror XQuery mode was sponsored by | |
216 |
<a href="http://marklogic.com">MarkLogic</a> and developed by |
|
216 | <a href="http://marklogic.com">MarkLogic</a> and developed by | |
217 | <a href="https://twitter.com/mbrevoort">Mike Brevoort</a>. |
|
217 | <a href="https://twitter.com/mbrevoort">Mike Brevoort</a>. | |
218 | </p> |
|
218 | </p> | |
219 |
|
219 | |||
220 |
</body> |
|
220 | </body> | |
221 | </html> |
|
221 | </html> |
General Comments 0
You need to be logged in to leave comments.
Login now