Пример #1
0
 private static void PrintMatchCase(PrintState s, MatchCase a)
 {
     PrintLine(s, "MatchCase");
     Indent(s);
     PrintDescWithAny(s, "Name", a.Token);
     if (a.Second != null)
     {
         PrintDescWithAny(s, "Second", a.Second);
     }
     PrintDescWithAny(s, "Statement", a.Statement);
     UnIndent(s);
 }
Пример #2
0
        private static MatchCase ParseMatchCase(ParserState s)
        {
            var result = new MatchCase();

            result.Token = ParseTokenWithType(s, TokenType.Identifier);
            if (s.Token.Type == TokenType.Operator && s.Token.Value == "|" && (result.Token.Value == "null" || result.Token.Value == "default"))
            {
                ReadToken(s);
                result.Second = ParseTokenWithType(s, TokenType.Identifier);
            }
            ParseTokenWithType(s, TokenType.Colon);
            result.Statement = ParseStatement(s);
            return(result);
        }
Пример #3
0
 private static void CheckMatchCase(RangeFinderState s, MatchCase a)
 {
     CheckAny(s, a.Token);
     CheckAny(s, a.Second);
     CheckAny(s, a.Statement);
 }