fix c and stylus highlighters

This commit is contained in:
nightwing 2012-12-25 16:56:31 +04:00
commit 0c79b239b6
6 changed files with 178 additions and 34 deletions

2
build

@ -1 +1 @@
Subproject commit 9f433321a8cca9270753842c2517bd3588354dfe
Subproject commit 97bae1d132effbeca5eef8aaef2a2a1fa836b181

View file

@ -13,10 +13,94 @@
"state": "start",
"data": [
[ "keyword", "#include" ],
[ "text", " " ],
[ "constant", "<iostream>" ]
[ "constant.other", " <iostream>" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "directive",
"data": [
[ "keyword", "#include" ],
[ "constant.other.multiline", " \\" ]
]
},
{
"state": "start",
"data": [
[ "constant.other", " <iostream>" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "directive",
"data": [
[ "keyword", "#include" ],
[ "constant.other.multiline", " \\" ]
]
},
{
"state": "directive",
"data": [
[ "constant.other.multiline", " \\" ]
]
},
{
"state": "start",
"data": [
[ "constant.other", " <iostream>" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "directive",
"data": [
[ "keyword", "#include" ],
[ "constant.other.multiline", " \\" ]
]
},
{
"state": "directive",
"data": [
[ "constant.other.multiline", " \\" ]
]
},
{
"state": "start",
"data": [
[ "constant.other", " \"iostream\"" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "#include" ],
[ "constant.other", " <boost/asio/io_service.hpp>" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "#include" ],
[ "constant.other", " \"boost/asio/io_service.hpp\"" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
@ -105,6 +189,32 @@
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "#if" ],
[ "constant.other", " VERBOSE >= 2" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "prints" ],
[ "paren.lparen", "(" ],
[ "string", "\"trace message\"" ],
[ "paren.rparen", ")" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "#endif" ]
]
},
{
"state": "start",
"data": [
@ -120,5 +230,49 @@
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "comment", "/*" ],
[ "comment", " Print an error message and get out */" ]
]
},
{
"state": "directive",
"data": [
[ "keyword", "#define" ],
[ "constant.other.multiline", " ABORT \\" ]
]
},
{
"state": "directive",
"data": [
[ "constant.other.multiline", " do { \\" ]
]
},
{
"state": "directive",
"data": [
[ "constant.other.multiline", " print( \"Abort\\n\" ); \\" ]
]
},
{
"state": "directive",
"data": [
[ "constant.other.multiline", " exit(8); \\" ]
]
},
{
"state": "start",
"data": [
[ "constant.other", "} while (0) " ],
[ "comment", "/*" ],
[ "comment", " Note: No semicolon */" ]
]
}
]

View file

@ -618,8 +618,7 @@
"state": "start",
"data": [
[ "keyword", "#import" ],
[ "text", " " ],
[ "constant", "<stdio.h>" ]
[ "constant.other", " <stdio.h>" ]
]
},
{
@ -991,19 +990,14 @@
"state": "start",
"data": [
[ "keyword", "#ifndef" ],
[ "text", " " ],
[ "constant.language.objc", "Nil" ]
[ "constant.other", " Nil" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "#define" ],
[ "text", " " ],
[ "constant.language.objc", "Nil" ],
[ "text", " " ],
[ "identifier", "__DARWIN_NULL" ],
[ "text", " " ],
[ "constant.other", " Nil __DARWIN_NULL " ],
[ "comment", "/*" ],
[ "comment", " id of Nil class */" ]
]

View file

@ -207,8 +207,8 @@
[ "constant.numeric", "1" ],
[ "keyword", "px" ],
[ "text", " " ],
[ "keyword", "s" ],
[ "text", "olid grayLighter" ]
[ "support.constant", "solid" ],
[ "text", " grayLighter" ]
]
},
{
@ -295,8 +295,7 @@
[ "text", " " ],
[ "support.type", "display" ],
[ "text", ": " ],
[ "keyword", "in" ],
[ "support.constant", "line" ]
[ "support.constant", "inline" ]
]
},
{
@ -323,8 +322,7 @@
[ "text", " " ],
[ "support.type", "display" ],
[ "text", " " ],
[ "keyword", "in" ],
[ "support.constant", "line" ]
[ "support.constant", "inline" ]
]
},
{
@ -356,8 +354,7 @@
[ "text", " " ],
[ "support.type", "display" ],
[ "text", " " ],
[ "keyword", "in" ],
[ "support.constant", "line" ]
[ "support.constant", "inline" ]
]
},
{
@ -410,7 +407,7 @@
{
"state": "start",
"data": [
[ "text", " " ],
[ "text", " " ],
[ "keyword.control.stylus", "!important" ]
]
},
@ -421,7 +418,7 @@
{
"state": "start",
"data": [
[ "text", " " ],
[ "text", " " ],
[ "keyword.control.stylus", "unless" ]
]
}

View file

@ -85,11 +85,11 @@ var c_cppHighlightRules = function() {
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
}, {
token : "keyword", // pre-compiler directives
regex : "(?:#include|#import|#pragma|#line|#define|#undef|#if|#ifdef|#else|#elif|#ifndef)",
regex : "(?:#include|#import|#pragma|#line|#define|#undef|#if|#ifdef|#else|#elif|#ifndef)\\b",
next : "directive"
}, {
token : "keyword", // special case pre-compiler directive
regex : "(?:#endif)"
regex : "(?:#endif)\\b"
}, {
token : "support.function.C99.c",
regex : cFunctions

View file

@ -21,8 +21,7 @@ var StylusHighlightRules = function() {
"support.constant.fonts": CssHighlightRules.supportConstantFonts
}, "text", true);
this.$rules =
{
this.$rules = {
"start": [
{
token : "comment",
@ -82,16 +81,16 @@ var StylusHighlightRules = function() {
"regex": "-webkit-|-moz\\-|-ms-|-o-"
},
{
"token": ["keyword.control.stylus"],
"regex": "(?:\\b|\\s)(!important|for|in|return|true|false|null|if|else|unless|return)(?:\\b)"
"token": "keyword.control.stylus",
"regex": "(?:!important|for|in|return|true|false|null|if|else|unless|return)\\b"
},
{
"token": ["keyword.operator.stylus"],
"regex": "((?:!|~|\\+|-|(?:\\*)?\\*|\\/|%|(?:\\.)\\.\\.|<|>|(?:=|:|\\?|\\+|-|\\*|\\/|%|<|>)?=|!=))"
"token": "keyword.operator.stylus",
"regex": "!|~|\\+|-|(?:\\*)?\\*|\\/|%|(?:\\.)\\.\\.|<|>|(?:=|:|\\?|\\+|-|\\*|\\/|%|<|>)?=|!="
},
{
"token": ["keyword.operator.stylus"],
"regex": "(?:\\b)(in|is(?:nt)?|not)(?:\\b)"
"token": "keyword.operator.stylus",
"regex": "(?:in|is(?:nt)?|not)\\b"
},
{
token : "string",
@ -107,8 +106,8 @@ var StylusHighlightRules = function() {
regex : CssHighlightRules.numRe
},
{
token : ["keyword"],
regex : "(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
token : "keyword",
regex : "(?:ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\\b"
},
{
token : keywordMapper,