Skip to content
Browse files

Added C Sharp. Fixes #1

  • Loading branch information...
1 parent 4b775f2 commit 4b8c7d7580a4fffa49f0eb70dd8ae9afc603df08 Dan Stewart committed May 3, 2012
Showing with 947 additions and 1 deletion.
  1. +613 −0 demos/csharp.html
  2. +1 −0 demos/index.html
  3. +88 −0 js/language/csharp.js
  4. +2 −1 tests/index.html
  5. +169 −0 tests/language/csharp-test.js
  6. +73 −0 themes/obsidian.css
  7. +1 −0 util/builder.py
View
613 demos/csharp.html
@@ -0,0 +1,613 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Syntax Highlighting</title>
+<link href="../themes/obsidian.css" rel="stylesheet" type="text/css" media="screen">
+<body>
+
+<pre>
+<code data-language="csharp">/*
+ this is some sample C# code
+*/
+
+#pragma warning disable 1591
+//------------------------------------------------------------------------------
+// &lt;auto-generated&gt;
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.3521
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// &lt;/auto-generated&gt;
+//------------------------------------------------------------------------------
+
+namespace NerdDinner.Models
+{
+ using System.Data.Linq;
+ using System.Data.Linq.Mapping;
+ using System.Data;
+ using System.Collections.Generic;
+ using System.Reflection;
+ using System.Linq;
+ using System.Linq.Expressions;
+ using System.ComponentModel;
+ using System;
+
+ [System.Data.Linq.Mapping.DatabaseAttribute(Name="NerdDinner")]
+ public partial class NerdDinnerDataContext : System.Data.Linq.DataContext
+ {
+
+ private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
+
+ #region Extensibility Method Definitions
+ partial void OnCreated();
+ partial void InsertDinner(Dinner instance);
+ partial void UpdateDinner(Dinner instance);
+ partial void DeleteDinner(Dinner instance);
+ partial void InsertRSVP(RSVP instance);
+ partial void UpdateRSVP(RSVP instance);
+ partial void DeleteRSVP(RSVP instance);
+ #endregion
+
+ public NerdDinnerDataContext() :
+ base(global::System.Configuration.ConfigurationManager.ConnectionStrings["NerdDinnerConnectionString"].ConnectionString, mappingSource)
+ {
+ OnCreated();
+ }
+
+ public NerdDinnerDataContext(string connection) :
+ base(connection, mappingSource)
+ {
+ OnCreated();
+ }
+
+ public NerdDinnerDataContext(System.Data.IDbConnection connection) :
+ base(connection, mappingSource)
+ {
+ OnCreated();
+ }
+
+ public NerdDinnerDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
+ base(connection, mappingSource)
+ {
+ OnCreated();
+ }
+
+ public NerdDinnerDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
+ base(connection, mappingSource)
+ {
+ OnCreated();
+ }
+
+ public System.Data.Linq.Table&lt;Dinner&gt; Dinners
+ {
+ get
+ {
+ return this.GetTable&lt;Dinner&gt;();
+ }
+ }
+
+ public System.Data.Linq.Table&lt;RSVP&gt; RSVPs
+ {
+ get
+ {
+ return this.GetTable&lt;RSVP&gt;();
+ }
+ }
+
+ [Function(Name="dbo.NearestDinners", IsComposable=true)]
+ public IQueryable&lt;NearestDinnersResult&gt; NearestDinners(
+ [Parameter(DbType="Real")] System.Nullable&lt;float&gt; lat,
+ [Parameter(Name="long", DbType="Real")] System.Nullable&lt;float&gt; @long)
+ {
+ return this.CreateMethodCallQuery&lt;NearestDinnersResult&gt;(
+ this,
+ ((MethodInfo)(MethodInfo.GetCurrentMethod())),
+ lat,
+ @long);
+ }
+
+ [Function(Name="dbo.DistanceBetween", IsComposable=true)]
+ public System.Nullable&lt;float&gt; DistanceBetween(
+ [Parameter(Name="Lat1", DbType="Real")] System.Nullable&lt;float&gt; lat1,
+ [Parameter(Name="Long1", DbType="Real")] System.Nullable&lt;float&gt; long1,
+ [Parameter(Name="Lat2", DbType="Real")] System.Nullable&lt;float&gt; lat2,
+ [Parameter(Name="Long2", DbType="Real")] System.Nullable&lt;float&gt; long2)
+ {
+ return ((System.Nullable&lt;float&gt;)(this.ExecuteMethodCall(
+ this,
+ ((MethodInfo)(MethodInfo.GetCurrentMethod())),
+ lat1,
+ long1,
+ lat2,
+ long2).ReturnValue));
+ }
+ }
+
+ [Table(Name="dbo.Dinners")]
+ public partial class Dinner : INotifyPropertyChanging, INotifyPropertyChanged
+ {
+
+ private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
+
+ private int _DinnerID;
+
+ private string _Title;
+
+ private System.DateTime _EventDate;
+
+ private string _Description;
+
+ private string _HostedBy;
+
+ private string _ContactPhone;
+
+ private string _Address;
+
+ private string _Country;
+
+ private double _Latitude;
+
+ private double _Longitude;
+
+ private EntitySet&lt;RSVP&gt; _RSVPs;
+
+ #region Extensibility Method Definitions
+ partial void OnLoaded();
+ partial void OnValidate(System.Data.Linq.ChangeAction action);
+ partial void OnCreated();
+ partial void OnDinnerIDChanging(int value);
+ partial void OnDinnerIDChanged();
+ partial void OnTitleChanging(string value);
+ partial void OnTitleChanged();
+ partial void OnEventDateChanging(System.DateTime value);
+ partial void OnEventDateChanged();
+ partial void OnDescriptionChanging(string value);
+ partial void OnDescriptionChanged();
+ partial void OnHostedByChanging(string value);
+ partial void OnHostedByChanged();
+ partial void OnContactPhoneChanging(string value);
+ partial void OnContactPhoneChanged();
+ partial void OnAddressChanging(string value);
+ partial void OnAddressChanged();
+ partial void OnCountryChanging(string value);
+ partial void OnCountryChanged();
+ partial void OnLatitudeChanging(double value);
+ partial void OnLatitudeChanged();
+ partial void OnLongitudeChanging(double value);
+ partial void OnLongitudeChanged();
+ #endregion
+
+ public Dinner()
+ {
+ this._RSVPs = new EntitySet&lt;RSVP&gt;(new Action&lt;RSVP&gt;(this.attach_RSVPs), new Action&lt;RSVP&gt;(this.detach_RSVPs));
+ OnCreated();
+ }
+
+ [Column(Storage="_DinnerID", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
+ public int DinnerID
+ {
+ get
+ {
+ return this._DinnerID;
+ }
+ set
+ {
+ if ((this._DinnerID != value))
+ {
+ this.OnDinnerIDChanging(value);
+ this.SendPropertyChanging();
+ this._DinnerID = value;
+ this.SendPropertyChanged("DinnerID");
+ this.OnDinnerIDChanged();
+ }
+ }
+ }
+
+ [Column(Storage="_Title", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
+ public string Title
+ {
+ get
+ {
+ return this._Title;
+ }
+ set
+ {
+ if ((this._Title != value))
+ {
+ this.OnTitleChanging(value);
+ this.SendPropertyChanging();
+ this._Title = value;
+ this.SendPropertyChanged("Title");
+ this.OnTitleChanged();
+ }
+ }
+ }
+
+ [Column(Storage="_EventDate", DbType="DateTime NOT NULL")]
+ public System.DateTime EventDate
+ {
+ get
+ {
+ return this._EventDate;
+ }
+ set
+ {
+ if ((this._EventDate != value))
+ {
+ this.OnEventDateChanging(value);
+ this.SendPropertyChanging();
+ this._EventDate = value;
+ this.SendPropertyChanged("EventDate");
+ this.OnEventDateChanged();
+ }
+ }
+ }
+
+ [Column(Storage="_Description", DbType="NVarChar(256)")]
+ public string Description
+ {
+ get
+ {
+ return this._Description;
+ }
+ set
+ {
+ if ((this._Description != value))
+ {
+ this.OnDescriptionChanging(value);
+ this.SendPropertyChanging();
+ this._Description = value;
+ this.SendPropertyChanged("Description");
+ this.OnDescriptionChanged();
+ }
+ }
+ }
+
+ [Column(Storage="_HostedBy", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
+ public string HostedBy
+ {
+ get
+ {
+ return this._HostedBy;
+ }
+ set
+ {
+ if ((this._HostedBy != value))
+ {
+ this.OnHostedByChanging(value);
+ this.SendPropertyChanging();
+ this._HostedBy = value;
+ this.SendPropertyChanged("HostedBy");
+ this.OnHostedByChanged();
+ }
+ }
+ }
+
+ [Column(Storage="_ContactPhone", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
+ public string ContactPhone
+ {
+ get
+ {
+ return this._ContactPhone;
+ }
+ set
+ {
+ if ((this._ContactPhone != value))
+ {
+ this.OnContactPhoneChanging(value);
+ this.SendPropertyChanging();
+ this._ContactPhone = value;
+ this.SendPropertyChanged("ContactPhone");
+ this.OnContactPhoneChanged();
+ }
+ }
+ }
+
+ [Column(Storage="_Address", DbType="NVarChar(50)")]
+ public string Address
+ {
+ get
+ {
+ return this._Address;
+ }
+ set
+ {
+ if ((this._Address != value))
+ {
+ this.OnAddressChanging(value);
+ this.SendPropertyChanging();
+ this._Address = value;
+ this.SendPropertyChanged("Address");
+ this.OnAddressChanged();
+ }
+ }
+ }
+
+ [Column(Storage="_Country", DbType="NVarChar(30)")]
+ public string Country
+ {
+ get
+ {
+ return this._Country;
+ }
+ set
+ {
+ if ((this._Country != value))
+ {
+ this.OnCountryChanging(value);
+ this.SendPropertyChanging();
+ this._Country = value;
+ this.SendPropertyChanged("Country");
+ this.OnCountryChanged();
+ }
+ }
+ }
+
+ [Column(Storage="_Latitude", DbType="Float NOT NULL")]
+ public double Latitude
+ {
+ get
+ {
+ return this._Latitude;
+ }
+ set
+ {
+ if ((this._Latitude != value))
+ {
+ this.OnLatitudeChanging(value);
+ this.SendPropertyChanging();
+ this._Latitude = value;
+ this.SendPropertyChanged("Latitude");
+ this.OnLatitudeChanged();
+ }
+ }
+ }
+
+ [Column(Storage="_Longitude", DbType="Float NOT NULL")]
+ public double Longitude
+ {
+ get
+ {
+ return this._Longitude;
+ }
+ set
+ {
+ if ((this._Longitude != value))
+ {
+ this.OnLongitudeChanging(value);
+ this.SendPropertyChanging();
+ this._Longitude = value;
+ this.SendPropertyChanged("Longitude");
+ this.OnLongitudeChanged();
+ }
+ }
+ }
+
+ [Association(Name="Dinner_RSVP", Storage="_RSVPs", ThisKey="DinnerID", OtherKey="DinnerID")]
+ public EntitySet&lt;RSVP&gt; RSVPs
+ {
+ get
+ {
+ return this._RSVPs;
+ }
+ set
+ {
+ this._RSVPs.Assign(value);
+ }
+ }
+
+ public event PropertyChangingEventHandler PropertyChanging;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void SendPropertyChanging()
+ {
+ if ((this.PropertyChanging != null))
+ {
+ this.PropertyChanging(this, emptyChangingEventArgs);
+ }
+ }
+
+ protected virtual void SendPropertyChanged(String propertyName)
+ {
+ if ((this.PropertyChanged != null))
+ {
+ this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+
+ private void attach_RSVPs(RSVP entity)
+ {
+ this.SendPropertyChanging();
+ entity.Dinner = this;
+ }
+
+ private void detach_RSVPs(RSVP entity)
+ {
+ this.SendPropertyChanging();
+ entity.Dinner = null;
+ }
+ }
+
+ [Table(Name="dbo.RSVP")]
+ public partial class RSVP : INotifyPropertyChanging, INotifyPropertyChanged
+ {
+
+ private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
+
+ private int _RsvpID;
+
+ private int _DinnerID;
+
+ private string _AttendeeName;
+
+ private EntityRef&lt;Dinner&gt; _Dinner;
+
+ #region Extensibility Method Definitions
+ partial void OnLoaded();
+ partial void OnValidate(System.Data.Linq.ChangeAction action);
+ partial void OnCreated();
+ partial void OnRsvpIDChanging(int value);
+ partial void OnRsvpIDChanged();
+ partial void OnDinnerIDChanging(int value);
+ partial void OnDinnerIDChanged();
+ partial void OnAttendeeNameChanging(string value);
+ partial void OnAttendeeNameChanged();
+ #endregion
+
+ public RSVP()
+ {
+ this._Dinner = default(EntityRef&lt;Dinner&gt;);
+ OnCreated();
+ }
+
+ [Column(Storage="_RsvpID", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
+ public int RsvpID
+ {
+ get
+ {
+ return this._RsvpID;
+ }
+ set
+ {
+ if ((this._RsvpID != value))
+ {
+ this.OnRsvpIDChanging(value);
+ this.SendPropertyChanging();
+ this._RsvpID = value;
+ this.SendPropertyChanged("RsvpID");
+ this.OnRsvpIDChanged();
+ }
+ }
+ }
+
+ [Column(Storage="_DinnerID", DbType="Int NOT NULL")]
+ public int DinnerID
+ {
+ get
+ {
+ return this._DinnerID;
+ }
+ set
+ {
+ if ((this._DinnerID != value))
+ {
+ if (this._Dinner.HasLoadedOrAssignedValue)
+ {
+ throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
+ }
+ this.OnDinnerIDChanging(value);
+ this.SendPropertyChanging();
+ this._DinnerID = value;
+ this.SendPropertyChanged("DinnerID");
+ this.OnDinnerIDChanged();
+ }
+ }
+ }
+
+ [Column(Storage="_AttendeeName", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
+ public string AttendeeName
+ {
+ get
+ {
+ return this._AttendeeName;
+ }
+ set
+ {
+ if ((this._AttendeeName != value))
+ {
+ this.OnAttendeeNameChanging(value);
+ this.SendPropertyChanging();
+ this._AttendeeName = value;
+ this.SendPropertyChanged("AttendeeName");
+ this.OnAttendeeNameChanged();
+ }
+ }
+ }
+
+ [Association(Name="Dinner_RSVP", Storage="_Dinner", ThisKey="DinnerID", OtherKey="DinnerID", IsForeignKey=true)]
+ public Dinner Dinner
+ {
+ get
+ {
+ return this._Dinner.Entity;
+ }
+ set
+ {
+ Dinner previousValue = this._Dinner.Entity;
+ if (((previousValue != value)
+ || (this._Dinner.HasLoadedOrAssignedValue == false)))
+ {
+ this.SendPropertyChanging();
+ if ((previousValue != null))
+ {
+ this._Dinner.Entity = null;
+ previousValue.RSVPs.Remove(this);
+ }
+ this._Dinner.Entity = value;
+ if ((value != null))
+ {
+ value.RSVPs.Add(this);
+ this._DinnerID = value.DinnerID;
+ }
+ else
+ {
+ this._DinnerID = default(int);
+ }
+ this.SendPropertyChanged("Dinner");
+ }
+ }
+ }
+
+ public event PropertyChangingEventHandler PropertyChanging;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void SendPropertyChanging()
+ {
+ if ((this.PropertyChanging != null))
+ {
+ this.PropertyChanging(this, emptyChangingEventArgs);
+ }
+ }
+
+ protected virtual void SendPropertyChanged(String propertyName)
+ {
+ if ((this.PropertyChanged != null))
+ {
+ this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+ }
+
+ public partial class NearestDinnersResult
+ {
+
+ private int _DinnerID;
+
+ public NearestDinnersResult()
+ {
+ }
+
+ [Column(Storage="_DinnerID", DbType="Int NOT NULL")]
+ public int DinnerID
+ {
+ get
+ {
+ return this._DinnerID;
+ }
+ set
+ {
+ if ((this._DinnerID != value))
+ {
+ this._DinnerID = value;
+ }
+ }
+ }
+ }
+}
+#pragma warning restore 1591</code>
+</pre>
+ <script src="../js/rainbow.js"></script>
+ <script src="../js/language/csharp.js"></script>
+</body>
View
1 demos/index.html
@@ -3,6 +3,7 @@
<title>Syntax Highlighting</title>
<body>
<ul>
+ <li><a href="csharp.html">csharp demo</a></li>
<li><a href="css.html">css demo</a></li>
<li><a href="html.html">html demo</a></li>
<li><a href="js.html">js demo</a></li>
View
88 js/language/csharp.js
@@ -0,0 +1,88 @@
+/**
+* C# patterns
+*
+* @author Dan Stewart
+* @version 1.0
+* Do not use generic.js with this.
+*/
+Rainbow.extend('csharp', [
+ {
+ // http://msdn.microsoft.com/en-us/library/23954zh5.aspx
+ 'name': 'constant',
+ 'pattern': /\b(false|null|true)\b/g
+ },
+ {
+ // http://msdn.microsoft.com/en-us/library/x53a06bb%28v=vs.100%29.aspx
+ // Does not support putting an @ in front of a keyword which makes it not a keyword anymore.
+ 'name': 'keyword',
+ 'pattern': /\b(abstract|add|alias|ascending|as|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|descending|double|do|dynamic|else|enum|event|explicit|extern|false|finally|fixed|float|foreach|for|from|get|global|goto|group|if|implicit|int|interface|internal|into|in|is|join|let|lock|long|namespace|new|object|operator|orderby|out|override|params|partial|private|protected|public|readonly|ref|remove|return|sbyte|sealed|select|set|short|sizeof|stackalloc|static|string|struct|switch|this|throw|try|typeof|uint|unchecked|ulong|unsafe|ushort|using|value|var|virtual|void|volatile|where|while|yield)\b/g
+ },
+ {
+ 'matches': {
+ 1: 'keyword',
+ 2: {
+ 'name': 'support.class',
+ 'pattern': /\w+/g
+ }
+ },
+ 'pattern': /(typeof)\s([^\$].*?)(\)|;)/g
+ },
+ {
+ 'matches': {
+ 1: 'keyword.namespace',
+ 2: {
+ 'name': 'support.namespace',
+ 'pattern': /\w+/g
+ }
+ },
+ 'pattern': /\b(namespace)\s(.*?);/g
+ },
+ {
+ 'matches': {
+ 1: 'storage.modifier',
+ 2: 'storage.class',
+ 3: 'entity.name.class',
+ 4: 'storage.modifier.extends',
+ 5: 'entity.other.inherited-class'
+ },
+ 'pattern': /\b(abstract|sealed)?\s?(class)\s(\w+)(\sextends\s)?([\w\\]*)?\s?\{?(\n|\})/g
+ },
+ {
+ 'name': 'keyword.static',
+ 'pattern': /\b(static)\b/g
+ },
+ {
+ 'matches': {
+ 1: 'keyword.new',
+ 2: {
+ 'name': 'support.class',
+ 'pattern': /\w+/g
+ }
+
+ },
+ 'pattern': /\b(new)\s([^\$].*?)(?=\)|\(|;|&)/g
+ },
+ {
+ 'name': 'string',
+ 'pattern': /(")(.*?)\1/g
+ },
+ {
+ 'name': 'integer',
+ 'pattern': /\b(0x[\da-f]+|\d+)\b/g
+ },
+ {
+ 'name': 'comment',
+ 'pattern': /\/\*[\s\S]*?\*\/|(\/\/)[\s\S]*?$/gm
+ },
+ {
+ 'name': 'operator',
+ // http://msdn.microsoft.com/en-us/library/6a71f45d%28v=vs.100%29.aspx
+ // ++ += + -- -= - <<= << <= => >>= >> >= != ! ~ ^ || && &= & ?? :: : *= * |= %= |= == =
+ 'pattern': /(\+\+|\+=|\+|--|-=|-|&lt;&lt;=|&lt;&lt;|&lt;=|=&gt;|&gt;&gt;=|&gt;&gt;|&gt;=|!=|!|~|\^|\|\||&amp;&amp;|&amp;=|&amp;|\?\?|::|:|\*=|\*|\/=|%=|\|=|==|=)/g
+ },
+ {
+ // http://msdn.microsoft.com/en-us/library/ed8yd1ha%28v=vs.100%29.aspx
+ 'name': 'preprocessor',
+ 'pattern': /(\#if|\#else|\#elif|\#endif|\#define|\#undef|\#warning|\#error|\#line|\#region|\#endregion|\#pragma)[\s\S]*?$/gm
+ }
+]);
View
3 tests/index.html
@@ -9,7 +9,8 @@
<fieldset>
<legend>Select Language(s)</legend>
<select multiple name="languages">
- <option selected value="css">css</option>
+ <option selected value="csharp">csharp</option>
+ <option selected value="css">css</option>
<option selected value="generic">generic</option>
<option selected value="html">html</option>
<option selected value="javascript">javascript</option>
View
169 tests/language/csharp-test.js
@@ -0,0 +1,169 @@
+/**
+ * C# tests
+ *
+ * @author Dan Stewart
+ * These tests assume all rainbow js files are loaded.
+ */
+RainbowTester.startTest('csharp');
+
+RainbowTester.run(
+ 'echo',
+
+ 'Console.WriteLine("hello world");',
+
+ 'Console.<span class="function call">WriteLine</span>(<span class="string">"hello world"</span>);'
+);
+
+RainbowTester.run(
+ 'variable',
+
+ 'var foo = true;',
+
+ '<span class="keyword">var</span> foo <span class="operator">=</span> <span class="constant">true</span>;'
+);
+
+RainbowTester.run(
+ 'string concatenation',
+
+ 'string foo = "test " + "string " + "concatenation";',
+
+ '<span class="keyword">string</span> foo <span class="operator">=</span> <span class="string">"test "</span> <span class="operator">+</span> <span class="string">"string "</span> <span class="operator">+</span> <span class="string">"concatenation"</span>;'
+);
+
+RainbowTester.run(
+ 'typeof',
+
+ "var is_array_object = typeof(System.Array);",
+
+ '<span class="keyword">var</span> is_array_object <span class="operator">=</span> <span class="keyword">typeof</span>(System.<span class="keyword">Array</span>);'
+);
+
+RainbowTester.run(
+ 'array stuff',
+
+ 'string[] turtles = new string[] {\n' +
+ ' "leonardo",\n' +
+ ' "michaelangelo",\n' +
+ ' "donatello",\n' +
+ ' "raphael"\n' +
+ '};\n' +
+ '\n' +
+ 'bool exists = turtles[0] == "leonardo";',
+
+ '<span class="keyword">string</span>[] turtles <span class="operator">=</span> <span class="keyword">new</span> <span class="keyword">string</span>[] {\n' +
+ ' <span class="string">"leonardo"</span>,\n' +
+ ' <span class="string">"michaelangelo"</span>,\n' +
+ ' <span class="string">"donatello"</span>,\n' +
+ ' <span class="string">"raphael"</span>\n' +
+ '};\n' +
+ '\n' +
+ '<span class="keyword">bool</span> exists <span class="operator">=</span> turtles[<span class="integer">0</span>] <span class="operator">==</span> <span class="string">"leonardo"</span>;'
+);
+
+RainbowTester.run(
+ 'namespace declaration',
+
+ 'namespace Sonic.Database {',
+
+ '<span class="keyword">namespace</span> Sonic.Database {'
+);
+
+RainbowTester.run(
+ 'class declaration',
+
+ 'class MyClass {}',
+
+ '<span class="storage class">class</span> <span class="entity name class">MyClass</span> {}'
+);
+
+RainbowTester.run(
+ 'abstract class declaration',
+
+ 'abstract class MyClass {}',
+
+ '<span class="storage modifier">abstract</span> <span class="storage class">class</span> <span class="entity name class">MyClass</span> {}'
+);
+
+RainbowTester.run(
+ 'sealed class declaration',
+
+ 'sealed class TestClass\n' +
+ '{\n' +
+ '}',
+
+ '<span class="storage modifier">sealed</span> <span class="storage class">class</span> <span class="entity name class">TestClass</span>\n' +
+ '{\n' +
+ '}'
+);
+
+RainbowTester.run(
+ 'child class declaration',
+
+ 'class MyCollection : ICollection {}',
+
+ '<span class="keyword">class</span> MyCollection <span class="operator">:</span> ICollection {}'
+);
+
+RainbowTester.run(
+ 'test static',
+
+ 'static void doSomethingElse() {}',
+
+ '<span class="keyword">static</span> <span class="keyword">void</span> <span class="function call">doSomethingElse</span>() {}'
+);
+
+RainbowTester.run(
+ 'test magic function',
+
+ 'protected void Page_Load(object sender, EventArgs e)\n' +
+ '{\n' +
+ ' // do whatever\n' +
+ '}',
+
+ '<span class="keyword">protected</span> <span class="keyword">void</span> <span class="function call">Page_Load</span>(<span class="keyword">object</span> sender, EventArgs e)\n' +
+ '{\n' +
+ ' <span class="comment">// do whatever</span>\n' +
+ '}'
+);
+
+RainbowTester.run(
+ 'test new class',
+
+ 'new SomeClass();',
+
+ '<span class="keyword new">new</span> <span class="support class">SomeClass</span>();'
+);
+
+RainbowTester.run(
+ 'test new namespace class',
+
+ 'var s = new Sonic.Database.Query();',
+
+ '<span class="keyword">var</span> s <span class="operator">=</span> <span class="keyword new">new</span> <span class="support class">Sonic</span>.<span class="support class">Database</span>.<span class="support class">Query</span>();'
+);
+
+RainbowTester.run(
+ 'test static class call',
+
+ 'var path = Sonic.App.getInstance();',
+
+ '<span class="keyword">var</span> path <span class="operator">=</span> Sonic.App.<span class="function call">getInstance</span>();'
+);
+
+RainbowTester.run(
+ 'type hint',
+
+ 'public static string getForUser(User user, Sort sort) {}',
+
+ '<span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">string</span> <span class="function call">getForUser</span>(User user, Sort sort) {}'
+);
+
+RainbowTester.run(
+ 'generics',
+
+ 'public IList&lt;string&gt; firstNames = new List&lt;string&gt;()',
+
+ '<span class="keyword">public</span> IList<span class="keyword operator">&lt;</span><span class="keyword">string</span><span class="keyword operator">&gt;</span> firstNames <span class="operator">=</span> <span class="keyword new">new</span> <span class="support class">List</span><span class="keyword operator">&lt;</span><span class="keyword">string</span><span class="keyword operator">&gt;</span>()'
+);
+
+RainbowTester.endTest('csharp');
View
73 themes/obsidian.css
@@ -0,0 +1,73 @@
+/**
+ * Obsidian theme
+ *
+ * Adapted from a theme based on:
+ * http://studiostyl.es/schemes/son-of-obsidian
+ *
+ * @author Dan Stewart <dan@stewshack.com>
+ * @version 1.0
+ */
+pre {
+ background: #22282A;
+ word-wrap: break-word;
+ margin: 0px;
+ padding: 0px;
+ padding: 10px;
+ color: #F1F2F3;
+ font-size: 14px;
+ margin-bottom: 20px;
+}
+
+pre, code {
+ font-family: 'Monaco', courier, monospace;
+}
+
+pre .comment {
+ color: #66747B;
+}
+
+pre .constant {
+ color: #EC7600;
+}
+
+pre .storage {
+ color: #EC7600;
+}
+
+pre .string, pre .comment.docstring {
+ color: #EC7600;
+}
+
+pre .string.regexp, pre .support.tag.script, pre .support.tag.style {
+ color: #fff;
+}
+
+
+pre .keyword, pre .selector {
+ color: #93C763;
+}
+
+pre .inherited-class {
+ font-style: italic;
+}
+
+pre .entity {
+ color: #93C763;
+}
+
+pre .integer {
+ color: #FFCD22;
+}
+
+pre .support, *[data-language="csharp"] .function.call {
+ color: #FACD22;
+}
+
+pre .variable.global, pre .variable.class, pre .variable.instance {
+ color: #CCC;
+}
+
+/* C# specific rule */
+pre .preprocessor {
+ color: #66747B;
+}
View
1 util/builder.py
@@ -14,6 +14,7 @@ def __init__(self, js_path, closure_path, theme_path=None):
self.versions = {
'c': '1.0.6',
+ 'csharp': '1.0',
'css': '1.0.7',
'generic': '1.0.8',
'html': '1.0.6',

0 comments on commit 4b8c7d7

Please sign in to comment.
Something went wrong with that request. Please try again.