xl.js 2.5 KB

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