예제 #1
0
        private static IExpression ParseBlock(IdentifierToken name, IEnumerator <Token> tokenStream)
        {
            var token = tokenStream.GetNext();

            return(token switch
            {
                CloseBraceToken _ => new Block(name, ImmutableArray <Assignment> .Empty),
                IdentifierToken i => ParseBlock(name, i, tokenStream),
                _ => throw ParsingException.CreateError(token, "identifier or end of block"),
            });
예제 #2
0
        private static IExpression ParseBlockOrTupleList(IdentifierToken name, IEnumerator <Token> tokenStream)
        {
            var token = tokenStream.GetNext();

            return(token switch
            {
                OpenBraceToken ob => ParseIntTupleList(name, ob.Location, tokenStream),
                CloseBraceToken _ => new Block(name, ImmutableArray <Assignment> .Empty),
                IdentifierToken i => ParseBlock(name, i, tokenStream),
                _ => throw ParsingException.CreateError(token, "identifier, end of block, or start of tuple"),
            });