xl.js (2536B)
1 /* 2 Language: XL 3 Author: Christophe de Dinechin <christophe@taodyne.com> 4 Description: An extensible programming language, based on parse tree rewriting 5 Website: http://xlr.sf.net 6 */ 7 8 function xl(hljs) { 9 var BUILTIN_MODULES = 10 'ObjectLoader Animate MovieCredits Slides Filters Shading Materials LensFlare Mapping VLCAudioVideo ' + 11 'StereoDecoder PointCloud NetworkAccess RemoteControl RegExp ChromaKey Snowfall NodeJS Speech Charts'; 12 13 var XL_KEYWORDS = { 14 $pattern: /[a-zA-Z][a-zA-Z0-9_?]*/, 15 keyword: 16 'if then else do while until for loop import with is as where when by data constant ' + 17 'integer real text name boolean symbol infix prefix postfix block tree', 18 literal: 19 'true false nil', 20 built_in: 21 'in mod rem and or xor not abs sign floor ceil sqrt sin cos tan asin ' + 22 'acos atan exp expm1 log log2 log10 log1p pi at text_length text_range ' + 23 'text_find text_replace contains page slide basic_slide title_slide ' + 24 'title subtitle fade_in fade_out fade_at clear_color color line_color ' + 25 'line_width texture_wrap texture_transform texture scale_?x scale_?y ' + 26 'scale_?z? translate_?x translate_?y translate_?z? rotate_?x rotate_?y ' + 27 'rotate_?z? rectangle circle ellipse sphere path line_to move_to ' + 28 'quad_to curve_to theme background contents locally time mouse_?x ' + 29 'mouse_?y mouse_buttons ' + 30 BUILTIN_MODULES 31 }; 32 33 var DOUBLE_QUOTE_TEXT = { 34 className: 'string', 35 begin: '"', end: '"', illegal: '\\n' 36 }; 37 var SINGLE_QUOTE_TEXT = { 38 className: 'string', 39 begin: '\'', end: '\'', illegal: '\\n' 40 }; 41 var LONG_TEXT = { 42 className: 'string', 43 begin: '<<', end: '>>' 44 }; 45 var BASED_NUMBER = { 46 className: 'number', 47 begin: '[0-9]+#[0-9A-Z_]+(\\.[0-9-A-Z_]+)?#?([Ee][+-]?[0-9]+)?' 48 }; 49 var IMPORT = { 50 beginKeywords: 'import', end: '$', 51 keywords: XL_KEYWORDS, 52 contains: [DOUBLE_QUOTE_TEXT] 53 }; 54 var FUNCTION_DEFINITION = { 55 className: 'function', 56 begin: /[a-z][^\n]*->/, returnBegin: true, end: /->/, 57 contains: [ 58 hljs.inherit(hljs.TITLE_MODE, {starts: { 59 endsWithParent: true, 60 keywords: XL_KEYWORDS 61 }}) 62 ] 63 }; 64 return { 65 name: 'XL', 66 aliases: ['tao'], 67 keywords: XL_KEYWORDS, 68 contains: [ 69 hljs.C_LINE_COMMENT_MODE, 70 hljs.C_BLOCK_COMMENT_MODE, 71 DOUBLE_QUOTE_TEXT, 72 SINGLE_QUOTE_TEXT, 73 LONG_TEXT, 74 FUNCTION_DEFINITION, 75 IMPORT, 76 BASED_NUMBER, 77 hljs.NUMBER_MODE 78 ] 79 }; 80 } 81 82 module.exports = xl;