Merge pull request #1358 from ajaxorg/dart-based-on-c

Based Dart mode on C/C++ mode so that at least the indentation basics
This commit is contained in:
Harutyun Amirjanyan 2013-04-08 04:52:55 -07:00
commit 5fb95ca184
3 changed files with 7 additions and 6 deletions

View file

@ -96,13 +96,13 @@
"start"
],[
"start",
["keyword.other.import.dart","#import"],
["keyword.other.import.dart","import"],
["text","("],
["string","\"http://dartwatch.com/myOtherLibrary.dart\""],
["text",");"]
],[
"start",
["keyword.other.import.dart","#import"],
["keyword.other.import.dart","import"],
["text","("],
["string","\"myOtherLibrary.dart\""],
["text",", "],

View file

@ -41,18 +41,19 @@ define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var CMode = require("./c_cpp").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var DartHighlightRules = require("./dart_highlight_rules").DartHighlightRules;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
CMode.call(this);
var highlighter = new DartHighlightRules();
this.foldingRules = new CStyleFoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
};
oop.inherits(Mode, TextMode);
oop.inherits(Mode, CMode);
(function() {
// Extra logic goes here.

View file

@ -13,7 +13,7 @@ var DartHighlightRules = function() {
var constantLanguage = "true|false|null";
var variableLanguage = "this|super";
var keywordControl = "try|catch|finally|throw|break|case|continue|default|do|else|for|if|in|return|switch|while|new";
var keywordDeclaration = "abstract|class|extends|external|factory|implements|interface|get|native|operator|set|typedef";
var keywordDeclaration = "abstract|class|extends|external|factory|implements|get|native|operator|set|typedef";
var storageModifier = "static|final|const";
var storageType = "void|bool|num|int|double|Dynamic|var|String";
@ -52,7 +52,7 @@ var DartHighlightRules = function() {
},
{
token: "keyword.other.import.dart",
regex: "#(?:\\b)(?:library|import|source|resource)(?:\\b)"
regex: "(?:\\b)(?:library|import|source|part|of)(?:\\b)"
},
{
token : ["keyword.other.import.dart", "text"],