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

WISH: implement collect and keep as new parse's keywords #2471

Closed
Oldes opened this issue Dec 21, 2021 · 0 comments
Closed

WISH: implement collect and keep as new parse's keywords #2471

Oldes opened this issue Dec 21, 2021 · 0 comments
Labels
Oldes.resolved Bugs/wishes with Oldes' fixes/features Red compatibility Issues and changes required for compatibility with Red language Test.written Type.parse Parse related issues Type.wish

Comments

@Oldes
Copy link
Owner

Oldes commented Dec 21, 2021

It's already implemented in Red language and quite often used, so it should be added to Rebol for a better compatibility.

In Red it works like:

>> parse "abc" [collect any [keep 1 skip]]
== [#"a" #"b" #"c"]

>> parse [1 "a"][collect any [integer! | keep string!]]
== ["a"]

>> parse "abc" [collect any [keep 1 2 skip]]
== ["ab" #"c"]

>> parse "abc" [collect any [collect any [keep 1 2 skip]]]
== [["ab" #"c"]]

>> parse "abc" [collect any [collect any [keep 2 skip] keep to end]]
== [["ab"] #"c"]

>>  parse "abc" [any [keep 1 skip]]
*** Script Error: PARSE - KEEP is used without a wrapping COLLECT

>> collect [parse "abc" [any [keep 1 2 skip]]] ;<--- requires parse's collect!
*** Script Error: PARSE - KEEP is used without a wrapping COLLECT
@Oldes Oldes added Type.wish Type.parse Parse related issues labels Dec 21, 2021
@Oldes Oldes added the Red compatibility Issues and changes required for compatibility with Red language label Jul 21, 2022
@Oldes Oldes added Test.written Oldes.resolved Bugs/wishes with Oldes' fixes/features labels Jul 22, 2022
Oldes added a commit to Oldes/Rebol3 that referenced this issue Jul 23, 2022
Oldes added a commit to Oldes/Rebol3 that referenced this issue Jul 23, 2022
Oldes added a commit to Oldes/Rebol3 that referenced this issue Jul 26, 2022
Oldes added a commit to Oldes/Rebol3 that referenced this issue Jul 26, 2022
Oldes added a commit to Oldes/Rebol3 that referenced this issue Jul 26, 2022
Oldes added a commit to Oldes/Rebol3 that referenced this issue Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Oldes.resolved Bugs/wishes with Oldes' fixes/features Red compatibility Issues and changes required for compatibility with Red language Test.written Type.parse Parse related issues Type.wish
Projects
None yet
Development

No branches or pull requests

1 participant