/*
  THIS FILE WAS AUTOGENERATED BY mode_highlight_rules.tmpl.js (UUID: 958518BC-799F-477A-99F9-5B28EBF230F6) */


define(function(require, exports, module) {
"use strict";

var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;

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 storageModifier = "static|final|const";
    var storageType = "void|bool|num|int|double|Dynamic|var|String";

    var keywordMapper = this.createKeywordMapper({
        "constant.language.dart": constantLanguage,
        "variable.language.dart": variableLanguage,
        "keyword.control.dart": keywordControl,
        "keyword.declaration.dart": keywordDeclaration,
        "storage.modifier.dart": storageModifier,
        "storage.type.primitive.dart": storageType
    }, "identifier");

    var stringfill = {
        token : "string",
        merge : true,
        regex : ".+"
    };

    // regexp must not have capturing parentheses. Use (?:) instead.
    // regexps are ordered -> the first match is used

    this.$rules = 
        {
    "start": [
        {
            "token" : "comment",
            "regex" : /\/\/.*$/
        },
        {
            "token" : "comment", // multi line comment
            "merge" : true,
            "regex" : /\/\*/,
            "next" : "comment"
        },
        {
            "token": ["meta.preprocessor.script.dart"],
            "regex": "^(#!.*)$"
        },
        {
            "token": [ "keyword.other.import.dart", "meta.declaration.dart"],
            "regex": "#(?:\\b)(?:library|import|source|resource)(?:\\b)"
        },
        {
            "token" : ["keyword.other.import.dart", "text"],
            "regex" : "(?:\\b)(prefix)(\\s*:)"
        },
        {
            "regex": "\\bas\\b",
            "token": "keyword.cast.dart"
        },
        {
            "regex": "\\?|:",
            "token": "keyword.control.ternary.dart"
        },
        {
            "regex": "(?:\\b)(is\\!?)(?:\\b)",
            "token": ["keyword.operator.dart"]
        },
        {
            "regex": "(<<|>>>?|~|\\^|\\||&)",
            "token": ["keyword.operator.bitwise.dart"]
        },
        {
            "regex": "((?:&|\\^|\\||<<|>>>?)=)",
            "token": ["keyword.operator.assignment.bitwise.dart"]
        },
        {
            "regex": "(===?|!==?|<=?|>=?)",
            "token": ["keyword.operator.comparison.dart"]
        },
        {
            "regex": "((?:[+*/%-]|\\~)=)",
            "token": ["keyword.operator.assignment.arithmetic.dart"]
        },
        {
            "regex": "=",
            "token": "keyword.operator.assignment.dart"
        },
        {
            "token" : "string",
            "merge" : true,
            "regex" : "'''",
            "next" : "qdoc"
        }, 
        {
            "token" : "string",
            "merge" : true,
            "regex" : '"""',
            "next" : "qqdoc"
        }, 
        {
            "token" : "string",
            "merge" : true,
            "regex" : "'",
            "next" : "qstring"
        }, 
        {
            "token" : "string",
            "merge" : true,
            "regex" : '"',
            "next" : "qqstring"
        }, 
        {
            "regex": "(\\-\\-|\\+\\+)",
            "token": ["keyword.operator.increment-decrement.dart"]
        },
        {
            "regex": "(\\-|\\+|\\*|\\/|\\~\\/|%)",
            "token": ["keyword.operator.arithmetic.dart"]
        },
        {
            "regex": "(!|&&|\\|\\|)",
            "token": ["keyword.operator.logical.dart"]
        },
        {
            "token" : "constant.numeric", // hex
            "regex" : "0[xX][0-9a-fA-F]+\\b"
        }, 
        {
            "token" : "constant.numeric", // float
            "regex" : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
        }, 
        {
            "token" : keywordMapper,
            "regex" : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
        }
    ],
    "comment" : [
        {
            token : "comment", // closing comment
            regex : ".*?\\*\\/",
            merge : true,
            next : "start"
        }, {
            token : "comment", // comment spanning whole line
            merge : true,
            regex : ".+"
        }
    ],
    "qdoc" : [
        {
            "token" : "string",
            "regex" : ".*?'''",
            "next" : "start"
        }, stringfill],

    "qqdoc" : [
        {
            "token" : "string",
            "regex" : '.*?"""',
            "next" : "start"
        }, stringfill],

    "qstring" : [
        {
            "token" : "string",
            "regex" : "[^\\\\']*(?:\\\\.[^\\\\']*)*'",
            "merge" : true,
            "next" : "start"
        }, stringfill],

    "qqstring" : [
        {
            "token" : "string",
            "regex" : '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',
            "merge" : true,
            "next" : "start"
        }, stringfill]
}

};

oop.inherits(DartHighlightRules, TextHighlightRules);

exports.DartHighlightRules = DartHighlightRules;
});
