misplaced compiler error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zorba |
Fix Committed
|
Medium
|
Nicolae Brinza |
Bug Description
Given:
(:===== CUT =====:)
jsoniq version "1.0";
declare namespace an = "http://
declare %an:sequential function local:same-
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-
(:===== CUT =====:)
one gets:
</tmp/x.jq>:3,65: static error [err:XPST0003]: invalid expression: syntax error, missing semicolon ";" after statement.; raised at /Users/
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
- Cezar Andrei: Approve
- Nicolae Brinza: Approve
-
Diff: 27986 lines (+3970/-3837)13 files modifiedsrc/compiler/parser/jsoniq_parser.cpp (+1545/-1531)
src/compiler/parser/jsoniq_parser.hpp (+6/-6)
src/compiler/parser/jsoniq_scanner.cpp (+371/-385)
src/compiler/parser/parser.y (+31/-10)
src/compiler/parser/xquery_parser.cpp (+1533/-1519)
src/compiler/parser/xquery_parser.hpp (+6/-6)
src/compiler/parser/xquery_scanner.cpp (+366/-380)
test/rbkt/ExpQueryResults/zorba/parser/syntax-errors/missing-semicolon-06.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/parser/syntax-errors/missing-semicolon-07.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/parser/syntax-errors/missing-semicolon-08.xml.res (+1/-0)
test/rbkt/Queries/zorba/parser/syntax-errors/missing-semicolon-06.xq (+34/-0)
test/rbkt/Queries/zorba/parser/syntax-errors/missing-semicolon-07.xq (+34/-0)
test/rbkt/Queries/zorba/parser/syntax-errors/missing-semicolon-08.xq (+41/-0)
Changed in zorba: | |
milestone: | 3.0 → none |
Changed in zorba: | |
status: | New → Fix Committed |