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:
commit
5fb95ca184
3 changed files with 7 additions and 6 deletions
|
|
@ -96,13 +96,13 @@
|
||||||
"start"
|
"start"
|
||||||
],[
|
],[
|
||||||
"start",
|
"start",
|
||||||
["keyword.other.import.dart","#import"],
|
["keyword.other.import.dart","import"],
|
||||||
["text","("],
|
["text","("],
|
||||||
["string","\"http://dartwatch.com/myOtherLibrary.dart\""],
|
["string","\"http://dartwatch.com/myOtherLibrary.dart\""],
|
||||||
["text",");"]
|
["text",");"]
|
||||||
],[
|
],[
|
||||||
"start",
|
"start",
|
||||||
["keyword.other.import.dart","#import"],
|
["keyword.other.import.dart","import"],
|
||||||
["text","("],
|
["text","("],
|
||||||
["string","\"myOtherLibrary.dart\""],
|
["string","\"myOtherLibrary.dart\""],
|
||||||
["text",", "],
|
["text",", "],
|
||||||
|
|
|
||||||
|
|
@ -41,18 +41,19 @@ define(function(require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var oop = require("../lib/oop");
|
var oop = require("../lib/oop");
|
||||||
var TextMode = require("./text").Mode;
|
var CMode = require("./c_cpp").Mode;
|
||||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||||
var DartHighlightRules = require("./dart_highlight_rules").DartHighlightRules;
|
var DartHighlightRules = require("./dart_highlight_rules").DartHighlightRules;
|
||||||
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
var Mode = function() {
|
var Mode = function() {
|
||||||
|
CMode.call(this);
|
||||||
var highlighter = new DartHighlightRules();
|
var highlighter = new DartHighlightRules();
|
||||||
this.foldingRules = new CStyleFoldMode();
|
this.foldingRules = new CStyleFoldMode();
|
||||||
|
|
||||||
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
||||||
};
|
};
|
||||||
oop.inherits(Mode, TextMode);
|
oop.inherits(Mode, CMode);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
// Extra logic goes here.
|
// Extra logic goes here.
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ var DartHighlightRules = function() {
|
||||||
var constantLanguage = "true|false|null";
|
var constantLanguage = "true|false|null";
|
||||||
var variableLanguage = "this|super";
|
var variableLanguage = "this|super";
|
||||||
var keywordControl = "try|catch|finally|throw|break|case|continue|default|do|else|for|if|in|return|switch|while|new";
|
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 storageModifier = "static|final|const";
|
||||||
var storageType = "void|bool|num|int|double|Dynamic|var|String";
|
var storageType = "void|bool|num|int|double|Dynamic|var|String";
|
||||||
|
|
||||||
|
|
@ -52,7 +52,7 @@ var DartHighlightRules = function() {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
token: "keyword.other.import.dart",
|
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"],
|
token : ["keyword.other.import.dart", "text"],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue