i was making a lexical analyzer but i am stuck here can anybody please help with this where am i going wrong :S
Console.WriteLine("ENTER STRING:");
// string ch = string.Intern(System.Console.ReadLine());
string str = Console.ReadLine();
Console.ReadLine();
string[] kw = new string[2]{ "for","while"};
string[] punc = new string[2]{ ";","."};
//if(kw.Contains(str))
switch (str)
{
case kw:
{
Console.WriteLine("\n\nkeyword");
return str;
//Console.WriteLine(kw.Contains(str));
Console.ReadLine();
}
//else if(punc.Contains(str))
case punc:
{
Console.WriteLine("\n\npunctuation");
//Console.WriteLine(punc.Contains(str));
Console.ReadLine();
}
default:
Console.WriteLine("\n\ninvalid string");
}
}
}
}