diff options
author | Martin Nordholts <enselic@gmail.com> | 2021-10-23 11:27:59 +0200 |
---|---|---|
committer | Martin Nordholts <enselic@gmail.com> | 2021-10-23 13:35:32 +0200 |
commit | 6eb2cc9caccbf45bb1d3b4f404ff4ee825ec4dcf (patch) | |
tree | bffae0fa13c6ac199f9346d50c7bb4c31fe6ce93 | |
parent | f28d9db3d0903dfa6ecbaf9fae6e3e4605c6f33d (diff) |
Add LiveScript syntax
The file `LiveScript.sublime-syntax` is a pure export from a licenced version
of Sublime Text, Version 3.1.1, Build 3176 with
assets/syntaxes/02_Extra/LiveScript/Syntaxes/LiveScript.tmLanguage as the source
file.
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | CHANGELOG.md | 1 | ||||
m--------- | assets/syntaxes/02_Extra/LiveScript | 0 | ||||
-rw-r--r-- | assets/syntaxes/02_Extra/LiveScript.sublime-syntax | 400 | ||||
-rw-r--r-- | tests/syntax-tests/highlighted/LiveScript/livescript-demo.ls | 83 | ||||
-rw-r--r-- | tests/syntax-tests/source/LiveScript/LICENSE.md | 23 | ||||
-rw-r--r-- | tests/syntax-tests/source/LiveScript/livescript-demo.ls | 83 |
7 files changed, 593 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules index 2426d305..6a8f3c40 100644 --- a/.gitmodules +++ b/.gitmodules @@ -203,6 +203,9 @@ [submodule "assets/syntaxes/02_Extra/Lean"] path = assets/syntaxes/02_Extra/Lean url = https://github.com/leanprover/vscode-lean.git +[submodule "assets/syntaxes/02_Extra/LiveScript"] + path = assets/syntaxes/02_Extra/LiveScript + url = https://github.com/paulmillr/LiveScript.tmbundle [submodule "assets/syntaxes/02_Extra/Zig"] path = assets/syntaxes/02_Extra/Zig url = https://github.com/ziglang/sublime-zig-language.git diff --git a/CHANGELOG.md b/CHANGELOG.md index a8b38ee7..b0ab9534 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ - Syslog highlighting improvements, see #1793 (@scop) - Added support for `slim` syntax, see #1693 (@mfinelli) - Racket, see #1884 (@jubnzv) +- LiveScript, see #1915 (@Enselic) ## New themes diff --git a/assets/syntaxes/02_Extra/LiveScript b/assets/syntaxes/02_Extra/LiveScript new file mode 160000 +Subproject 25750138511925b74da9508050c766f36061805 diff --git a/assets/syntaxes/02_Extra/LiveScript.sublime-syntax b/assets/syntaxes/02_Extra/LiveScript.sublime-syntax new file mode 100644 index 00000000..24f27d68 --- /dev/null +++ b/assets/syntaxes/02_Extra/LiveScript.sublime-syntax @@ -0,0 +1,400 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: LiveScript +comment: "LiveScript Syntax: version 1" +file_extensions: + - ls + - Slakefile + - ls.erb +first_line_match: ^#!.*\bls +scope: source.livescript +contexts: + main: + - match: |- + (?x) + !?[~-]{1,2}>\*? + |<[~-]{1,2}!? + |\(\s* (?= instanceof[\s)]|and[\s)]|or[\s)]|is[\s)]|isnt[\s)]|in[\s)]|import[\s)]|import\ all[\s)] |\.|[-+/*%^&<>=|][\b\s)\w$]|\*\*|\%\%) + | (?<=[\s(]instanceof|[\s(]and|[\s(]or|[\s(]is|[\s(]isnt|[\s(]in|[\s(]import|[\s(]import\ all|[\s(]do|\.|\*\*|\%\%|[\b\s(\w$][-+/*%^&<>=|]) \s*\) + scope: storage.type.function.livescript + - match: \/\* + captures: + 0: punctuation.definition.comment.livescript + push: + - meta_scope: comment.block.livescript + - match: \*\/ + captures: + 0: punctuation.definition.comment.livescript + pop: true + - match: '@\w*' + scope: storage.type.annotation.livescriptscript + - match: '(#)(?!\{).*$\n?' + scope: comment.line.number-sign.livescript + captures: + 1: punctuation.definition.comment.livescript + - match: '((?:!|~|!~|~!)?function\*?)\s+([$\w\-]*[$\w]+)' + captures: + 1: storage.type.function.livescript + 2: entity.name.function.livescript + - match: (new)\s+(\w+(?:\.\w*)*) + captures: + 1: keyword.operator.new.livescript + 2: entity.name.type.instance.livescript + - match: \b(package|private|protected|public|interface|enum|static)(?!-)\b + scope: keyword.illegal.livescript + - match: "'''" + captures: + 0: punctuation.definition.string.begin.livescript + push: + - meta_scope: string.quoted.heredoc.livescript + - match: "'''" + captures: + 0: punctuation.definition.string.end.livescript + pop: true + - match: '"""' + captures: + 0: punctuation.definition.string.begin.livescript + push: + - meta_scope: string.quoted.double.heredoc.livescript + - match: '"""' + captures: + 0: punctuation.definition.string.end.livescript + pop: true + - match: \\. + scope: constant.character.escape.livescript + - include: interpolated_livescript + - match: "``" + captures: + 0: punctuation.definition.string.begin.livescript + push: + - meta_scope: string.quoted.script.livescript + - match: "``" + captures: + 0: punctuation.definition.string.end.livescript + pop: true + - match: '\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)' + scope: constant.character.escape.livescript + - match: '<\[' + push: + - meta_scope: string.array-literal.livescript + - match: '\]>' + pop: true + - match: '/{2}(?![\s=/*+{}?]).*?[^\\]/[igmy]{0,4}(?![a-zA-Z0-9])/{2}' + scope: string.regexp.livescript + - match: '/{2}\n' + push: + - meta_scope: string.regexp.livescript + - match: "/{2}[imgy]{0,4}" + pop: true + - include: embedded_spaced_comment + - include: interpolated_livescript + - match: "/{2}" + push: + - meta_scope: string.regexp.livescript + - match: "/{2}[imgy]{0,4}" + pop: true + - match: '\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)' + scope: constant.character.escape.livescript + - include: interpolated_livescript + - match: '/(?![\s=/*+{}?]).*?[^\\]/[igmy]{0,4}(?![a-zA-Z0-9])' + scope: string.regexp.livescript + - match: |- + (?x) + \b(?<![\.\$\-@])( + instanceof|new|delete|typeof|and|or|is|isnt|not + )(?!\-|\s*:)\b + scope: keyword.operator.livescript + - match: <\||\|> + scope: keyword.operator.livescript + - match: "=>" + scope: keyword.control.livescript + - match: |- + (?x) + \b(?<![\.\$\-@])(?: + return|break|continue|throw + |try|if|while|for|for\s+own|switch|unless|until + |catch|finally|else|nobreak|case|default|fallthrough|when|otherwise|then + |yield + )(?!\-|\s*:)\b + scope: keyword.control.livescript + - match: |- + (?x) + and=|or=|%|&|\^|\*|\/|(?<![a-zA-Z$_])(\-)?\-(?!\-?>)|\+\+|\+| + ~(?!~?>)|==|=|!=|<=|>=|<<=|>>=| + >>>=|<>|<(?!\[)|(?<!\])>|(?<!\w)!(?!([~\-]+)?>)|&&|\.\.(\.)?|\s\.\s|\?|\|\||\:|\*=|(?<!\()/=|%=|\+=|\-=|\.=|&= + |\^= + scope: keyword.operator.livescript + - match: |- + (?x) + \b(?<![\.\$\-@])(?: + function + )(?!\-|\s*:)\b + scope: storage.type.function.livescript + - match: |- + (?x) + \b(?<![\.\$\-@])(?: + this|throw|then|try|typeof!?|til|to + |continue|const|case|catch|class + |in|instanceof|import|import\s+all|implements|if|is + |default|delete|debugger|do + |for|for\s+own|finally|function|from|fallthrough + |super|switch + |else|nobreak|extends|export|eval + |and|arguments + |new|not + |unless|until + |while|with|when + |of|or|otherwise + |let|var|loop + |match + |by|yield + )(?!\-|\s*:)\b + scope: keyword.other.livescript + - match: '([a-zA-Z\$_](?:[\w$.-])*)\s*(?!\::)((:)|(=(?!>)))\s*(?!(\s*!?\s*\(.*\))?\s*(!?[~-]{1,2}>\*?))' + captures: + 1: variable.assignment.livescript + 3: punctuation.separator.key-value, keyword.operator.livescript + 4: keyword.operator.livescript + - match: '(?<=\s|^)([\[\{])(?=.*?[\]\}]\s+[:=])' + captures: + 0: keyword.operator.livescript + push: + - meta_scope: meta.variable.assignment.destructured.livescript + - match: '([\]\}]\s*[:=])' + captures: + 0: keyword.operator.livescript + pop: true + - include: variable_name + - include: instance_variable + - include: single_quoted_string + - include: double_quoted_string + - include: numeric + - match: |- + (?x) + (\s*) + (?=[a-zA-Z\$_]) + ([a-zA-Z\$_]([\w$.:-])*)\s* + (?=[:=](\s*!?\s*\(.*\))?\s*(!?[~-]{1,2}>\*?)) + scope: meta.function.livescript + captures: + 2: entity.name.function.livescript + 3: entity.name.function.livescript + 4: variable.parameter.function.livescript + 5: storage.type.function.livescript + - match: \b(?<!\.)(true|on|yes)(?!\s*:)\b + scope: constant.language.boolean.true.livescript + - match: \b(?<!\.)(false|off|no)(?!\s*:)\b + scope: constant.language.boolean.false.livescript + - match: \b(?<!\.)(null|void)(?!\s*:)\b + scope: constant.language.null.livescript + - match: \b(?<!\.)(super|this|extends)(?!\s*:)\b + scope: variable.language.livescript + - match: '(class\b)\s+(@?[a-zA-Z$_][\w$.-]*)?(?:\s+(extends)\s+(@?[a-zA-Z$_][\w$.-]*))?' + scope: meta.class.livescript + captures: + 1: storage.type.class.livescript + 2: entity.name.type.class.livescript + 3: keyword.control.inheritance.livescript + 4: entity.other.inherited-class.livescript + - match: \b(debugger|\\)\b + scope: keyword.other.livescript + - match: |- + (?x)\b( + Array|ArrayBuffer|Blob|Boolean|Date|document|event|Function| + Int(8|16|32|64)Array|Math|Map|Number| + Object|Proxy|RegExp|Set|String|WeakMap| + window|Uint(8|16|32|64)Array|XMLHttpRequest + )\b + scope: support.class.livescript + - match: \b(console)\b + scope: entity.name.type.object.livescript + - match: \b(Infinity|NaN|undefined)\b + scope: constant.language.livescript + - match: \; + scope: punctuation.terminator.statement.livescript + - match: ',[ |\t]*' + scope: meta.delimiter.object.comma.livescript + - match: \. + scope: meta.delimiter.method.period.livescript + - match: '\{|\}' + scope: meta.brace.curly.livescript + - match: \(|\) + scope: meta.brace.round.livescript + - match: '\[|\]\s*' + scope: meta.brace.square.livescript + - include: instance_variable + - include: backslash_string + - include: single_quoted_string + - include: double_quoted_string + - include: numeric + - match: '()(@|@@|[$\w\-]*[$\w]+)\s*(`)' + captures: + 1: keyword.operator.livescript + 2: meta.function-call.livescript + 3: keyword.operator.livescript + - match: "`" + scope: keyword.operator.livescript + - match: '()(@|@@|[$\w\-]*[$\w]+)(?:(\??\!)|[(])' + captures: + 1: keyword.operator.livescript + 2: meta.function-call.livescript + 3: keyword.operator.livescript + - match: '(@|@@|[$\w\-]*[$\w]+)(\?)? (?!\s*(((by|of|and|or|with|when|unless|if|is|isnt|else|nobreak|for|from|not in|in|catch|til|to|then|import|extends|implements|instanceof)\b)|[=:.*\/+\-%\^<>][ =)]|[`}%*)]|/(?!.*?/)|&&|[.][^.]|=>|\/ +|\||\|\||\-\-|\+\+|\|>|<|\||$|\n|\#|/\*))' + captures: + 1: meta.function-call.livescript + 2: keyword.operator.livescript + - match: \| _ + scope: keyword.control.livescript + - match: '\|(?![.])' + scope: keyword.control.livescript + - match: \| + scope: keyword.operator.livescript + - match: ((?<=console\.)(debug|warn|info|log|error|time(End|-end)|assert))\b + scope: support.function.console.livescript + - match: |- + (?x)\b( + decodeURI(Component)?|encodeURI(Component)?|eval|parse(Float|Int)|require + )\b + scope: support.function.livescript + - match: |- + (?x)(?<![.-])\b( + map|filter|reject|partition|find|each|head|tail|last|initial|empty| + values|keys|length|cons|append|join|reverse|fold(l|r)?1?|unfoldr| + and(List|-list)|or(List|-list)|any|all|unique|sum|product|mean|compact| + concat(Map|-map)?|maximum|minimum|scan(l|r)?1?|replicate|slice|apply| + split(At|-at)?|take(While|-while)?|drop(While|-while)?|span|first| + break(It|-it)|list(ToObj|-to-obj)|obj(ToFunc|-to-func)| + pairs(ToObj|-to-obj)|obj(ToPairs|-to-pairs|ToLists|-to-lists)| + zip(All|-all)?(With|-with)?|compose|curry|partial|flip|fix| + sort(With|-with|By|-by)?|group(By|-by)|break(List|-list|Str|-str)| + difference|intersection|union|average|flatten|chars|unchars|repeat| + lines|unlines|words|unwords|max|min|negate|abs|signum|quot|rem|div|mod| + recip|pi|tau|exp|sqrt|ln|pow|sin|cos|tan|asin|acos|atan|atan2|truncate| + round|ceiling|floor|is(It|-it)NaN|even|odd|gcd|lcm|disabled__id + )\b(?![.-]) + comment: | + Generated by DOM query from http://gkz.github.com/prelude-ls/: + [].slice + .call(document.querySelectorAll(".nav-pills li a")) + .map(function(_) {return _.innerText}) + .filter(function(_) {return _.trim() !== '}) + .slice(2) + .join("|") + scope: support.function.prelude.livescript + - match: '(?x)(?<![.-])\b(that|it|e|_)\b' + scope: support.function.semireserved.livescript + - match: |- + (?x)((?<=(\.|\]|\)))( + apply|call|concat|every|filter|for(Each|-each)| + from|has(Own|-own)(Property|-property)|index(Of|-of)| + is(Prototype|-prototype)(Of|-of)|join|last(Index|-index)(Of|-of)| + map|of|pop|property(Is|-is)(Enumerable|-enumerable)|push| + reduce(Right|-right)?|reverse|shift|slice|some|sort| + splice|to(Locale|-locale)?(String|-string)|unshift|valueOf + ))\b(?!-) + scope: support.function.method.array.livescript + - match: |- + (?x)((?<=Array\.)( + isArray + ))\b + scope: support.function.static.array.livescript + - match: |- + (?x)((?<=Object\.)( + create|define(Propert|-propert)(ies|y)|freeze| + get(Own|-own)(Property|-property)(Descriptors?|Names)| + get(Property|-property)(Descriptor|Names)|getPrototypeOf| + is((Extensible|-extensible)|(Frozen|-frozen)|(Sealed|-sealed))?| + keys|prevent(Extensions|-extensions)|seal + ))\b + scope: support.function.static.object.livescript + - match: |- + (?x)((?<=Math\.)( + abs|acos|acosh|asin|asinh|atan|atan2|atanh|ceil|cos|cosh|exp|expm1|floor| + hypot|log|log10|log1p|log2|max|min|pow|random|round|sign|sin|sinh|sqrt| + tan|tanh|trunc + ))\b + scope: support.function.static.math.livescript + - match: |- + (?x)((?<=Number\.)( + is(Finite|Integer|NaN)|to(Integer|-integer) + ))\b + scope: support.function.static.number.livescript + - match: '[\$\w][\w-]*' + scope: variable.other.livescript + backslash_string: + - match: '\\([\\)\s,\};\]])?' + captures: + 0: string.quoted.single.livescript + push: + - meta_content_scope: string.quoted.single.livescript + - match: '([\\)\s,\};\]])' + captures: + 0: punctuation.definition.string.end.livescript + pop: true + constructor_variable: + - match: '([a-zA-Z$_][\w$-]*)(@{2})([a-zA-Z$_][\w$-]*)?' + scope: variable.other.readwrite.constructor.livescript + double_quoted_string: + - match: '"' + captures: + 0: punctuation.definition.string.begin.livescript + push: + - meta_scope: string.quoted.double.livescript + - match: '"' + captures: + 0: punctuation.definition.string.end.livescript + pop: true + - match: '\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)' + scope: constant.character.escape.livescript + - include: interpolated_livescript + embedded_comment: + - match: (?<!\\)(#).*$\n + scope: comment.line.number-sign.livescript + captures: + 1: punctuation.definition.comment.livescript + embedded_spaced_comment: + - match: (?<!\\)(#\s).*$\n + scope: comment.line.number-sign.livescript + captures: + 1: punctuation.definition.comment.livescript + instance_variable: + - match: '(?<![$\w\-])(@)' + scope: variable.other.readwrite.instance.livescript + interpolated_livescript: + - match: '\#\{' + captures: + 0: punctuation.section.embedded.livescript + push: + - meta_scope: source.livescript.embedded.source + - match: '\}' + captures: + 0: punctuation.section.embedded.livescript + pop: true + - include: main + - match: '\#' + push: + - meta_scope: source.livescript.embedded.source.simple + - match: "" + pop: true + - include: main + numeric: + - match: '(?<![\$@a-zA-Z_])(([0-9]+r[0-9_]+)|((16r|0[xX])[0-9a-fA-F_]+)|([0-9]+(\.[0-9]+[0-9_]*)?(e[+\-]?[0-9_]+)?)[_a-zA-Z0-9]*)' + scope: constant.numeric.livescript + single_quoted_string: + - match: "'" + captures: + 0: punctuation.definition.string.begin.livescript + push: + - meta_scope: string.quoted.single.livescript + - match: "'" + captures: + 0: punctuation.definition.string.end.livescript + pop: true + - match: '\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)' + scope: constant.character.escape.livescript + variable_name: + - match: '([a-zA-Z\$_][\w$-]*(\.\w+)*)(?!\-)' + scope: variable.assignment.livescript + captures: + 1: variable.assignment.livescript diff --git a/tests/syntax-tests/highlighted/LiveScript/livescript-demo.ls b/tests/syntax-tests/highlighted/LiveScript/livescript-demo.ls new file mode 100644 index 00000000..f6aba10c --- /dev/null +++ b/tests/syntax-tests/highlighted/LiveScript/livescript-demo.ls @@ -0,0 +1,83 @@ +[38;2;166;226;46ma[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m +[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;166;226;46mb[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m-->[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m +[38;2;249;38;114mvar[0m[38;2;248;248;242m [0m[38;2;166;226;46mc[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m~>[0m[38;2;248;248;242m [0m[38;2;190;132;255m3[0m +[38;2;166;226;46md[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m~~>[0m +[38;2;166;226;46me[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;255;255;255ma[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;255;255;255mb[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m~>[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;255;255;255mc[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m-->[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;255;255;255md[0m[38;2;248;248;242m, [0m[38;2;102;217;239me[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m~~>[0m[38;2;248;248;242m [0m[38;2;190;132;255m5[0m +[38;2;166;226;46mdashes-identifier[0m[38;2;166;226;46ms[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m +[38;2;248;248;242m [0m[38;2;255;255;255ma[0m[38;2;248;248;242m [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;255;255;255ma[0m +[38;2;248;248;242m [0m[38;2;255;255;255mb[0m[38;2;248;248;242m [0m[38;2;249;38;114m--[0m[38;2;248;248;242m [0m[38;2;255;255;255mc[0m +[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;249;38;114m-[0m[38;2;190;132;255m1[0m +[38;2;248;248;242m [0m[38;2;255;255;255ma-[0m[38;2;248;248;242m [0m[38;2;255;255;255ma[0m +[38;2;248;248;242m [0m[38;2;248;248;242ma[0m[38;2;248;248;242m [0m[38;2;249;38;114m-[0m[38;2;255;255;255ma[0m + +[38;2;246;170;17m//abc [0m[38;2;246;170;17m#[0m[38;2;246;170;17meaze [0m[38;2;246;170;17m#[0m[38;2;246;170;17m@ //[0m +[38;2;246;170;17m//[0m +[38;2;246;170;17ma [0m[38;2;246;170;17m#[0m[38;2;246;170;17mbaze[0m +[38;2;246;170;17m//[0m + +[38;2;255;255;255mpubli[0m +[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;102;217;239mit[0m[38;2;248;248;242m [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;230;219;116m\[0m[38;2;230;219;116mabc[0m[38;2;248;248;242m [0m[38;2;249;38;114mand[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;166;226;46m$-[0m[38;2;166;226;46my[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114m![0m[38;2;255;255;255m([0m[38;2;255;255;255ma[0m[38;2;248;248;242m,[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m~[0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242mmap[0m[38;2;248;248;242m [0m[38;2;246;170;17m//a[0m[38;2;246;170;17m#[0m[38;2;246;170;17m//[0m +[38;2;249;38;114mthen[0m[38;2;248;248;242m [0m[38;2;249;38;114mmatch[0m[38;2;248;248;242m [0m[38;2;102;217;239mthat[0m[38;2;248;248;242m [0m[38;2;249;38;114m| _[0m[38;2;248;248;242m [0m[38;2;249;38;114m|[0m[38;2;248;248;242m [0m[38;2;249;38;114motherwise[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;249;38;114mimplements[0m[38;2;248;248;242m [0m[38;2;248;248;242m$[0m[38;2;248;248;242m([0m[38;2;230;219;116m"[0m[38;2;230;219;116m#[0m[38;2;230;219;116mabc [0m[38;2;230;219;116m#[0m[38;2;230;219;116m@a[0m[38;2;230;219;116m"[0m[38;2;255;255;255m)[0m + +[38;2;249;38;114mswitch[0m[38;2;248;248;242m [0m[38;2;249;38;114m|[0m[38;2;255;255;255ma[0m[38;2;249;38;114m=>[0m[38;2;255;255;255mb[0m +[38;2;249;38;114m|[0m[38;2;248;248;242m [0m[38;2;255;255;255ma[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m[38;2;248;248;242m [0m[38;2;255;255;255mb[0m + +[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;255;255;255ma[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;255;255;255mb[0m[38;2;248;248;242m [0m[38;2;249;38;114melse[0m[38;2;248;248;242m [0m[38;2;255;255;255mc[0m + +[38;2;166;226;46munderscores_i$[0m[38;2;166;226;46md[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m +[38;2;246;170;17m/regexp1/[0m[38;2;248;248;242m [0m[38;2;249;38;114mand[0m[38;2;248;248;242m [0m[38;2;246;170;17m//regexp2//g[0m +[38;2;230;219;116m'[0m[38;2;230;219;116mstrings[0m[38;2;230;219;116m'[0m[38;2;248;248;242m [0m[38;2;249;38;114mand[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mstrings[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;249;38;114mand[0m[38;2;248;248;242m [0m[38;2;230;219;116m\[0m[38;2;230;219;116mstrings[0m +[38;2;255;255;255m([0m[38;2;248;248;242m[[0m[38;2;190;132;255m2[0m[38;2;248;248;242m [0m[38;2;249;38;114mtil[0m[38;2;248;248;242m [0m[38;2;190;132;255m10[0m[38;2;248;248;242m] [0m[38;2;249;38;114mor[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m [0m[38;2;249;38;114mto[0m[38;2;248;248;242m [0m[38;2;190;132;255m50[0m[38;2;248;248;242m][0m[38;2;255;255;255m)[0m +[38;2;248;248;242m [0m[38;2;249;38;114m|>[0m[38;2;248;248;242m [0m[38;2;248;248;242mmap[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m([0m[38;2;249;38;114m*[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;255;255;255m)[0m +[38;2;248;248;242m [0m[38;2;249;38;114m|>[0m[38;2;248;248;242m [0m[38;2;248;248;242mfilter[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m([0m[38;2;249;38;114m>[0m[38;2;248;248;242m [0m[38;2;190;132;255m5[0m[38;2;255;255;255m)[0m +[38;2;248;248;242m [0m[38;2;249;38;114m|>[0m[38;2;248;248;242m [0m[38;2;248;248;242mfold[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m([0m[38;2;249;38;114m+[0m[3;38;2;102;217;239m)[0m + +[38;2;248;248;242msetTimeout[0m[38;2;248;248;242m [0m[38;2;102;217;239m_[0m[38;2;248;248;242m, [0m[38;2;190;132;255m3000[0m[38;2;248;248;242m [0m[38;2;249;38;114m<|[0m[38;2;248;248;242m [0m[38;2;255;255;255mdo-stuff[0m +[38;2;102;217;239m_[0m[38;2;248;248;242m.[0m[38;2;102;217;239mmap[0m[38;2;248;248;242m;[0m[38;2;248;248;242m [0m[38;2;255;255;255m_abc[0m[38;2;248;248;242m;[0m[38;2;248;248;242m [0m[38;2;255;255;255m__[0m + + +[38;2;249;38;114mclass[0m[38;2;248;248;242m [0m[38;2;255;255;255mClass[0m[38;2;248;248;242m [0m[38;2;249;38;114mextends[0m[38;2;248;248;242m [0m[38;2;255;255;255mAnc-est-or[0m +[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;255;255;255margs[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m->[0m + +[38;2;166;226;46mcop[0m[38;2;166;226;46my[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;249;38;114mfrom[0m[38;2;248;248;242m, [0m[38;2;249;38;114mto[0m[38;2;248;248;242m, [0m[38;2;255;255;255mcallback[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m-->[0m +[38;2;248;248;242m [0m[38;2;255;255;255merror[0m[38;2;248;248;242m, [0m[38;2;255;255;255mdata[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m<-[0m[38;2;248;248;242m [0m[38;2;248;248;242mread[0m[38;2;248;248;242m [0m[38;2;255;255;255mfile[0m +[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;248;248;242mcallback[0m[38;2;248;248;242m [0m[38;2;255;255;255merror[0m[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;255;255;255merror[0m[38;2;249;38;114m?[0m +[38;2;248;248;242m [0m[38;2;255;255;255merror[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m<~[0m[38;2;248;248;242m [0m[38;2;248;248;242mwrite[0m[38;2;248;248;242m [0m[38;2;255;255;255mfile[0m[38;2;248;248;242m, [0m[38;2;255;255;255mdata[0m +[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;248;248;242mcallback[0m[38;2;248;248;242m [0m[38;2;255;255;255merror[0m[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;255;255;255merror[0m[38;2;249;38;114m?[0m +[38;2;248;248;242m [0m[38;2;248;248;242mcallback[0m[38;2;248;248;242m([0m[38;2;255;255;255m)[0m + +[38;2;248;248;242m$[0m[38;2;248;248;242m([0m[38;2;230;219;116m\[0m[38;2;230;219;116m#gafBr[0m[38;2;248;248;242m)[0m[38;2;248;248;242m.[0m[38;2;248;248;242mtext[0m[38;2;248;248;242m [0m[38;2;255;255;255m$t[0m[38;2;248;248;242m.[0m[38;2;248;248;242mfmtFloat[0m[38;2;248;248;242m([0m[38;2;255;255;255mefb[0m[38;2;248;248;242m.[0m[38;2;255;255;255mgaf[0m[38;2;255;255;255m)[0m + +[3;38;2;102;217;239m->[0m +[3;38;2;102;217;239m~>[0m +[3;38;2;102;217;239m~~>[0m +[3;38;2;102;217;239m-->[0m +[38;2;117;113;94m#[0m[38;2;117;113;94m Comment[0m +[38;2;117;113;94m/*[0m[38;2;117;113;94m Comment [0m[38;2;117;113;94m*/[0m +[38;2;117;113;94m#[0m[38;2;117;113;94m error, data <- read file[0m +[38;2;248;248;242m [0m[38;2;117;113;94m/*[0m[38;2;117;113;94m error, data <- read file [0m[38;2;117;113;94m*/[0m + +[38;2;166;226;46mad[0m[38;2;166;226;46md[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;248;248;242ma[0m[38;2;249;38;114m=[0m[38;2;190;132;255m1[0m[38;2;248;248;242m, [0m[38;2;248;248;242mb[0m[38;2;249;38;114m=[0m[38;2;190;132;255m2[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m-->[0m[38;2;248;248;242m [0m[38;2;255;255;255ma[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;255;255;255mb[0m +[38;2;248;248;242madd[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m +[38;2;248;248;242mdo-stuff[0m[38;2;249;38;114m![0m +[38;2;255;255;255mdo-stuff[0m[38;2;249;38;114m?[0m[38;2;248;248;242m [0m[38;2;117;113;94m#[0m +[38;2;248;248;242mdo-stuff[0m[38;2;249;38;114m?[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m +[38;2;255;255;255mdo-stuff[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m +[38;2;255;255;255m@[0m[38;2;248;248;242mdo-stuff[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;190;132;255m1[0m +[38;2;255;255;255m@[0m[38;2;255;255;255mdo-stuff[0m[38;2;248;248;242m [0m[38;2;249;38;114m/[0m[38;2;190;132;255m1[0m +[38;2;248;248;242ma[0m[38;2;248;248;242m [0m[38;2;248;248;242mb[0m[38;2;248;248;242m [0m[38;2;255;255;255mc[0m[38;2;248;248;242m [0m[38;2;249;38;114m|>[0m[38;2;248;248;242m [0m[38;2;255;255;255md[0m[38;2;248;248;242m [0m[38;2;249;38;114m<|[0m[38;2;248;248;242m [0m[38;2;248;248;242me[0m[38;2;248;248;242m [0m[38;2;248;248;242mf[0m[38;2;248;248;242m([0m[38;2;255;255;255mg[0m[38;2;255;255;255m)[0m +[38;2;230;219;116m'[0m[38;2;230;219;116mcats[0m[38;2;230;219;116m'[0m[38;2;248;248;242m [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mcats[0m[38;2;230;219;116m'[0m +[38;2;230;219;116m'[0m[38;2;230;219;116mcats[0m[38;2;230;219;116m'[0m[38;2;248;248;242m [0m[38;2;249;38;114m`[0m[38;2;102;217;239m_[0m[38;2;248;248;242m.[0m[38;2;248;248;242mis-insensitive[0m[38;2;249;38;114m`[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mCATS[0m[38;2;230;219;116m'[0m +[38;2;248;248;242msetTimeout[0m[38;2;248;248;242m [0m[38;2;102;217;239m_[0m[38;2;248;248;242m, [0m[38;2;190;132;255m1000[0m[38;2;248;248;242m [0m[38;2;249;38;114m<|[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m!->[0m[38;2;248;248;242m [0m[38;2;166;226;46mconsole[0m[38;2;248;248;242m.[0m[38;2;248;248;242mlog[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mWho summoned me[0m[38;2;230;219;116m'[0m +[38;2;248;248;242mprivate-list[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114myield[0m[38;2;248;248;242m [0m[38;2;255;255;255m@[0m[38;2;248;248;242mget-private-list[0m[38;2;249;38;114m![0m +[38;2;249;38;114mswitch[0m[38;2;248;248;242m [0m[38;2;249;38;114m|[0m[38;2;248;248;242m [0m[38;2;190;132;255mtrue[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m#[0m[38;2;230;219;116m@@spaghetti[0m[38;2;230;219;116m"[0m +[3;38;2;102;217;239m~function[0m[38;2;248;248;242m [0m[38;2;166;226;46madd[0m[38;2;248;248;242m [0m[38;2;248;248;242ma[0m[38;2;249;38;114m=[0m[38;2;190;132;255m1[0m[38;2;248;248;242m, [0m[38;2;248;248;242mb[0m[38;2;249;38;114m=[0m[38;2;190;132;255m2[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;255;255;255ma[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;255;255;255mb[0m +[38;2;255;255;255mrow[0m[38;2;248;248;242m.[0m[38;2;190;132;255m0[0m[38;2;248;248;242m.[0m[38;2;255;255;255m_id[0m +[38;2;249;38;114mnew[0m[38;2;248;248;242m [0m[38;2;166;226;46mSpaghetti[0m +[38;2;255;255;255m([0m[38;2;249;38;114m++[0m[38;2;255;255;255ma[0m[38;2;249;38;114m++[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;249;38;114m++[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m [0m[38;2;249;38;114m++[0m[38;2;255;255;255m)[0m +[3;38;2;102;217;239m([0m[38;2;248;248;242m.[0m[38;2;255;255;255mcool[0m[38;2;248;248;242m.[0m[3;38;2;102;217;239m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m([0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;255;255;255ma[0m[38;2;248;248;242m [0m[38;2;249;38;114m-[0m[3;38;2;102;217;239m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m([0m[38;2;249;38;114m/[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m [0m[38;2;249;38;114m*[0m[3;38;2;102;217;239m)[0m +[38;2;255;255;255m([0m[38;2;248;248;242mina[0m[38;2;248;248;242m [0m[38;2;249;38;114m-[0m[38;2;255;255;255ma[0m[38;2;248;248;242m [0m[38;2;249;38;114min[0m[3;38;2;102;217;239m)[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[3;38;2;102;217;239m->[0m[38;2;248;248;242m [0m[38;2;255;255;255ma[0m[38;2;255;255;255m)[0m +[38;2;255;255;255m([0m[38;2;255;255;255mina[0m[38;2;248;248;242m [0m[38;2;249;38;114min[0m[38;2;255;255;255m$a[0m[38;2;255;255;255m)[0m +[38;2;255;255;255m([0m[38;2;255;255;255ma[0m[38;2;248;248;242m [0m[38;2;255;255;255mis-in[0m[38;2;255;255;255m)[0m +[3;38;2;102;217;239m([0m[38;2;249;38;114min[0m[3;38;2;102;217;239m)[0m +[38;2;255;255;255m([0m[38;2;255;255;255m([0m[38;2;255;255;255m([0m[38;2;255;255;255m([0m[38;2;255;255;255m([0m[3;38;2;102;217;239m([0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;248;248;242ma[0m[38;2;248;248;242m([0m[38;2;255;255;255m([0m[38;2;255;255;255ma[0m[38;2;255;255;255m)[0m[38;2;255;255;255m)[0m[38;2;255;255;255m)[0m[38;2;255;255;255m)[0m[38;2;255;255;255m)[0m[38;2;255;255;255m)[0m[38;2;255;255;255m)[0m[38;2;255;255;255m)[0m diff --git a/tests/syntax-tests/source/LiveScript/LICENSE.md b/tests/syntax-tests/source/LiveScript/LICENSE.md new file mode 100644 index 00000000..5c436445 --- /dev/null +++ b/tests/syntax-tests/source/LiveScript/LICENSE.md @@ -0,0 +1,23 @@ +The `livescript-demo.ls` file has been added from https://github.com/paulmillr/LiveScript.tmbundle under the following license: + +The MIT License (MIT) + +Copyright (c) 2012 Paul Miller (http://paulmillr.com/), Jeremy Ashkenas + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tests/syntax-tests/source/LiveScript/livescript-demo.ls b/tests/syntax-tests/source/LiveScript/livescript-demo.ls new file mode 100644 index 00000000..dc34f8cf --- /dev/null +++ b/tests/syntax-tests/source/LiveScript/livescript-demo.ls @@ -0,0 +1,83 @@ +a = -> 1 +const b = --> 2 +var c = ~> 3 +d = ~~> +e = (a) -> (b) ~> (c) --> (d, e) ~~> 5 +dashes-identifiers = -> + a - a + b -- c + 1-1 1- -1 + a- a + a -a + +//abc #eaze #@ // +// +a #baze +// + +publi +if it is \abc and ($-y = !(a,) ->) ~= map //a#// +then match that | _ | otherwise => implements $("#abc #@a") + +switch |a=>b +| a then b + +if a => b else c + +underscores_i$d = -> +/regexp1/ and //regexp2//g +'strings' and "strings" and \strings +([2 til 10] or [1 to 50]) + |> map (* 2) + |> filter (> 5) + |> fold (+) + +setTimeout _, 3000 <| do-stuff +_.map; _abc; __ + + +class Class extends Anc-est-or + (args) -> + +copy = (from, to, callback) --> + error, data <- read file + return callback error if error? + error <~ write file, data + return callback error if error? + callback() + +$(\#gafBr).text $t.fmtFloat(efb.gaf) + +-> +~> +~~> +--> +# Comment +/* Comment */ +# error, data <- read file + /* error, data <- read file */ + +add = (a=1, b=2) --> a + b +add 1 2 +do-stuff! +do-stuff? # +do-stuff? 1 +do-stuff + 1 +@do-stuff +1 +@do-stuff /1 +a b c |> d <| e f(g) +'cats' is 'cats' +'cats' `_.is-insensitive` 'CATS' +setTimeout _, 1000 <| !-> console.log 'Who summoned me' +private-list = yield @get-private-list! +switch | true => "#@@spaghetti" +~function add a=1, b=2 => a + b +row.0._id +new Spaghetti +(++a++) (++ 2 ++) +(.cool.) (+ a -) (/ 2 *) +(ina -a in) (-> a) +(ina in$a) +(a is-in) +(in) +((((((+ a((a)))))))) |