166 lines
5.9 KiB
JavaScript
Executable File
166 lines
5.9 KiB
JavaScript
Executable File
/* ***** BEGIN LICENSE BLOCK *****
|
|
* Distributed under the BSD license:
|
|
*
|
|
* Copyright (c) 2012, Ajax.org B.V.
|
|
* All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions are met:
|
|
* * Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
* documentation and/or other materials provided with the distribution.
|
|
* * Neither the name of Ajax.org B.V. nor the
|
|
* names of its contributors may be used to endorse or promote products
|
|
* derived from this software without specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
*
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
/* This file was autogenerated from turtle.tmLanguage (uuid: ) */
|
|
/****************************************************************************************
|
|
* IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
|
|
* fileTypes *
|
|
****************************************************************************************/
|
|
|
|
define(function(require, exports, module) {
|
|
"use strict";
|
|
|
|
var oop = require("../lib/oop");
|
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
|
|
|
var TurtleHighlightRules = function() {
|
|
// regexp must not have capturing parentheses. Use (?:) instead.
|
|
// regexps are ordered -> the first match is used
|
|
|
|
this.$rules = {
|
|
start: [{
|
|
include: "#comments"
|
|
}, {
|
|
include: "#strings"
|
|
}, {
|
|
include: "#base-prefix-declarations"
|
|
}, {
|
|
include: "#string-language-suffixes"
|
|
}, {
|
|
include: "#string-datatype-suffixes"
|
|
}, {
|
|
include: "#relative-urls"
|
|
}, {
|
|
include: "#xml-schema-types"
|
|
}, {
|
|
include: "#rdf-schema-types"
|
|
}, {
|
|
include: "#owl-types"
|
|
}, {
|
|
include: "#qnames"
|
|
}, {
|
|
include: "#punctuation-operators"
|
|
}],
|
|
"#base-prefix-declarations": [{
|
|
token: "keyword.other.prefix.turtle",
|
|
regex: /@(?:base|prefix)/
|
|
}],
|
|
"#comments": [{
|
|
token: [
|
|
"punctuation.definition.comment.turtle",
|
|
"comment.line.hash.turtle"
|
|
],
|
|
regex: /(#)(.*$)/
|
|
}],
|
|
"#owl-types": [{
|
|
token: "support.type.datatype.owl.turtle",
|
|
regex: /owl:[a-zA-Z]+/
|
|
}],
|
|
"#punctuation-operators": [{
|
|
token: "keyword.operator.punctuation.turtle",
|
|
regex: /;|,|\.|\(|\)|\[|\]/
|
|
}],
|
|
"#qnames": [{
|
|
token: "entity.name.other.qname.turtle",
|
|
regex: /(?:[a-zA-Z][-_a-zA-Z0-9]*)?:(?:[_a-zA-Z][-_a-zA-Z0-9]*)?/
|
|
}],
|
|
"#rdf-schema-types": [{
|
|
token: "support.type.datatype.rdf.schema.turtle",
|
|
regex: /rdfs?:[a-zA-Z]+|(?:^|\s)a(?:\s|$)/
|
|
}],
|
|
"#relative-urls": [{
|
|
token: "string.quoted.other.relative.url.turtle",
|
|
regex: /</,
|
|
push: [{
|
|
token: "string.quoted.other.relative.url.turtle",
|
|
regex: />/,
|
|
next: "pop"
|
|
}, {
|
|
defaultToken: "string.quoted.other.relative.url.turtle"
|
|
}]
|
|
}],
|
|
"#string-datatype-suffixes": [{
|
|
token: "keyword.operator.datatype.suffix.turtle",
|
|
regex: /\^\^/
|
|
}],
|
|
"#string-language-suffixes": [{
|
|
token: [
|
|
"keyword.operator.language.suffix.turtle",
|
|
"constant.language.suffix.turtle"
|
|
],
|
|
regex: /(?!")(@)([a-z]+(?:\-[a-z0-9]+)*)/
|
|
}],
|
|
"#strings": [{
|
|
token: "string.quoted.triple.turtle",
|
|
regex: /"""/,
|
|
push: [{
|
|
token: "string.quoted.triple.turtle",
|
|
regex: /"""/,
|
|
next: "pop"
|
|
}, {
|
|
defaultToken: "string.quoted.triple.turtle"
|
|
}]
|
|
}, {
|
|
token: "string.quoted.double.turtle",
|
|
regex: /"/,
|
|
push: [{
|
|
token: "string.quoted.double.turtle",
|
|
regex: /"/,
|
|
next: "pop"
|
|
}, {
|
|
token: "invalid.string.newline",
|
|
regex: /$/
|
|
}, {
|
|
token: "constant.character.escape.turtle",
|
|
regex: /\\./
|
|
}, {
|
|
defaultToken: "string.quoted.double.turtle"
|
|
}]
|
|
}],
|
|
"#xml-schema-types": [{
|
|
token: "support.type.datatype.xml.schema.turtle",
|
|
regex: /xsd?:[a-z][a-zA-Z]+/
|
|
}]
|
|
};
|
|
|
|
this.normalizeRules();
|
|
};
|
|
|
|
TurtleHighlightRules.metaData = {
|
|
fileTypes: ["ttl", "nt"],
|
|
name: "Turtle",
|
|
scopeName: "source.turtle"
|
|
};
|
|
|
|
|
|
oop.inherits(TurtleHighlightRules, TextHighlightRules);
|
|
|
|
exports.TurtleHighlightRules = TurtleHighlightRules;
|
|
}); |