Incs/codemirror/mode/soy/test.js

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE

(function() {
  var mode = CodeMirror.getMode({indentUnit: 2}, "soy");
  function MT(name) {test.mode(name, mode, Array.prototype.slice.call(arguments, 1));}

  // Test of small keywords and words containing them.
  MT('keywords-test',
     '[keyword {] [keyword as] worrying [keyword and] notorious [keyword as]',
     '    the Fandor[operator -]alias assassin, [keyword or]',
     '    Corcand cannot fit [keyword in] [keyword }]');

  MT('let-test',
     '[keyword {template] [def .name][keyword }]',
     '  [keyword {let] [def $name]: [string "world"][keyword /}]',
     '  [tag&bracket <][tag h1][tag&bracket >]',
     '    Hello, [keyword {][variable-2 $name][keyword }]',
     '  [tag&bracket </][tag h1][tag&bracket >]',
     '[keyword {/template}]',
     '');

  MT('function-test',
     '[keyword {] [callee&variable css]([string "MyClass"])[keyword }]',
     '[tag&bracket <][tag input] [attribute value]=[string "]' +
     '[keyword {] [callee&variable index]([variable-2&error $list])[keyword }]' +
        '[string "][tag&bracket />]');

  MT('namespace-test',
     '[keyword {namespace] [variable namespace][keyword }]')

  MT('namespace-with-attribute-test',
     '[keyword {namespace] [variable my.namespace.templates] ' +
         '[attribute requirecss]=[string "my.namespace"][keyword }]');

  MT('operators-test',
     '[keyword {] [atom 1] [operator ==] [atom 1] [keyword }]',
     '[keyword {] [atom 1] [operator !=] [atom 2] [keyword }]',
     '[keyword {] [atom 2] [operator +] [atom 2] [keyword }]',
     '[keyword {] [atom 2] [operator -] [atom 2] [keyword }]',
     '[keyword {] [atom 2] [operator *] [atom 2] [keyword }]',
     '[keyword {] [atom 2] [operator /] [atom 2] [keyword }]',
     '[keyword {] [atom 2] [operator %] [atom 2] [keyword }]',
     '[keyword {] [atom 2] [operator <=] [atom 2] [keyword }]',
     '[keyword {] [atom 2] [operator >=] [atom 2] [keyword }]',
     '[keyword {] [atom 3] [operator >] [atom 2] [keyword }]',
     '[keyword {] [atom 2] [operator >] [atom 3] [keyword }]',
     '[keyword {] [variable-2&error $variable] [operator |] safeHtml [keyword }]')

  MT('primitive-test',
     '[keyword {] [atom true] [keyword }]',
     '[keyword {] [atom false] [keyword }]',
     '[keyword {] truethy [keyword }]',
     '[keyword {] falsey [keyword }]',
     '[keyword {] [atom 42] [keyword }]',
     '[keyword {] [atom .42] [keyword }]',
     '[keyword {] [atom 0.42] [keyword }]',
     '[keyword {] [atom -0.42] [keyword }]',
     '[keyword {] [atom -.2] [keyword }]',
     '[keyword {] [atom 0x1F] [keyword }]',

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。