misplaced compiler error

Bug #1210320 reported by Paul J. Lucas
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zorba
Fix Committed
Medium
Nicolae Brinza

Bug Description

Given:

(:===== CUT =====:)
jsoniq version "1.0";

declare namespace an = "http://www.zorba-xquery.com/annotations";

declare %an:sequential function local:same-sentence( $tokens as object* )
  as xs:boolean
{
  let $head := head( $tokens )
  for $t in tail( $tokens ) { (: <-- missing "return" here :)
    if ( $t.sentence ne $head.sentence )
    then exit returning false;
    else ;
  }
  true
};

let $tokens := (
  { "sentence" : 1 },
  { "sentence" : 1 },
  { "sentence" : 2 }
)
return local:same-sentence( $tokens )
(:===== CUT =====:)

one gets:

</tmp/x.jq>:3,65: static error [err:XPST0003]: invalid expression: syntax error, missing semicolon ";" after statement.; raised at /Users/pjl/src/flwor/zorba/repo/bug-1187161/zorba/src/compiler/api/compiler_api.cpp:253

The actual error is the missing "return" in the "for", but the compiler instead complains about the ';' that is present despite it's complaint.

Related branches

Chris Hillery (ceejatec)
Changed in zorba:
milestone: 3.0 → none
Nicolae Brinza (nbrinza)
Changed in zorba:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.