Пример #1
0
 void Parse_LanguageBody(Context& ctx)
 {
     if (ctx.Token() == TKKeywordLanguage)
     {
         //LanguageBody => KeywordLanguage Identifier LeftCurlyBracketCharacter Declarations RightCurlyBracketCharacter 
         ctx.Match(TKKeywordLanguage);
         ctx.Match(TKIdentifier);
         ctx.Action_LanguageName();
         ctx.Match(TKLeftCurlyBracketCharacter);
         Parse_Declarations(ctx);
         ctx.Match(TKRightCurlyBracketCharacter);
     }
     else
     {
         assert(false);
     }
 }
Пример #2
0
void Parse_LanguageBody(Context& ctx)
{
    if (ctx.Token() == TKKeywordLanguage)
    {
        //LanguageBody => KeywordLanguage Identifier LeftCurlyBracketCharacter Declarations RightCurlyBracketCharacter
        ctx.Match(TKKeywordLanguage);
        ctx.Match(TKIdentifier);
        ctx.Action_LanguageName();
        ctx.Match(TKLeftCurlyBracketCharacter);
        Parse_Declarations(ctx);
        ctx.Match(TKRightCurlyBracketCharacter);
    }
    else
    {
        throw ParserException(ctx.GetLine(), ctx.GetCol(), ErrorCodeUnexpectedToken);
    }
}