Created
August 13, 2014 00:19
-
-
Save pronvit/c20e3577fd2f9683a144 to your computer and use it in GitHub Desktop.
Ace editor syntax highlighting for Dwarf Fortress config files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(function(require, exports, module) { | |
"use strict"; | |
var oop = require("../lib/oop"); | |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; | |
var DFHighlightRules = function() { | |
this.$rules = { | |
"start": [ | |
{ | |
token: "paren.lparen", | |
regex: "\\s*\\[", | |
next: "inside", | |
}, | |
{ | |
token: "comment", | |
regex: ".*$" | |
}, | |
], | |
"inside": [ | |
{ | |
token: "paren.rparen", | |
regex: "]", | |
next: "start" | |
}, | |
{ | |
token: ['constant.other', "constant.numeric"], | |
regex: "(:)([+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b)" | |
}, | |
{ | |
token: ['constant.other', 'constant'], | |
regex: /(:)([A-Z_0-9]+)(?=[:\]])/ | |
}, | |
{ | |
token: ['constant.other', 'string'], | |
regex: /(:)([^:\]]+)/ | |
}, | |
{ | |
token: ['constant.language'], | |
regex: /([a-zA-Z_0-9]+)/ | |
}, | |
] | |
}; | |
}; | |
oop.inherits(DFHighlightRules, TextHighlightRules); | |
exports.DFHighlightRules = DFHighlightRules; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment