Skip to content

feat: Preludes Until, String, Span, Line and EOL#133

Draft
phorward wants to merge 11 commits intotokay-lang:mainfrom
phorward:prelude-Until
Draft

feat: Preludes Until, String, Span, Line and EOL#133
phorward wants to merge 11 commits intotokay-lang:mainfrom
phorward:prelude-Until

Conversation

@phorward
Copy link
Member

@phorward phorward commented Jan 18, 2024

This is the PR for implementing the built-in parselets

Started with Until.tok draft.
Currently not working due #130. (meanwhile fixed by #166).


The original definition from #10:

Until : @<P, Escape: Void>

The Until-parselet parses data until a specific token occurs.

  • '"' Until<'"', Escape: '\\'> '"' parse strings like "Hello World" or with escape sequences like "Hello\nWorld"
  • Implement a String parselet as shortcut for above, like String: @<Start, End: Void, Escape: Void>
  • Until<Not<Char<A-Za-z_>]>> parse anything consisting not of Char<A-Za-z_> INVALID.
  • Until<EOF> read all until EOF
  • Line built-in #38 refers to a Line parselet for matching input lines

Started with until.tok draft.
Currently not working due tokay-lang#130.
@phorward phorward added the feature New feature or request label Jan 18, 2024
@phorward phorward self-assigned this Feb 3, 2024
@phorward
Copy link
Member Author

phorward commented Jul 3, 2024

This PR is a dependency for #38

@phorward phorward added this to the v0.7 milestone Oct 2, 2024
@phorward
Copy link
Member Author

The original attempt of until.tok, which is this:

Until : @<P, Escape: Void, Reject: Void> {
    Peek<P>  accept $0
    (Escape P | Char)  repeat
    Reject?  reject
}

String: @<Start: Char<'">, End: Void, Escape: '\\'> {
    Start Until<(End | Start), Escape> (End | Start)
}

#print(Until<'x', '\\'> 'x')
print("STRING:", String<'"'>)
print(Char)

now works with #166 as expected 💯.

phorward added a commit that referenced this pull request Oct 28, 2025
This feature allows for dynamic match and touch.
It is needed by #133.
@phorward phorward changed the title feat: Until and String-preludes feat: Preludes Until, String, Span, Line and EOL Oct 31, 2025
@phorward phorward linked an issue Oct 31, 2025 that may be closed by this pull request
@phorward phorward mentioned this pull request Oct 31, 2025
@phorward phorward linked an issue Nov 1, 2025 that may be closed by this pull request
11 tasks
@phorward phorward mentioned this pull request Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Builtin / default constants Line built-in

1 participant