* @throws XPathException
     */
    private void parseLetClause(List clauseList) throws XPathException {
        boolean first = true;
        do {
            LetClause clause = new LetClause();
            if (first) {
                clause.offset = t.currentTokenStartOffset;
            }
            clauseList.add(clause);
            nextToken();
            if (first) {
                first = false;
            } else {
                clause.offset = t.currentTokenStartOffset;
            }
            expect(Token.DOLLAR);
            nextToken();
            expect(Token.NAME);
            String var = t.currentTokenValue;

            LetExpression v = new LetExpression();
            StructuredQName varQName = makeStructuredQName(var, false);
            v.setRequiredType(SequenceType.ANY_SEQUENCE);
            v.setVariableQName(varQName);
            clause.variable = v;
            nextToken();

            if (t.currentToken == Token.AS) {
                nextToken();
                v.setRequiredType(parseSequenceType());
            }

            expect(Token.ASSIGN);
            nextToken();
            v.setSequence(parseExprSingle());
            declareRangeVariable(v);
        } while (t.currentToken == Token.COMMA);
    }