/*
Language: Context Free Design Grammar
Author: John Horigan <redacted>
Category: graphics
*/
function(hljs) {
var CFDG_KEYWORDS = {
keyword: 'startshape|10 rule shape|10 background include import tile path|10 loop clone ' +
'let finally if else switch case time timescale rotate r flip f size s skew x y z ' +
'transform trans hue h saturation sat brightness b alpha a ',
built_in: 'cos sin tan cot acos asin atan acot cosh sinh tanh acosh asinh atanh log log10 ' +
'sqrt exp abs floor ceiling infinity factorial sg isNatural bitnot bitor bitand bitxor ' +
'bitleft bitright atan2 mod divides div dot cross hsb2rgb rgb2hsb vec min max ftime ' +
'frame rand_static rand rand::exponential rand::gamma rand::weibull rand::extremeV ' +
'rand::normal rand::lognormal rand::chisquared rand::cauchy rand::fisherF ' +
'rand::studentT randint randint::bernoulli randint::binomial randint::negbinomial ' +
'randint::poisson randint::discrete randint::geometric'
};
return {
case_insensitive: false,
aliases: ['cfdg'],
lexemes: /[a-zA-Z][a-zA-Z0-9:_]*/,
keywords: CFDG_KEYWORDS,
contains: [
{
className: 'string',
begin: '"', end: '"',
illegal: '\\n\\r',
},
{
className: 'number',
begin: /(\b\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?/,
relevance: 0
},
{
className: 'strong',
begin: /\bCF::[a-zA-Z]+/,
relevance: 10
},
// This symbol definition conflicts with my keywords and built-ins
{
className: 'symbol',
begin: /\b[a-zA-Z_]([:a-zA-Z_0-9])*/,
relevance: 0
},
hljs.C_BLOCK_COMMENT_MODE,
hljs.C_LINE_COMMENT_MODE,
hljs.HASH_COMMENT_MODE,
]
};
}