Add Dart support

This commit is contained in:
Garen Torikian 2012-11-10 14:59:53 -08:00 • committed by nightwing
commit 5f7884657a
8 changed files with 317 additions and 4 deletions

View file

@ -72,6 +72,7 @@ var docs = {
"docs/cpp.cpp": "C/C++",
"docs/csharp.cs": "C#",
"docs/css.css": "CSS",
"docs/dart.dart": "Dart",
"docs/diff.diff": "Diff",
"docs/glsl.glsl": "Glsl",
"docs/golang.go": "Go",

View file

@ -0,0 +1,58 @@
main() {
print('Hello World!');
}
int fib(int n) => (n > 1) ? (fib(n - 1) + fib(n - 2)) : n;
main() {
print('fib(20) = ${fib(20)}');
}
/*asd
asdad
*/
0.67
77
.86
#import("http://dartwatch.com/myOtherLibrary.dart");
#import("myOtherLibrary.dart", prefix:"lib1");
"""asdasdads
asdadsadsasd
asdasdasdad"""
'23424'
0x234
foo is bar
int x = 4 << 10
// Create a class for Point.
class Point {
// Final variables cannot be changed once they are assigned.
// Create two instance variables.
final num x, y;
// A constructor, with syntactic sugar for setting instance variables.
Point(this.x, this.y);
// A named constructor with an initializer list.
Point.origin() : x = 0, y = 0;
// A method.
num distanceTo(Point other) {
var dx = x - other.x;
var dy = y - other.y;
return sqrt(dx * dx + dy * dy);
}
}
// Check for null.
var unicorn;
assert(unicorn == null);
// Check for NaN.
var iMeantToDoThis = 0/0;
assert(iMeantToDoThis.isNaN());

View file

@ -41,6 +41,7 @@ var modesByName = {
coldfusion: ["ColdFusion" , "cfm"],
csharp: ["C#" , "cs"],
css: ["CSS" , "css"],
dart: ["Dart" , "dart"],
diff: ["Diff" , "diff|patch"],
glsl: ["Glsl" , "glsl|frag|vert"],
golang: ["Go" , "go"],