2 * Copyright (C) 2013 FooProject
3 * * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
6 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
7 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
9 You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
13 namespace FooEditEngine
21 /// どのカテゴリーにも属さないトークンを表す
25 /// キーワード1として表示するトークンを表す
29 /// キーワード2として表示するトークンを表す
33 /// コメントとして表示するトークンを表す
37 /// 文字リテラルとして表示するトークンを表す
41 /// コントロールとして表示するトークンを表す
49 public class TokenSpilitEventArgs
58 public TokenType type;
60 /// トークンの切り出しをやめるなら真をセットし、そうでないなら偽をセットする(規定値は偽)
71 public TokenSpilitEventArgs()
78 /// <param name="index">開始インデックス</param>
79 /// <param name="length">長さ</param>
80 /// <param name="type">トークンタイプ</param>
81 public TokenSpilitEventArgs(int index,int length, TokenType type)
91 /// トークンが切り出された時に呼ばれるイベント
93 /// <param name="state">イベントデータ</param>
94 /// <returns></returns>
95 public delegate void TokenSpilitHandeler(TokenSpilitEventArgs state);
98 /// シンタックスハイライトを行うためのインターフェイス
100 public interface IHilighter
110 /// <param name="text">対象となる文字列</param>
111 /// <param name="length">文字列の長さ</param>
112 /// <param name="action">トークンが切り出されたときに呼び出されるデリゲート</param>
113 /// <returns>エンクロージャーレベル。開始エンクロージャーだけを検出した場合は1以上の値を返し、
114 /// 終了エンクロージャーだけを検出した場合を-1以下の値を返すようにします。
115 /// 何も検出しなかった場合、開始エンクロージャーと終了エンクロージャーが対になっている場合、
116 /// エンクロージャー内で開始エンクロージャーを検出した場合は0を返します
117 /// なお、開始エンクロージャーがすでに検出されている状態で検出したことを返した場合、その結果は無視されます
120 /// int DoHilight(string text,int length, TokenSpilitHandeler action)
122 /// if(length > 3 && text == "foo")
123 /// action(new TokenSpilitEventArgs(0,3,TokenType.Keyword1);
127 int DoHilight(string text,int length, TokenSpilitHandeler action);