トークン読み込み用クラス (大文字・小文字を意識する 言語用)

これまでC# で作成してきた「SourceToHTML」を、VJ# に焼きなおしてみます。

TokenReaderCase.jsl


package SourceToHtml;

//*******************************************************************************************************
// トークンごとに 文字列と その種類を返す ( 大文字・小文字を意識する 言語用 )
//*******************************************************************************************************
public class TokenReaderCase extends TokenReaderCommon
{
//---------------------------------------------------------------------------------------------------
// 初期化
//---------------------------------------------------------------------------------------------------
public TokenReaderCase(Reader reader, String langType)
{
super(reader, langType);
}
//---------------------------------------------------------------------------------------------------
// 文字列か?
//---------------------------------------------------------------------------------------------------
protected boolean IsString()
{
return (_context.currChar == '\"');
}
//---------------------------------------------------------------------------------------------------
// 文字か?
//---------------------------------------------------------------------------------------------------
protected boolean IsChar()
{
return (_context.currChar == '\'');
}
//---------------------------------------------------------------------------------------------------
// ディレクティブか?
//---------------------------------------------------------------------------------------------------
protected boolean IsDirective()
{
return (_context.currChar == '#');
}
//---------------------------------------------------------------------------------------------------
// 予約語ではないか?
//---------------------------------------------------------------------------------------------------
protected String getKeyWord()
{
//識別子が 予約語であれば、その文字列を返す
if (_keyWords.Contains(_context.currToken.tokenString))
return _context.currToken.tokenString;

return "";
}
//---------------------------------------------------------------------------------------------------
// 状態を更新 (文字列)
//---------------------------------------------------------------------------------------------------
protected void getNextStateStr()
{
super.getNextStateStr();

if (_context.currChar == '\"')
_context.State = "その他";

else if (_context.currChar == '\\')
_context.State = "文字列中のエスケープシーケンス";
}
//---------------------------------------------------------------------------------------------------
// 状態を更新 (文字)
//---------------------------------------------------------------------------------------------------
protected void getNextStateCha()
{
super.getNextStateCha();

if (_context.currChar == '\'')
_context.State = "その他";

else if (_context.currChar == '\\')
_context.State = "文字中のエスケープシーケンス";
}
//---------------------------------------------------------------------------------------------------
// 状態を更新 (ディレクティブ)
//---------------------------------------------------------------------------------------------------
protected void getNextStateDir()
{
super.getNextStateDir();

if (_context.currChar == '\n')
_context.State = "その他";

else if (!System.Char.IsLetter(_context.currChar))
_context.State = "不明";
}
}