Skip to content

Commit

Permalink
xquery 4: braced typeswitch
Browse files Browse the repository at this point in the history
  • Loading branch information
benibela committed Nov 29, 2023
1 parent f877f99 commit d6ced24
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions data/xquery__parse.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down

0 comments on commit d6ced24

Please sign in to comment.