Opened 12 years ago

Closed 10 years ago

#146 closed defect (fixed)

WCPS parser does not raise exception when parenthesis are missing

Reported by: Piero Campalani Owned by: Dimitar Misev
Priority: minor Milestone: 8.4
Component: petascope Version: 8.3
Keywords: wcps parser parenthesis Cc: utkrist
Complexity: Very Hard

Description

E.g. a correct WCPS coverageExpr:

for C in (mean_summer_airtemp) return 
    encode(
        scale(C,{
            x:"CRS:1"(0:127),
            y:"CRS:1"(0:156)
        }),
        "png"
    )

Same query + random removal of parenthesis:

for C in mean_summer_airtemp) return 
    encode(
        scale C,{
            x:"CRS:1"(0:127),
            y:"CRS:1"0:156)
    ),
    "png"

The output is identical.
The parser *does* notice this (logs), but no exception is thrown.

Change History (6)

comment:1 by Dimitar Misev, 12 years ago

Nice bug if you're lazy to type parenthesis :))

comment:2 by Piero Campalani, 12 years ago

Summary: WCPS parser does not raise exception when parethesis are missingWCPS parser does not raise exception when parenthesis are missing

ahah…

comment:3 by Dimitar Misev, 12 years ago

Resolution: wontfix
Status: newclosed

I've looked around and it seems like there's nothing much we can do to force it throw an error. I think it's just how antlr works, if it can still recognise the query it considers it fine. Even removing the for will work.. :D Removing in won't work though.

So I close it as won't fix because I think we can't do anything about it.

comment:4 by Dimitar Misev, 10 years ago

Cc: utkrist added
Complexity: Very Hard
Resolution: wontfix
Status: closedreopened

Utkrist has accidentally discovered a way to fix this and make the grammar stricter.

I'm afraid it will break some existing queries/services (we discovered it as some queries in the systemtest erroneously have extra parentheses. So I'm not sure if we want to fix this now?

comment:5 by Piero Campalani, 10 years ago

Accidentally discovered?
Wow.. Good shot Utkrist!

Imho, if this is not very hard like you (maybe accidentally again) set on this ticket, we should fix it: personally I feel safer to know that parenthesis checks are strict.

comment:6 by Dimitar Misev, 10 years ago

Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.