From d6ced249a6b63bb4d64ad38bd5b610b73670c889 Mon Sep 17 00:00:00 2001 From: benibela Date: Wed, 29 Nov 2023 22:34:23 +0100 Subject: [PATCH] xquery 4: braced typeswitch --- data/xquery__parse.pas | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/data/xquery__parse.pas b/data/xquery__parse.pas index 2be8eb59..d22ef855 100644 --- a/data/xquery__parse.pas +++ b/data/xquery__parse.pas @@ -1878,11 +1878,13 @@ function TXQParsingContext.parseTypeSwitch: TXQTermTypeSwitch; var word: String; clause: TXQTermTypeSwitch.TXQTermTypeSwitchClause; + braced: Boolean; begin requireXQuery('for typeswitch statement'); result := TXQTermTypeSwitch.Create; try result.push(expectTerm('(', @parsePrimaryLevel, ')')); + braced := nextTokenIs('{'); word := nextToken(); while word = 'case' do begin @@ -1905,6 +1907,8 @@ function TXQParsingContext.parseTypeSwitch: TXQTermTypeSwitch; result.push(clause); if pos^ = '$' then clause.variable := TXQTermVariable(pointer(parseVariable)); clause.expr := expectTerm('return', @parse); + + if braced then expect('}'); except result.free; raise;