src/main/webapp/plugins/editor.md/lib/codemirror/mode/stylus/stylus.js
(开头部分) 23KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
CodeMirror.defineMode("stylus", function(config) {
var operatorsRegexp = /^(\?:?|\+[+=]?|-[\-=]?|\*[\*=]?|\/=?|[=!:\?]?=|<=?|>=?|%=?|&&|\|=?|\~|!|\^|\\)/,
delimitersRegexp = /^(?:[()\[\]{},:`=;]|\.\.?\.?)/,
wordOperatorsRegexp = wordRegexp(wordOperators),
commonKeywordsRegexp = wordRegexp(commonKeywords),
commonAtomsRegexp = wordRegexp(commonAtoms),
commonDefRegexp = wordRegexp(commonDef),
vendorPrefixesRegexp = new RegExp(/^\-(moz|ms|o|webkit)-/),
cssValuesWithBracketsRegexp = new RegExp("^(" + cssValuesWithBrackets_.join("|") + ")\\([\\w\-\\#\\,\\.\\%\\s\\(\\)]*\\)");
var tokenBase = function(stream, state) {
if (stream.eatSpace()) return null;
var ch = stream.peek();
// Single line Comment
if (stream.match('//')) {
stream.skipToEnd();
return "comment";
}
// Multiline Comment
if (stream.match('/*')) {
state.tokenizer = multilineComment;
return state.tokenizer(stream, state);
}
// Strings
if (ch === '"' || ch === "'") {
stream.next();
state.tokenizer = buildStringTokenizer(ch);
return "string";
}
// Def
if (ch === "@") {
stream.next();
if (stream.match(/extend/)) {
dedent(state); // remove indentation after selectors
} else if (stream.match(/media[\w-\s]*[\w-]/)) {
indent(state);
} else if(stream.eatWhile(/[\w-]/)) {
if(stream.current().match(commonDefRegexp)) {
indent(state);
}
后面还有 384 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
