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"), });
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"), });