Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slice operator is marked as invalid #64

Open
fionera opened this issue May 16, 2023 · 3 comments
Open

Slice operator is marked as invalid #64

fionera opened this issue May 16, 2023 · 3 comments

Comments

@fionera
Copy link

fionera commented May 16, 2023

This is a valid expression:

strings.Join(_t[:len(_t)-1], "-")
@jansorg
Copy link
Collaborator

jansorg commented May 30, 2023

// fixme this is a simple rewrite as non-left-recursive for now
// fixme: commented slice as it's not yet well defined in the grammar
PrimaryExpr ::= Operand {Selector | Index /*| Slice*/ | Arguments}* {extends=Expression}
Selector ::= "." (<<identifier_ref>> | simple_string_lit) {extends=PrimaryExpr}
Index ::= "[" Expression (":" Expression)? "]" {extends=PrimaryExpr pin=1} //fixme find out why example use ":" in Index
Argument ::= Expression {extends=PrimaryExpr}
Arguments ::= "(" [ ( Argument { comma Argument }* ) [ comma ] ] ")" {extends=PrimaryExpr pin=1}
// fixme Slice is missing
, the official grammar is missing the spec of Slice. Is there perhaps a list of examples to help me understand what it does?
I'm not a regular user of Cue, so I don't know enough about the language to fix it without a spec.

@jansorg
Copy link
Collaborator

jansorg commented May 30, 2023

cc @leoluk ^

@fionera
Copy link
Author

fionera commented May 30, 2023

Afaik its the same grammar as in Go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants