Web/kzcms/ckfinder/plugins/fileeditor/codemirror/contrib/csharp/js/tokenizecsharp.js
(开头部分) 7KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/* Tokenizer for CSharp code */
var tokenizeCSharp = (function() {
// Advance the stream until the given character (not preceded by a
// backslash) is encountered, or the end of the line is reached.
function nextUntilUnescaped(source, end) {
var escaped = false;
var next;
while (!source.endOfLine()) {
var next = source.next();
if (next == end && !escaped)
return false;
escaped = !escaped && next == "\\";
}
return escaped;
}
// A map of JavaScript's keywords. The a/b/c keyword distinction is
// very rough, but it gives the parser enough information to parse
// correct code correctly (we don't care that much how we parse
// incorrect code). The style information included in these objects
// is used by the highlighter to pick the correct CSS style for a
// token.
var keywords = function(){
function result(type, style){
return {type: type, style: "csharp-" + style};
}
// keywords that take a parenthised expression, and then a
// statement (if)
var keywordA = result("keyword a", "keyword");
// keywords that take just a statement (else)
var keywordB = result("keyword b", "keyword");
// keywords that optionally take an expression, and form a
// statement (return)
var keywordC = result("keyword c", "keyword");
var operator = result("operator", "keyword");
var atom = result("atom", "atom");
// just a keyword with no indentation implications
var keywordD = result("keyword d", "keyword");
return {
"if": keywordA, "while": keywordA, "with": keywordA,
"else": keywordB, "do": keywordB, "try": keywordB, "finally": keywordB,
"return": keywordC, "break": keywordC, "continue": keywordC, "new": keywordC, "delete": keywordC, "throw": keywordC,
"in": operator, "typeof": operator, "instanceof": operator,
"var": result("var", "keyword"), "function": result("function", "keyword"), "catch": result("catch", "keyword"),
"for": result("for", "keyword"), "switch": result("switch", "keyword"),
"case": result("case", "keyword"), "default": result("default", "keyword"),
"true": atom, "false": atom, "null": atom,
"class": result("class", "keyword"), "namespace": result("class", "keyword"),
"public": keywordD, "private": keywordD, "protected": keywordD, "internal": keywordD,
"extern": keywordD, "override": keywordD, "virtual": keywordD, "abstract": keywordD,
"static": keywordD, "out": keywordD, "ref": keywordD, "const": keywordD,
"foreach": result("for", "keyword"), "using": keywordC,
"int": keywordD, "double": keywordD, "long": keywordD, "bool": keywordD, "char": keywordD,
"void": keywordD, "string": keywordD, "byte": keywordD, "sbyte": keywordD, "decimal": keywordD,
后面还有 136 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
