예제 #1
0
파일: Lexer.cs 프로젝트: Hyosya/Yoron
 /// <summary>
 /// キーワードと変数名を識別する
 /// </summary>
 /// <param name="word"></param>
 /// <returns></returns>
 private static Token JudgeWord(string word)
 {
     if (BoolLiteral.SpecifiedCollection.Contains(word))
     {
         return(new BoolLiteral(word));
     }
     if (word.Length == 2 && IfKeyword.IsMatch(word))
     {
         return(new IfKeyword());
     }
     if (word.Length == 5 && WhileKeyword.IsMatch(word))
     {
         return(new WhileKeyword());
     }
     if (word.Length == 5 && BreakKeyword.IsMatch(word))
     {
         return(new BreakKeyword());
     }
     if (word.Length == 8 && ContinueKeyword.IsMatch(word))
     {
         return(new ContinueKeyword());
     }
     return(new Identifier(word));
 }
예제 #2
0
 private static void KeywordEqual(IfKeyword expected, IfKeyword actual)
 {
     throw new NotImplementedException();
 }