测试一下erlang的highlight

没有实际内容,无德操代码刷屏而已。
来源:http://stevegilham.blogspot.com/2008/12/syntax-highlight-brush-for-erlang.html

-module(erlbattle).
-export([start/0]).
-include("schema.hrl").
-include("test.hrl").
-include_lib("stdlib/include/ms_transform.hrl").

%% 战场初始化启动程序
start() ->
    io:format("Server Starting ....~n", []),

    %% 创建两方部队的初始状态
	io:format("Army matching into the battle fileds....~n", []),
	battlefield:create(),

	%%  TODO: 这段主要是后面用于让每台机器都能够以相同的结果运行的作用
	%%  io:format("Testing Computer Speed....~n", [])
	Sleep = 10,

	%% 启动一个计时器, 作为战场节拍
	Timer = spawn(worldclock, start, [self(),0,Sleep]),

	%% 创建两个指令队列, 这两个队列只能由各自看到
	BlueQueue = ets:new(blueQueue, [{keypos, #command.warrior_id}]),
	RedQueue = ets:new(redQueue, [{keypos, #command.warrior_id}]),

	%% 启动红方和蓝方的决策程序
	%% TODO:  为了避免某一方通过狂发消息,影响对方, 未来要有独立的通讯程序负责每方的信息
	io:format("Command Please, Generel....~n", []),
	BlueSide = spawn(feardFarmers, start, [self(), "Blue"]),
	RedSide = spawn(englandArmy, start, [self(), "Red"]),

	%% 开始战场循环
	run(Timer, BlueSide, RedSide,BlueQueue, RedQueue).

另外他提供的似乎是老版本的sh,和我用的这个不兼容,修改了一下:

SyntaxHighlighter.brushes.Erlang = function()
{
 var keywords = 'after begin case catch cond end fun if let of query receive when '+
  'define record export import include include_lib ifdef ifndef else endif undef '+
  'apply attribute call do in letrec module primop try';

 this.regexList = [
  { regex: new RegExp('%.*$', 'gm'),    css: 'comment' },   // one line comments
  { regex: SyntaxHighlighter.regexLib.doubleQuotedString,     css: 'string' },   // strings
  { regex: new RegExp(this.getKeywords(keywords), 'g'),  css: 'keyword' },  // Erlang keyword
  { regex: new RegExp('_?[A-Z]\\w*', 'g'), css: 'values'},
  { regex: new RegExp('\\w+/\\d+', 'g'), css: 'funs'},
  ];

 this.cssClass = 'dp-erl';
 this.style = '.dp-erl .values { color: #c88; font-weight: bold;} '+
  '.dp-erl .funs { color: #f00; } ';
};

SyntaxHighlighter.brushes.Erlang.prototype = new SyntaxHighlighter.Highlighter();
SyntaxHighlighter.brushes.Erlang.aliases = ['erlang', 'erl'];
>_<|| 我手贱!!这个有问题!绝对有问题!!一般般啦,真的很一般般。还不错哦~小表扬一下!GJ!乃就是新世界的神様了,快去拯救世界吧! (No Ratings Yet)
Loading...

Comments are closed.

春菜 对话 相声
双击调戏
双击调戏