private ILexerAction CreateLexerAction([NotNull] GrammarAST ID, [Nullable] GrammarAST arg)
{
string command = ID.Text;
CheckCommands(command, ID.Token);
if ("skip".Equals(command) && arg == null)
{
return LexerSkipAction.Instance;
}
else if ("more".Equals(command) && arg == null)
{
return LexerMoreAction.Instance;
}
else if ("popMode".Equals(command) && arg == null)
{
return LexerPopModeAction.Instance;
}
else if ("mode".Equals(command) && arg != null)
{
string modeName = arg.Text;
int? mode = GetModeConstantValue(modeName, arg.Token);
if (mode == null)
{
return null;
}
return new LexerModeAction(mode.Value);
}
else if ("pushMode".Equals(command) && arg != null)
{
string modeName = arg.Text;
int? mode = GetModeConstantValue(modeName, arg.Token);
if (mode == null)
{
return null;
}
return new LexerPushModeAction(mode.Value);
}
else if ("type".Equals(command) && arg != null)
{
string typeName = arg.Text;
int? type = GetTokenConstantValue(typeName, arg.Token);
if (type == null)
{
return null;
}
return new LexerTypeAction(type.Value);
}
else if ("channel".Equals(command) && arg != null)
{
string channelName = arg.Text;
int? channel = GetChannelConstantValue(channelName, arg.Token);
if (channel == null)
{
return null;
}
return new LexerChannelAction(channel.Value);
}
else
{
return null;
}
}