123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- /*
- Language: XL
- Author: Christophe de Dinechin <christophe@taodyne.com>
- Description: An extensible programming language, based on parse tree rewriting
- Website: http://xlr.sf.net
- */
- function xl(hljs) {
- const KWS = [
- "if",
- "then",
- "else",
- "do",
- "while",
- "until",
- "for",
- "loop",
- "import",
- "with",
- "is",
- "as",
- "where",
- "when",
- "by",
- "data",
- "constant",
- "integer",
- "real",
- "text",
- "name",
- "boolean",
- "symbol",
- "infix",
- "prefix",
- "postfix",
- "block",
- "tree"
- ];
- const BUILT_INS = [
- "in",
- "mod",
- "rem",
- "and",
- "or",
- "xor",
- "not",
- "abs",
- "sign",
- "floor",
- "ceil",
- "sqrt",
- "sin",
- "cos",
- "tan",
- "asin",
- "acos",
- "atan",
- "exp",
- "expm1",
- "log",
- "log2",
- "log10",
- "log1p",
- "pi",
- "at",
- "text_length",
- "text_range",
- "text_find",
- "text_replace",
- "contains",
- "page",
- "slide",
- "basic_slide",
- "title_slide",
- "title",
- "subtitle",
- "fade_in",
- "fade_out",
- "fade_at",
- "clear_color",
- "color",
- "line_color",
- "line_width",
- "texture_wrap",
- "texture_transform",
- "texture",
- "scale_?x",
- "scale_?y",
- "scale_?z?",
- "translate_?x",
- "translate_?y",
- "translate_?z?",
- "rotate_?x",
- "rotate_?y",
- "rotate_?z?",
- "rectangle",
- "circle",
- "ellipse",
- "sphere",
- "path",
- "line_to",
- "move_to",
- "quad_to",
- "curve_to",
- "theme",
- "background",
- "contents",
- "locally",
- "time",
- "mouse_?x",
- "mouse_?y",
- "mouse_buttons"
- ];
- const BUILTIN_MODULES = [
- "ObjectLoader",
- "Animate",
- "MovieCredits",
- "Slides",
- "Filters",
- "Shading",
- "Materials",
- "LensFlare",
- "Mapping",
- "VLCAudioVideo",
- "StereoDecoder",
- "PointCloud",
- "NetworkAccess",
- "RemoteControl",
- "RegExp",
- "ChromaKey",
- "Snowfall",
- "NodeJS",
- "Speech",
- "Charts"
- ];
- const LITERALS = [
- "true",
- "false",
- "nil"
- ];
- const KEYWORDS = {
- $pattern: /[a-zA-Z][a-zA-Z0-9_?]*/,
- keyword: KWS,
- literal: LITERALS,
- built_in: BUILT_INS.concat(BUILTIN_MODULES)
- };
- const DOUBLE_QUOTE_TEXT = {
- className: 'string',
- begin: '"',
- end: '"',
- illegal: '\\n'
- };
- const SINGLE_QUOTE_TEXT = {
- className: 'string',
- begin: '\'',
- end: '\'',
- illegal: '\\n'
- };
- const LONG_TEXT = {
- className: 'string',
- begin: '<<',
- end: '>>'
- };
- const BASED_NUMBER = {
- className: 'number',
- begin: '[0-9]+#[0-9A-Z_]+(\\.[0-9-A-Z_]+)?#?([Ee][+-]?[0-9]+)?'
- };
- const IMPORT = {
- beginKeywords: 'import',
- end: '$',
- keywords: KEYWORDS,
- contains: [ DOUBLE_QUOTE_TEXT ]
- };
- const FUNCTION_DEFINITION = {
- className: 'function',
- begin: /[a-z][^\n]*->/,
- returnBegin: true,
- end: /->/,
- contains: [
- hljs.inherit(hljs.TITLE_MODE, { starts: {
- endsWithParent: true,
- keywords: KEYWORDS
- } })
- ]
- };
- return {
- name: 'XL',
- aliases: [ 'tao' ],
- keywords: KEYWORDS,
- contains: [
- hljs.C_LINE_COMMENT_MODE,
- hljs.C_BLOCK_COMMENT_MODE,
- DOUBLE_QUOTE_TEXT,
- SINGLE_QUOTE_TEXT,
- LONG_TEXT,
- FUNCTION_DEFINITION,
- IMPORT,
- BASED_NUMBER,
- hljs.NUMBER_MODE
- ]
- };
- }
- export { xl as default };
|