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

[CN] Allow member_shift<ctype> as a syntax #728

Open
dc-mak opened this issue Nov 27, 2024 · 0 comments
Open

[CN] Allow member_shift<ctype> as a syntax #728

dc-mak opened this issue Nov 27, 2024 · 0 comments
Labels
cn language Related to design of the CN language

Comments

@dc-mak
Copy link
Contributor

dc-mak commented Nov 27, 2024

Current one is confusing. Stop-gap for #349 . Should be a very small change to the parser, making it more similar to array_shift

| CN_ARRAY_SHIFT LT ty=ctype GT LPAREN base=expr COMMA index=expr RPAREN
{ Cerb_frontend.Cn.(CNExpr ( Cerb_location.(region ($startpos, $endpos) (PointCursor $startpos($1)))
, CNExpr_array_shift (base, Some ty, index))) }
| CN_ARRAY_SHIFT LPAREN base=expr COMMA index=expr RPAREN
{ Cerb_frontend.Cn.(CNExpr ( Cerb_location.(region ($startpos, $endpos) (PointCursor $startpos($1)))
, CNExpr_array_shift (base, None, index))) }
| CN_MEMBER_SHIFT LPAREN base=expr COMMA member=cn_variable RPAREN
{ Cerb_frontend.Cn.(CNExpr ( Cerb_location.(region ($startpos, $endpos) (PointCursor $startpos($1)))
, CNExpr_membershift (base, None, member))) }
| CN_MEMBER_SHIFT LT tag=cn_variable GT LPAREN base=expr COMMA member=cn_variable RPAREN
{ Cerb_frontend.Cn.(CNExpr ( Cerb_location.(region ($startpos, $endpos) (PointCursor $startpos($1)))
, CNExpr_membershift (base, Some tag, member))) }

@dc-mak dc-mak added cn language Related to design of the CN language labels Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cn language Related to design of the CN language
Projects
None yet
Development

No branches or pull requests

1 participant