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