Beispiel #1
0
 void Parse_SyntaxExpressionSingle(Context& ctx)
 {
     if (ctx.Token() == TKLiteralChar ||
         ctx.Token() == TKIdentifier ||
         ctx.Token() == TKLeftCurlyBracketCharacter ||
         ctx.Token() == TKStringLiteral)
     {
         //SyntaxExpressionSingle => SyntaxExpressionItem SyntaxExpressionSingleFollow 
         Parse_SyntaxExpressionItem(ctx);
         Parse_SyntaxExpressionSingleFollow(ctx);
     }
     else if (ctx.Token() == TKKeywordEmpty)
     {
         //SyntaxExpressionSingle => KeywordEmpty 
         ctx.Match(TKKeywordEmpty);
         ctx.Action_PrintEmptyProduction();
     }
     else
     {
         assert(false);
     }
 }
Beispiel #2
0
void Parse_SyntaxExpressionSingle(Context& ctx)
{
    if (ctx.Token() == TKLiteralChar ||
            ctx.Token() == TKIdentifier ||
            ctx.Token() == TKLeftCurlyBracketCharacter ||
            ctx.Token() == TKStringLiteral)
    {
        //SyntaxExpressionSingle => SyntaxExpressionItem SyntaxExpressionSingleFollow
        Parse_SyntaxExpressionItem(ctx);
        Parse_SyntaxExpressionSingleFollow(ctx);
    }
    else if (ctx.Token() == TKKeywordEmpty)
    {
        //SyntaxExpressionSingle => KeywordEmpty
        ctx.Match(TKKeywordEmpty);
        ctx.Action_PrintEmptyProduction();
    }
    else
    {
        throw ParserException(ctx.GetLine(), ctx.GetCol(), ErrorCodeUnexpectedToken);
    }
}