shbrushmatlabm.js

来自「本人参见电子竞赛的时候搜集和整理的有关电子秤的资料」· JavaScript 代码 · 共 31 行

JS
31
字号
dp.sh.Brushes.CMatlabM = function()
{
	var keywords =	'for if end function break case catch classdef continue' +
					' default otherwise else elseif global' +
					'parfor switch return true flase while try';

	this.regexList = [
		// There's a slight problem with matching single line comments and figuring out
		// a difference between // and ///. Using lookahead and lookbehind solves the
		// problem, unfortunately JavaScript doesn't support lookbehind. So I'm at a 
		// loss how to translate that regular expression to JavaScript compatible one.
//		{ regex: new RegExp('(?<!/)//(?!/).*$|(?<!/)////(?!/).*$|/\\*[^\\*]*(.)*?\\*/', 'gm'),	css: 'comment' },			// one line comments starting with anything BUT '///' and multiline comments
//		{ regex: new RegExp('(?<!/)///(?!/).*$', 'gm'),											css: 'comments' },		// XML comments starting with ///

		{ regex: new RegExp('%.*$', 'gm'),				css: 'comment' },			// one line comments
		{ regex: new RegExp('%{(?!\\$)[\\s\\S]*?}%', 'gm'),		css: 'comment' },  			// multiline comments %{ }%	
		

		{ regex: dp.sh.RegexLib.DoubleQuotedString,					css: 'string' },			// strings
		{ regex: dp.sh.RegexLib.SingleQuotedString,					css: 'string' },			// strings

		{ regex: new RegExp(this.GetKeywords(keywords), 'gm'),		css: 'keyword' }			// Matlab M keyword
		];

	this.CssClass = 'dp-m';
	//this.Style = '.dp-m .vars { color: #d00; }';
}

dp.sh.Brushes.CMatlabM.prototype	= new dp.sh.Highlighter();
dp.sh.Brushes.CMatlabM.Aliases	= ['m'];

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?