Comments (7)
Good question, -9223372036854775808
is the minimum value for an int64
and is parsed as such, so the negation operator (-_
) isn't actually applied in this case.
That said, you've raised a good test case for double negation: -(-9223372036854775808)
should produce an error and it likely doesn't in the implementations.
@JimLarson thoughts?
from cel-spec.
The definition of numeric values says.
“ We only support positive, decimal integer literals; negative integers are produced by the unary negation operator.”
This seems to suggest the test case is at odds with the specification.
from cel-spec.
from cel-spec.
Will that lead to changes in the grammar to prefix an optional leading ‘-‘ to the numeric tokens to created signed tokens?
from cel-spec.
In the current implementations, the numeric tokens are signed. I believe they have been for quite some time:
It appears that I forgot to update the lexis in the spec, but you can see from the grammar change about 1.5 years ago, that the tokens are signed and the spec out of date.
Out of curiosity, are you looking to implement the spec yourself with a custom lexer / parser?
from cel-spec.
My mistake. I was relying on the EBNF in the language specification document. As well as the text of the specification. Should I put in a PR to fix that?
I see how signs were added to the literal specification in https://github.com/google/cel-go/blob/master/parser/gen/CEL.g4#L80-L89.
And yes. We're looking at creating a CEL implementation. cloud-custodian/cloud-custodian#5759.
from cel-spec.
I'd be happy to accept a PR. Honestly, this was my oversight, so I wouldn't have expected anyone to dig into the implementations to figure this out.
If you're looking to bootstrap your project, you could also use the ANTLR Python codegen / runtime. You will likely be able to build something faster with another tool, but the ANTLR stack should be self-consistent.
You don't need to support proto-based types, a pure-Python representation of CEL values should be sufficient, though it would be a good idea to support nullable primatives and the strict definition of JSON that proto does. Also an ability to map from the CEL AST proto to your in-memory representation will make it possible to setup a conformance harness.
I have more advice that I'd be happy to give, if you'd like to reach out via the [email protected] mailing list.
Cheers!
from cel-spec.
Related Issues (20)
- Conformance tests for heterogeneous numeric in/equality HOT 1
- Allow optional trailing commas in function calls
- Is the cel-spec compatible with Kotlin, if so, how do I add this in my project? HOT 1
- pseudo numeric values in map keys HOT 1
- CeL pure functions HOT 1
- Merging maps HOT 2
- Optional Values Support HOT 4
- Map to Map/List conversion
- CIDR block validation HOT 1
- has() macro for complicated map key HOT 1
- Does cel support regex syntax? HOT 1
- Will cel be moving to a new organization? HOT 1
- [Question] how to specify now()? HOT 3
- Support jq x[] operation
- Support bitwise operators HOT 3
- C spex
- Link to the implementation dashboard is broken. HOT 1
- Function Definitions and Variables HOT 2
- Protobuf extensions HOT 2
- Checking for undeclared reference HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cel-spec.