Opened 5 years ago

Closed 3 years ago

#146 closed defect (fixed)

WCPS parser does not raise exception when parenthesis are missing

Reported by: pcampalani Owned by: dmisev
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 Changed 5 years ago by dmisev

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

comment:2 Changed 5 years ago by pcampalani

  • Summary changed from WCPS parser does not raise exception when parethesis are missing to WCPS parser does not raise exception when parenthesis are missing

ahah...

comment:3 Changed 4 years ago by dmisev

  • Resolution set to wontfix
  • Status changed from new to closed

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 Changed 3 years ago by dmisev

  • Cc utkrist added
  • Complexity set to Very Hard
  • Resolution wontfix deleted
  • Status changed from closed to reopened

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 Changed 3 years ago by pcampalani

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 Changed 3 years ago by dmisev

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.