melpa/html/languages/smalltalk.js

56 lines
1.2 KiB
JavaScript
Raw Normal View History

/*
Language: Smalltalk
Author: Vladimir Gubarkov <xonixx@gmail.com>
*/
hljs.LANGUAGES.smalltalk = function() {
var VAR_IDENT_RE = '[a-z][a-zA-Z0-9_]*';
var CHAR = {
className: 'char',
begin: '\\$.{1}'
};
var SYMBOL = {
className: 'symbol',
begin: '#' + hljs.UNDERSCORE_IDENT_RE
};
return {
defaultMode: {
keywords: {'self': 1, 'super': 1, 'nil': 1, 'true': 1, 'false': 1, 'thisContext': 1}, // only 6
contains: [
{
className: 'comment',
begin: '"', end: '"',
relevance: 0
},
hljs.APOS_STRING_MODE,
{
className: 'class',
begin: '\\b[A-Z][A-Za-z0-9_]*',
relevance: 0
},
{
className: 'method',
begin: VAR_IDENT_RE + ':'
},
hljs.C_NUMBER_MODE,
SYMBOL,
CHAR,
{
className: 'localvars',
begin: '\\|\\s*((' + VAR_IDENT_RE + ')\\s*)+\\|'
},
{
className: 'array',
begin: '\\#\\(', end: '\\)',
contains: [
hljs.APOS_STRING_MODE,
CHAR,
hljs.C_NUMBER_MODE,
SYMBOL
]
}
]
}
};
}();