mirror of
https://github.com/correl/melpa.git
synced 2024-12-01 03:00:08 +00:00
102 lines
2.9 KiB
JavaScript
102 lines
2.9 KiB
JavaScript
|
/*
|
||
|
Language: CSS
|
||
|
*/
|
||
|
|
||
|
hljs.LANGUAGES.css = function() {
|
||
|
var FUNCTION = {
|
||
|
className: 'function',
|
||
|
begin: hljs.IDENT_RE + '\\(', end: '\\)',
|
||
|
contains: [{
|
||
|
endsWithParent: true, excludeEnd: true,
|
||
|
contains: [hljs.NUMBER_MODE, hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE]
|
||
|
}]
|
||
|
};
|
||
|
return {
|
||
|
case_insensitive: true,
|
||
|
defaultMode: {
|
||
|
illegal: '[=/|\']',
|
||
|
contains: [
|
||
|
hljs.C_BLOCK_COMMENT_MODE,
|
||
|
{
|
||
|
className: 'id', begin: '\\#[A-Za-z0-9_-]+'
|
||
|
},
|
||
|
{
|
||
|
className: 'class', begin: '\\.[A-Za-z0-9_-]+',
|
||
|
relevance: 0
|
||
|
},
|
||
|
{
|
||
|
className: 'attr_selector',
|
||
|
begin: '\\[', end: '\\]',
|
||
|
illegal: '$'
|
||
|
},
|
||
|
{
|
||
|
className: 'pseudo',
|
||
|
begin: ':(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\"\\\']+'
|
||
|
},
|
||
|
{
|
||
|
className: 'at_rule',
|
||
|
begin: '@(font-face|page)',
|
||
|
lexems: '[a-z-]+',
|
||
|
keywords: {'font-face': 1, 'page': 1}
|
||
|
},
|
||
|
{
|
||
|
className: 'at_rule',
|
||
|
begin: '@', end: '[{;]', // at_rule eating first "{" is a good thing
|
||
|
// because it doesn't let it to be parsed as
|
||
|
// a rule set but instead drops parser into
|
||
|
// the defaultMode which is how it should be.
|
||
|
excludeEnd: true,
|
||
|
keywords: {'import': 1, 'page': 1, 'media': 1, 'charset': 1},
|
||
|
contains: [
|
||
|
FUNCTION,
|
||
|
hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE,
|
||
|
hljs.NUMBER_MODE
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
className: 'tag', begin: hljs.IDENT_RE,
|
||
|
relevance: 0
|
||
|
},
|
||
|
{
|
||
|
className: 'rules',
|
||
|
begin: '{', end: '}',
|
||
|
illegal: '[^\\s]',
|
||
|
relevance: 0,
|
||
|
contains: [
|
||
|
hljs.C_BLOCK_COMMENT_MODE,
|
||
|
{
|
||
|
className: 'rule',
|
||
|
begin: '[^\\s]', returnBegin: true, end: ';', endsWithParent: true,
|
||
|
contains: [
|
||
|
{
|
||
|
className: 'attribute',
|
||
|
begin: '[A-Z\\_\\.\\-]+', end: ':',
|
||
|
excludeEnd: true,
|
||
|
illegal: '[^\\s]',
|
||
|
starts: {
|
||
|
className: 'value',
|
||
|
endsWithParent: true, excludeEnd: true,
|
||
|
contains: [
|
||
|
FUNCTION,
|
||
|
hljs.NUMBER_MODE,
|
||
|
hljs.QUOTE_STRING_MODE,
|
||
|
hljs.APOS_STRING_MODE,
|
||
|
hljs.C_BLOCK_COMMENT_MODE,
|
||
|
{
|
||
|
className: 'hexcolor', begin: '\\#[0-9A-F]+'
|
||
|
},
|
||
|
{
|
||
|
className: 'important', begin: '!important'
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
};
|
||
|
}();
|