google / cel-spec

Common Expression Language -- specification and binary representation
https://cel.dev
Apache License 2.0
2.88k stars 225 forks source link

Flexible comment style #169

Open yegle opened 3 years ago

yegle commented 3 years ago

Hi,

It looks like only // style line comment is supported in CEL. I wonder if this rule can be relaxed to support # style line comment.

Since CEL can be embedded in other config languages (e.g. having Cloud Armor configs in Terraform config), it would be ideal if flexible comment style can be supported. Having to write // comment within a language with # style comment is a bit weird.

TristonianJones commented 3 years ago

Hi @yegle,

I've tried embedding CEL in YAML before and my experience was that I could write a YAML comment and it would be stripped from the CEL string by the YAML parser. Could you give me an example of how you're using it so maybe I can better understand where the problematic usage comes up for you. Perhaps I was just writing a lot of header-style comments on the YAML field and just didn't think too much about trying to write inline comments with the expression.

Thanks,

-Tristan

yegle commented 3 years ago

https://github.com/google/exposure-notifications-verification-server/blob/main/terraform/dos.tf is an example. The Terraform HCL supports both # and // styles of line comment, but the comment of the embedded Cloud Armor config (in CEL) has to be written using //.

TristonianJones commented 3 years ago

Thanks for the example, I'll give it a look.