Changeset - c9bcfe2d2ade
[Not reviewed]
default
0 48 0
Marcin Kuzminski - 12 years ago 2013-06-21 01:11:16
marcin@python-works.com
codecleaner
48 files changed with 439 insertions and 441 deletions:
0 comments (0 inline, 0 general)
rhodecode/public/js/mode/apl/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: APL mode</title>
 
    <link rel="stylesheet" href="../../doc/docs.css"> 
 
    <link rel="stylesheet" href="../../lib/codemirror.css"> 
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="../../addon/edit/matchbrackets.js"></script>
 
    <script src="apl.js"></script>
 
    <style>
 
	.CodeMirror { border: 2px inset #dee; }
 
    .CodeMirror { border: 2px inset #dee; }
 
    </style>
 
  </head>
 
  <body>
 
    <h1>CodeMirror: APL mode</h1>
 

	
 
<form><textarea id="code" name="code">
 
⍝ Conway's game of life
 

	
 
⍝ This example was inspired by the impressive demo at
 
⍝ http://www.youtube.com/watch?v=a9xAKttWgP4
 

	
 
⍝ Create a matrix:
 
⍝     0 1 1
 
⍝     1 1 0
 
⍝     0 1 0
 
creature ← (3 3 ⍴ ⍳ 9) ∈ 1 2 3 4 7   ⍝ Original creature from demo
 
creature ← (3 3 ⍴ ⍳ 9) ∈ 1 3 6 7 8   ⍝ Glider
 

	
 
⍝ Place the creature on a larger board, near the centre
 
board ← ¯1 ⊖ ¯2 ⌽ 5 7 ↑ creature
 

	
 
⍝ A function to move from one generation to the next
 
life ← {∨/ 1 ⍵ ∧ 3 4 = ⊂+/ +⌿ 1 0 ¯1 ∘.⊖ 1 0 ¯1 ⌽¨ ⊂⍵}
 

	
 
⍝ Compute n-th generation and format it as a
 
⍝ character matrix
 
gen ← {' #'[(life ⍣ ⍵) board]}
 

	
 
⍝ Show first three generations
 
(gen 1) (gen 2) (gen 3)
 
</textarea></form>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        lineNumbers: true,
 
        matchBrackets: true,
 
        mode: "text/apl"
 
      });
 
    </script>
 

	
 
    <p>Simple mode that tries to handle APL as well as it can.</p>
 
    <p>It attempts to label functions/operators based upon
 
    monadic/dyadic usage (but this is far from fully fleshed out).
 
    This means there are meaningful classnames so hover states can
 
    have popups etc.</p>
 

	
 
    <p><strong>MIME types defined:</strong> <code>text/apl</code> (APL code)</p>
 
  </body>
rhodecode/public/js/mode/asterisk/index.html
Show inline comments
 
@@ -7,136 +7,136 @@
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="asterisk.js"></script>
 
    <style>
 
      .CodeMirror {border: 1px solid #999;}
 
      .cm-s-default span.cm-arrow { color: red; }
 
    </style>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
  </head>
 
  <body>
 
    <h1>CodeMirror: Asterisk dialplan mode</h1>
 
    <form><textarea id="code" name="code">
 
; extensions.conf - the Asterisk dial plan
 
;
 

	
 
[general]
 
;
 
; If static is set to no, or omitted, then the pbx_config will rewrite
 
; this file when extensions are modified.  Remember that all comments
 
; made in the file will be lost when that happens.
 
static=yes
 

	
 
#include "/etc/asterisk/additional_general.conf
 

	
 
[iaxprovider]
 
switch => IAX2/user:[key]@myserver/mycontext
 

	
 
[dynamic]
 
#exec /usr/bin/dynamic-peers.pl
 

	
 
[trunkint]
 
;
 
; International long distance through trunk
 
;
 
exten => _9011.,1,Macro(dundi-e164,${EXTEN:4})
 
exten => _9011.,n,Dial(${GLOBAL(TRUNK)}/${FILTER(0-9,${EXTEN:${GLOBAL(TRUNKMSD)}})})
 

	
 
[local]
 
;
 
; Master context for local, toll-free, and iaxtel calls only
 
;
 
ignorepat => 9
 
include => default
 

	
 
[demo]
 
include => stdexten
 
;
 
; We start with what to do when a call first comes in.
 
;
 
exten => s,1,Wait(1)			; Wait a second, just for fun
 
same  => n,Answer			; Answer the line
 
same  => n,Set(TIMEOUT(digit)=5)	; Set Digit Timeout to 5 seconds
 
same  => n,Set(TIMEOUT(response)=10)	; Set Response Timeout to 10 seconds
 
same  => n(restart),BackGround(demo-congrats)	; Play a congratulatory message
 
same  => n(instruct),BackGround(demo-instruct)	; Play some instructions
 
same  => n,WaitExten			; Wait for an extension to be dialed.
 
exten => s,1,Wait(1)            ; Wait a second, just for fun
 
same  => n,Answer           ; Answer the line
 
same  => n,Set(TIMEOUT(digit)=5)    ; Set Digit Timeout to 5 seconds
 
same  => n,Set(TIMEOUT(response)=10)    ; Set Response Timeout to 10 seconds
 
same  => n(restart),BackGround(demo-congrats)   ; Play a congratulatory message
 
same  => n(instruct),BackGround(demo-instruct)  ; Play some instructions
 
same  => n,WaitExten            ; Wait for an extension to be dialed.
 

	
 
exten => 2,1,BackGround(demo-moreinfo)	; Give some more information.
 
exten => 2,1,BackGround(demo-moreinfo)  ; Give some more information.
 
exten => 2,n,Goto(s,instruct)
 

	
 
exten => 3,1,Set(LANGUAGE()=fr)		; Set language to french
 
exten => 3,n,Goto(s,restart)		; Start with the congratulations
 
exten => 3,1,Set(LANGUAGE()=fr)     ; Set language to french
 
exten => 3,n,Goto(s,restart)        ; Start with the congratulations
 

	
 
exten => 1000,1,Goto(default,s,1)
 
;
 
; We also create an example user, 1234, who is on the console and has
 
; voicemail, etc.
 
;
 
exten => 1234,1,Playback(transfer,skip)		; "Please hold while..."
 
					; (but skip if channel is not up)
 
exten => 1234,1,Playback(transfer,skip)     ; "Please hold while..."
 
                    ; (but skip if channel is not up)
 
exten => 1234,n,Gosub(${EXTEN},stdexten(${GLOBAL(CONSOLE)}))
 
exten => 1234,n,Goto(default,s,1)		; exited Voicemail
 
exten => 1234,n,Goto(default,s,1)       ; exited Voicemail
 

	
 
exten => 1235,1,Voicemail(1234,u)		; Right to voicemail
 
exten => 1235,1,Voicemail(1234,u)       ; Right to voicemail
 

	
 
exten => 1236,1,Dial(Console/dsp)		; Ring forever
 
exten => 1236,n,Voicemail(1234,b)		; Unless busy
 
exten => 1236,1,Dial(Console/dsp)       ; Ring forever
 
exten => 1236,n,Voicemail(1234,b)       ; Unless busy
 

	
 
;
 
; # for when they're done with the demo
 
;
 
exten => #,1,Playback(demo-thanks)	; "Thanks for trying the demo"
 
exten => #,n,Hangup			; Hang them up.
 
exten => #,1,Playback(demo-thanks)  ; "Thanks for trying the demo"
 
exten => #,n,Hangup         ; Hang them up.
 

	
 
;
 
; A timeout and "invalid extension rule"
 
;
 
exten => t,1,Goto(#,1)			; If they take too long, give up
 
exten => i,1,Playback(invalid)		; "That's not valid, try again"
 
exten => t,1,Goto(#,1)          ; If they take too long, give up
 
exten => i,1,Playback(invalid)      ; "That's not valid, try again"
 

	
 
;
 
; Create an extension, 500, for dialing the
 
; Asterisk demo.
 
;
 
exten => 500,1,Playback(demo-abouttotry); Let them know what's going on
 
exten => 500,n,Dial(IAX2/guest@pbx.digium.com/s@default)	; Call the Asterisk demo
 
exten => 500,n,Playback(demo-nogo)	; Couldn't connect to the demo site
 
exten => 500,n,Goto(s,6)		; Return to the start over message.
 
exten => 500,n,Dial(IAX2/guest@pbx.digium.com/s@default)    ; Call the Asterisk demo
 
exten => 500,n,Playback(demo-nogo)  ; Couldn't connect to the demo site
 
exten => 500,n,Goto(s,6)        ; Return to the start over message.
 

	
 
;
 
; Create an extension, 600, for evaluating echo latency.
 
;
 
exten => 600,1,Playback(demo-echotest)	; Let them know what's going on
 
exten => 600,n,Echo			; Do the echo test
 
exten => 600,n,Playback(demo-echodone)	; Let them know it's over
 
exten => 600,n,Goto(s,6)		; Start over
 
exten => 600,1,Playback(demo-echotest)  ; Let them know what's going on
 
exten => 600,n,Echo         ; Do the echo test
 
exten => 600,n,Playback(demo-echodone)  ; Let them know it's over
 
exten => 600,n,Goto(s,6)        ; Start over
 

	
 
;
 
;	You can use the Macro Page to intercom a individual user
 
;   You can use the Macro Page to intercom a individual user
 
exten => 76245,1,Macro(page,SIP/Grandstream1)
 
; or if your peernames are the same as extensions
 
exten => _7XXX,1,Macro(page,SIP/${EXTEN})
 
;
 
;
 
; System Wide Page at extension 7999
 
;
 
exten => 7999,1,Set(TIMEOUT(absolute)=60)
 
exten => 7999,2,Page(Local/Grandstream1@page&Local/Xlite1@page&Local/1234@page/n,d)
 

	
 
; Give voicemail at extension 8500
 
;
 
exten => 8500,1,VoicemailMain
 
exten => 8500,n,Goto(s,6)
 

	
 
    </textarea></form>
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        mode: "text/x-asterisk",
 
        matchBrackets: true,
 
        lineNumber: true
 
      });
 
    </script>
 

	
 
    <p><strong>MIME types defined:</strong> <code>text/x-asterisk</code>.</p>
 

	
 
  </body>
 
</html>
rhodecode/public/js/mode/clike/scala.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: C-like mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <link rel="stylesheet" href="../../theme/ambiance.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="../../addon/edit/matchbrackets.js"></script>
 
    <script src="clike.js"></script>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
    <style>
 
      body
 
      {
 
        margin: 0;
 
        padding: 0;
 
        max-width:inherit;
 
        height: 100%;
 
      }
 
      html, form, .CodeMirror, .CodeMirror-scroll
 
      {
 
        height: 100%;        
 
        height: 100%;
 
      }
 
    </style>
 
  </head>
 
  <body>
 
<form>
 
<textarea id="code" name="code">
 

	
 
  /*                     __                                               *\
 
  **     ________ ___   / /  ___     Scala API                            **
 
  **    / __/ __// _ | / /  / _ |    (c) 2003-2011, LAMP/EPFL             **
 
  **  __\ \/ /__/ __ |/ /__/ __ |    http://scala-lang.org/               **
 
  ** /____/\___/_/ |_/____/_/ | |                                         **
 
  **                          |/                                          **
 
  \*                                                                      */
 

	
 
  package scala.collection
 

	
 
  import generic._
 
  import mutable.{ Builder, ListBuffer }
 
  import annotation.{tailrec, migration, bridge}
 
  import annotation.unchecked.{ uncheckedVariance => uV }
 
  import parallel.ParIterable
 

	
 
  /** A template trait for traversable collections of type `Traversable[A]`.
 
   *  
 
   *
 
   *  $traversableInfo
 
   *  @define mutability
 
   *  @define traversableInfo
 
   *  This is a base trait of all kinds of $mutability Scala collections. It
 
   *  implements the behavior common to all collections, in terms of a method
 
   *  `foreach` with signature:
 
   * {{{
 
   *     def foreach[U](f: Elem => U): Unit
 
   * }}}
 
   *  Collection classes mixing in this trait provide a concrete 
 
   *  Collection classes mixing in this trait provide a concrete
 
   *  `foreach` method which traverses all the
 
   *  elements contained in the collection, applying a given function to each.
 
   *  They also need to provide a method `newBuilder`
 
   *  which creates a builder for collections of the same kind.
 
   *  
 
   *
 
   *  A traversable class might or might not have two properties: strictness
 
   *  and orderedness. Neither is represented as a type.
 
   *  
 
   *
 
   *  The instances of a strict collection class have all their elements
 
   *  computed before they can be used as values. By contrast, instances of
 
   *  a non-strict collection class may defer computation of some of their
 
   *  elements until after the instance is available as a value.
 
   *  A typical example of a non-strict collection class is a
 
   *  <a href="../immutable/Stream.html" target="ContentFrame">
 
   *  `scala.collection.immutable.Stream`</a>.
 
   *  A more general class of examples are `TraversableViews`.
 
   *  
 
   *
 
   *  If a collection is an instance of an ordered collection class, traversing
 
   *  its elements with `foreach` will always visit elements in the
 
   *  same order, even for different runs of the program. If the class is not
 
   *  ordered, `foreach` can visit elements in different orders for
 
   *  different runs (but it will keep the same order in the same run).'
 
   * 
 
   *
 
   *  A typical example of a collection class which is not ordered is a
 
   *  `HashMap` of objects. The traversal order for hash maps will
 
   *  depend on the hash codes of its elements, and these hash codes might
 
   *  differ from one run to the next. By contrast, a `LinkedHashMap`
 
   *  is ordered because it's `foreach` method visits elements in the
 
   *  order they were inserted into the `HashMap`.
 
   *
 
   *  @author Martin Odersky
 
   *  @version 2.8
 
   *  @since   2.8
 
   *  @tparam A    the element type of the collection
 
   *  @tparam Repr the type of the actual collection containing the elements.
 
   *
 
   *  @define Coll Traversable
 
   *  @define coll traversable collection
 
   */
 
  trait TraversableLike[+A, +Repr] extends HasNewBuilder[A, Repr] 
 
  trait TraversableLike[+A, +Repr] extends HasNewBuilder[A, Repr]
 
                                      with FilterMonadic[A, Repr]
 
                                      with TraversableOnce[A]
 
                                      with GenTraversableLike[A, Repr]
 
                                      with Parallelizable[A, ParIterable[A]]
 
  {
 
    self =>
 

	
 
    import Traversable.breaks._
 

	
 
    /** The type implementing this traversable */
 
    protected type Self = Repr
 

	
 
    /** The collection of type $coll underlying this `TraversableLike` object.
 
     *  By default this is implemented as the `TraversableLike` object itself,
 
     *  but this can be overridden.
 
     */
 
    def repr: Repr = this.asInstanceOf[Repr]
 

	
 
    /** The underlying collection seen as an instance of `$Coll`.
 
     *  By default this is implemented as the current collection object itself,
 
     *  but this can be overridden.
 
     */
 
    protected[this] def thisCollection: Traversable[A] = this.asInstanceOf[Traversable[A]]
 

	
 
    /** A conversion from collections of type `Repr` to `$Coll` objects.
 
     *  By default this is implemented as just a cast, but this can be overridden.
 
     */
 
    protected[this] def toCollection(repr: Repr): Traversable[A] = repr.asInstanceOf[Traversable[A]]
 

	
 
    /** Creates a new builder for this collection type.
 
     */
 
    protected[this] def newBuilder: Builder[A, Repr]
 

	
 
    protected[this] def parCombiner = ParIterable.newCombiner[A]
 

	
 
    /** Applies a function `f` to all elements of this $coll.
 
     *  
 
     *
 
     *    Note: this method underlies the implementation of most other bulk operations.
 
     *    It's important to implement this method in an efficient way.
 
     *  
 
     *
 
     *
 
     *  @param  f   the function that is applied for its side-effect to every element.
 
     *              The result of function `f` is discarded.
 
     *              
 
     *  @tparam  U  the type parameter describing the result of function `f`. 
 
     *
 
     *  @tparam  U  the type parameter describing the result of function `f`.
 
     *              This result will always be ignored. Typically `U` is `Unit`,
 
     *              but this is not necessary.
 
     *
 
     *  @usecase def foreach(f: A => Unit): Unit
 
     */
 
    def foreach[U](f: A => U): Unit
 

	
 
    /** Tests whether this $coll is empty.
 
     *
 
     *  @return    `true` if the $coll contain no elements, `false` otherwise.
 
     */
 
    def isEmpty: Boolean = {
 
      var result = true
 
      breakable {
 
        for (x <- this) {
 
          result = false
 
          break
 
        }
 
      }
 
      result
 
    }
 

	
 
    /** Tests whether this $coll is known to have a finite size.
 
     *  All strict collections are known to have finite size. For a non-strict collection
 
     *  such as `Stream`, the predicate returns `true` if all elements have been computed.
 
     *  It returns `false` if the stream is not yet evaluated to the end.
 
     *
 
     *  Note: many collection methods will not work on collections of infinite sizes. 
 
     *  Note: many collection methods will not work on collections of infinite sizes.
 
     *
 
     *  @return  `true` if this collection is known to have finite size, `false` otherwise.
 
     */
 
    def hasDefiniteSize = true
 

	
 
    def ++[B >: A, That](that: GenTraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
 
      val b = bf(repr)
 
      if (that.isInstanceOf[IndexedSeqLike[_, _]]) b.sizeHint(this, that.seq.size)
 
      b ++= thisCollection
 
      b ++= that.seq
 
      b.result
 
    }
 

	
 
    @bridge
 
    def ++[B >: A, That](that: TraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That =
 
      ++(that: GenTraversableOnce[B])(bf)
 

	
 
    /** Concatenates this $coll with the elements of a traversable collection.
 
     *  It differs from ++ in that the right operand determines the type of the
 
     *  resulting collection rather than the left one.
 
     * 
 
     *
 
     *  @param that   the traversable to append.
 
     *  @tparam B     the element type of the returned collection. 
 
     *  @tparam B     the element type of the returned collection.
 
     *  @tparam That  $thatinfo
 
     *  @param bf     $bfinfo
 
     *  @return       a new collection of type `That` which contains all elements
 
     *                of this $coll followed by all elements of `that`.
 
     * 
 
     *
 
     *  @usecase def ++:[B](that: TraversableOnce[B]): $Coll[B]
 
     *  
 
     *
 
     *  @return       a new $coll which contains all elements of this $coll
 
     *                followed by all elements of `that`.
 
     */
 
    def ++:[B >: A, That](that: TraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
 
      val b = bf(repr)
 
      if (that.isInstanceOf[IndexedSeqLike[_, _]]) b.sizeHint(this, that.size)
 
      b ++= that
 
      b ++= thisCollection
 
      b.result
 
    }
 

	
 
    /** This overload exists because: for the implementation of ++: we should reuse
 
     *  that of ++ because many collections override it with more efficient versions.
 
     *  Since TraversableOnce has no '++' method, we have to implement that directly,
 
     *  but Traversable and down can use the overload.
 
     */
 
    def ++:[B >: A, That](that: Traversable[B])(implicit bf: CanBuildFrom[Repr, B, That]): That =
 
      (that ++ seq)(breakOut)
 

	
 
    def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
 
      val b = bf(repr)
 
      b.sizeHint(this) 
 
      b.sizeHint(this)
 
      for (x <- this) b += f(x)
 
      b.result
 
    }
 

	
 
    def flatMap[B, That](f: A => GenTraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
 
      val b = bf(repr)
 
      for (x <- this) b ++= f(x).seq
 
      b.result
 
    }
 

	
 
    /** Selects all elements of this $coll which satisfy a predicate.
 
     *
 
     *  @param p     the predicate used to test elements.
 
     *  @return      a new $coll consisting of all elements of this $coll that satisfy the given
 
     *               predicate `p`. The order of the elements is preserved.
 
     */
 
    def filter(p: A => Boolean): Repr = {
 
      val b = newBuilder
 
      for (x <- this) 
 
      for (x <- this)
 
        if (p(x)) b += x
 
      b.result
 
    }
 

	
 
    /** Selects all elements of this $coll which do not satisfy a predicate.
 
     *
 
     *  @param p     the predicate used to test elements.
 
     *  @return      a new $coll consisting of all elements of this $coll that do not satisfy the given
 
     *               predicate `p`. The order of the elements is preserved.
 
     */
 
    def filterNot(p: A => Boolean): Repr = filter(!p(_))
 

	
 
    def collect[B, That](pf: PartialFunction[A, B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
 
      val b = bf(repr)
 
      for (x <- this) if (pf.isDefinedAt(x)) b += pf(x)
 
      b.result
 
    }
 

	
 
    /** Builds a new collection by applying an option-valued function to all
 
     *  elements of this $coll on which the function is defined.
 
     *
 
     *  @param f      the option-valued function which filters and maps the $coll.
 
     *  @tparam B     the element type of the returned collection.
 
     *  @tparam That  $thatinfo
 
     *  @param bf     $bfinfo
 
     *  @return       a new collection of type `That` resulting from applying the option-valued function
 
     *                `f` to each element and collecting all defined results.
 
     *                The order of the elements is preserved.
 
     *
 
     *  @usecase def filterMap[B](f: A => Option[B]): $Coll[B]
 
     *  
 
     *
 
     *  @param pf     the partial function which filters and maps the $coll.
 
     *  @return       a new $coll resulting from applying the given option-valued function
 
     *                `f` to each element and collecting all defined results.
 
     *                The order of the elements is preserved.
 
    def filterMap[B, That](f: A => Option[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
 
      val b = bf(repr)
 
      for (x <- this) 
 
      for (x <- this)
 
        f(x) match {
 
          case Some(y) => b += y
 
          case _ =>
 
        }
 
      b.result
 
    }
 
     */
 

	
 
    /** Partitions this $coll in two ${coll}s according to a predicate.
 
     *
 
     *  @param p the predicate on which to partition.
 
     *  @return  a pair of ${coll}s: the first $coll consists of all elements that 
 
     *  @return  a pair of ${coll}s: the first $coll consists of all elements that
 
     *           satisfy the predicate `p` and the second $coll consists of all elements
 
     *           that don't. The relative order of the elements in the resulting ${coll}s
 
     *           is the same as in the original $coll.
 
     */
 
    def partition(p: A => Boolean): (Repr, Repr) = {
 
      val l, r = newBuilder
 
      for (x <- this) (if (p(x)) l else r) += x
 
      (l.result, r.result)
 
    }
 

	
 
    def groupBy[K](f: A => K): immutable.Map[K, Repr] = {
 
      val m = mutable.Map.empty[K, Builder[A, Repr]]
 
      for (elem <- this) {
 
        val key = f(elem)
 
        val bldr = m.getOrElseUpdate(key, newBuilder)
 
        bldr += elem
 
      }
 
      val b = immutable.Map.newBuilder[K, Repr]
 
      for ((k, v) <- m)
 
        b += ((k, v.result))
 

	
 
      b.result
 
    }
 

	
 
    /** Tests whether a predicate holds for all elements of this $coll.
 
     *
 
     *  $mayNotTerminateInf
 
     *
 
     *  @param   p     the predicate used to test elements.
 
     *  @return        `true` if the given predicate `p` holds for all elements
 
     *                 of this $coll, otherwise `false`.
 
     */
 
    def forall(p: A => Boolean): Boolean = {
 
      var result = true
 
      breakable {
 
        for (x <- this)
 
          if (!p(x)) { result = false; break }
 
      }
 
      result
 
    }
 

	
 
    /** Tests whether a predicate holds for some of the elements of this $coll.
 
     *
 
     *  $mayNotTerminateInf
 
     *
 
     *  @param   p     the predicate used to test elements.
 
     *  @return        `true` if the given predicate `p` holds for some of the
 
     *                 elements of this $coll, otherwise `false`.
 
     */
 
    def exists(p: A => Boolean): Boolean = {
 
      var result = false
 
      breakable {
 
        for (x <- this)
 
          if (p(x)) { result = true; break }
 
      }
 
      result
 
    }
 

	
 
    /** Finds the first element of the $coll satisfying a predicate, if any.
 
     * 
 
     *
 
     *  $mayNotTerminateInf
 
     *  $orderDependent
 
     *
 
     *  @param p    the predicate used to test elements.
 
     *  @return     an option value containing the first element in the $coll
 
     *              that satisfies `p`, or `None` if none exists.
 
     */
 
    def find(p: A => Boolean): Option[A] = {
 
      var result: Option[A] = None
 
      breakable {
 
        for (x <- this)
 
          if (p(x)) { result = Some(x); break }
 
      }
 
      result
 
    }
 

	
 
    def scan[B >: A, That](z: B)(op: (B, B) => B)(implicit cbf: CanBuildFrom[Repr, B, That]): That = scanLeft(z)(op)
 

	
 
    def scanLeft[B, That](z: B)(op: (B, A) => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
 
      val b = bf(repr)
 
      b.sizeHint(this, 1)
 
      var acc = z
 
      b += acc
 
      for (x <- this) { acc = op(acc, x); b += acc }
 
      b.result
 
    }
 

	
 
    @migration(2, 9,
 
      "This scanRight definition has changed in 2.9.\n" +
 
      "The previous behavior can be reproduced with scanRight.reverse."
 
    )
 
    def scanRight[B, That](z: B)(op: (A, B) => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
 
      var scanned = List(z)
 
      var acc = z
 
      for (x <- reversed) {
 
        acc = op(x, acc)
 
        scanned ::= acc
 
      }
 
      val b = bf(repr)
 
      for (elem <- scanned) b += elem
 
      b.result
 
    }
 

	
 
    /** Selects the first element of this $coll.
 
     *  $orderDependent
 
     *  @return  the first element of this $coll.
 
     *  @throws `NoSuchElementException` if the $coll is empty.
 
     */
 
    def head: A = {
 
      var result: () => A = () => throw new NoSuchElementException
 
      breakable {
 
        for (x <- this) {
 
          result = () => x
 
          break
 
        }
 
      }
 
      result()
 
    }
 

	
 
    /** Optionally selects the first element.
 
     *  $orderDependent
 
     *  @return  the first element of this $coll if it is nonempty, `None` if it is empty.
 
     */
 
    def headOption: Option[A] = if (isEmpty) None else Some(head)
 

	
 
    /** Selects all elements except the first.
 
     *  $orderDependent
 
     *  @return  a $coll consisting of all elements of this $coll
 
     *           except the first one.
 
     *  @throws `UnsupportedOperationException` if the $coll is empty.
 
     */ 
 
     */
 
    override def tail: Repr = {
 
      if (isEmpty) throw new UnsupportedOperationException("empty.tail")
 
      drop(1)
 
    }
 

	
 
    /** Selects the last element.
 
      * $orderDependent
 
      * @return The last element of this $coll.
 
      * @throws NoSuchElementException If the $coll is empty.
 
      */
 
    def last: A = {
 
      var lst = head
 
      for (x <- this)
 
        lst = x
 
      lst
 
    }
 

	
 
    /** Optionally selects the last element.
 
     *  $orderDependent
 
     *  @return  the last element of this $coll$ if it is nonempty, `None` if it is empty.
 
     */
 
    def lastOption: Option[A] = if (isEmpty) None else Some(last)
 

	
 
    /** Selects all elements except the last.
 
     *  $orderDependent
 
     *  @return  a $coll consisting of all elements of this $coll
 
     *           except the last one.
 
     *  @throws `UnsupportedOperationException` if the $coll is empty.
 
     */
 
    def init: Repr = {
 
      if (isEmpty) throw new UnsupportedOperationException("empty.init")
 
      var lst = head
 
      var follow = false
 
      val b = newBuilder
 
      b.sizeHint(this, -1)
 
      for (x <- this.seq) {
 
        if (follow) b += lst
 
        else follow = true
 
        lst = x
 
      }
 
      b.result
 
    }
 

	
 
    def take(n: Int): Repr = slice(0, n)
 

	
 
    def drop(n: Int): Repr = 
 
    def drop(n: Int): Repr =
 
      if (n <= 0) {
 
        val b = newBuilder
 
        b.sizeHint(this)
 
        b ++= thisCollection result
 
      }
 
      else sliceWithKnownDelta(n, Int.MaxValue, -n)
 

	
 
    def slice(from: Int, until: Int): Repr = sliceWithKnownBound(math.max(from, 0), until)
 

	
 
    // Precondition: from >= 0, until > 0, builder already configured for building.
 
    private[this] def sliceInternal(from: Int, until: Int, b: Builder[A, Repr]): Repr = {
 
      var i = 0
 
      breakable {
 
        for (x <- this.seq) {
 
          if (i >= from) b += x
 
          i += 1
 
          if (i >= until) break
 
        }
 
      }
 
      b.result
 
    }
 
    // Precondition: from >= 0
 
    private[scala] def sliceWithKnownDelta(from: Int, until: Int, delta: Int): Repr = {
 
      val b = newBuilder
 
      if (until <= from) b.result
 
      else {
 
        b.sizeHint(this, delta)
 
        sliceInternal(from, until, b)
 
      }
 
    }
 
    // Precondition: from >= 0
 
    private[scala] def sliceWithKnownBound(from: Int, until: Int): Repr = {
 
      val b = newBuilder
 
      if (until <= from) b.result
 
      else {
 
        b.sizeHintBounded(until - from, this)      
 
        b.sizeHintBounded(until - from, this)
 
        sliceInternal(from, until, b)
 
      }
 
    }
 

	
 
    def takeWhile(p: A => Boolean): Repr = {
 
      val b = newBuilder
 
      breakable {
 
        for (x <- this) {
 
          if (!p(x)) break
 
          b += x
 
        }
 
      }
 
      b.result
 
    }
 

	
 
    def dropWhile(p: A => Boolean): Repr = {
 
      val b = newBuilder
 
      var go = false
 
      for (x <- this) {
 
        if (!p(x)) go = true
 
        if (go) b += x
 
      }
 
      b.result
 
    }
 

	
 
    def span(p: A => Boolean): (Repr, Repr) = {
 
      val l, r = newBuilder
 
      var toLeft = true
 
      for (x <- this) {
 
        toLeft = toLeft && p(x)
 
        (if (toLeft) l else r) += x
 
      }
 
      (l.result, r.result)
 
    }
 

	
 
    def splitAt(n: Int): (Repr, Repr) = {
 
      val l, r = newBuilder
 
      l.sizeHintBounded(n, this)
 
      if (n >= 0) r.sizeHint(this, -n)
 
      var i = 0
 
      for (x <- this) {
 
        (if (i < n) l else r) += x
 
        i += 1
 
      }
 
      (l.result, r.result)
 
    }
 

	
 
    /** Iterates over the tails of this $coll. The first value will be this
 
     *  $coll and the final one will be an empty $coll, with the intervening
 
     *  values the results of successive applications of `tail`.
 
     *
 
     *  @return   an iterator over all the tails of this $coll
 
     *  @example  `List(1,2,3).tails = Iterator(List(1,2,3), List(2,3), List(3), Nil)`
 
     */  
 
     */
 
    def tails: Iterator[Repr] = iterateUntilEmpty(_.tail)
 

	
 
    /** Iterates over the inits of this $coll. The first value will be this
 
     *  $coll and the final one will be an empty $coll, with the intervening
 
     *  values the results of successive applications of `init`.
 
     *
 
     *  @return  an iterator over all the inits of this $coll
 
     *  @example  `List(1,2,3).inits = Iterator(List(1,2,3), List(1,2), List(1), Nil)`
 
     */
 
    def inits: Iterator[Repr] = iterateUntilEmpty(_.init)
 

	
 
    /** Copies elements of this $coll to an array.
 
     *  Fills the given array `xs` with at most `len` elements of
 
     *  this $coll, starting at position `start`.
 
     *  Copying will stop once either the end of the current $coll is reached,
 
     *  or the end of the array is reached, or `len` elements have been copied.
 
     *
 
     *  $willNotTerminateInf
 
     * 
 
     *
 
     *  @param  xs     the array to fill.
 
     *  @param  start  the starting index.
 
     *  @param  len    the maximal number of elements to copy.
 
     *  @tparam B      the type of the elements of the array. 
 
     * 
 
     *  @tparam B      the type of the elements of the array.
 
     *
 
     *
 
     *  @usecase def copyToArray(xs: Array[A], start: Int, len: Int): Unit
 
     */
 
    def copyToArray[B >: A](xs: Array[B], start: Int, len: Int) {
 
      var i = start
 
      val end = (start + len) min xs.length
 
      breakable {
 
        for (x <- this) {
 
          if (i >= end) break
 
          xs(i) = x
 
          i += 1
 
        }
 
      }
 
    }
 

	
 
    def toTraversable: Traversable[A] = thisCollection
 
    def toIterator: Iterator[A] = toStream.iterator
 
    def toStream: Stream[A] = toBuffer.toStream
 

	
 
    /** Converts this $coll to a string.
 
     *
 
     *  @return   a string representation of this collection. By default this
 
     *            string consists of the `stringPrefix` of this $coll,
 
     *            followed by all elements separated by commas and enclosed in parentheses.
 
     */
 
    override def toString = mkString(stringPrefix + "(", ", ", ")")
 

	
 
    /** Defines the prefix of this object's `toString` representation.
 
     *
 
     *  @return  a string representation which starts the result of `toString`
 
     *           applied to this $coll. By default the string prefix is the
 
     *           simple name of the collection class $coll.
 
     */
 
    def stringPrefix : String = {
 
      var string = repr.asInstanceOf[AnyRef].getClass.getName
 
      val idx1 = string.lastIndexOf('.' : Int)
 
      if (idx1 != -1) string = string.substring(idx1 + 1)
 
      val idx2 = string.indexOf('$')
 
      if (idx2 != -1) string = string.substring(0, idx2)
 
      string
 
    }
 

	
 
    /** Creates a non-strict view of this $coll.
 
     * 
 
     *
 
     *  @return a non-strict view of this $coll.
 
     */
 
    def view = new TraversableView[A, Repr] {
 
      protected lazy val underlying = self.repr
 
      override def foreach[U](f: A => U) = self foreach f
 
    }
 

	
 
    /** Creates a non-strict view of a slice of this $coll.
 
     *
 
     *  Note: the difference between `view` and `slice` is that `view` produces
 
     *        a view of the current $coll, whereas `slice` produces a new $coll.
 
     * 
 
     *
 
     *  Note: `view(from, to)` is equivalent to `view.slice(from, to)`
 
     *  $orderDependent
 
     * 
 
     *
 
     *  @param from   the index of the first element of the view
 
     *  @param until  the index of the element following the view
 
     *  @return a non-strict view of a slice of this $coll, starting at index `from`
 
     *  and extending up to (but not including) index `until`.
 
     */
 
    def view(from: Int, until: Int): TraversableView[A, Repr] = view.slice(from, until)
 

	
 
    /** Creates a non-strict filter of this $coll.
 
     *
 
     *  Note: the difference between `c filter p` and `c withFilter p` is that
 
     *        the former creates a new collection, whereas the latter only
 
     *        restricts the domain of subsequent `map`, `flatMap`, `foreach`,
 
     *        and `withFilter` operations.
 
     *  $orderDependent
 
     * 
 
     *
 
     *  @param p   the predicate used to test elements.
 
     *  @return    an object of class `WithFilter`, which supports
 
     *             `map`, `flatMap`, `foreach`, and `withFilter` operations.
 
     *             All these operations apply to those elements of this $coll which
 
     *             satisfy the predicate `p`.
 
     */
 
    def withFilter(p: A => Boolean): FilterMonadic[A, Repr] = new WithFilter(p)
 

	
 
    /** A class supporting filtered operations. Instances of this class are
 
     *  returned by method `withFilter`.
 
     */
 
    class WithFilter(p: A => Boolean) extends FilterMonadic[A, Repr] {
 

	
 
      /** Builds a new collection by applying a function to all elements of the
 
       *  outer $coll containing this `WithFilter` instance that satisfy predicate `p`.
 
       *
 
       *  @param f      the function to apply to each element.
 
       *  @tparam B     the element type of the returned collection.
 
       *  @tparam That  $thatinfo
 
       *  @param bf     $bfinfo
 
       *  @return       a new collection of type `That` resulting from applying
 
       *                the given function `f` to each element of the outer $coll
 
       *                that satisfies predicate `p` and collecting the results.
 
       *
 
       *  @usecase def map[B](f: A => B): $Coll[B] 
 
       *  
 
       *  @usecase def map[B](f: A => B): $Coll[B]
 
       *
 
       *  @return       a new $coll resulting from applying the given function
 
       *                `f` to each element of the outer $coll that satisfies
 
       *                predicate `p` and collecting the results.
 
       */
 
      def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
 
        val b = bf(repr)
 
        for (x <- self) 
 
        for (x <- self)
 
          if (p(x)) b += f(x)
 
        b.result
 
      }
 

	
 
      /** Builds a new collection by applying a function to all elements of the
 
       *  outer $coll containing this `WithFilter` instance that satisfy
 
       *  predicate `p` and concatenating the results. 
 
       *  predicate `p` and concatenating the results.
 
       *
 
       *  @param f      the function to apply to each element.
 
       *  @tparam B     the element type of the returned collection.
 
       *  @tparam That  $thatinfo
 
       *  @param bf     $bfinfo
 
       *  @return       a new collection of type `That` resulting from applying
 
       *                the given collection-valued function `f` to each element
 
       *                of the outer $coll that satisfies predicate `p` and
 
       *                concatenating the results.
 
       *
 
       *  @usecase def flatMap[B](f: A => TraversableOnce[B]): $Coll[B]
 
       * 
 
       *
 
       *  @return       a new $coll resulting from applying the given collection-valued function
 
       *                `f` to each element of the outer $coll that satisfies predicate `p` and concatenating the results.
 
       */
 
      def flatMap[B, That](f: A => GenTraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
 
        val b = bf(repr)
 
        for (x <- self) 
 
        for (x <- self)
 
          if (p(x)) b ++= f(x).seq
 
        b.result
 
      }
 

	
 
      /** Applies a function `f` to all elements of the outer $coll containing
 
       *  this `WithFilter` instance that satisfy predicate `p`.
 
       *
 
       *  @param  f   the function that is applied for its side-effect to every element.
 
       *              The result of function `f` is discarded.
 
       *              
 
       *  @tparam  U  the type parameter describing the result of function `f`. 
 
       *
 
       *  @tparam  U  the type parameter describing the result of function `f`.
 
       *              This result will always be ignored. Typically `U` is `Unit`,
 
       *              but this is not necessary.
 
       *
 
       *  @usecase def foreach(f: A => Unit): Unit
 
       */   
 
      def foreach[U](f: A => U): Unit = 
 
        for (x <- self) 
 
       */
 
      def foreach[U](f: A => U): Unit =
 
        for (x <- self)
 
          if (p(x)) f(x)
 

	
 
      /** Further refines the filter for this $coll.
 
       *
 
       *  @param q   the predicate used to test elements.
 
       *  @return    an object of class `WithFilter`, which supports
 
       *             `map`, `flatMap`, `foreach`, and `withFilter` operations.
 
       *             All these operations apply to those elements of this $coll which
 
       *             satisfy the predicate `q` in addition to the predicate `p`.
 
       */
 
      def withFilter(q: A => Boolean): WithFilter = 
 
      def withFilter(q: A => Boolean): WithFilter =
 
        new WithFilter(x => p(x) && q(x))
 
    }
 

	
 
    // A helper for tails and inits.
 
    private def iterateUntilEmpty(f: Traversable[A @uV] => Traversable[A @uV]): Iterator[Repr] = {
 
      val it = Iterator.iterate(thisCollection)(f) takeWhile (x => !x.isEmpty)
 
      it ++ Iterator(Nil) map (newBuilder ++= _ result)
 
    }
 
  }
 

	
 

	
 
</textarea>
 
</form>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        lineNumbers: true,
 
        matchBrackets: true,
 
        theme: "ambiance",
 
        mode: "text/x-scala"
 
      });
 
    </script>
 
  </body>
 
</html>
rhodecode/public/js/mode/cobol/index.html
Show inline comments
 
@@ -38,158 +38,158 @@
 
        .CodeMirror-activeline-background {background: #555555 !important;}
 
    </style>
 
  </head>
 
  <body>
 
    <p> Select Theme <select onchange="selectTheme()" id="selectTheme">
 
        <option>default</option>
 
        <option>ambiance</option>
 
        <option>blackboard</option>
 
        <option>cobalt</option>
 
        <option>eclipse</option>
 
        <option>elegant</option>
 
        <option>erlang-dark</option>
 
        <option>lesser-dark</option>
 
        <option>midnight</option>
 
        <option>monokai</option>
 
        <option>neat</option>
 
        <option>night</option>
 
        <option>rubyblue</option>
 
        <option>solarized dark</option>
 
        <option>solarized light</option>
 
        <option selected>twilight</option>
 
        <option>vibrant-ink</option>
 
        <option>xq-dark</option>
 
        <option>xq-light</option>
 
    </select>    Select Font Size <select onchange="selectFontsize()" id="selectFontSize">
 
          <option value="13px">13px</option>
 
          <option value="14px">14px</option>
 
          <option value="16px">16px</option>
 
          <option value="18px">18px</option>
 
          <option value="20px" selected="selected">20px</option>
 
          <option value="24px">24px</option>
 
          <option value="26px">26px</option>
 
          <option value="28px">28px</option>
 
          <option value="30px">30px</option>
 
          <option value="32px">32px</option>
 
          <option value="34px">34px</option>
 
          <option value="36px">36px</option>
 
        </select>
 
<label for="checkBoxReadOnly">Read-only</label>
 
<input type="checkbox" id="checkBoxReadOnly" onchange="selectReadOnly()">
 
<label for="id_tabToIndentSpace">Insert Spaces on Tab</label>
 
<input type="checkbox" id="id_tabToIndentSpace" onchange="tabToIndentSpace()">
 
</p>
 
<textarea id="code" name="code">
 
---------1---------2---------3---------4---------5---------6---------7---------8
 
12345678911234567892123456789312345678941234567895123456789612345678971234567898
 
000010 IDENTIFICATION DIVISION.                                        MODTGHERE
 
000020 PROGRAM-ID.       SAMPLE.
 
000030 AUTHOR.           TEST SAM. 
 
000030 AUTHOR.           TEST SAM.
 
000040 DATE-WRITTEN.     5 February 2013
 
000041
 
000042* A sample program just to show the form.
 
000043* The program copies its input to the output,
 
000044* and counts the number of records.
 
000045* At the end this number is printed.
 
000046
 
000050 ENVIRONMENT DIVISION.
 
000060 INPUT-OUTPUT SECTION.
 
000070 FILE-CONTROL.
 
000080     SELECT STUDENT-FILE     ASSIGN TO SYSIN
 
000090         ORGANIZATION IS LINE SEQUENTIAL.
 
000100     SELECT PRINT-FILE       ASSIGN TO SYSOUT
 
000110         ORGANIZATION IS LINE SEQUENTIAL.
 
000120
 
000130 DATA DIVISION.
 
000140 FILE SECTION.
 
000150 FD  STUDENT-FILE
 
000160     RECORD CONTAINS 43 CHARACTERS
 
000170     DATA RECORD IS STUDENT-IN.
 
000180 01  STUDENT-IN              PIC X(43).
 
000190
 
000200 FD  PRINT-FILE
 
000210     RECORD CONTAINS 80 CHARACTERS
 
000220     DATA RECORD IS PRINT-LINE.
 
000230 01  PRINT-LINE              PIC X(80).
 
000240
 
000250 WORKING-STORAGE SECTION.
 
000260 01  DATA-REMAINS-SWITCH     PIC X(2)      VALUE SPACES.
 
000261 01  RECORDS-WRITTEN         PIC 99.
 
000270
 
000280 01  DETAIL-LINE.
 
000290     05  FILLER              PIC X(7)      VALUE SPACES.
 
000300     05  RECORD-IMAGE        PIC X(43).
 
000310     05  FILLER              PIC X(30)     VALUE SPACES.
 
000311 
 
000311
 
000312 01  SUMMARY-LINE.
 
000313     05  FILLER              PIC X(7)      VALUE SPACES.
 
000314     05  TOTAL-READ          PIC 99.
 
000315     05  FILLER              PIC X         VALUE SPACE.
 
000316     05  FILLER              PIC X(17)     
 
000316     05  FILLER              PIC X(17)
 
000317                 VALUE  'Records were read'.
 
000318     05  FILLER              PIC X(53)     VALUE SPACES.
 
000319
 
000320 PROCEDURE DIVISION.
 
000321
 
000330 PREPARE-SENIOR-REPORT.
 
000340     OPEN INPUT  STUDENT-FILE
 
000350          OUTPUT PRINT-FILE.
 
000351     MOVE ZERO TO RECORDS-WRITTEN.
 
000360     READ STUDENT-FILE
 
000370         AT END MOVE 'NO' TO DATA-REMAINS-SWITCH
 
000380     END-READ.
 
000390     PERFORM PROCESS-RECORDS
 
000410         UNTIL DATA-REMAINS-SWITCH = 'NO'.
 
000411     PERFORM PRINT-SUMMARY.
 
000420     CLOSE STUDENT-FILE
 
000430           PRINT-FILE.
 
000440     STOP RUN.
 
000450
 
000460 PROCESS-RECORDS.
 
000470     MOVE STUDENT-IN TO RECORD-IMAGE.
 
000480     MOVE DETAIL-LINE TO PRINT-LINE.
 
000490     WRITE PRINT-LINE.
 
000500     ADD 1 TO RECORDS-WRITTEN.
 
000510     READ STUDENT-FILE
 
000520         AT END MOVE 'NO' TO DATA-REMAINS-SWITCH
 
000530     END-READ. 
 
000530     END-READ.
 
000540
 
000550 PRINT-SUMMARY.
 
000560     MOVE RECORDS-WRITTEN TO TOTAL-READ.
 
000570     MOVE SUMMARY-LINE TO PRINT-LINE.
 
000571     WRITE PRINT-LINE. 
 
000571     WRITE PRINT-LINE.
 
000572
 
000580
 
</textarea>
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        lineNumbers: true,
 
        matchBrackets: true,
 
        mode: "text/x-cobol",
 
        theme : "twilight",
 
        styleActiveLine: true,
 
        showCursorWhenSelecting : true,  
 
        showCursorWhenSelecting : true,
 
      });
 
      function selectTheme() {
 
        var themeInput = document.getElementById("selectTheme");
 
        var theme = themeInput.options[themeInput.selectedIndex].innerHTML;
 
        editor.setOption("theme", theme);
 
      }
 
      function selectFontsize() {
 
        var fontSizeInput = document.getElementById("selectFontSize");
 
        var fontSize = fontSizeInput.options[fontSizeInput.selectedIndex].innerHTML;
 
        editor.getWrapperElement().style["font-size"] = fontSize;
 
        editor.refresh();
 
      }
 
      function selectReadOnly() {
 
        editor.setOption("readOnly", document.getElementById("checkBoxReadOnly").checked);
 
      }
 
      function tabToIndentSpace() {
 
        if (document.getElementById("id_tabToIndentSpace").checked) {
 
            editor.setOption("extraKeys", {Tab: function(cm) { cm.replaceSelection("    ", "end"); }});
 
        } else {
 
            editor.setOption("extraKeys", {Tab: function(cm) { cm.replaceSelection("    ", "end"); }});
 
        }
 
      }
 
    </script>
 
  </body>
 
</html>
rhodecode/public/js/mode/coffeescript/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: CoffeeScript mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="coffeescript.js"></script>
 
    <style>.CodeMirror {border-top: 1px solid silver; border-bottom: 1px solid silver;}</style>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
  </head>
 
  <body>
 
    <h1>CodeMirror: CoffeeScript mode</h1>
 
    <form><textarea id="code" name="code">
 
# CoffeeScript mode for CodeMirror
 
# Copyright (c) 2011 Jeff Pickhardt, released under
 
# the MIT License.
 
#
 
# Modified from the Python CodeMirror mode, which also is 
 
# Modified from the Python CodeMirror mode, which also is
 
# under the MIT License Copyright (c) 2010 Timothy Farrell.
 
#
 
# The following script, Underscore.coffee, is used to 
 
# The following script, Underscore.coffee, is used to
 
# demonstrate CoffeeScript mode for CodeMirror.
 
#
 
# To download CoffeeScript mode for CodeMirror, go to:
 
# https://github.com/pickhardt/coffeescript-codemirror-mode
 

	
 
# **Underscore.coffee
 
# (c) 2011 Jeremy Ashkenas, DocumentCloud Inc.**
 
# Underscore is freely distributable under the terms of the
 
# [MIT license](http://en.wikipedia.org/wiki/MIT_License).
 
# Portions of Underscore are inspired by or borrowed from
 
# [Prototype.js](http://prototypejs.org/api), Oliver Steele's
 
# [Functional](http://osteele.com), and John Resig's
 
# [Micro-Templating](http://ejohn.org).
 
# For all details and documentation:
 
# http://documentcloud.github.com/underscore/
 

	
 

	
 
# Baseline setup
 
# --------------
 

	
 
# Establish the root object, `window` in the browser, or `global` on the server.
 
root = this
 

	
 

	
 
# Save the previous value of the `_` variable.
 
previousUnderscore = root._
 

	
 
### Multiline
 
    comment
 
###
 

	
 
# Establish the object that gets thrown to break out of a loop iteration.
 
# `StopIteration` is SOP on Mozilla.
 
breaker = if typeof(StopIteration) is 'undefined' then '__break__' else StopIteration
 

	
 

	
 
#### Docco style single line comment (title)
 

	
 

	
 
# Helper function to escape **RegExp** contents, because JS doesn't have one.
 
escapeRegExp = (string) -> string.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1')
 

	
 

	
 
# Save bytes in the minified (but not gzipped) version:
 
ArrayProto = Array.prototype
 
ObjProto = Object.prototype
 

	
 

	
rhodecode/public/js/mode/diff/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: Diff mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="diff.js"></script>
 
    <style>
 
      .CodeMirror {border-top: 1px solid #ddd; border-bottom: 1px solid #ddd;}
 
      span.cm-meta {color: #a0b !important;}
 
      span.cm-error { background-color: black; opacity: 0.4;}
 
      span.cm-error.cm-string { background-color: red; }
 
      span.cm-error.cm-tag { background-color: #2b2; }
 
    </style>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
  </head>
 
  <body>
 
    <h1>CodeMirror: Diff mode</h1>
 
    <form><textarea id="code" name="code">
 
diff --git a/index.html b/index.html
 
index c1d9156..7764744 100644
 
--- a/index.html
 
+++ b/index.html
 
@@ -95,7 +95,8 @@ StringStream.prototype = {
 
     <script>
 
       var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
         lineNumbers: true,
 
-        autoMatchBrackets: true
 
+        autoMatchBrackets: true,
 
+      onGutterClick: function(x){console.log(x);}
 
       });
 
     </script>
 
   </body>
 
diff --git a/lib/codemirror.js b/lib/codemirror.js
 
index 04646a9..9a39cc7 100644
 
--- a/lib/codemirror.js
 
+++ b/lib/codemirror.js
 
@@ -399,10 +399,16 @@ var CodeMirror = (function() {
 
     }
 
 
 

	
 
     function onMouseDown(e) {
 
-      var start = posFromMouse(e), last = start;    
 
-      var start = posFromMouse(e), last = start;
 
+      var start = posFromMouse(e), last = start, target = e.target();
 
       if (!start) return;
 
       setCursor(start.line, start.ch, false);
 
       if (e.button() != 1) return;
 
+      if (target.parentNode == gutter) {    
 
+      if (target.parentNode == gutter) {
 
+        if (options.onGutterClick)
 
+          options.onGutterClick(indexOf(gutter.childNodes, target) + showingFrom);
 
+        return;
 
+      }
 
+
 
       if (!focused) onFocus();
 
 
 

	
 
       e.stop();
 
@@ -808,7 +814,7 @@ var CodeMirror = (function() {
 
       for (var i = showingFrom; i < showingTo; ++i) {
 
         var marker = lines[i].gutterMarker;
 
         if (marker) html.push('<div class="' + marker.style + '">' + htmlEscape(marker.text) + '</div>');
 
-        else html.push("<div>" + (options.lineNumbers ? i + 1 : "\u00a0") + "</div>");
 
+        else html.push("<div>" + (options.lineNumbers ? i + options.firstLineNumber : "\u00a0") + "</div>");
 
       }
 
       gutter.style.display = "none"; // TODO test whether this actually helps
 
       gutter.innerHTML = html.join("");
 
@@ -1371,10 +1377,8 @@ var CodeMirror = (function() {
 
         if (option == "parser") setParser(value);
 
         else if (option === "lineNumbers") setLineNumbers(value);
 
         else if (option === "gutter") setGutter(value);
 
-        else if (option === "readOnly") options.readOnly = value;
 
-        else if (option === "indentUnit") {options.indentUnit = indentUnit = value; setParser(options.parser);}
 
-        else if (/^(?:enterMode|tabMode|indentWithTabs|readOnly|autoMatchBrackets|undoDepth)$/.test(option)) options[option] = value;
 
-        else throw new Error("Can't set option " + option);
 
+        else if (option === "indentUnit") {options.indentUnit = value; setParser(options.parser);}
 
+        else options[option] = value;
 
       },
 
       cursorCoords: cursorCoords,
 
       undo: operation(undo),
 
@@ -1402,7 +1406,8 @@ var CodeMirror = (function() {
 
       replaceRange: operation(replaceRange),
 
 
 

	
 
       operation: function(f){return operation(f)();},
 
-      refresh: function(){updateDisplay([{from: 0, to: lines.length}]);}
 
+      refresh: function(){updateDisplay([{from: 0, to: lines.length}]);},
 
+      getInputField: function(){return input;}
 
     };
 
     return instance;
 
   }
 
@@ -1420,6 +1425,7 @@ var CodeMirror = (function() {
 
     readOnly: false,
 
     onChange: null,
 
     onCursorActivity: null,
 
+    onGutterClick: null,
 
     autoMatchBrackets: false,
 
     workTime: 200,
 
     workDelay: 300,
 
</textarea></form>
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
 
    </script>
 

	
 
    <p><strong>MIME types defined:</strong> <code>text/x-diff</code>.</p>
 

	
 
  </body>
 
</html>
rhodecode/public/js/mode/ecl/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <title>CodeMirror: ECL mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="ecl.js"></script>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
    <style>.CodeMirror {border: 1px solid black;}</style>
 
  </head>
 
  <body>
 
    <h1>CodeMirror: ECL mode</h1>
 
    <form><textarea id="code" name="code">
 
/*
 
sample useless code to demonstrate ecl syntax highlighting
 
this is a multiline comment!
 
*/
 

	
 
//  this is a singleline comment!
 

	
 
import ut;
 
r := 
 
r :=
 
  record
 
   string22 s1 := '123';
 
   integer4 i1 := 123;
 
  end;
 
#option('tmp', true);
 
d := dataset('tmp::qb', r, thor);
 
output(d);
 
</textarea></form>
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
 
    </script>
 

	
 
    <p>Based on CodeMirror's clike mode.  For more information see <a href="http://hpccsystems.com">HPCC Systems</a> web site.</p>
 
    <p><strong>MIME types defined:</strong> <code>text/x-ecl</code>.</p>
 

	
 
  </body>
 
</html>
rhodecode/public/js/mode/erlang/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: Erlang mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="../../addon/edit/matchbrackets.js"></script>
 
    <script src="erlang.js"></script>
 
    <link rel="stylesheet" href="../../theme/erlang-dark.css">
 
    <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
  </head>
 
  <body>
 
    <h1>CodeMirror: Erlang mode</h1>
 

	
 
<form><textarea id="code" name="code">
 
%% -*- mode: erlang; erlang-indent-level: 2 -*-
 
%%% Created :  7 May 2012 by mats cronqvist <masse@klarna.com>
 

	
 
%% @doc
 
%% Demonstrates how to print a record.
 
%% @end
 

	
 
-module('ex').
 
-author('mats cronqvist').
 
-export([demo/0,
 
         rec_info/1]).
 

	
 
-record(demo,{a="One",b="Two",c="Three",d="Four"}).
 

	
 
rec_info(demo) -> record_info(fields,demo).
 

	
 
demo() -> expand_recs(?MODULE,#demo{a="A",b="BB"}).
 
  
 

	
 
expand_recs(M,List) when is_list(List) ->
 
  [expand_recs(M,L)||L<-List];
 
expand_recs(M,Tup) when is_tuple(Tup) ->
 
  case tuple_size(Tup) of
 
    L when L < 1 -> Tup;
 
    L ->
 
      try Fields = M:rec_info(element(1,Tup)),
 
          L = length(Fields)+1,
 
          lists:zip(Fields,expand_recs(M,tl(tuple_to_list(Tup))))
 
      catch _:_ ->
 
          list_to_tuple(expand_recs(M,tuple_to_list(Tup)))
 
      end
 
  end;
 
expand_recs(_,Term) ->
 
  Term.
 
</textarea></form>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        lineNumbers: true,
 
        matchBrackets: true,
 
        extraKeys: {"Tab":  "indentAuto"},
 
        theme: "erlang-dark"
 
      });
 
    </script>
 

	
 
    <p><strong>MIME types defined:</strong> <code>text/x-erlang</code>.</p>
 
  </body>
 
</html>
rhodecode/public/js/mode/gas/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
    <head>
 
        <meta charset="utf-8">
 
        <title>CodeMirror: Gas mode</title>
 
        <link rel="stylesheet" href="../../lib/codemirror.css">
 
        <script src="../../lib/codemirror.js"></script>
 
        <script src="gas.js"></script>
 
        <link rel="stylesheet" href="../../doc/docs.css">
 
        <style>.CodeMirror {border: 2px inset #dee;}</style>
 
    </head>
 
    <body>
 
        <h1>CodeMirror: Gas mode</h1>
 

	
 
        <form>
 
<textarea id="code" name="code">
 
.syntax unified
 
.global main
 

	
 
/* 
 
/*
 
 *  A
 
 *  multi-line
 
 *  comment.
 
 */
 

	
 
@ A single line comment.
 

	
 
main:
 
        push    {sp, lr}
 
        ldr     r0, =message
 
        bl      puts
 
        mov     r0, #0
 
        pop     {sp, pc}
 

	
 
message:
 
        .asciz "Hello world!<br />"
 
</textarea>
 
        </form>
 

	
 
        <script>
 
            var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
                lineNumbers: true,
 
                mode: {name: "gas", architecture: "ARMv6"},
 
            });
 
        </script>
 

	
 
        <p>Handles AT&amp;T assembler syntax (more specifically this handles
 
        the GNU Assembler (gas) syntax.)
 
        It takes a single optional configuration parameter:
 
        <code>architecture</code>, which can be one of <code>"ARM"</code>,
 
        <code>"ARMv6"</code> or <code>"x86"</code>.
 
        Including the parameter adds syntax for the registers and special
 
        directives for the supplied architecture.
 

	
 
        <p><strong>MIME types defined:</strong> <code>text/x-gas</code></p>
 
    </body>
 
</html>
rhodecode/public/js/mode/gfm/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: GFM mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="../../addon/mode/overlay.js"></script>
 
    <script src="../xml/xml.js"></script>
 
    <script src="../markdown/markdown.js"></script>
 
    <script src="gfm.js"></script>
 
    
 

	
 
    <!-- Code block highlighting modes -->
 
    <script src="../javascript/javascript.js"></script>
 
    <script src="../css/css.js"></script>
 
    <script src="../htmlmixed/htmlmixed.js"></script>
 
    <script src="../clike/clike.js"></script>
 
    
 

	
 
    <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
  </head>
 
  <body>
 
    <h1>CodeMirror: GFM mode</h1>
 

	
 
<form><textarea id="code" name="code">
 
GitHub Flavored Markdown
 
========================
 

	
 
Everything from markdown plus GFM features:
 

	
 
## URL autolinking
 

	
 
Underscores_are_allowed_between_words.
 

	
 
## Fenced code blocks (and syntax highlighting)
 

	
 
```javascript
 
for (var i = 0; i &lt; items.length; i++) {
 
    console.log(items[i], i); // log them
 
}
 
```
 

	
 
## Task Lists
 

	
 
- [ ] Incomplete task list item
 
- [x] **Completed** task list item
 

	
 
## A bit of GitHub spice
 

	
 
* SHA: be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
 
* User@SHA ref: mojombo@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
 
* User/Project@SHA: mojombo/god@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
 
* \#Num: #1
 
* User/#Num: mojombo#1
 
* User/Project#Num: mojombo/god#1
 

	
 
See http://github.github.com/github-flavored-markdown/.
 

	
 
</textarea></form>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        mode: 'gfm',
 
        lineNumbers: true,
 
        theme: "default"
 
      });
rhodecode/public/js/mode/go/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: Go mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <link rel="stylesheet" href="../../theme/elegant.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="../../addon/edit/matchbrackets.js"></script>
 
    <script src="go.js"></script>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
    <style>.CodeMirror {border:1px solid #999; background:#ffc}</style>
 
  </head>
 
  <body>
 
    <h1>CodeMirror: Go mode</h1>
 

	
 
<form><textarea id="code" name="code">
 
// Prime Sieve in Go.
 
// Taken from the Go specification.
 
// Copyright © The Go Authors.
 

	
 
package main
 

	
 
import "fmt"
 

	
 
// Send the sequence 2, 3, 4, ... to channel 'ch'.
 
func generate(ch chan&lt;- int) {
 
	for i := 2; ; i++ {
 
		ch &lt;- i  // Send 'i' to channel 'ch'
 
	}
 
    for i := 2; ; i++ {
 
        ch &lt;- i  // Send 'i' to channel 'ch'
 
    }
 
}
 

	
 
// Copy the values from channel 'src' to channel 'dst',
 
// removing those divisible by 'prime'.
 
func filter(src &lt;-chan int, dst chan&lt;- int, prime int) {
 
	for i := range src {    // Loop over values received from 'src'.
 
		if i%prime != 0 {
 
			dst &lt;- i  // Send 'i' to channel 'dst'.
 
		}
 
	}
 
    for i := range src {    // Loop over values received from 'src'.
 
        if i%prime != 0 {
 
            dst &lt;- i  // Send 'i' to channel 'dst'.
 
        }
 
    }
 
}
 

	
 
// The prime sieve: Daisy-chain filter processes together.
 
func sieve() {
 
	ch := make(chan int)  // Create a new channel.
 
	go generate(ch)       // Start generate() as a subprocess.
 
	for {
 
		prime := &lt;-ch
 
		fmt.Print(prime, "\n")
 
		ch1 := make(chan int)
 
		go filter(ch, ch1, prime)
 
		ch = ch1
 
	}
 
    ch := make(chan int)  // Create a new channel.
 
    go generate(ch)       // Start generate() as a subprocess.
 
    for {
 
        prime := &lt;-ch
 
        fmt.Print(prime, "\n")
 
        ch1 := make(chan int)
 
        go filter(ch, ch1, prime)
 
        ch = ch1
 
    }
 
}
 

	
 
func main() {
 
	sieve()
 
    sieve()
 
}
 
</textarea></form>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        theme: "elegant",
 
        matchBrackets: true,
 
        indentUnit: 8,
 
        tabSize: 8,
 
        indentWithTabs: true,
 
        mode: "text/x-go"
 
      });
 
    </script>
 

	
 
    <p><strong>MIME type:</strong> <code>text/x-go</code></p>
 
  </body>
 
</html>
rhodecode/public/js/mode/haskell/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: Haskell mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="../../addon/edit/matchbrackets.js"></script>
 
    <script src="haskell.js"></script>
 
    <link rel="stylesheet" href="../../theme/elegant.css">
 
    <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
  </head>
 
  <body>
 
    <h1>CodeMirror: Haskell mode</h1>
 

	
 
<form><textarea id="code" name="code">
 
module UniquePerms (
 
    uniquePerms
 
    )
 
where
 

	
 
-- | Find all unique permutations of a list where there might be duplicates.
 
uniquePerms :: (Eq a) => [a] -> [[a]]
 
uniquePerms = permBag . makeBag
 

	
 
-- | An unordered collection where duplicate values are allowed,
 
-- but represented with a single value and a count.
 
type Bag a = [(a, Int)]
 

	
 
makeBag :: (Eq a) => [a] -> Bag a
 
makeBag [] = []
 
makeBag (a:as) = mix a $ makeBag as
 
  where
 
    mix a []                        = [(a,1)]
 
    mix a (bn@(b,n):bs) | a == b    = (b,n+1):bs
 
                        | otherwise = bn : mix a bs
 

	
 
permBag :: Bag a -> [[a]]
 
permBag [] = [[]]
 
permBag bs = concatMap (\(f,cs) -> map (f:) $ permBag cs) . oneOfEach $ bs
 
  where
 
    oneOfEach [] = []
 
    oneOfEach (an@(a,n):bs) =
 
        let bs' = if n == 1 then bs else (a,n-1):bs
 
        in (a,bs') : mapSnd (an:) (oneOfEach bs)
 
    
 

	
 
    apSnd f (a,b) = (a, f b)
 
    mapSnd = map . apSnd
 
</textarea></form>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        lineNumbers: true,
 
        matchBrackets: true,
 
        theme: "elegant"
 
      });
 
    </script>
 

	
 
    <p><strong>MIME types defined:</strong> <code>text/x-haskell</code>.</p>
 
  </body>
 
</html>
rhodecode/public/js/mode/haxe/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: Haxe mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="haxe.js"></script>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
    <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
 
  </head>
 
  <body>
 
    <h1>CodeMirror: Haxe mode</h1>
 

	
 
<div><textarea id="code" name="code">
 
import one.two.Three;
 

	
 
@attr("test")
 
class Foo&lt;T&gt; extends Three
 
{
 
	public function new()
 
	{
 
		noFoo = 12;
 
	}
 
	
 
	public static inline function doFoo(obj:{k:Int, l:Float}):Int
 
	{
 
		for(i in 0...10)
 
		{
 
			obj.k++;
 
			trace(i);
 
			var var1 = new Array();
 
			if(var1.length > 1)
 
				throw "Error";
 
		}
 
		// The following line should not be colored, the variable is scoped out
 
		var1;
 
		/* Multi line
 
		 * Comment test
 
		 */
 
		return obj.k;
 
	}
 
	private function bar():Void
 
	{
 
		#if flash
 
		var t1:String = "1.21";
 
		#end
 
		try {
 
			doFoo({k:3, l:1.2});
 
		}
 
		catch (e : String) {
 
			trace(e);
 
		}
 
		var t2:Float = cast(3.2);
 
		var t3:haxe.Timer = new haxe.Timer();
 
		var t4 = {k:Std.int(t2), l:Std.parseFloat(t1)};
 
		var t5 = ~/123+.*$/i;
 
		doFoo(t4);
 
		untyped t1 = 4;
 
		bob = new Foo&lt;Int&gt;
 
	}
 
	public var okFoo(default, never):Float;
 
	var noFoo(getFoo, null):Int;
 
	function getFoo():Int {
 
		return noFoo;
 
	}
 
	
 
	public var three:Int;
 
    public function new()
 
    {
 
        noFoo = 12;
 
    }
 

	
 
    public static inline function doFoo(obj:{k:Int, l:Float}):Int
 
    {
 
        for(i in 0...10)
 
        {
 
            obj.k++;
 
            trace(i);
 
            var var1 = new Array();
 
            if(var1.length > 1)
 
                throw "Error";
 
        }
 
        // The following line should not be colored, the variable is scoped out
 
        var1;
 
        /* Multi line
 
         * Comment test
 
         */
 
        return obj.k;
 
    }
 
    private function bar():Void
 
    {
 
        #if flash
 
        var t1:String = "1.21";
 
        #end
 
        try {
 
            doFoo({k:3, l:1.2});
 
        }
 
        catch (e : String) {
 
            trace(e);
 
        }
 
        var t2:Float = cast(3.2);
 
        var t3:haxe.Timer = new haxe.Timer();
 
        var t4 = {k:Std.int(t2), l:Std.parseFloat(t1)};
 
        var t5 = ~/123+.*$/i;
 
        doFoo(t4);
 
        untyped t1 = 4;
 
        bob = new Foo&lt;Int&gt;
 
    }
 
    public var okFoo(default, never):Float;
 
    var noFoo(getFoo, null):Int;
 
    function getFoo():Int {
 
        return noFoo;
 
    }
 

	
 
    public var three:Int;
 
}
 
enum Color
 
{
 
	red;
 
	green;
 
	blue;
 
	grey( v : Int );
 
	rgb (r:Int,g:Int,b:Int);
 
    red;
 
    green;
 
    blue;
 
    grey( v : Int );
 
    rgb (r:Int,g:Int,b:Int);
 
}
 
</textarea></div>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        lineNumbers: true,
 
        indentUnit: 4,
 
        indentWithTabs: true
 
      });
 
    </script>
 

	
 
    <p><strong>MIME types defined:</strong> <code>text/x-haxe</code>.</p>
 
  </body>
 
</html>
rhodecode/public/js/mode/htmlembedded/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: Html Embedded Scripts mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="../xml/xml.js"></script>
 
    <script src="../javascript/javascript.js"></script>
 
    <script src="../css/css.js"></script>
 
    <script src="../htmlmixed/htmlmixed.js"></script>
 
    <script src="htmlembedded.js"></script>
 
    <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
  </head>
 
  <body>
 
    <h1>CodeMirror: Html Embedded Scripts mode</h1>
 

	
 
<form><textarea id="code" name="code">
 
<%
 
function hello(who) {
 
	return "Hello " + who;
 
    return "Hello " + who;
 
}
 
%>
 
This is an example of EJS (embedded javascript)
 
<p>The program says <%= hello("world") %>.</p>
 
<script>
 
	alert("And here is some normal JS code"); // also colored
 
    alert("And here is some normal JS code"); // also colored
 
</script>
 
</textarea></form>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        lineNumbers: true,
 
        mode: "application/x-ejs",
 
        indentUnit: 4,
 
        indentWithTabs: true,
 
        enterMode: "keep",
 
        tabMode: "shift"
 
      });
 
    </script>
 

	
 
    <p>Mode for html embedded scripts like JSP and ASP.NET. Depends on HtmlMixed which in turn depends on
 
    JavaScript, CSS and XML.<br />Other dependancies include those of the scriping language chosen.</p>
 

	
 
    <p><strong>MIME types defined:</strong> <code>application/x-aspx</code> (ASP.NET), 
 
    <p><strong>MIME types defined:</strong> <code>application/x-aspx</code> (ASP.NET),
 
    <code>application/x-ejs</code> (Embedded Javascript), <code>application/x-jsp</code> (JavaServer Pages)</p>
 
  </body>
 
</html>
rhodecode/public/js/mode/http/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: HTTP mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="http.js"></script>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
    <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
 
  </head>
 
  <body>
 
    <h1>CodeMirror: HTTP mode</h1>
 

	
 
<div><textarea id="code" name="code">
 
POST /somewhere HTTP/1.1
 
Host: example.com
 
If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
 
Content-Type: application/x-www-form-urlencoded;
 
	charset=utf-8
 
    charset=utf-8
 
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
 

	
 
This is the request body!
 
</textarea></div>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
 
    </script>
 

	
 
    <p><strong>MIME types defined:</strong> <code>message/http</code>.</p>
 
  </body>
 
</html>
rhodecode/public/js/mode/javascript/typescript.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: TypeScript mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="javascript.js"></script>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
    <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
 
  </head>
 
  <body>
 
    <h1>CodeMirror: TypeScript mode</h1>
 

	
 
<div><textarea id="code" name="code">
 
class Greeter {
 
	greeting: string;
 
	constructor (message: string) {
 
		this.greeting = message;
 
	}
 
	greet() {
 
		return "Hello, " + this.greeting;
 
	}
 
}   
 
    greeting: string;
 
    constructor (message: string) {
 
        this.greeting = message;
 
    }
 
    greet() {
 
        return "Hello, " + this.greeting;
 
    }
 
}
 

	
 
var greeter = new Greeter("world");
 

	
 
var button = document.createElement('button')
 
button.innerText = "Say Hello"
 
button.onclick = function() {
 
	alert(greeter.greet())
 
    alert(greeter.greet())
 
}
 

	
 
document.body.appendChild(button)
 

	
 
</textarea></div>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        lineNumbers: true,
 
        matchBrackets: true,
 
        mode: "text/typescript"
 
      });
 
    </script>
 

	
 
    <p>This is a specialization of the <a href="index.html">JavaScript mode</a>.</p>
 
  </body>
 
</html>
rhodecode/public/js/mode/less/index.html
Show inline comments
 
@@ -82,102 +82,102 @@ h1 { color: green }
 

	
 
span[hello="Ocean"][goodbye="Land"]
 

	
 
a[rel~="copyright"] { ... }
 
a[href="http://www.w3.org/"] { ... }
 

	
 
DIALOGUE[character=romeo]
 
DIALOGUE[character=juliet]
 

	
 
[att^=val]
 
[att$=val]
 
[att*=val]
 

	
 
@namespace foo "http://www.example.com";
 
[foo|att=val] { color: blue }
 
[*|att] { color: yellow }
 
[|att] { color: green }
 
[att] { color: green }
 

	
 

	
 
*:target { color : red }
 
*:target::before { content : url(target.png) }
 

	
 
E[foo]{
 
  padding:65px;
 
}
 
E[foo] ~ F{
 
  padding:65px;
 
}
 
E#myid{
 
  padding:65px;
 
}
 
input[type="search"]::-webkit-search-decoration,
 
input[type="search"]::-webkit-search-cancel-button {
 
  -webkit-appearance: none; // Inner-padding issues in Chrome OSX, Safari 5
 
}
 
button::-moz-focus-inner,
 
input::-moz-focus-inner { // Inner padding and border oddities in FF3/4
 
  padding: 0;
 
  border: 0;
 
}
 
.btn {
 
  // reset here as of 2.0.3 due to Recess property order
 
  border-color: #ccc;
 
  border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);
 
}
 
fieldset span button, fieldset span input[type="file"] {
 
  font-size:12px;
 
	font-family:Arial, Helvetica, sans-serif;
 
    font-family:Arial, Helvetica, sans-serif;
 
}
 
.el tr:nth-child(even):last-child td:first-child{
 
	-moz-border-radius-bottomleft:3px;
 
	-webkit-border-bottom-left-radius:3px;
 
	border-bottom-left-radius:3px;
 
    -moz-border-radius-bottomleft:3px;
 
    -webkit-border-bottom-left-radius:3px;
 
    border-bottom-left-radius:3px;
 
}
 

	
 
/* Some LESS code */
 

	
 
button {
 
    width:  32px;
 
    height: 32px;
 
    border: 0;
 
    margin: 4px;
 
    cursor: pointer;
 
}
 
button.icon-plus { background: url(http://dahlström.net/tmp/sharp-icons/svg-icon-target.svg#plus) no-repeat; }
 
button.icon-chart { background: url(http://dahlström.net/tmp/sharp-icons/svg-icon-target.svg#chart) no-repeat; }
 

	
 
button:hover { background-color: #999; }
 
button:active { background-color: #666; }
 

	
 
@test_a: #eeeQQQ;//this is not a valid hex value and thus parsed as an element id
 
@test_b: #eeeFFF //this is a valid hex value but the declaration doesn't end with a semicolon and thus parsed as an element id
 

	
 
#eee aaa .box
 
{
 
  #test bbb {
 
    width: 500px;
 
    height: 250px;
 
    background-image: url(dir/output/sheep.png), url( betweengrassandsky.png );
 
    background-position: center bottom, left top;
 
    background-repeat: no-repeat;
 
  }
 
}
 

	
 
@base: #f938ab;
 

	
 
.box-shadow(@style, @c) when (iscolor(@c)) {
 
  box-shadow:         @style @c;
 
  -webkit-box-shadow: @style @c;
 
  -moz-box-shadow:    @style @c;
 
}
 
.box-shadow(@style, @alpha: 50%) when (isnumber(@alpha)) {
 
  .box-shadow(@style, rgba(0, 0, 0, @alpha));
 
}
 

	
 
@color: #4D926F;
 

	
 
#header {
 
  color: @color;
 
  color: #000000;
 
}
 
@@ -302,381 +302,381 @@ h1, h2, h3, h4 {
 
ul, li {
 
  list-style-type: none;
 
}
 
code { .code; }
 
code {
 
  .string, .regexp { color: @dark }
 
  .keyword { font-weight: bold }
 
  .comment { color: rgba(0, 0, 0, 0.5) }
 
  .number { color: @blue }
 
  .class, .special { color: rgba(0, 50, 100, 0.8) }
 
}
 
pre {
 
  padding: 0 30px;
 
  .wrap;
 
}
 
blockquote {
 
  font-style: italic;
 
}
 
body > footer {
 
  text-align: left;
 
  margin-left: 10px;
 
  font-style: italic;
 
  font-size: 18px;
 
  color: #888;
 
}
 

	
 
#logo {
 
  margin-top: 30px;
 
  margin-bottom: 30px;
 
  display: block;
 
  width: 199px;
 
  height: 81px;
 
  background: url(/images/logo.png) no-repeat;
 
}
 
nav {
 
  margin-left: 15px;
 
}
 
nav a, #dropdown li {
 
  display: inline-block;
 
  color: white;
 
  line-height: 42px;
 
  margin: 0;
 
  padding: 0px 15px;
 
  text-shadow: -1px -1px 1px rgba(0, 0, 0, 0.5);
 
  text-decoration: none;
 
  border: 2px solid transparent;
 
  border-width: 0 2px;
 
  &:hover {
 
    .dark-red; 
 
    .dark-red;
 
    text-decoration: none;
 
  }
 
}
 
.dark-red {
 
    @red: @medium;
 
    border: 2px solid darken(@red, 25%);
 
    border-left-color: darken(@red, 15%);
 
    border-right-color: darken(@red, 15%);
 
    border-bottom: 0;
 
    border-top: 0;
 
    background-color: darken(@red, 10%);
 
}
 

	
 
.content {
 
  margin: 0 auto;
 
  width: 980px;
 
}
 

	
 
#menu {
 
  position: absolute;
 
  width: 100%;
 
  z-index: 3;
 
  clear: both;
 
  display: block;
 
  background-color: @blue;
 
  height: 42px;
 
  border-top: 2px solid lighten(@alpha-blue, 20%);
 
  border-bottom: 2px solid darken(@alpha-blue, 25%);
 
  .box-shadow(0, 1px, 8px, 0.6);
 
  -moz-box-shadow: 0 0 0 #000; // Because firefox sucks.
 

	
 
  &.docked {
 
    background-color: hsla(210, 60%, 40%, 0.4);
 
  }
 
  &:hover {
 
    background-color: @blue;
 
  }
 

	
 
  #dropdown {
 
    margin: 0 0 0 117px;
 
    padding: 0;
 
    padding-top: 5px;
 
    display: none;
 
    width: 190px;
 
    border-top: 2px solid @medium;
 
    color: @highlight;
 
    border: 2px solid darken(@medium, 25%);
 
    border-left-color: darken(@medium, 15%);
 
    border-right-color: darken(@medium, 15%);
 
    border-top-width: 0;
 
    background-color: darken(@medium, 10%);
 
    ul {
 
      padding: 0px;  
 
      padding: 0px;
 
    }
 
    li {
 
      font-size: 14px;
 
      display: block;
 
      text-align: left;
 
      padding: 0;
 
      border: 0;
 
      a {
 
        display: block;
 
        padding: 0px 15px;  
 
        padding: 0px 15px;
 
        text-decoration: none;
 
        color: white;  
 
        color: white;
 
        &:hover {
 
          background-color: darken(@medium, 15%);
 
          text-decoration: none;
 
        }
 
      }
 
    }
 
    .border-radius(5px, bottom);
 
    .box-shadow(0, 6px, 8px, 0.5);
 
  }
 
}
 

	
 
#main {
 
  margin: 0 auto;
 
  width: 100%;
 
  background-color: @light-blue;
 
  border-top: 8px solid darken(@light-blue, 5%);
 

	
 
  #intro {
 
    background-color: lighten(@light-blue, 25%);
 
    float: left;
 
    margin-top: -8px;
 
    margin-right: 5px;
 

	
 
    height: 380px;
 
    position: relative;
 
    z-index: 2;
 
    font-family: 'Droid Serif', 'Georgia';
 
    width: 395px;
 
    padding: 45px 20px 23px 30px;
 
    border: 2px dashed darken(@light-blue, 10%);
 
    .box-shadow(1px, 0px, 6px, 0.5);
 
    border-bottom: 0;
 
    border-top: 0;
 
    #download { color: transparent; border: 0; float: left; display: inline-block; margin: 15px 0 15px -5px; }
 
    #download img { display: inline-block}
 
    #download-info {
 
      code {
 
        font-size: 13px;  
 
        font-size: 13px;
 
      }
 
      color: @blue + #333; display: inline; float: left; margin: 36px 0 0 15px }
 
  }
 
  h2 {
 
    span {
 
      color: @medium;  
 
      color: @medium;
 
    }
 
    color: @blue;
 
    margin: 20px 0;
 
    font-size: 24px;
 
    line-height: 1.2em;
 
  }
 
  h3 {
 
    color: @blue;
 
    line-height: 1.4em;
 
    margin: 30px 0 15px 0;
 
    font-size: 1em;
 
    text-shadow: 0px 0px 0px @lightest;
 
    span { color: @medium }
 
  }
 
  #example {
 
    p {
 
      font-size: 18px;
 
      color: @blue;
 
      font-weight: bold;
 
      text-shadow: 0px 1px 1px @lightest;
 
    }
 
    pre {
 
      margin: 0;
 
      text-shadow: 0 -1px 1px @darkest;
 
      margin-top: 20px;
 
      background-color: desaturate(@darkest, 8%);
 
      border: 0;
 
      width: 450px;
 
      color: lighten(@lightest, 2%);
 
      background-repeat: repeat;
 
      padding: 15px;
 
      border: 1px dashed @lightest;
 
      line-height: 15px;
 
      .box-shadow(0, 0px, 15px, 0.5);
 
      .code;
 
      .border-radius(2px);
 
      code .attribute { color: hsl(40, 50%, 70%) }
 
      code .variable  { color: hsl(120, 10%, 50%) }
 
      code .element   { color: hsl(170, 20%, 50%) }
 

	
 
      code .string, .regexp { color: hsl(75, 50%, 65%) }
 
      code .class { color: hsl(40, 40%, 60%); font-weight: normal }
 
      code .id { color: hsl(50, 40%, 60%); font-weight: normal }
 
      code .comment { color: rgba(255, 255, 255, 0.2) }
 
      code .number, .color { color: hsl(10, 40%, 50%) }
 
      code .class, code .mixin, .special { color: hsl(190, 20%, 50%) }
 
      #time { color: #aaa }
 
    }
 
    float: right;
 
    font-size: 12px;
 
    margin: 0;
 
    margin-top: 15px;
 
    padding: 0;
 
    width: 500px;
 
  }
 
}
 

	
 

	
 
.page {
 
  .content {
 
    width: 870px;
 
    padding: 45px;
 
  }
 
  margin: 0 auto;
 
  font-family: 'Georgia', serif;
 
  font-size: 18px;
 
  line-height: 26px;
 
  padding: 0 60px;
 
  code {
 
    font-size: 16px;  
 
    font-size: 16px;
 
  }
 
  pre {
 
    border-width: 1px;
 
    border-style: dashed;
 
    padding: 15px;
 
    margin: 15px 0;
 
  }
 
  h1 {
 
    text-align: left;
 
    font-size: 40px;
 
    margin-top: 15px;
 
    margin-bottom: 35px;
 
  }
 
  p + h1 { margin-top: 60px }
 
  h2, h3 {
 
    margin: 30px 0 15px 0;
 
  }
 
  p + h2, pre + h2, code + h2 {
 
    border-top: 6px solid rgba(255, 255, 255, 0.1);
 
    padding-top: 30px;
 
  }
 
  h3 {
 
    margin: 15px 0;
 
  }
 
}
 

	
 

	
 
#docs {
 
  @bg: lighten(@light-blue, 5%);
 
  border-top: 2px solid lighten(@bg, 5%);
 
  color: @blue;
 
  background-color: @light-blue;
 
  .box-shadow(0, -2px, 5px, 0.2);
 

	
 
  h1 {
 
    font-family: 'Droid Serif', 'Georgia', serif;
 
    padding-top: 30px;
 
    padding-left: 45px;
 
    font-size: 44px;
 
    text-align: left;
 
    margin: 30px 0 !important;
 
    text-shadow: 0px 1px 1px @lightest;
 
    font-weight: bold;
 
  }
 
  .content {
 
    clear: both;
 
    border-color: transparent;
 
    background-color: lighten(@light-blue, 25%);
 
    .box-shadow(0, 5px, 5px, 0.4);
 
  }
 
  pre {
 
    @background: lighten(@bg, 30%);
 
    color: lighten(@blue, 10%);
 
    background-color: @background;
 
    border-color: lighten(@light-blue, 25%);
 
    border-width: 2px;
 
    code .attribute { color: hsl(40, 50%, 30%) }
 
    code .variable  { color: hsl(120, 10%, 30%) }
 
    code .element   { color: hsl(170, 20%, 30%) }
 

	
 
    code .string, .regexp { color: hsl(75, 50%, 35%) }
 
    code .class { color: hsl(40, 40%, 30%); font-weight: normal }
 
    code .id { color: hsl(50, 40%, 30%); font-weight: normal }
 
    code .comment { color: rgba(0, 0, 0, 0.4) }
 
    code .number, .color { color: hsl(10, 40%, 30%) }
 
    code .class, code .mixin, .special { color: hsl(190, 20%, 30%) }
 
  }
 
  pre code                    { font-size: 15px  }
 
  p + h2, pre + h2, code + h2 { border-top-color: rgba(0, 0, 0, 0.1) }
 
}
 

	
 
td {
 
  padding-right: 30px;  
 
  padding-right: 30px;
 
}
 
#synopsis {
 
  .box-shadow(0, 5px, 5px, 0.2);
 
}
 
#synopsis, #about {
 
  h2 {
 
    font-size: 30px;  
 
    font-size: 30px;
 
    padding: 10px 0;
 
  }
 
  h1 + h2 {
 
      margin-top: 15px;  
 
      margin-top: 15px;
 
  }
 
  h3 { font-size: 22px }
 

	
 
  .code-example {
 
    border-spacing: 0;
 
    border-width: 1px;
 
    border-style: dashed;
 
    padding: 0;
 
    pre { border: 0; margin: 0 }
 
    td {
 
      border: 0;
 
      margin: 0;
 
      background-color: desaturate(darken(@darkest, 5%), 20%);
 
      vertical-align: top;
 
      padding: 0;
 
    }
 
    tr { padding: 0 }
 
  }
 
  .css-output {
 
    td {
 
      border-left: 0;  
 
      border-left: 0;
 
    }
 
  }
 
  .less-example {
 
    //border-right: 1px dotted rgba(255, 255, 255, 0.5) !important;
 
  }
 
  .css-output, .less-example {
 
    width: 390px;
 
  }
 
  pre {
 
    padding: 20px;
 
    line-height: 20px;
 
    font-size: 14px;
 
  }
 
}
 
#about, #synopsis, #guide {
 
  a {
 
    text-decoration: none;
 
    color: @light-yellow;
 
    border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
 
    &:hover {
 
      text-decoration: none;
 
      border-bottom: 1px dashed @light-yellow;
 
    }
 
  }
 
  @bg: desaturate(darken(@darkest, 5%), 20%);
 
  text-shadow: 0 -1px 1px lighten(@bg, 5%);
 
  color: @highlight;
 
  background-color: @bg;
 
  .content {
 
    background-color: desaturate(@darkest, 20%);
 
    clear: both;
 
    .box-shadow(0, 5px, 5px, 0.4);
 
  }
 
  h1, h2, h3 {
 
    color: @dark-yellow;
 
  }
 
  pre {
 
      code .attribute { color: hsl(40, 50%, 70%) }
 
      code .variable  { color: hsl(120, 10%, 50%) }
 
      code .element   { color: hsl(170, 20%, 50%) }
 

	
 
      code .string, .regexp { color: hsl(75, 50%, 65%) }
 
      code .class { color: hsl(40, 40%, 60%); font-weight: normal }
 
      code .id { color: hsl(50, 40%, 60%); font-weight: normal }
 
      code .comment { color: rgba(255, 255, 255, 0.2) }
 
      code .number, .color { color: hsl(10, 40%, 50%) }
 
      code .class, code .mixin, .special { color: hsl(190, 20%, 50%) }
 
    background-color: @bg;
rhodecode/public/js/mode/lua/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: Lua mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../addon/edit/matchbrackets.js"></script>
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="lua.js"></script>
 
    <link rel="stylesheet" href="../../theme/neat.css">
 
    <style>.CodeMirror {border: 1px solid black;}</style>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
  </head>
 
  <body>
 
    <h1>CodeMirror: Lua mode</h1>
 
    <form><textarea id="code" name="code">
 
--[[
 
example useless code to show lua syntax highlighting
 
this is multiline comment
 
]]
 

	
 
function blahblahblah(x)
 

	
 
  local table = {
 
    "asd" = 123,
 
    "x" = 0.34,  
 
    "x" = 0.34,
 
  }
 
  if x ~= 3 then
 
    print( x )
 
  elseif x == "string"
 
    my_custom_function( 0x34 )
 
  else
 
    unknown_function( "some string" )
 
  end
 

	
 
  --single line comment
 
  
 

	
 
end
 

	
 
function blablabla3()
 

	
 
  for k,v in ipairs( table ) do
 
    --abcde..
 
    y=[=[
 
  x=[[
 
      x is a multi line string
 
   ]]
 
  but its definition is iside a highest level string!
 
  ]=]
 
    print(" \"\" ")
 

	
 
    s = math.sin( x )
 
  end
 

	
 
end
 
</textarea></form>
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        tabMode: "indent",
 
        matchBrackets: true,
 
        theme: "neat"
 
      });
 
    </script>
 

	
 
    <p>Loosely based on Franciszek
 
    Wawrzak's <a href="http://codemirror.net/1/contrib/lua">CodeMirror
 
    1 mode</a>. One configuration parameter is
 
    supported, <code>specials</code>, to which you can provide an
 
    array of strings to have those identifiers highlighted with
 
    the <code>lua-special</code> style.</p>
 
    <p><strong>MIME types defined:</strong> <code>text/x-lua</code>.</p>
 

	
 
  </body>
 
</html>
rhodecode/public/js/mode/markdown/index.html
Show inline comments
 
@@ -26,319 +26,319 @@ Markdown: Basics
 
    &lt;li&gt;&lt;a href="/projects/markdown/license" title="Pricing and License Information"&gt;License&lt;/a&gt;&lt;/li&gt;
 
    &lt;li&gt;&lt;a href="/projects/markdown/dingus" title="Online Markdown Web Form"&gt;Dingus&lt;/a&gt;&lt;/li&gt;
 
&lt;/ul&gt;
 

	
 

	
 
Getting the Gist of Markdown's Formatting Syntax
 
------------------------------------------------
 

	
 
This page offers a brief overview of what it's like to use Markdown.
 
The [syntax page] [s] provides complete, detailed documentation for
 
every feature, but Markdown should be very easy to pick up simply by
 
looking at a few examples of it in action. The examples on this page
 
are written in a before/after style, showing example syntax and the
 
HTML output produced by Markdown.
 

	
 
It's also helpful to simply try Markdown out; the [Dingus] [d] is a
 
web application that allows you type your own Markdown-formatted text
 
and translate it to XHTML.
 

	
 
**Note:** This document is itself written using Markdown; you
 
can [see the source for it by adding '.text' to the URL] [src].
 

	
 
  [s]: /projects/markdown/syntax  "Markdown Syntax"
 
  [d]: /projects/markdown/dingus  "Markdown Dingus"
 
  [src]: /projects/markdown/basics.text
 

	
 

	
 
## Paragraphs, Headers, Blockquotes ##
 

	
 
A paragraph is simply one or more consecutive lines of text, separated
 
by one or more blank lines. (A blank line is any line that looks like
 
a blank line -- a line containing nothing but spaces or tabs is
 
considered blank.) Normal paragraphs should not be indented with
 
spaces or tabs.
 

	
 
Markdown offers two styles of headers: *Setext* and *atx*.
 
Setext-style headers for `&lt;h1&gt;` and `&lt;h2&gt;` are created by
 
"underlining" with equal signs (`=`) and hyphens (`-`), respectively.
 
To create an atx-style header, you put 1-6 hash marks (`#`) at the
 
beginning of the line -- the number of hashes equals the resulting
 
HTML header level.
 

	
 
Blockquotes are indicated using email-style '`&gt;`' angle brackets.
 

	
 
Markdown:
 

	
 
    A First Level Header
 
    ====================
 
    
 

	
 
    A Second Level Header
 
    ---------------------
 

	
 
    Now is the time for all good men to come to
 
    the aid of their country. This is just a
 
    regular paragraph.
 

	
 
    The quick brown fox jumped over the lazy
 
    dog's back.
 
    
 

	
 
    ### Header 3
 

	
 
    &gt; This is a blockquote.
 
    &gt; 
 
    &gt;
 
    &gt; This is the second paragraph in the blockquote.
 
    &gt;
 
    &gt; ## This is an H2 in a blockquote
 

	
 

	
 
Output:
 

	
 
    &lt;h1&gt;A First Level Header&lt;/h1&gt;
 
    
 

	
 
    &lt;h2&gt;A Second Level Header&lt;/h2&gt;
 
    
 

	
 
    &lt;p&gt;Now is the time for all good men to come to
 
    the aid of their country. This is just a
 
    regular paragraph.&lt;/p&gt;
 
    
 

	
 
    &lt;p&gt;The quick brown fox jumped over the lazy
 
    dog's back.&lt;/p&gt;
 
    
 

	
 
    &lt;h3&gt;Header 3&lt;/h3&gt;
 
    
 

	
 
    &lt;blockquote&gt;
 
        &lt;p&gt;This is a blockquote.&lt;/p&gt;
 
        
 

	
 
        &lt;p&gt;This is the second paragraph in the blockquote.&lt;/p&gt;
 
        
 

	
 
        &lt;h2&gt;This is an H2 in a blockquote&lt;/h2&gt;
 
    &lt;/blockquote&gt;
 

	
 

	
 

	
 
### Phrase Emphasis ###
 

	
 
Markdown uses asterisks and underscores to indicate spans of emphasis.
 

	
 
Markdown:
 

	
 
    Some of these words *are emphasized*.
 
    Some of these words _are emphasized also_.
 
    
 

	
 
    Use two asterisks for **strong emphasis**.
 
    Or, if you prefer, __use two underscores instead__.
 

	
 
Output:
 

	
 
    &lt;p&gt;Some of these words &lt;em&gt;are emphasized&lt;/em&gt;.
 
    Some of these words &lt;em&gt;are emphasized also&lt;/em&gt;.&lt;/p&gt;
 
    
 

	
 
    &lt;p&gt;Use two asterisks for &lt;strong&gt;strong emphasis&lt;/strong&gt;.
 
    Or, if you prefer, &lt;strong&gt;use two underscores instead&lt;/strong&gt;.&lt;/p&gt;
 
   
 

	
 

	
 

	
 
## Lists ##
 

	
 
Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`,
 
`+`, and `-`) as list markers. These three markers are
 
interchangable; this:
 

	
 
    *   Candy.
 
    *   Gum.
 
    *   Booze.
 

	
 
this:
 

	
 
    +   Candy.
 
    +   Gum.
 
    +   Booze.
 

	
 
and this:
 

	
 
    -   Candy.
 
    -   Gum.
 
    -   Booze.
 

	
 
all produce the same output:
 

	
 
    &lt;ul&gt;
 
    &lt;li&gt;Candy.&lt;/li&gt;
 
    &lt;li&gt;Gum.&lt;/li&gt;
 
    &lt;li&gt;Booze.&lt;/li&gt;
 
    &lt;/ul&gt;
 

	
 
Ordered (numbered) lists use regular numbers, followed by periods, as
 
list markers:
 

	
 
    1.  Red
 
    2.  Green
 
    3.  Blue
 

	
 
Output:
 

	
 
    &lt;ol&gt;
 
    &lt;li&gt;Red&lt;/li&gt;
 
    &lt;li&gt;Green&lt;/li&gt;
 
    &lt;li&gt;Blue&lt;/li&gt;
 
    &lt;/ol&gt;
 

	
 
If you put blank lines between items, you'll get `&lt;p&gt;` tags for the
 
list item text. You can create multi-paragraph list items by indenting
 
the paragraphs by 4 spaces or 1 tab:
 

	
 
    *   A list item.
 
    
 

	
 
        With multiple paragraphs.
 

	
 
    *   Another item in the list.
 

	
 
Output:
 

	
 
    &lt;ul&gt;
 
    &lt;li&gt;&lt;p&gt;A list item.&lt;/p&gt;
 
    &lt;p&gt;With multiple paragraphs.&lt;/p&gt;&lt;/li&gt;
 
    &lt;li&gt;&lt;p&gt;Another item in the list.&lt;/p&gt;&lt;/li&gt;
 
    &lt;/ul&gt;
 
    
 

	
 

	
 

	
 
### Links ###
 

	
 
Markdown supports two styles for creating links: *inline* and
 
*reference*. With both styles, you use square brackets to delimit the
 
text you want to turn into a link.
 

	
 
Inline-style links use parentheses immediately after the link text.
 
For example:
 

	
 
    This is an [example link](http://example.com/).
 

	
 
Output:
 

	
 
    &lt;p&gt;This is an &lt;a href="http://example.com/"&gt;
 
    example link&lt;/a&gt;.&lt;/p&gt;
 

	
 
Optionally, you may include a title attribute in the parentheses:
 

	
 
    This is an [example link](http://example.com/ "With a Title").
 

	
 
Output:
 

	
 
    &lt;p&gt;This is an &lt;a href="http://example.com/" title="With a Title"&gt;
 
    example link&lt;/a&gt;.&lt;/p&gt;
 

	
 
Reference-style links allow you to refer to your links by names, which
 
you define elsewhere in your document:
 

	
 
    I get 10 times more traffic from [Google][1] than from
 
    [Yahoo][2] or [MSN][3].
 

	
 
    [1]: http://google.com/        "Google"
 
    [2]: http://search.yahoo.com/  "Yahoo Search"
 
    [3]: http://search.msn.com/    "MSN Search"
 

	
 
Output:
 

	
 
    &lt;p&gt;I get 10 times more traffic from &lt;a href="http://google.com/"
 
    title="Google"&gt;Google&lt;/a&gt; than from &lt;a href="http://search.yahoo.com/"
 
    title="Yahoo Search"&gt;Yahoo&lt;/a&gt; or &lt;a href="http://search.msn.com/"
 
    title="MSN Search"&gt;MSN&lt;/a&gt;.&lt;/p&gt;
 

	
 
The title attribute is optional. Link names may contain letters,
 
numbers and spaces, but are *not* case sensitive:
 

	
 
    I start my morning with a cup of coffee and
 
    [The New York Times][NY Times].
 

	
 
    [ny times]: http://www.nytimes.com/
 

	
 
Output:
 

	
 
    &lt;p&gt;I start my morning with a cup of coffee and
 
    &lt;a href="http://www.nytimes.com/"&gt;The New York Times&lt;/a&gt;.&lt;/p&gt;
 

	
 

	
 
### Images ###
 

	
 
Image syntax is very much like link syntax.
 

	
 
Inline (titles are optional):
 

	
 
    ![alt text](/path/to/img.jpg "Title")
 

	
 
Reference-style:
 

	
 
    ![alt text][id]
 

	
 
    [id]: /path/to/img.jpg "Title"
 

	
 
Both of the above examples produce the same output:
 

	
 
    &lt;img src="/path/to/img.jpg" alt="alt text" title="Title" /&gt;
 

	
 

	
 

	
 
### Code ###
 

	
 
In a regular paragraph, you can create code span by wrapping text in
 
backtick quotes. Any ampersands (`&amp;`) and angle brackets (`&lt;` or
 
`&gt;`) will automatically be translated into HTML entities. This makes
 
it easy to use Markdown to write about HTML example code:
 

	
 
    I strongly recommend against using any `&lt;blink&gt;` tags.
 

	
 
    I wish SmartyPants used named entities like `&amp;mdash;`
 
    instead of decimal-encoded entites like `&amp;#8212;`.
 

	
 
Output:
 

	
 
    &lt;p&gt;I strongly recommend against using any
 
    &lt;code&gt;&amp;lt;blink&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;
 
    
 

	
 
    &lt;p&gt;I wish SmartyPants used named entities like
 
    &lt;code&gt;&amp;amp;mdash;&lt;/code&gt; instead of decimal-encoded
 
    entites like &lt;code&gt;&amp;amp;#8212;&lt;/code&gt;.&lt;/p&gt;
 

	
 

	
 
To specify an entire block of pre-formatted code, indent every line of
 
the block by 4 spaces or 1 tab. Just like with code spans, `&amp;`, `&lt;`,
 
and `&gt;` characters will be escaped automatically.
 

	
 
Markdown:
 

	
 
    If you want your page to validate under XHTML 1.0 Strict,
 
    you've got to put paragraph tags in your blockquotes:
 

	
 
        &lt;blockquote&gt;
 
            &lt;p&gt;For example.&lt;/p&gt;
 
        &lt;/blockquote&gt;
 

	
 
Output:
 

	
 
    &lt;p&gt;If you want your page to validate under XHTML 1.0 Strict,
 
    you've got to put paragraph tags in your blockquotes:&lt;/p&gt;
 
    
 

	
 
    &lt;pre&gt;&lt;code&gt;&amp;lt;blockquote&amp;gt;
 
        &amp;lt;p&amp;gt;For example.&amp;lt;/p&amp;gt;
 
    &amp;lt;/blockquote&amp;gt;
 
    &lt;/code&gt;&lt;/pre&gt;
 
</textarea></form>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        mode: 'markdown',
 
        lineNumbers: true,
 
        theme: "default",
 
        extraKeys: {"Enter": "newlineAndIndentContinueMarkdownList"}
 
      });
 
    </script>
 

	
 
    <p>Optionally depends on the XML mode for properly highlighted inline XML blocks.</p>
 

	
 
    <p><strong>MIME types defined:</strong> <code>text/x-markdown</code>.</p>
 

	
 
    <p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#markdown_*">normal</a>,  <a href="../../test/index.html#verbose,markdown_*">verbose</a>.</p>
 

	
 
  </body>
 
</html>
rhodecode/public/js/mode/mirc/index.html
Show inline comments
 
@@ -90,60 +90,60 @@ dialog AKA_Search {
 
  button "Search", 2, 163 4 32 12
 
  radio "Search HostMask", 4, 61 22 55 10
 
  radio "Search Nicknames", 5, 123 22 56 10
 
  list 6, 8 38 190 169, sort extsel vsbar
 
  button "Check Selected", 7, 67 206 40 12
 
  button "Close", 8, 160 206 38 12, cancel
 
  box "Search Type", 3, 11 17 183 18
 
  button "Copy to Clipboard", 9, 111 206 46 12
 
}
 
On *:Dialog:Aka_Search:init:*: { did -c $dname 5 }
 
On *:Dialog:Aka_Search:Sclick:2,7,9: {
 
  if ($did == 2) && ($did($dname,1)) {
 
    did -r $dname 6
 
    var %search $+(*,$v1,*), %type $iif($did($dname,5).state,data,item), %matches = $hfind(NickNames,%search,0,w). [ $+ [ %type ] ]
 
    while (%matches) {
 
      did -a $dname 6 $hfind(NickNames,%search,%matches,w). [ $+ [ %type ] ]
 
      dec %matches
 
    }
 
    did -c $dname 6 1
 
  }
 
  elseif ($did == 7) && ($did($dname,6).seltext) { echo -ga $AKALogo 07 $mid($replace($hget(NickNames,$v1),$chr(126),$chr(44)),2,-1) }
 
  elseif ($did == 9) && ($did($dname,6).seltext) { clipboard $mid($v1,$pos($v1,*,1)) }
 
}
 
On *:Start:{
 
  if (!$hget(NickNames)) { hmake NickNames 10 }
 
  if ($isfile(NickNames.hsh)) { hload  NickNames NickNames.hsh }
 
}
 
On *:Exit: { if ($hget(NickNames)) { hsave NickNames NickNames.hsh } }
 
On *:Disconnect: { if ($hget(NickNames)) { hsave NickNames NickNames.hsh } }
 
On *:Unload: { hfree NickNames }
 
alias -l ialupdateCheck {
 
  inc -z $+(%,ialupdateCheck,$network) $calc($nick($1,0) / 4)
 
  ;If your ial is already being updated on join .who $1 out.
 
  ;If you are using /names to update ial you will still need this line.
 
  .who $1
 
}
 
Raw 352:*: {
 
  if ($($+(%,ialupdateCheck,$network),2)) haltdef
 
  NickNamesAdd $6 $+($network,$address($6,2))
 
}
 
Raw 315:*: {
 
  if ($($+(%,ialupdateCheck,$network),2)) haltdef
 
}
 

	
 
</textarea></form>
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        tabMode: "indent",
 
		theme: "twilight",
 
        theme: "twilight",
 
        lineNumbers: true,
 
		matchBrackets: true,
 
        matchBrackets: true,
 
        indentUnit: 4,
 
        mode: "text/mirc"
 
      });
 
    </script>
 

	
 
    <p><strong>MIME types defined:</strong> <code>text/mirc</code>.</p>
 

	
 
  </body>
 
</html>
rhodecode/public/js/mode/ntriples/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: NTriples mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="ntriples.js"></script>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
    <style type="text/css">
 
      .CodeMirror {
 
        border: 1px solid #eee;
 
      }
 
    </style>   
 
    </style>
 
  </head>
 
  <body>
 
    <h1>CodeMirror: NTriples mode</h1>
 
<form>
 
<textarea id="ntriples" name="ntriples">    
 
<textarea id="ntriples" name="ntriples">
 
<http://Sub1>     <http://pred1>     <http://obj> .
 
<http://Sub2>     <http://pred2#an2> "literal 1" .
 
<http://Sub3#an3> <http://pred3>     _:bnode3 .
 
_:bnode4          <http://pred4>     "literal 2"@lang .
 
_:bnode5          <http://pred5>     "literal 3"^^<http://type> .
 
</textarea>
 
</form>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("ntriples"), {});
 
    </script>
 
    <p><strong>MIME types defined:</strong> <code>text/n-triples</code>.</p>
 
  </body>
 
</html>
rhodecode/public/js/mode/ocaml/index.html
Show inline comments
 
@@ -30,97 +30,97 @@ let rec qsort = function
 
       let left, right = List.partition is_less rest in
 
       qsort left @ [pivot] @ qsort right
 

	
 
(* Fibonacci Sequence *)
 
let rec fib_aux n a b =
 
  match n with
 
  | 0 -&gt; a
 
  | _ -&gt; fib_aux (n - 1) (a + b) a
 
let fib n = fib_aux n 0 1
 

	
 
(* Birthday paradox *)
 
let year_size = 365.
 

	
 
let rec birthday_paradox prob people =
 
    let prob' = (year_size -. float people) /. year_size *. prob  in
 
    if prob' &lt; 0.5 then
 
        Printf.printf "answer = %d\n" (people+1)
 
    else
 
        birthday_paradox prob' (people+1) ;;
 

	
 
birthday_paradox 1.0 1
 

	
 
(* Church numerals *)
 
let zero f x = x
 
let succ n f x = f (n f x)
 
let one = succ zero
 
let two = succ (succ zero)
 
let add n1 n2 f x = n1 f (n2 f x)
 
let to_string n = n (fun k -&gt; "S" ^ k) "0"
 
let _ = to_string (add (succ two) two)
 

	
 
(* Elementary functions *)
 
let square x = x * x;;
 
let rec fact x =
 
  if x &lt;= 1 then 1 else x * fact (x - 1);;
 

	
 
(* Automatic memory management *)
 
let l = 1 :: 2 :: 3 :: [];;
 
[1; 2; 3];;
 
5 :: l;;
 

	
 
(* Polymorphism: sorting lists *)
 
let rec sort = function
 
  | [] -&gt; []
 
  | x :: l -&gt; insert x (sort l)
 

	
 
and insert elem = function
 
  | [] -&gt; [elem]
 
  | x :: l -&gt; 
 
  | x :: l -&gt;
 
      if elem &lt; x then elem :: x :: l else x :: insert elem l;;
 

	
 
(* Imperative features *)
 
let add_polynom p1 p2 =
 
  let n1 = Array.length p1
 
  and n2 = Array.length p2 in
 
  let result = Array.create (max n1 n2) 0 in
 
  for i = 0 to n1 - 1 do result.(i) &lt;- p1.(i) done;
 
  for i = 0 to n2 - 1 do result.(i) &lt;- result.(i) + p2.(i) done;
 
  result;;
 
add_polynom [| 1; 2 |] [| 1; 2; 3 |];;
 

	
 
(* We may redefine fact using a reference cell and a for loop *)
 
let fact n =
 
  let result = ref 1 in
 
  for i = 2 to n do
 
    result := i * !result
 
   done;
 
   !result;;
 
fact 5;;
 

	
 
(* Triangle (graphics) *)
 
let () =
 
  ignore( Glut.init Sys.argv );
 
  Glut.initDisplayMode ~double_buffer:true ();
 
  ignore (Glut.createWindow ~title:"OpenGL Demo");
 
  let angle t = 10. *. t *. t in
 
  let render () =
 
    GlClear.clear [ `color ];
 
    GlMat.load_identity ();
 
    GlMat.rotate ~angle: (angle (Sys.time ())) ~z:1. ();
 
    GlDraw.begins `triangles;
 
    List.iter GlDraw.vertex2 [-1., -1.; 0., 1.; 1., -1.];
 
    GlDraw.ends ();
 
    Glut.swapBuffers () in
 
  GlMat.mode `modelview;
 
  Glut.displayFunc ~cb:render;
 
  Glut.idleFunc ~cb:(Some Glut.postRedisplay);
 
  Glut.mainLoop ()
 

	
 
(* A Hundred Lines of Caml - http://caml.inria.fr/about/taste.en.html *)
 
(* OCaml page on Wikipedia - http://en.wikipedia.org/wiki/OCaml *)
 
</textarea>
 

	
 
<script>
 
  var editor = CodeMirror.fromTextArea(document.getElementById('code'), {
 
    mode: 'ocaml',
 
    lineNumbers: true,
rhodecode/public/js/mode/pascal/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: Pascal mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="pascal.js"></script>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
    <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
 
  </head>
 
  <body>
 
    <h1>CodeMirror: Pascal mode</h1>
 

	
 
<div><textarea id="code" name="code">
 
(* Example Pascal code *)
 

	
 
while a <> b do writeln('Waiting');
 
 
 
if a > b then 
 

	
 
if a > b then
 
  writeln('Condition met')
 
else 
 
else
 
  writeln('Condition not met');
 
 
 
for i := 1 to 10 do 
 

	
 
for i := 1 to 10 do
 
  writeln('Iteration: ', i:1);
 
 
 

	
 
repeat
 
  a := a + 1
 
until a = 10;
 
 
 

	
 
case i of
 
  0: write('zero');
 
  1: write('one');
 
  2: write('two')
 
end;
 
</textarea></div>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        lineNumbers: true,
 
        mode: "text/x-pascal"
 
      });
 
    </script>
 

	
 
    <p><strong>MIME types defined:</strong> <code>text/x-pascal</code>.</p>
 
  </body>
 
</html>
rhodecode/public/js/mode/perl/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: Perl mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="perl.js"></script>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
    <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
 
  </head>
 
  <body>
 
    <h1>CodeMirror: Perl mode</h1>
 

	
 
<div><textarea id="code" name="code">
 
#!/usr/bin/perl
 

	
 
use Something qw(func1 func2);
 

	
 
# strings
 
my $s1 = qq'single line';
 
our $s2 = q(multi-
 
              line);
 

	
 
=item Something
 
	Example.
 
    Example.
 
=cut
 

	
 
my $html=<<'HTML'
 
<html>
 
<title>hi!</title>
 
</html>
 
HTML
 

	
 
print "first,".join(',', 'second', qq~third~);
 

	
 
if($s1 =~ m[(?<!\s)(l.ne)\z]o) {
 
	$h->{$1}=$$.' predefined variables';
 
	$s2 =~ s/\-line//ox;
 
	$s1 =~ s[
 
		  line ]
 
		[
 
		  block
 
		]ox;
 
    $h->{$1}=$$.' predefined variables';
 
    $s2 =~ s/\-line//ox;
 
    $s1 =~ s[
 
          line ]
 
        [
 
          block
 
        ]ox;
 
}
 

	
 
1; # numbers and comments
 

	
 
__END__
 
something...
 

	
 
</textarea></div>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        lineNumbers: true
 
      });
 
    </script>
 

	
 
    <p><strong>MIME types defined:</strong> <code>text/x-perl</code>.</p>
 
  </body>
 
</html>
rhodecode/public/js/mode/php/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: PHP mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="../../addon/edit/matchbrackets.js"></script>
 
    <script src="../htmlmixed/htmlmixed.js"></script>
 
    <script src="../xml/xml.js"></script>
 
    <script src="../javascript/javascript.js"></script>
 
    <script src="../css/css.js"></script>
 
    <script src="../clike/clike.js"></script>
 
    <script src="php.js"></script>
 
    <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
  </head>
 
  <body>
 
    <h1>CodeMirror: PHP mode</h1>
 

	
 
<form><textarea id="code" name="code">
 
<?php
 
function hello($who) {
 
	return "Hello " . $who;
 
    return "Hello " . $who;
 
}
 
?>
 
<p>The program says <?= hello("World") ?>.</p>
 
<script>
 
	alert("And here is some JS code"); // also colored
 
    alert("And here is some JS code"); // also colored
 
</script>
 
</textarea></form>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        lineNumbers: true,
 
        matchBrackets: true,
 
        mode: "application/x-httpd-php",
 
        indentUnit: 4,
 
        indentWithTabs: true,
 
        enterMode: "keep",
 
        tabMode: "shift"
 
      });
 
    </script>
 

	
 
    <p>Simple HTML/PHP mode based on
 
    the <a href="../clike">C-like</a> mode. Depends on XML,
 
    JavaScript, CSS, HTMLMixed, and C-like modes.</p>
 

	
 
    <p><strong>MIME types defined:</strong> <code>application/x-httpd-php</code> (HTML with PHP code), <code>text/x-php</code> (plain, non-wrapped PHP code).</p>
 
  </body>
 
</html>
rhodecode/public/js/mode/pig/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: Pig Latin mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="pig.js"></script>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
    <style>.CodeMirror {border: 2px inset #dee;}</style>
 
  </head>
 
  <body>
 
    <h1>CodeMirror: Pig Latin mode</h1>
 

	
 
<form><textarea id="code" name="code">
 
-- Apache Pig (Pig Latin Language) Demo
 
/* 
 
/*
 
This is a multiline comment.
 
*/
 
a = LOAD "\path\to\input" USING PigStorage('\t') AS (x:long, y:chararray, z:bytearray);
 
b = GROUP a BY (x,y,3+4);
 
c = FOREACH b GENERATE flatten(group) as (x,y), SUM(group.$2) as z;
 
STORE c INTO "\path\to\output";
 

	
 
--
 
</textarea></form>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        lineNumbers: true,
 
        indentUnit: 4,
 
        mode: "text/x-pig"
 
      });
 
    </script>
 

	
 
    <p>
 
        Simple mode that handles Pig Latin language.
 
    </p>
 

	
 
    <p><strong>MIME type defined:</strong> <code>text/x-pig</code>
 
    (PIG code)
 
</html>
rhodecode/public/js/mode/python/LICENSE.txt
Show inline comments
 
The MIT License
 

	
 
Copyright (c) 2010 Timothy Farrell
 

	
 
Permission is hereby granted, free of charge, to any person obtaining a copy
 
of this software and associated documentation files (the "Software"), to deal
 
in the Software without restriction, including without limitation the rights
 
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
copies of the Software, and to permit persons to whom the Software is
 
furnished to do so, subject to the following conditions:
 

	
 
The above copyright notice and this permission notice shall be included in
 
all copies or substantial portions of the Software.
 

	
 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 
THE SOFTWARE.
 
\ No newline at end of file
 
THE SOFTWARE.
rhodecode/public/js/mode/python/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: Python mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="../../addon/edit/matchbrackets.js"></script>
 
    <script src="python.js"></script>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
    <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
 
  </head>
 
  <body>
 
    <h1>CodeMirror: Python mode</h1>
 
    
 

	
 
    <div><textarea id="code" name="code">
 
# Literals
 
1234
 
0.0e101
 
.123
 
0b01010011100
 
0o01234567
 
0x0987654321abcdef
 
7
 
2147483647
 
3L
 
79228162514264337593543950336L
 
0x100000000L
 
79228162514264337593543950336
 
0xdeadbeef
 
3.14j
 
10.j
 
10j
 
.001j
 
1e100j
 
3.14e-10j
 

	
 

	
 
# String Literals
 
'For\''
 
"God\""
 
"""so loved
 
the world"""
 
'''that he gave
 
his only begotten\' '''
 
'that whosoever believeth \
 
in him'
 
''
 

	
 
# Identifiers
 
__a__
 
a.b
 
a.b.c
 

	
 
# Operators
 
+ - * / % & | ^ ~ < >
 
== != <= >= <> << >> // **
 
and or not in is
 

	
 
# Delimiters
 
() [] {} , : ` = ; @ .  # Note that @ and . require the proper context.
 
+= -= *= /= %= &= |= ^=
 
//= >>= <<= **=
rhodecode/public/js/mode/q/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: Q mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="../../addon/edit/matchbrackets.js"></script>
 
    <script src="q.js"></script>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
    <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
 
  </head>
 
  <body>
 
    <h1>CodeMirror: Q mode</h1>
 

	
 
<div><textarea id="code" name="code">
 
/ utilities to quickly load a csv file - for more exhaustive analysis of the csv contents see csvguess.q
 
/ 2009.09.20 - updated to match latest csvguess.q 
 
/ 2009.09.20 - updated to match latest csvguess.q
 

	
 
/ .csv.colhdrs[file] - return a list of colhdrs from file
 
/ info:.csv.info[file] - return a table of information about the file
 
/ columns are: 
 
/	c - column name; ci - column index; t - load type; mw - max width; 
 
/	dchar - distinct characters in values; rule - rule that caught the type
 
/	maybe - needs checking, _could_ be say a date, but perhaps just a float?
 
/ columns are:
 
/   c - column name; ci - column index; t - load type; mw - max width;
 
/   dchar - distinct characters in values; rule - rule that caught the type
 
/   maybe - needs checking, _could_ be say a date, but perhaps just a float?
 
/ .csv.info0[file;onlycols] - like .csv.info except that it only analyses <onlycols>
 
/ example:
 
/	info:.csv.info0[file;(.csv.colhdrs file)like"*price"]
 
/	info:.csv.infolike[file;"*price"]
 
/	show delete from info where t=" "
 
/   info:.csv.info0[file;(.csv.colhdrs file)like"*price"]
 
/   info:.csv.infolike[file;"*price"]
 
/   show delete from info where t=" "
 
/ .csv.data[file;info] - use the info from .csv.info to read the data
 
/ .csv.data10[file;info] - like .csv.data but only returns the first 10 rows
 
/ bulkload[file;info] - bulk loads file into table DATA (which must be already defined :: DATA:() )
 
/ .csv.read[file]/read10[file] - for when you don't care about checking/tweaking the <info> before reading 
 
/ .csv.read[file]/read10[file] - for when you don't care about checking/tweaking the <info> before reading
 

	
 
\d .csv
 
DELIM:","
 
ZAPHDRS:0b / lowercase and remove _ from colhdrs (junk characters are always removed)
 
WIDTHHDR:25000 / number of characters read to get the header
 
READLINES:222 / number of lines read and used to guess the types
 
SYMMAXWIDTH:11 / character columns narrower than this are stored as symbols
 
SYMMAXGR:10 / max symbol granularity% before we give up and keep as a * string
 
FORCECHARWIDTH:30 / every field (of any type) with values this wide or more is forced to character "*"
 
DISCARDEMPTY:0b / completely ignore empty columns if true else set them to "C"
 
CHUNKSIZE:50000000 / used in fs2 (modified .Q.fs)
 

	
 
k)nameltrim:{$[~@x;.z.s'x;~(*x)in aA:.Q.a,.Q.A;(+/&\~x in aA)_x;x]}
 
k)fs2:{[f;s]((-7!s)>){[f;s;x]i:1+last@&0xa=r:1:(s;x;CHUNKSIZE);f@`\:i#r;x+i}[f;s]/0j}
 
cleanhdrs:{{$[ZAPHDRS;lower x except"_";x]}x where x in DELIM,.Q.an}
 
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]}
 

	
 
read:{[file]data[file;info[file]]}  
 
read10:{[file]data10[file;info[file]]}  
 
read:{[file]data[file;info[file]]}
 
read10:{[file]data10[file;info[file]]}
 

	
 
colhdrs:{[file]
 
	`$nameltrim DELIM vs cleanhdrs first read0(file;0;1+first where 0xa=read1(file;0;WIDTHHDR))}
 
    `$nameltrim DELIM vs cleanhdrs first read0(file;0;1+first where 0xa=read1(file;0;WIDTHHDR))}
 
data:{[file;info]
 
	(exec c from info where not t=" ")xcol(exec t from info;enlist DELIM)0:file}
 
    (exec c from info where not t=" ")xcol(exec t from info;enlist DELIM)0:file}
 
data10:{[file;info]
 
	data[;info](file;0;1+last 11#where 0xa=read1(file;0;15*WIDTHHDR))}
 
    data[;info](file;0;1+last 11#where 0xa=read1(file;0;15*WIDTHHDR))}
 
info0:{[file;onlycols]
 
	colhdrs:`$nameltrim DELIM vs cleanhdrs first head:read0(file;0;1+last where 0xa=read1(file;0;WIDTHHDR));
 
	loadfmts:(count colhdrs)#"S";if[count onlycols;loadfmts[where not colhdrs in onlycols]:"C"];
 
	breaks:where 0xa=read1(file;0;floor(10+READLINES)*WIDTHHDR%count head);
 
	nas:count as:colhdrs xcol(loadfmts;enlist DELIM)0:(file;0;1+last((1+READLINES)&count breaks)#breaks);
 
	info:([]c:key flip as;v:value flip as);as:();
 
	reserved:key`.q;reserved,:.Q.res;reserved,:`i;
 
	info:update res:c in reserved from info;
 
	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;
 
	info:update ci:`s#ci from info;
 
	if[count onlycols;info:update t:" ",rule:10 from info where not c in onlycols];
 
	info:update sdv:{string(distinct x)except`}peach v from info; 
 
	info:update ndv:count each sdv from info;
 
	info:update gr:floor 0.5+100*ndv%nas,mw:{max count each x}peach sdv from info where 0<ndv;
 
	info:update t:"*",rule:20 from info where mw>.csv.FORCECHARWIDTH; / long values
 
	info:update t:"C "[.csv.DISCARDEMPTY],rule:30,empty:1b from info where t="?",mw=0; / empty columns
 
	info:update dchar:{asc distinct raze x}peach sdv from info where t="?";
 
	info:update mdot:{max sum each"."=x}peach sdv from info where t="?",{"."in x}each dchar;
 
	info:update t:"n",rule:40 from info where t="?",{any x in"0123456789"}each dchar; / vaguely numeric..
 
	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
 
	info:update t:"J",rule:60 from info where t="n",mdot=0,{all x in"+-0123456789"}each dchar,.csv.cancast["J"]peach sdv;
 
	info:update t:"I",rule:70 from info where t="J",mw<12,.csv.cancast["I"]peach sdv;
 
	info:update t:"H",rule:80 from info where t="I",mw<7,.csv.cancast["H"]peach sdv;
 
	info:update t:"F",rule:90 from info where t="n",mdot<2,mw>1,.csv.cancast["F"]peach sdv;
 
	info:update t:"E",rule:100,maybe:1b from info where t="F",mw<9;
 
	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; 
 
	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; 
 
	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        
 
	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
 
	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;
 
	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;
 
	info:update t:"V",rule:170,maybe:0b from info where t="T",mw in 7 8,mdot=0,.csv.cancast["V"]peach sdv;
 
	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;
 
	info:update t:"Z",rule:190,maybe:0b from info where t="n",mw within 11 24,mdot<4,.csv.cancast["Z"]peach sdv;
 
	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;
 
	info:update t:"N",rule:210,maybe:1b from info where t="n",mw within 3 28,mdot=1,.csv.cancast["N"]peach sdv;
 
	info:update t:"?",rule:220,maybe:0b from info where t="n"; / reset remaining maybe numeric
 
	info:update t:"C",rule:230,maybe:0b from info where t="?",mw=1; / char
 
	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
 
	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
 
	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
 
	info:update t:"S",rule:270,maybe:1b from info where t="?",mw<.csv.SYMMAXWIDTH,mw>1,gr<.csv.SYMMAXGR; / symbols (max width permitting)
 
	info:update t:"*",rule:280,maybe:0b from info where t="?"; / the rest as strings
 
	/ flag those S/* columns which could be encoded to integers (.Q.j10/x10/j12/x12) to avoid symbols
 
	info:update j12:1b from info where t in"S*",mw<13,{all x in .Q.nA}each dchar;
 
	info:update j10:1b from info where t in"S*",mw<11,{all x in .Q.b6}each dchar; 
 
	select c,ci,t,maybe,empty,res,j10,j12,ipa,mw,mdot,rule,gr,ndv,dchar from info}
 
    colhdrs:`$nameltrim DELIM vs cleanhdrs first head:read0(file;0;1+last where 0xa=read1(file;0;WIDTHHDR));
 
    loadfmts:(count colhdrs)#"S";if[count onlycols;loadfmts[where not colhdrs in onlycols]:"C"];
 
    breaks:where 0xa=read1(file;0;floor(10+READLINES)*WIDTHHDR%count head);
 
    nas:count as:colhdrs xcol(loadfmts;enlist DELIM)0:(file;0;1+last((1+READLINES)&count breaks)#breaks);
 
    info:([]c:key flip as;v:value flip as);as:();
 
    reserved:key`.q;reserved,:.Q.res;reserved,:`i;
 
    info:update res:c in reserved from info;
 
    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;
 
    info:update ci:`s#ci from info;
 
    if[count onlycols;info:update t:" ",rule:10 from info where not c in onlycols];
 
    info:update sdv:{string(distinct x)except`}peach v from info;
 
    info:update ndv:count each sdv from info;
 
    info:update gr:floor 0.5+100*ndv%nas,mw:{max count each x}peach sdv from info where 0<ndv;
 
    info:update t:"*",rule:20 from info where mw>.csv.FORCECHARWIDTH; / long values
 
    info:update t:"C "[.csv.DISCARDEMPTY],rule:30,empty:1b from info where t="?",mw=0; / empty columns
 
    info:update dchar:{asc distinct raze x}peach sdv from info where t="?";
 
    info:update mdot:{max sum each"."=x}peach sdv from info where t="?",{"."in x}each dchar;
 
    info:update t:"n",rule:40 from info where t="?",{any x in"0123456789"}each dchar; / vaguely numeric..
 
    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
 
    info:update t:"J",rule:60 from info where t="n",mdot=0,{all x in"+-0123456789"}each dchar,.csv.cancast["J"]peach sdv;
 
    info:update t:"I",rule:70 from info where t="J",mw<12,.csv.cancast["I"]peach sdv;
 
    info:update t:"H",rule:80 from info where t="I",mw<7,.csv.cancast["H"]peach sdv;
 
    info:update t:"F",rule:90 from info where t="n",mdot<2,mw>1,.csv.cancast["F"]peach sdv;
 
    info:update t:"E",rule:100,maybe:1b from info where t="F",mw<9;
 
    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;
 
    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;
 
    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
 
    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
 
    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;
 
    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;
 
    info:update t:"V",rule:170,maybe:0b from info where t="T",mw in 7 8,mdot=0,.csv.cancast["V"]peach sdv;
 
    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;
 
    info:update t:"Z",rule:190,maybe:0b from info where t="n",mw within 11 24,mdot<4,.csv.cancast["Z"]peach sdv;
 
    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;
 
    info:update t:"N",rule:210,maybe:1b from info where t="n",mw within 3 28,mdot=1,.csv.cancast["N"]peach sdv;
 
    info:update t:"?",rule:220,maybe:0b from info where t="n"; / reset remaining maybe numeric
 
    info:update t:"C",rule:230,maybe:0b from info where t="?",mw=1; / char
 
    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
 
    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
 
    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
 
    info:update t:"S",rule:270,maybe:1b from info where t="?",mw<.csv.SYMMAXWIDTH,mw>1,gr<.csv.SYMMAXGR; / symbols (max width permitting)
 
    info:update t:"*",rule:280,maybe:0b from info where t="?"; / the rest as strings
 
    / flag those S/* columns which could be encoded to integers (.Q.j10/x10/j12/x12) to avoid symbols
 
    info:update j12:1b from info where t in"S*",mw<13,{all x in .Q.nA}each dchar;
 
    info:update j10:1b from info where t in"S*",mw<11,{all x in .Q.b6}each dchar;
 
    select c,ci,t,maybe,empty,res,j10,j12,ipa,mw,mdot,rule,gr,ndv,dchar from info}
 
info:info0[;()] / by default don't restrict columns
 
infolike:{[file;pattern] info0[file;{x where x like y}[lower colhdrs[file];pattern]]} / .csv.infolike[file;"*time"]
 

	
 
\d .
 
/ DATA:()
 
bulkload:{[file;info]
 
	if[not`DATA in system"v";'`DATA.not.defined];
 
	if[count DATA;'`DATA.not.empty];
 
	loadhdrs:exec c from info where not t=" ";loadfmts:exec t from info;
 
	.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]];
 
	count DATA}
 
@[.:;"\\l csvutil.custom.q";::]; / save your custom settings in csvutil.custom.q to override those set at the beginning of the file 
 
    if[not`DATA in system"v";'`DATA.not.defined];
 
    if[count DATA;'`DATA.not.empty];
 
    loadhdrs:exec c from info where not t=" ";loadfmts:exec t from info;
 
    .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]];
 
    count DATA}
 
@[.:;"\\l csvutil.custom.q";::]; / save your custom settings in csvutil.custom.q to override those set at the beginning of the file
 
</textarea></div>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        lineNumbers: true,
 
        matchBrackets: true
 
      });
 
    </script>
 

	
 
    <p><strong>MIME type defined:</strong> <code>text/x-q</code>.</p>
 
  </body>
 
</html>
rhodecode/public/js/mode/rpm/changes/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: RPM changes mode</title>
 
    <link rel="stylesheet" href="../../../lib/codemirror.css">
 
    <script src="../../../lib/codemirror.js"></script>
 
    <script src="changes.js"></script>
 
    <link rel="stylesheet" href="../../../doc/docs.css">
 
    <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
 
  </head>
 
  <body>
 
    <h1>CodeMirror: RPM changes mode</h1>
 
    
 

	
 
    <div><textarea id="code" name="code">
 
-------------------------------------------------------------------
 
Tue Oct 18 13:58:40 UTC 2011 - misterx@example.com
 

	
 
- Update to r60.3
 
- Fixes bug in the reflect package
 
  * disallow Interface method on Value obtained via unexported name
 

	
 
-------------------------------------------------------------------
 
Thu Oct  6 08:14:24 UTC 2011 - misterx@example.com
 

	
 
- Update to r60.2
 
- Fixes memory leak in certain map types
 

	
 
-------------------------------------------------------------------
 
Wed Oct  5 14:34:10 UTC 2011 - misterx@example.com
 

	
 
- Tweaks for gdb debugging
 
- go.spec changes:
 
  - move %go_arch definition to %prep section
 
  - pass correct location of go specific gdb pretty printer and
 
    functions to cpp as HOST_EXTRA_CFLAGS macro
 
  - install go gdb functions & printer
 
- gdb-printer.patch
 
  - patch linker (src/cmd/ld/dwarf.c) to emit correct location of go
 
    gdb functions and pretty printer
 
</textarea></div>
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        mode: {name: "changes"},
 
        lineNumbers: true,
 
        indentUnit: 4,
 
        tabMode: "shift"
 
      });
 
    </script>
 

	
 
    <p><strong>MIME types defined:</strong> <code>text/x-rpm-changes</code>.</p>
 
  </body>
 
</html>
rhodecode/public/js/mode/rpm/spec/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: RPM spec mode</title>
 
    <link rel="stylesheet" href="../../../lib/codemirror.css">
 
    <script src="../../../lib/codemirror.js"></script>
 
    <script src="spec.js"></script>
 
    <link rel="stylesheet" href="spec.css">
 
    <link rel="stylesheet" href="../../../doc/docs.css">
 
    <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
 
  </head>
 
  <body>
 
    <h1>CodeMirror: RPM spec mode</h1>
 
    
 

	
 
    <div><textarea id="code" name="code">
 
#
 
# spec file for package minidlna
 
#
 
# Copyright (c) 2011, Sascha Peilicke <saschpe@gmx.de>
 
#
 
# All modifications and additions to the file contributed by third parties
 
# remain the property of their copyright owners, unless otherwise agreed
 
# upon. The license for this file, and modifications and additions to the
 
# file, is the same license as for the pristine package itself (unless the
 
# license for the pristine package is not an Open Source License, in which
 
# case the license is the MIT License). An "Open Source License" is a
 
# license that conforms to the Open Source Definition (Version 1.9)
 
# published by the Open Source Initiative.
 

	
 

	
 
Name:           libupnp6
 
Version:        1.6.13
 
Release:        0
 
Summary:        Portable Universal Plug and Play (UPnP) SDK
 
Group:          System/Libraries
 
License:        BSD-3-Clause
 
Url:            http://sourceforge.net/projects/pupnp/
 
Source0:        http://downloads.sourceforge.net/pupnp/libupnp-%{version}.tar.bz2
 
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 

	
 
%description
 
The portable Universal Plug and Play (UPnP) SDK provides support for building
 
UPnP-compliant control points, devices, and bridges on several operating
 
systems.
 

	
 
%package -n libupnp-devel
 
Summary:        Portable Universal Plug and Play (UPnP) SDK
 
Group:          Development/Libraries/C and C++
 
Provides:       pkgconfig(libupnp)
 
Requires:       %{name} = %{version}
 

	
 
%description -n libupnp-devel
 
The portable Universal Plug and Play (UPnP) SDK provides support for building
 
UPnP-compliant control points, devices, and bridges on several operating
 
systems.
 

	
 
%prep
 
%setup -n libupnp-%{version}
 

	
 
%build
 
%configure --disable-static
 
make %{?_smp_mflags}
rhodecode/public/js/mode/rst/LICENSE.txt
Show inline comments
 
The MIT License
 

	
 
Copyright (c) 2013 Hasan Karahan
 

	
 
Permission is hereby granted, free of charge, to any person obtaining a copy
 
of this software and associated documentation files (the "Software"), to deal
 
in the Software without restriction, including without limitation the rights
 
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
copies of the Software, and to permit persons to whom the Software is
 
furnished to do so, subject to the following conditions:
 

	
 
The above copyright notice and this permission notice shall be included in
 
all copies or substantial portions of the Software.
 

	
 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 
THE SOFTWARE.
 
\ No newline at end of file
 
THE SOFTWARE.
rhodecode/public/js/mode/rst/index.html
Show inline comments
 
@@ -476,49 +476,48 @@ You can indent text after a comment star
 
Source encoding
 
---------------
 

	
 
Since the easiest way to include special characters like em dashes or copyright
 
signs in reST is to directly write them as Unicode characters, one has to
 
specify an encoding.  Sphinx assumes source files to be encoded in UTF-8 by
 
default; you can change this with the :confval:`source_encoding` config value.
 

	
 

	
 
Gotchas
 
-------
 

	
 
There are some problems one commonly runs into while authoring reST documents:
 

	
 
* **Separation of inline markup:** As said above, inline markup spans must be
 
  separated from the surrounding text by non-word characters, you have to use a
 
  backslash-escaped space to get around that.  See `the reference
 
  &lt;http://docutils.sf.net/docs/ref/rst/restructuredtext.html#inline-markup&gt;`_
 
  for the details.
 

	
 
* **No nested inline markup:** Something like ``*see :func:`foo`*`` is not
 
  possible.
 

	
 

	
 
.. rubric:: Footnotes
 

	
 
.. [1] When the default domain contains a :rst:dir:`class` directive, this directive
 
       will be shadowed.  Therefore, Sphinx re-exports it as :rst:dir:`rst-class`.
 
</textarea></form>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        lineNumbers: true,
 
      });
 
    </script>
 
    <p>
 
        The <code>python</code> mode will be used for highlighting blocks
 
        containing Python/IPython terminal sessions: blocks starting with
 
        <code>&gt;&gt;&gt;</code> (for Python) or <code>In [num]:</code> (for
 
        IPython).
 

	
 
        Further, the <code>stex</code> mode will be used for highlighting
 
        blocks containing LaTex code.
 
    </p>
 

	
 
    <p><strong>MIME types defined:</strong> <code>text/x-rst</code>.</p>
 
  </body>
 
</html>
 

	
rhodecode/public/js/mode/ruby/index.html
Show inline comments
 
@@ -5,155 +5,155 @@
 
    <title>CodeMirror: Ruby mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="../../addon/edit/matchbrackets.js"></script>
 
    <script src="ruby.js"></script>
 
    <style>
 
      .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
 
      .cm-s-default span.cm-arrow { color: red; }
 
    </style>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
  </head>
 
  <body>
 
    <h1>CodeMirror: Ruby mode</h1>
 
    <form><textarea id="code" name="code">
 
# Code from http://sandbox.mc.edu/~bennet/ruby/code/poly_rb.html
 
#
 
# This program evaluates polynomials.  It first asks for the coefficients
 
# of a polynomial, which must be entered on one line, highest-order first.
 
# It then requests values of x and will compute the value of the poly for
 
# each x.  It will repeatly ask for x values, unless you the user enters
 
# a blank line.  It that case, it will ask for another polynomial.  If the
 
# user types quit for either input, the program immediately exits.
 
#
 

	
 
#
 
# Function to evaluate a polynomial at x.  The polynomial is given
 
# as a list of coefficients, from the greatest to the least.
 
def polyval(x, coef)
 
    sum = 0
 
    coef = coef.clone           # Don't want to destroy the original
 
    while true
 
        sum += coef.shift       # Add and remove the next coef
 
        break if coef.empty?    # If no more, done entirely.
 
        sum *= x                # This happens the right number of times.
 
    end
 
    return sum
 
end
 

	
 
#
 
# Function to read a line containing a list of integers and return
 
# them as an array of integers.  If the string conversion fails, it
 
# throws TypeError.  If the input line is the word 'quit', then it
 
# converts it to an end-of-file exception
 
def readints(prompt)
 
    # Read a line
 
    print prompt
 
    line = readline.chomp
 
    raise EOFError.new if line == 'quit' # You can also use a real EOF.
 
            
 

	
 
    # Go through each item on the line, converting each one and adding it
 
    # to retval.
 
    retval = [ ]
 
    for str in line.split(/\s+/)
 
        if str =~ /^\-?\d+$/
 
            retval.push(str.to_i)
 
        else
 
            raise TypeError.new
 
        end
 
    end
 

	
 
    return retval
 
end
 

	
 
#
 
# Take a coeff and an exponent and return the string representation, ignoring
 
# the sign of the coefficient.
 
def term_to_str(coef, exp)
 
    ret = ""
 

	
 
    # Show coeff, unless it's 1 or at the right
 
    coef = coef.abs
 
    ret = coef.to_s     unless coef == 1 && exp > 0
 
    ret += "x" if exp > 0                               # x if exponent not 0
 
    ret += "^" + exp.to_s if exp > 1                    # ^exponent, if > 1.
 

	
 
    return ret
 
end
 

	
 
#
 
# Create a string of the polynomial in sort-of-readable form.
 
def polystr(p)
 
    # Get the exponent of first coefficient, plus 1.
 
    exp = p.length
 

	
 
    # Assign exponents to each term, making pairs of coeff and exponent,
 
    # Then get rid of the zero terms.
 
    p = (p.map { |c| exp -= 1; [ c, exp ] }).select { |p| p[0] != 0 }
 

	
 
    # If there's nothing left, it's a zero
 
    return "0" if p.empty?
 

	
 
    # *** Now p is a non-empty list of [ coef, exponent ] pairs. ***
 

	
 
    # Convert the first term, preceded by a "-" if it's negative.
 
    result = (if p[0][0] < 0 then "-" else "" end) + term_to_str(*p[0])
 

	
 
    # Convert the rest of the terms, in each case adding the appropriate
 
    # + or - separating them.  
 
    # + or - separating them.
 
    for term in p[1...p.length]
 
        # Add the separator then the rep. of the term.
 
        result += (if term[0] < 0 then " - " else " + " end) + 
 
        result += (if term[0] < 0 then " - " else " + " end) +
 
                term_to_str(*term)
 
    end
 

	
 
    return result
 
end
 
        
 

	
 
#
 
# Run until some kind of endfile.
 
begin
 
    # Repeat until an exception or quit gets us out.
 
    while true
 
        # Read a poly until it works.  An EOF will except out of the
 
        # program.
 
        print "\n"
 
        begin
 
            poly = readints("Enter a polynomial coefficients: ")
 
        rescue TypeError
 
            print "Try again.\n"
 
            retry
 
        end
 
        break if poly.empty?
 

	
 
        # Read and evaluate x values until the user types a blank line.
 
        # Again, an EOF will except out of the pgm.
 
        while true
 
            # Request an integer.
 
            print "Enter x value or blank line: "
 
            x = readline.chomp
 
            break if x == ''
 
            raise EOFError.new if x == 'quit'
 

	
 
            # If it looks bad, let's try again.
 
            if x !~ /^\-?\d+$/
 
                print "That doesn't look like an integer.  Please try again.\n"
 
                next
 
            end
 

	
 
            # Convert to an integer and print the result.
 
            x = x.to_i
 
            print "p(x) = ", polystr(poly), "\n"
 
            print "p(", x, ") = ", polyval(x, poly), "\n"
 
        end
 
    end
 
rescue EOFError
 
    print "\n=== EOF ===\n"
 
rescue Interrupt, SignalException
 
    print "\n=== Interrupted ===\n"
 
else
 
    print "--- Bye ---\n"
 
end
 
</textarea></form>
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        mode: "text/x-ruby",
rhodecode/public/js/mode/scheme/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: Scheme mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="scheme.js"></script>
 
    <style>.CodeMirror {background: #f8f8f8;}</style>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
  </head>
 
  <body>
 
    <h1>CodeMirror: Scheme mode</h1>
 
    <form><textarea id="code" name="code">
 
; See if the input starts with a given symbol.
 
(define (match-symbol input pattern)
 
  (cond ((null? (remain input)) #f)
 
	((eqv? (car (remain input)) pattern) (r-cdr input))
 
	(else #f)))
 
    ((eqv? (car (remain input)) pattern) (r-cdr input))
 
    (else #f)))
 

	
 
; Allow the input to start with one of a list of patterns.
 
(define (match-or input pattern)
 
  (cond ((null? pattern) #f)
 
	((match-pattern input (car pattern)))
 
	(else (match-or input (cdr pattern)))))
 
    ((match-pattern input (car pattern)))
 
    (else (match-or input (cdr pattern)))))
 

	
 
; Allow a sequence of patterns.
 
(define (match-seq input pattern)
 
  (if (null? pattern)
 
      input
 
      (let ((match (match-pattern input (car pattern))))
 
	(if match (match-seq match (cdr pattern)) #f))))
 
    (if match (match-seq match (cdr pattern)) #f))))
 

	
 
; Match with the pattern but no problem if it does not match.
 
(define (match-opt input pattern)
 
  (let ((match (match-pattern input (car pattern))))
 
    (if match match input)))
 

	
 
; Match anything (other than '()), until pattern is found. The rather
 
; clumsy form of requiring an ending pattern is needed to decide where
 
; the end of the match is. If none is given, this will match the rest
 
; of the sentence.
 
(define (match-any input pattern)
 
  (cond ((null? (remain input)) #f)
 
	((null? pattern) (f-cons (remain input) (clear-remain input)))
 
	(else
 
	 (let ((accum-any (collector)))
 
	   (define (match-pattern-any input pattern)
 
	     (cond ((null? (remain input)) #f)
 
		   (else (accum-any (car (remain input)))
 
			 (cond ((match-pattern (r-cdr input) pattern))
 
			       (else (match-pattern-any (r-cdr input) pattern))))))
 
	   (let ((retval (match-pattern-any input (car pattern))))
 
	     (if retval
 
		 (f-cons (accum-any) retval)
 
		 #f))))))
 
    ((null? pattern) (f-cons (remain input) (clear-remain input)))
 
    (else
 
     (let ((accum-any (collector)))
 
       (define (match-pattern-any input pattern)
 
         (cond ((null? (remain input)) #f)
 
           (else (accum-any (car (remain input)))
 
             (cond ((match-pattern (r-cdr input) pattern))
 
                   (else (match-pattern-any (r-cdr input) pattern))))))
 
       (let ((retval (match-pattern-any input (car pattern))))
 
         (if retval
 
         (f-cons (accum-any) retval)
 
         #f))))))
 
</textarea></form>
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
 
    </script>
 

	
 
    <p><strong>MIME types defined:</strong> <code>text/x-scheme</code>.</p>
 

	
 
  </body>
 
</html>
rhodecode/public/js/mode/smalltalk/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: Smalltalk mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="../../addon/edit/matchbrackets.js"></script>
 
    <script src="smalltalk.js"></script>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
    <style>
 
      .CodeMirror {border: 2px solid #dee; border-right-width: 10px;}
 
      .CodeMirror-gutter {border: none; background: #dee;}
 
      .CodeMirror-gutter pre {color: white; font-weight: bold;}
 
    </style>
 
  </head>
 
  <body>
 
    <h1>CodeMirror: Smalltalk mode</h1>
 

	
 
<form><textarea id="code" name="code">
 
" 
 
"
 
    This is a test of the Smalltalk code
 
"
 
Seaside.WAComponent subclass: #MyCounter [
 
    | count |
 
    MyCounter class &gt;&gt; canBeRoot [ ^true ]
 

	
 
    initialize [
 
        super initialize.
 
        count := 0.
 
    ]
 
    states [ ^{ self } ]
 
    renderContentOn: html [
 
        html heading: count.
 
        html anchor callback: [ count := count + 1 ]; with: '++'.
 
        html space.
 
        html anchor callback: [ count := count - 1 ]; with: '--'.
 
    ]
 
]
 

	
 
MyCounter registerAsApplication: 'mycounter'
 
</textarea></form>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        lineNumbers: true,
 
        matchBrackets: true,
 
        mode: "text/x-stsrc",
 
        indentUnit: 4
 
      });
 
    </script>
 

	
 
    <p>Simple Smalltalk mode.</p>
 

	
 
    <p><strong>MIME types defined:</strong> <code>text/x-stsrc</code>.</p>
 
  </body>
 
</html>
rhodecode/public/js/mode/smarty/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: Smarty mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="smarty.js"></script>
 
    <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
  </head>
 
  <body>
 
    <h1>CodeMirror: Smarty mode</h1>
 

	
 
	<h3>Default settings (Smarty 2, <b>{</b> and <b>}</b> delimiters)</h3>
 
    <h3>Default settings (Smarty 2, <b>{</b> and <b>}</b> delimiters)</h3>
 
    <form><textarea id="code" name="code">
 
{extends file="parent.tpl"}
 
{include file="template.tpl"}
 

	
 
{* some example Smarty content *}
 
{if isset($name) && $name == 'Blog'}
 
  This is a {$var}.
 
  {$integer = 451}, {$array[] = "a"}, {$stringvar = "string"}
 
  {assign var='bob' value=$var.prop}
 
{elseif $name == $foo}
 
  {function name=menu level=0}
 
    {foreach $data as $entry}
 
      {if is_array($entry)}
 
        - {$entry@key}
 
        {menu data=$entry level=$level+1}
 
      {else}
 
        {$entry}
 
      {/if}
 
    {/foreach}
 
  {/function}
 
{/if}</textarea></form>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        lineNumbers: true,
 
        mode: "smarty"
 
      });
 
    </script>
 

	
 
    <br />
 

	
 
	<h3>Smarty 2, custom delimiters</h3>
 
    <h3>Smarty 2, custom delimiters</h3>
 
    <form><textarea id="code2" name="code2">
 
{--extends file="parent.tpl"--}
 
{--include file="template.tpl"--}
 

	
 
{--* some example Smarty content *--}
 
{--if isset($name) && $name == 'Blog'--}
 
  This is a {--$var--}.
 
  {--$integer = 451--}, {--$array[] = "a"--}, {--$stringvar = "string"--}
 
  {--assign var='bob' value=$var.prop--}
 
{--elseif $name == $foo--}
 
  {--function name=menu level=0--}
 
    {--foreach $data as $entry--}
 
      {--if is_array($entry)--}
 
        - {--$entry@key--}
 
        {--menu data=$entry level=$level+1--}
 
      {--else--}
 
        {--$entry--}
 
      {--/if--}
 
    {--/foreach--}
 
  {--/function--}
 
{--/if--}</textarea></form>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code2"), {
 
        lineNumbers: true,
 
        mode: {
 
          name: "smarty",
 
          leftDelimiter: "{--",
 
          rightDelimiter: "--}"
 
        }
 
      });
 
    </script>
 

	
 
	<br />
 
    <br />
 

	
 
	<h3>Smarty 3</h3>
 
    <h3>Smarty 3</h3>
 

	
 
	<textarea id="code3" name="code3">
 
    <textarea id="code3" name="code3">
 
Nested tags {$foo={counter one=1 two={inception}}+3} are now valid in Smarty 3.
 

	
 
<script>
 
function test() {
 
	console.log("Smarty 3 permits single curly braces followed by whitespace to NOT slip into Smarty mode.");
 
    console.log("Smarty 3 permits single curly braces followed by whitespace to NOT slip into Smarty mode.");
 
}
 
</script>
 

	
 
{assign var=foo value=[1,2,3]}
 
{assign var=foo value=['y'=>'yellow','b'=>'blue']}
 
{assign var=foo value=[1,[9,8],3]}
 

	
 
{$foo=$bar+2} {* a comment *}
 
{$foo.bar=1}  {* another comment *}
 
{$foo = myfunct(($x+$y)*3)}
 
{$foo = strlen($bar)}
 
{$foo.bar.baz=1}, {$foo[]=1}
 

	
 
Smarty "dot" syntax (note: embedded {} are used to address ambiguities):
 

	
 
{$foo.a.b.c}      => $foo['a']['b']['c']
 
{$foo.a.$b.c}     => $foo['a'][$b]['c']
 
{$foo.a.{$b+4}.c} => $foo['a'][$b+4]['c']
 
{$foo.a.{$b.c}}   => $foo['a'][$b['c']]
 

	
 
{$object->method1($x)->method2($y)}</textarea>
 

	
 
	<script>
 
		var editor = CodeMirror.fromTextArea(document.getElementById("code3"), {
 
			lineNumbers: true,
 
			mode: "smarty",
 
			smartyVersion: 3
 
		});
 
	</script>
 
    <script>
 
        var editor = CodeMirror.fromTextArea(document.getElementById("code3"), {
 
            lineNumbers: true,
 
            mode: "smarty",
 
            smartyVersion: 3
 
        });
 
    </script>
 

	
 

	
 
    <p>A plain text/Smarty version 2 or 3 mode, which allows for custom delimiter tags.</p>
 

	
 
    <p><strong>MIME types defined:</strong> <code>text/x-smarty</code></p>
 
  </body>
 
</html>
rhodecode/public/js/mode/sql/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
    <head>
 
        <meta charset="utf-8">
 
        <title>SQL Mode for CodeMirror</title>
 
        <link rel="stylesheet" href="../../lib/codemirror.css" />
 
        <script src="../../lib/codemirror.js"></script>
 
        <script src="sql.js"></script>
 
        <style>
 
.CodeMirror {
 
    border-top: 1px solid black;
 
    border-bottom: 1px solid black;
 
}
 
        </style>
 
        <link rel="stylesheet" href="../../doc/docs.css">
 
        <script>
 
var init = function() {
 
    var mime = 'text/x-mariadb';
 

	
 
    // get mime type
 
    if (window.location.href.indexOf('mime=') > -1) {
 
        mime = window.location.href.substr(window.location.href.indexOf('mime=') + 5);
 
    }
 

	
 
    window.editor = CodeMirror.fromTextArea(document.getElementById('code'), {
 
        mode: mime,
 
        indentWithTabs: true,
 
        smartIndent: true,
 
        lineNumbers: true,
 
        matchBrackets : true,
 
        autofocus: true
 
    });
 
};
 
        </script>
 
    </head>
 
    <body onload="init();">
 
        <h1>SQL Mode for CodeMirror</h1>
 
        <form>
 
            <textarea id="code" name="code">-- SQL Mode for CodeMirror
 
SELECT SQL_NO_CACHE DISTINCT
 
		@var1 AS `val1`, @'val2', @global.'sql_mode',
 
		1.1 AS `float_val`, .14 AS `another_float`, 0.09e3 AS `int_with_esp`,
 
		0xFA5 AS `hex`, x'fa5' AS `hex2`, 0b101 AS `bin`, b'101' AS `bin2`,
 
		DATE '1994-01-01' AS `sql_date`, { T "1994-01-01" } AS `odbc_date`,
 
		'my string', _utf8'your string', N'her string',
 
        @var1 AS `val1`, @'val2', @global.'sql_mode',
 
        1.1 AS `float_val`, .14 AS `another_float`, 0.09e3 AS `int_with_esp`,
 
        0xFA5 AS `hex`, x'fa5' AS `hex2`, 0b101 AS `bin`, b'101' AS `bin2`,
 
        DATE '1994-01-01' AS `sql_date`, { T "1994-01-01" } AS `odbc_date`,
 
        'my string', _utf8'your string', N'her string',
 
        TRUE, FALSE, UNKNOWN
 
	FROM DUAL
 
	-- space needed after '--'
 
	# 1 line comment
 
	/* multiline
 
	comment! */
 
	LIMIT 1 OFFSET 0;
 
    FROM DUAL
 
    -- space needed after '--'
 
    # 1 line comment
 
    /* multiline
 
    comment! */
 
    LIMIT 1 OFFSET 0;
 
</textarea>
 
            </form>
 
            <p><strong>MIME types defined:</strong> 
 
            <p><strong>MIME types defined:</strong>
 
            <code><a href="?mime=text/x-sql">text/x-sql</a></code>,
 
            <code><a href="?mime=text/x-mysql">text/x-mysql</a></code>,
 
            <code><a href="?mime=text/x-mariadb">text/x-mariadb</a></code>,
 
            <code><a href="?mime=text/x-cassandra">text/x-cassandra</a></code>,
 
            <code><a href="?mime=text/x-plsql">text/x-plsql</a></code>.
 
        </p>
 
        <p>
 
            <strong>Tests:</strong>
 
            <a href="../../test/index.html#sql_*">normal</a>,
 
            <a href="../../test/index.html#verbose,sql_*">verbose</a>.
 
        </p>
 
    </body>
 
</html>
rhodecode/public/js/mode/stex/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: sTeX mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="stex.js"></script>
 
    <style>.CodeMirror {background: #f8f8f8;}</style>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
  </head>
 
  <body>
 
    <h1>CodeMirror: sTeX mode</h1>
 
     <form><textarea id="code" name="code">
 
\begin{module}[id=bbt-size]
 
\importmodule[balanced-binary-trees]{balanced-binary-trees}
 
\importmodule[\KWARCslides{dmath/en/cardinality}]{cardinality}
 

	
 
\begin{frame}
 
  \frametitle{Size Lemma for Balanced Trees}
 
  \begin{itemize}
 
  \item
 
    \begin{assertion}[id=size-lemma,type=lemma] 
 
    Let $G=\tup{V,E}$ be a \termref[cd=binary-trees]{balanced binary tree} 
 
    \begin{assertion}[id=size-lemma,type=lemma]
 
    Let $G=\tup{V,E}$ be a \termref[cd=binary-trees]{balanced binary tree}
 
    of \termref[cd=graph-depth,name=vertex-depth]{depth}$n>i$, then the set
 
     $\defeq{\livar{V}i}{\setst{\inset{v}{V}}{\gdepth{v} = i}}$ of
 
    \termref[cd=graphs-intro,name=node]{nodes} at 
 
    \termref[cd=graphs-intro,name=node]{nodes} at
 
    \termref[cd=graph-depth,name=vertex-depth]{depth} $i$ has
 
    \termref[cd=cardinality,name=cardinality]{cardinality} $\power2i$.
 
   \end{assertion}
 
  \item
 
    \begin{sproof}[id=size-lemma-pf,proofend=,for=size-lemma]{via induction over the depth $i$.}
 
      \begin{spfcases}{We have to consider two cases}
 
        \begin{spfcase}{$i=0$}
 
          \begin{spfstep}[display=flow]
 
            then $\livar{V}i=\set{\livar{v}r}$, where $\livar{v}r$ is the root, so
 
            $\eq{\card{\livar{V}0},\card{\set{\livar{v}r}},1,\power20}$.
 
          \end{spfstep}
 
        \end{spfcase}
 
        \begin{spfcase}{$i>0$}
 
          \begin{spfstep}[display=flow]
 
           then $\livar{V}{i-1}$ contains $\power2{i-1}$ vertexes 
 
           then $\livar{V}{i-1}$ contains $\power2{i-1}$ vertexes
 
           \begin{justification}[method=byIH](IH)\end{justification}
 
          \end{spfstep}
 
          \begin{spfstep}
 
           By the \begin{justification}[method=byDef]definition of a binary
 
              tree\end{justification}, each $\inset{v}{\livar{V}{i-1}}$ is a leaf or has
 
            two children that are at depth $i$.
 
          \end{spfstep}
 
          \begin{spfstep}
 
           As $G$ is \termref[cd=balanced-binary-trees,name=balanced-binary-tree]{balanced} and $\gdepth{G}=n>i$, $\livar{V}{i-1}$ cannot contain
 
            leaves.
 
          \end{spfstep}
 
          \begin{spfstep}[type=conclusion]
 
           Thus $\eq{\card{\livar{V}i},{\atimes[cdot]{2,\card{\livar{V}{i-1}}}},{\atimes[cdot]{2,\power2{i-1}}},\power2i}$.
 
          \end{spfstep}
 
        \end{spfcase}
 
      \end{spfcases}
 
    \end{sproof}
 
  \item 
 
    \begin{assertion}[id=fbbt,type=corollary]	
 
  \item
 
    \begin{assertion}[id=fbbt,type=corollary]
 
      A fully balanced tree of depth $d$ has $\power2{d+1}-1$ nodes.
 
    \end{assertion}
 
  \item
 
      \begin{sproof}[for=fbbt,id=fbbt-pf]{}
 
        \begin{spfstep}
 
          Let $\defeq{G}{\tup{V,E}}$ be a fully balanced tree
 
        \end{spfstep}
 
        \begin{spfstep}
 
          Then $\card{V}=\Sumfromto{i}1d{\power2i}= \power2{d+1}-1$.
 
        \end{spfstep}
 
      \end{sproof}
 
    \end{itemize}
 
  \end{frame}
 
\begin{note}
 
  \begin{omtext}[type=conclusion,for=binary-tree]
 
    This shows that balanced binary trees grow in breadth very quickly, a consequence of
 
    this is that they are very shallow (and this compute very fast), which is the essence of
 
    the next result.
 
  \end{omtext}
 
\end{note}
 
\end{module}
 

	
 
%%% Local Variables: 
 
%%% Local Variables:
 
%%% mode: LaTeX
 
%%% TeX-master: "all"
 
%%% End: \end{document}
 
</textarea></form>
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
 
    </script>
 

	
 
    <p><strong>MIME types defined:</strong> <code>text/x-stex</code>.</p>
 

	
 
    <p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#stex_*">normal</a>,  <a href="../../test/index.html#verbose,stex_*">verbose</a>.</p>
 

	
 
  </body>
 
</html>
rhodecode/public/js/mode/tcl/index.html
Show inline comments
 
@@ -18,112 +18,112 @@
 
## To use this script you must set channel flag +whois (ie .chanset #chan +whois)           ##
 
##############################################################################################
 
##      ____                __                 ###########################################  ##
 
##     / __/___ _ ___ _ ___/ /____ ___   ___   ###########################################  ##
 
##    / _/ / _ `// _ `// _  // __// _ \ / _ \  ###########################################  ##
 
##   /___/ \_, / \_, / \_,_//_/   \___// .__/  ###########################################  ##
 
##        /___/ /___/                 /_/      ###########################################  ##
 
##                                             ###########################################  ##
 
##############################################################################################
 
##  ##                             Start Setup.                                         ##  ##
 
##############################################################################################
 
namespace eval whois {
 
## change cmdchar to the trigger you want to use                                        ##  ##
 
  variable cmdchar "!"
 
## change command to the word trigger you would like to use.                            ##  ##
 
## Keep in mind, This will also change the .chanset +/-command                          ##  ##
 
  variable command "whois"
 
## change textf to the colors you want for the text.                                    ##  ##
 
  variable textf "\017\00304"
 
## change tagf to the colors you want for tags:                                         ##  ##
 
  variable tagf "\017\002"
 
## Change logo to the logo you want at the start of the line.                           ##  ##
 
  variable logo "\017\00304\002\[\00306W\003hois\00304\]\017"
 
## Change lineout to the results you want. Valid results are channel users modes topic  ##  ##
 
  variable lineout "channel users modes topic"
 
##############################################################################################
 
##  ##                           End Setup.                                              ## ##
 
##############################################################################################
 
  variable channel ""
 
  setudef flag $whois::command
 
  bind pub -|- [string trimleft $whois::cmdchar]${whois::command} whois::list
 
  bind raw -|- "311" whois::311
 
  bind raw -|- "312" whois::312
 
  bind raw -|- "319" whois::319
 
  bind raw -|- "317" whois::317
 
  bind raw -|- "313" whois::multi
 
  bind raw -|- "310" whois::multi
 
  bind raw -|- "335" whois::multi
 
  bind raw -|- "301" whois::301
 
  bind raw -|- "671" whois::multi
 
  bind raw -|- "320" whois::multi
 
  bind raw -|- "401" whois::multi
 
  bind raw -|- "318" whois::318
 
  bind raw -|- "307" whois::307
 
}
 
proc whois::311 {from key text} {
 
  if {[regexp -- {^[^\s]+\s(.+?)\s(.+?)\s(.+?)\s\*\s\:(.+)$} $text wholematch nick ident host realname]} {
 
    putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Host:${whois::textf} \
 
	$nick \(${ident}@${host}\) ${whois::tagf}Realname:${whois::textf} $realname"
 
    $nick \(${ident}@${host}\) ${whois::tagf}Realname:${whois::textf} $realname"
 
  }
 
}
 
proc whois::multi {from key text} {
 
  if {[regexp {\:(.*)$} $text match $key]} {
 
    putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Note:${whois::textf} [subst $$key]"
 
	return 1
 
    return 1
 
  }
 
}
 
proc whois::312 {from key text} {
 
  regexp {([^\s]+)\s\:} $text match server
 
  putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Server:${whois::textf} $server"
 
}
 
proc whois::319 {from key text} {
 
  if {[regexp {.+\:(.+)$} $text match channels]} {
 
    putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Channels:${whois::textf} $channels"
 
  }
 
}
 
proc whois::317 {from key text} {
 
  if {[regexp -- {.*\s(\d+)\s(\d+)\s\:} $text wholematch idle signon]} {
 
    putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Connected:${whois::textf} \
 
	[ctime $signon] ${whois::tagf}Idle:${whois::textf} [duration $idle]"
 
    [ctime $signon] ${whois::tagf}Idle:${whois::textf} [duration $idle]"
 
  }
 
}
 
proc whois::301 {from key text} {
 
  if {[regexp {^.+\s[^\s]+\s\:(.*)$} $text match awaymsg]} {
 
    putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Away:${whois::textf} $awaymsg"
 
  }
 
}
 
proc whois::318 {from key text} {
 
  namespace eval whois {
 
	variable channel ""
 
    variable channel ""
 
  }
 
  variable whois::channel ""
 
}
 
proc whois::307 {from key text} {
 
  putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Services:${whois::textf} Registered Nick"
 
}
 
proc whois::list {nick host hand chan text} {
 
  if {[lsearch -exact [channel info $chan] "+${whois::command}"] != -1} {
 
    namespace eval whois {
 
	  variable channel ""
 
	}
 
      variable channel ""
 
    }
 
    variable whois::channel $chan
 
    putserv "WHOIS $text"
 
  }
 
}
 
putlog "\002*Loaded* \017\00304\002\[\00306W\003hois\00304\]\017 \002by \
 
Ford_Lawnmower irc.GeekShed.net #Script-Help"
 
</textarea></form>
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        tabMode: "indent",
 
		theme: "night",
 
        theme: "night",
 
        lineNumbers: true,
 
        indentUnit: 2,
 
        mode: "text/x-tcl"
 
      });
 
    </script>
 

	
 
    <p><strong>MIME types defined:</strong> <code>text/x-tcl</code>.</p>
 

	
 
  </body>
 
</html>
rhodecode/public/js/mode/tiddlywiki/index.html
Show inline comments
 
@@ -83,60 +83,60 @@ JS styled code. TiddlyWiki mixed mode sh
 

	
 
<!--{{{-->
 
XML styled code. TiddlyWiki mixed mode should support highlighter switching in the future.
 
<!--}}}-->
 
<<<
 

	
 
!!Tables
 
<<<
 
|CssClass|k
 
|!heading column 1|!heading column 2|
 
|row 1, column 1|row 1, column 2|
 
|row 2, column 1|row 2, column 2|
 
|>|COLSPAN|
 
|ROWSPAN| ... |
 
|~| ... |
 
|CssProperty:value;...| ... |
 
|caption|c
 

	
 
''Annotation:''
 
* The {{{>}}} marker creates a "colspan", causing the current cell to merge with the one to the right.
 
* The {{{~}}} marker creates a "rowspan", causing the current cell to merge with the one above.
 
<<<
 
!!Images /% TODO %/
 
cf. [[TiddlyWiki.com|http://www.tiddlywiki.com/#EmbeddedImages]]
 

	
 
!Hyperlinks
 
* [[WikiWords|WikiWord]] are automatically transformed to hyperlinks to the respective tiddler
 
** the automatic transformation can be suppressed by preceding the respective WikiWord with a tilde ({{{~}}}): {{{~WikiWord}}}
 
* [[PrettyLinks]] are enclosed in square brackets and contain the desired tiddler name: {{{[[tiddler name]]}}}
 
** optionally, a custom title or description can be added, separated by a pipe character ({{{|}}}): {{{[[title|target]]}}}<br>'''N.B.:''' In this case, the target can also be any website (i.e. URL).
 

	
 
!Custom Styling
 
* {{{@@CssProperty:value;CssProperty:value;...@@}}}<br>''N.B.:'' CSS color definitions should use lowercase letters to prevent the inadvertent creation of WikiWords.
 
* <html><code>{{customCssClass{...}}}</code></html>
 
* raw HTML can be inserted by enclosing the respective code in HTML tags: {{{<html> ... </html>}}}
 

	
 
!Special Markers
 
* {{{<br>}}} forces a manual line break
 
* {{{----}}} creates a horizontal ruler
 
* [[HTML entities|http://www.tiddlywiki.com/#HtmlEntities]]
 
* [[HTML entities local|HtmlEntities]]
 
* {{{<<macroName>>}}} calls the respective [[macro|Macros]]
 
* To hide text within a tiddler so that it is not displayed, it can be wrapped in {{{/%}}} and {{{%/}}}.<br/>This can be a useful trick for hiding drafts or annotating complex markup.
 
* To prevent wiki markup from taking effect for a particular section, that section can be enclosed in three double quotes: e.g. {{{"""WikiWord"""}}}.
 
</textarea></div>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        mode: 'tiddlywiki',      
 
        mode: 'tiddlywiki',
 
        lineNumbers: true,
 
        enterMode: 'keep',
 
        matchBrackets: true
 
      });
 
    </script>
 

	
 
    <p>TiddlyWiki mode supports a single configuration.</p>
 

	
 
    <p><strong>MIME types defined:</strong> <code>text/x-tiddlywiki</code>.</p>
 
  </body>
 
</html>
rhodecode/public/js/mode/tiki/index.html
Show inline comments
 
@@ -26,56 +26,56 @@ Styling
 
^^ Box on multi
 
lines
 
of content^^
 
__bold__
 
''italic''
 
===underline===
 
::center::
 
--Line Through--
 

	
 
Operators
 
~np~No parse~/np~
 

	
 
Link
 
[link|desc|nocache]
 

	
 
Wiki
 
((Wiki))
 
((Wiki|desc))
 
((Wiki|desc|timeout))
 

	
 
Table
 
||row1 col1|row1 col2|row1 col3
 
row2 col1|row2 col2|row2 col3
 
row3 col1|row3 col2|row3 col3||
 

	
 
Lists:
 
*bla
 
**bla-1
 
++continue-bla-1
 
***bla-2
 
++continue-bla-1
 
*bla
 
+continue-bla
 
#bla
 
** tra-la-la
 
+continue-bla
 
#bla
 

	
 
Plugin (standard):
 
{PLUGIN(attr="my attr")}
 
Plugin Body
 
{PLUGIN}
 

	
 
Plugin (inline):
 
{plugin attr="my attr"}
 
</textarea></div>
 

	
 
<script type="text/javascript">
 
	var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        mode: 'tiki',      
 
    var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        mode: 'tiki',
 
        lineNumbers: true
 
    });
 
</script>
 

	
 
</body>
 
</html>
rhodecode/public/js/mode/tiki/tiki.css
Show inline comments
 
.cm-tw-syntaxerror {
 
	color: #FFF;
 
	background-color: #900;
 
    color: #FFF;
 
    background-color: #900;
 
}
 

	
 
.cm-tw-deleted {
 
	text-decoration: line-through;
 
    text-decoration: line-through;
 
}
 

	
 
.cm-tw-header5 {
 
	font-weight: bold;
 
    font-weight: bold;
 
}
 
.cm-tw-listitem:first-child { /*Added first child to fix duplicate padding when highlighting*/
 
	padding-left: 10px;
 
    padding-left: 10px;
 
}
 

	
 
.cm-tw-box {
 
	border-top-width: 0px ! important;
 
	border-style: solid;
 
	border-width: 1px;
 
	border-color: inherit;
 
    border-top-width: 0px ! important;
 
    border-style: solid;
 
    border-width: 1px;
 
    border-color: inherit;
 
}
 

	
 
.cm-tw-underline {
 
	text-decoration: underline;
 
}
 
\ No newline at end of file
 
    text-decoration: underline;
 
}
rhodecode/public/js/mode/turtle/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: Turtle mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="turtle.js"></script>
 
    <style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
  </head>
 
  <body>
 
    <h1>CodeMirror: Turtle mode</h1>
 
    <form><textarea id="code" name="code">
 
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
 
@prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
 
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
 

	
 
<http://purl.org/net/bsletten> 
 
<http://purl.org/net/bsletten>
 
    a foaf:Person;
 
    foaf:interest <http://www.w3.org/2000/01/sw/>;
 
    foaf:based_near [
 
        geo:lat "34.0736111" ;
 
        geo:lon "-118.3994444"
 
   ]
 

	
 
</textarea></form>
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        mode: "text/turtle",
 
        tabMode: "indent",
 
        matchBrackets: true
 
      });
 
    </script>
 

	
 
    <p><strong>MIME types defined:</strong> <code>text/turtle</code>.</p>
 

	
 
  </body>
 
</html>
rhodecode/public/js/mode/vb/index.html
Show inline comments
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: VB.NET mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="vb.js"></script>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
    <link href="http://fonts.googleapis.com/css?family=Inconsolata" rel="stylesheet" type="text/css">
 
    <style>
 
      .CodeMirror {border: 1px solid #aaa; height:210px; height: auto;}
 
      .CodeMirror-scroll { overflow-x: auto; overflow-y: hidden;}
 
      .CodeMirror pre { font-family: Inconsolata; font-size: 14px}
 
    </style> 
 
    </style>
 
    <script type="text/javascript" src="../../addon/runmode/runmode.js"></script>
 
  </head>
 
  <body onload="init()">
 
    <h1>CodeMirror: VB.NET mode</h1>
 
<script type="text/javascript">
 
function test(golden, text) {
 
  var ok = true;
 
  var i = 0;
 
  function callback(token, style, lineNo, pos){
 
		//console.log(String(token) + " " + String(style) + " " + String(lineNo) + " " + String(pos));
 
        //console.log(String(token) + " " + String(style) + " " + String(lineNo) + " " + String(pos));
 
    var result = [String(token), String(style)];
 
    if (golden[i][0] != result[0] || golden[i][1] != result[1]){
 
      return "Error, expected: " + String(golden[i]) + ", got: " + String(result);
 
      ok = false;
 
    }
 
    i++;
 
  }
 
  CodeMirror.runMode(text, "text/x-vb",callback); 
 
  CodeMirror.runMode(text, "text/x-vb",callback);
 

	
 
  if (ok) return "Tests OK";
 
}
 
function testTypes() {
 
  var golden = [['Integer','keyword'],[' ','null'],['Float','keyword']]
 
  var text =  "Integer Float";
 
  return test(golden,text);
 
}
 
function testIf(){
 
  var golden = [['If','keyword'],[' ','null'],['True','keyword'],[' ','null'],['End','keyword'],[' ','null'],['If','keyword']];
 
  var text = 'If True End If';
 
  return test(golden, text);
 
}
 
function testDecl(){
 
   var golden = [['Dim','keyword'],[' ','null'],['x','variable'],[' ','null'],['as','keyword'],[' ','null'],['Integer','keyword']];
 
   var text = 'Dim x as Integer';
 
   return test(golden, text);
 
}
 
function testAll(){
 
  var result = "";
 

	
 
  result += testTypes() + "\n";
 
  result += testIf() + "\n";
 
  result += testDecl() + "\n";
 
  return result;
 

	
 
}
 
function initText(editor) {
 
  var content = 'Class rocket\nPrivate quality as Double\nPublic Sub launch() as String\nif quality > 0.8\nlaunch = "Successful"\nElse\nlaunch = "Failed"\nEnd If\nEnd sub\nEnd class\n';
 
  editor.setValue(content);
 
  for (var i =0; i< editor.lineCount(); i++) editor.indentLine(i);
 
}
 
function init() {
 
    editor = CodeMirror.fromTextArea(document.getElementById("solution"), {
 
        lineNumbers: true,
 
        mode: "text/x-vb",
 
        readOnly: false,
 
        tabMode: "shift"
 
    });
 
    runTest();
 
}
 
function runTest() {
 
	document.getElementById('testresult').innerHTML = testAll();
 
    document.getElementById('testresult').innerHTML = testAll();
 
  initText(editor);
 
	
 

	
 
}
 
</script>
 

	
 

	
 
  <div id="edit">
 
  <textarea style="width:95%;height:200px;padding:5px;" name="solution" id="solution" ></textarea>
 
  </div>
 
  <pre id="testresult"></pre>
 
  <p>MIME type defined: <code>text/x-vb</code>.</p>
 

	
 
</body></html>
rhodecode/public/js/mode/vbscript/index.html
Show inline comments
 
<!doctype html>
 
<html>
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: VBScript mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="vbscript.js"></script>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
    <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
 
  </head>
 
  <body>
 
    <h1>CodeMirror: VBScript mode</h1>
 

	
 
<div><textarea id="code" name="code">
 
' Pete Guhl
 
' 03-04-2012
 
'
 
' Basic VBScript support for codemirror2
 

	
 
Const ForReading = 1, ForWriting = 2, ForAppending = 8
 

	
 
Call Sub020_PostBroadcastToUrbanAirship(strUserName, strPassword, intTransmitID, strResponse)
 

	
 
If Not IsNull(strResponse) AND Len(strResponse) = 0 Then
 
	boolTransmitOkYN = False
 
    boolTransmitOkYN = False
 
Else
 
	' WScript.Echo "Oh Happy Day! Oh Happy DAY!"
 
	boolTransmitOkYN = True
 
    ' WScript.Echo "Oh Happy Day! Oh Happy DAY!"
 
    boolTransmitOkYN = True
 
End If
 
</textarea></div>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        lineNumbers: true
 
      });
 
    </script>
 

	
 
    <p><strong>MIME types defined:</strong> <code>text/vbscript</code>.</p>
 
  </body>
 
</html>
 

	
rhodecode/public/js/mode/verilog/index.html
Show inline comments
 
@@ -27,95 +27,95 @@ module butterfly
 
    input wire [MWIDTH-1:0]        m_in,
 
    // The twiddle factor.
 
    input wire signed [WIDTH-1:0]  w,
 
    // XA
 
    input wire signed [WIDTH-1:0]  xa,
 
    // XB
 
    input wire signed [WIDTH-1:0]  xb,
 
    // Set to 1 when new data is present on inputs.
 
    input wire                     x_nd,
 
    // delayed version of m_in.
 
    output reg [MWIDTH-1:0]        m_out,
 
    // YA = XA + W*XB
 
    // YB = XA - W*XB
 
    output wire signed [WIDTH-1:0] ya,
 
    output wire signed [WIDTH-1:0] yb,
 
    output reg                     y_nd,
 
    output reg                     error
 
    );
 

	
 
   // Set wire to the real and imag parts for convenience.
 
   wire signed [WIDTH/2-1:0]        xa_re;
 
   wire signed [WIDTH/2-1:0]        xa_im;
 
   assign xa_re = xa[WIDTH-1:WIDTH/2];
 
   assign xa_im = xa[WIDTH/2-1:0];
 
   wire signed [WIDTH/2-1: 0]       ya_re;
 
   wire signed [WIDTH/2-1: 0]       ya_im;
 
   assign ya = {ya_re, ya_im};
 
   wire signed [WIDTH/2-1: 0]       yb_re;
 
   wire signed [WIDTH/2-1: 0]       yb_im;
 
   assign yb = {yb_re, yb_im};
 

	
 
   // Delayed stuff.
 
   reg signed [WIDTH/2-1:0]         xa_re_z;
 
   reg signed [WIDTH/2-1:0]         xa_im_z;
 
   // Output of multiplier
 
   wire signed [WIDTH-1:0]          xbw;
 
   wire signed [WIDTH/2-1:0]        xbw_re;
 
   wire signed [WIDTH/2-1:0]        xbw_im;
 
   assign xbw_re = xbw[WIDTH-1:WIDTH/2];
 
   assign xbw_im = xbw[WIDTH/2-1:0];
 
   // Do summing
 
   // I don't think we should get overflow here because of the
 
   // size of the twiddle factors.
 
   // If we do testing should catch it.
 
   assign ya_re = xa_re_z + xbw_re;
 
   assign ya_im = xa_im_z + xbw_im;
 
   assign yb_re = xa_re_z - xbw_re;
 
   assign yb_im = xa_im_z - xbw_im;
 
   
 

	
 
   // Create the multiply module.
 
   multiply_complex #(WIDTH) multiply_complex_0
 
     (.clk(clk),
 
      .rst_n(rst_n),
 
      .x(xb),
 
      .y(w),
 
      .z(xbw)
 
      );
 

	
 
  always @ (posedge clk)
 
    begin
 
       if (!rst_n)
 
         begin
 
            y_nd <= 1'b0;
 
            error <= 1'b0;
 
         end
 
       else
 
         begin
 
            // Set delay for x_nd_old and m.
 
            y_nd <= x_nd;
 
            m_out <= m_in;
 
            if (x_nd)
 
              begin
 
                 xa_re_z <= xa_re/2;
 
                 xa_im_z <= xa_im/2;
 
              end
 
         end
 
    end
 
   
 

	
 
endmodule
 
</textarea></form>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        lineNumbers: true,
 
        mode: "text/x-verilog"
 
      });
 
    </script>
 

	
 
    <p>Simple mode that tries to handle Verilog-like languages as well as it
 
    can. Takes one configuration parameters: <code>keywords</code>, an
 
    object whose property names are the keywords in the language.</p>
 

	
 
    <p><strong>MIME types defined:</strong> <code>text/x-verilog</code> (Verilog code).</p>
 
  </body>
 
</html>
rhodecode/public/js/mode/xquery/index.html
Show inline comments
 
<!doctype html> 
 
<html> 
 
<!doctype html>
 
<html>
 
<!--
 
/*
 
Copyright (C) 2011 by MarkLogic Corporation
 
Author: Mike Brevoort <mike@brevoort.com>
 

	
 
Permission is hereby granted, free of charge, to any person obtaining a copy
 
of this software and associated documentation files (the "Software"), to deal
 
in the Software without restriction, including without limitation the rights
 
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
copies of the Software, and to permit persons to whom the Software is
 
furnished to do so, subject to the following conditions:
 

	
 
The above copyright notice and this permission notice shall be included in
 
all copies or substantial portions of the Software.
 

	
 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 
THE SOFTWARE.
 
*/
 
-->
 
  <head> 
 
  <head>
 
    <meta charset="utf-8">
 
    <title>CodeMirror: XQuery mode</title> 
 
    <link rel="stylesheet" href="../../lib/codemirror.css"> 
 
    <script src="../../lib/codemirror.js"></script> 
 
    <script src="xquery.js"></script> 
 
    <link rel="stylesheet" href="../../doc/docs.css"> 
 
    <link rel="stylesheet" href="../../theme/xq-dark.css"> 
 
    <title>CodeMirror: XQuery mode</title>
 
    <link rel="stylesheet" href="../../lib/codemirror.css">
 
    <script src="../../lib/codemirror.js"></script>
 
    <script src="xquery.js"></script>
 
    <link rel="stylesheet" href="../../doc/docs.css">
 
    <link rel="stylesheet" href="../../theme/xq-dark.css">
 
    <style type="text/css">
 
	.CodeMirror {
 
	  border-top: 1px solid black; border-bottom: 1px solid black;
 
	  height:400px;
 
	}
 
    </style> 
 
  </head> 
 
  <body> 
 
    <h1>CodeMirror: XQuery mode</h1> 
 
 
 
<div class="cm-s-default"> 
 
	<textarea id="code" name="code"> 
 
    .CodeMirror {
 
      border-top: 1px solid black; border-bottom: 1px solid black;
 
      height:400px;
 
    }
 
    </style>
 
  </head>
 
  <body>
 
    <h1>CodeMirror: XQuery mode</h1>
 

	
 
<div class="cm-s-default">
 
    <textarea id="code" name="code">
 
xquery version &quot;1.0-ml&quot;;
 
(: this is
 
 : a 
 
 : a
 
   "comment" :)
 
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;
 
let $joe:=1
 
return element element {
 
	attribute attribute { 1 },
 
	element test { &#39;a&#39; }, 
 
	attribute foo { &quot;bar&quot; },
 
	fn:doc()[ foo/@bar eq $let ],
 
	//x }    
 
 
 
    attribute attribute { 1 },
 
    element test { &#39;a&#39; },
 
    attribute foo { &quot;bar&quot; },
 
    fn:doc()[ foo/@bar eq $let ],
 
    //x }
 

	
 
(: a more 'evil' test :)
 
(: Modified Blakeley example (: with nested comment :) ... :)
 
declare private function local:declare() {()};
 
declare private function local:private() {()};
 
declare private function local:function() {()};
 
declare private function local:local() {()};
 
let $let := &lt;let&gt;let $let := &quot;let&quot;&lt;/let&gt;
 
return element element {
 
	attribute attribute { try { xdmp:version() } catch($e) { xdmp:log($e) } },
 
	attribute fn:doc { &quot;bar&quot; castable as xs:string },
 
	element text { text { &quot;text&quot; } },
 
	fn:doc()[ child::eq/(@bar | attribute::attribute) eq $let ],
 
	//fn:doc
 
    attribute attribute { try { xdmp:version() } catch($e) { xdmp:log($e) } },
 
    attribute fn:doc { &quot;bar&quot; castable as xs:string },
 
    element text { text { &quot;text&quot; } },
 
    fn:doc()[ child::eq/(@bar | attribute::attribute) eq $let ],
 
    //fn:doc
 
}
 

	
 

	
 

	
 
xquery version &quot;1.0-ml&quot;;
 

	
 
(: Copyright 2006-2010 Mark Logic Corporation. :)
 

	
 
(:
 
 : Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
 
 : you may not use this file except in compliance with the License.
 
 : You may obtain a copy of the License at
 
 :
 
 :     http://www.apache.org/licenses/LICENSE-2.0
 
 :
 
 : Unless required by applicable law or agreed to in writing, software
 
 : distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
 
 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
 : See the License for the specific language governing permissions and
 
 : limitations under the License.
 
 :)
 

	
 
module namespace json = &quot;http://marklogic.com/json&quot;;
 
declare default function namespace &quot;http://www.w3.org/2005/xpath-functions&quot;;
 

	
 
(: Need to backslash escape any double quotes, backslashes, and newlines :)
 
declare function json:escape($s as xs:string) as xs:string {
 
  let $s := replace($s, &quot;\\&quot;, &quot;\\\\&quot;)
 
  let $s := replace($s, &quot;&quot;&quot;&quot;, &quot;\\&quot;&quot;&quot;)
 
  let $s := replace($s, codepoints-to-string((13, 10)), &quot;\\n&quot;)
 
  let $s := replace($s, codepoints-to-string(13), &quot;\\n&quot;)
 
  let $s := replace($s, codepoints-to-string(10), &quot;\\n&quot;)
 
  return $s
 
};
 

	
 
declare function json:atomize($x as element()) as xs:string {
 
  if (count($x/node()) = 0) then 'null'
 
  else if ($x/@type = &quot;number&quot;) then
 
    let $castable := $x castable as xs:float or
 
                     $x castable as xs:double or
 
                     $x castable as xs:decimal
 
    return
 
    if ($castable) then xs:string($x)
 
    else error(concat(&quot;Not a number: &quot;, xdmp:describe($x)))
 
  else if ($x/@type = &quot;boolean&quot;) then
 
    let $castable := $x castable as xs:boolean
 
    return
 
    if ($castable) then xs:string(xs:boolean($x))
 
@@ -148,74 +148,74 @@ declare function json:print-name-value($
 
  else if ($first-in-array) then
 
    string-join(('&quot;', json:escape($name), '&quot;:[',
 
      string-join((for $i in ($x, $x/following-sibling::*[name(.) = $name]) return json:print-value($i)), &quot;,&quot;),
 
    ']'), &quot;&quot;)
 
   else
 
     string-join(('&quot;', json:escape($name), '&quot;:', json:print-value($x)), &quot;&quot;)
 
};
 

	
 
(:~
 
  Transforms an XML element into a JSON string representation.  See http://json.org.
 
  &lt;p/&gt;
 
  Sample usage:
 
  &lt;pre&gt;
 
    xquery version &quot;1.0-ml&quot;;
 
    import module namespace json=&quot;http://marklogic.com/json&quot; at &quot;json.xqy&quot;;
 
    json:serialize(&amp;lt;foo&amp;gt;&amp;lt;bar&amp;gt;kid&amp;lt;/bar&amp;gt;&amp;lt;/foo&amp;gt;)
 
  &lt;/pre&gt;
 
  Sample transformations:
 
  &lt;pre&gt;
 
  &amp;lt;e/&amp;gt; becomes {&quot;e&quot;:null}
 
  &amp;lt;e&amp;gt;text&amp;lt;/e&amp;gt; becomes {&quot;e&quot;:&quot;text&quot;}
 
  &amp;lt;e&amp;gt;quote &quot; escaping&amp;lt;/e&amp;gt; becomes {&quot;e&quot;:&quot;quote \&quot; escaping&quot;}
 
  &amp;lt;e&amp;gt;backslash \ escaping&amp;lt;/e&amp;gt; becomes {&quot;e&quot;:&quot;backslash \\ escaping&quot;}
 
  &amp;lt;e&amp;gt;&amp;lt;a&amp;gt;text1&amp;lt;/a&amp;gt;&amp;lt;b&amp;gt;text2&amp;lt;/b&amp;gt;&amp;lt;/e&amp;gt; becomes {&quot;e&quot;:{&quot;a&quot;:&quot;text1&quot;,&quot;b&quot;:&quot;text2&quot;}}
 
  &amp;lt;e&amp;gt;&amp;lt;a&amp;gt;text1&amp;lt;/a&amp;gt;&amp;lt;a&amp;gt;text2&amp;lt;/a&amp;gt;&amp;lt;/e&amp;gt; becomes {&quot;e&quot;:{&quot;a&quot;:[&quot;text1&quot;,&quot;text2&quot;]}}
 
  &amp;lt;e&amp;gt;&amp;lt;a array=&quot;true&quot;&amp;gt;text1&amp;lt;/a&amp;gt;&amp;lt;/e&amp;gt; becomes {&quot;e&quot;:{&quot;a&quot;:[&quot;text1&quot;]}}
 
  &amp;lt;e&amp;gt;&amp;lt;a type=&quot;boolean&quot;&amp;gt;false&amp;lt;/a&amp;gt;&amp;lt;/e&amp;gt; becomes {&quot;e&quot;:{&quot;a&quot;:false}}
 
  &amp;lt;e&amp;gt;&amp;lt;a type=&quot;number&quot;&amp;gt;123.5&amp;lt;/a&amp;gt;&amp;lt;/e&amp;gt; becomes {&quot;e&quot;:{&quot;a&quot;:123.5}}
 
  &amp;lt;e quote=&quot;true&quot;&amp;gt;&amp;lt;div attrib=&quot;value&quot;/&amp;gt;&amp;lt;/e&amp;gt; becomes {&quot;e&quot;:&quot;&amp;lt;div attrib=\&quot;value\&quot;/&amp;gt;&quot;}
 
  &lt;/pre&gt;
 
  &lt;p/&gt;
 
  Namespace URIs are ignored.  Namespace prefixes are included in the JSON name.
 
  &lt;p/&gt;
 
  Attributes are ignored, except for the special attribute @array=&quot;true&quot; that
 
  indicates the JSON serialization should write the node, even if single, as an
 
  array, and the attribute @type that can be set to &quot;boolean&quot; or &quot;number&quot; to
 
  dictate the value should be written as that type (unquoted).  There's also
 
  an @quote attribute that when set to true writes the inner content as text
 
  rather than as structured JSON, useful for sending some XHTML over the
 
  wire.
 
  &lt;p/&gt;
 
  Text nodes within mixed content are ignored.
 

	
 
  @param $x Element node to convert
 
  @return String holding JSON serialized representation of $x
 

	
 
  @author Jason Hunter
 
  @version 1.0.1
 
  
 

	
 
  Ported to xquery 1.0-ml; double escaped backslashes in json:escape
 
:)
 
declare function json:serialize($x as element())  as xs:string {
 
  string-join(('{', json:print-name-value($x), '}'), &quot;&quot;)
 
};
 
  </textarea> 
 
</div> 
 
 
 
    <script> 
 
  </textarea>
 
</div>
 

	
 
    <script>
 
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 
        lineNumbers: true,
 
        matchBrackets: true,
 
        theme: "xq-dark"
 
      });
 
    </script> 
 
 
 
    <p><strong>MIME types defined:</strong> <code>application/xquery</code>.</p> 
 
 
 
    <p>Development of the CodeMirror XQuery mode was sponsored by 
 
      <a href="http://marklogic.com">MarkLogic</a> and developed by 
 
    </script>
 

	
 
    <p><strong>MIME types defined:</strong> <code>application/xquery</code>.</p>
 

	
 
    <p>Development of the CodeMirror XQuery mode was sponsored by
 
      <a href="http://marklogic.com">MarkLogic</a> and developed by
 
      <a href="https://twitter.com/mbrevoort">Mike Brevoort</a>.
 
    </p>
 
 
 
  </body> 
 

	
 
  </body>
 
</html>
0 comments (0 inline, 0 general)