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

Peeking for regexes in xparse #482

Closed
blefloch opened this issue Sep 23, 2018 · 1 comment
Closed

Peeking for regexes in xparse #482

blefloch opened this issue Sep 23, 2018 · 1 comment
Assignees
Labels
duplicate This issue or pull request already exists enhancement New feature or request l3regex xparse Historical: see latex3/latex2e

Comments

@blefloch
Copy link
Member

  1. Given xparse: eats space token while looking for not provided, trailing optional argument #466 I've looked again at \peek_ functions. Despite there being many functions: 3 catcode/charcode/meaning, times 2 (remove or not), times 2 (ignore_spaces or not), times 3 (TF, T, F), plus a few others (N_type, collect_inline, …), the functions don't cover every use case. One option is to try and find building blocks. Another option is to provide a very general tool: peeking for an arbitrary regex, e.g.

    \peek_regex:nTF { [A-Za-z]* }   { word ~ "#1" ~ found }   { no ~ word }
    

    or a more general \peek_regex_replace:nnTF, or even something like

    \peek_case_regex_replace:nTF
     {
      { regex1 } { replacement1 } { code receiving replacement1 as #1 }
      { regex2 } { replacement2 } { code receiving replacement2 as #1 }
      ...
    }
    { code for when one case matched }
    { code for when no case matched }
    
  2. We regularly get requests for all sorts of new argument types in xparse ([xparse] "optional token" or "list of options for t type argument" #424, xparse: arguments of restricted content #465, xparse sorted embellishment list #467, some stackexchange questions). Should we bite the bullet and provide a regex argument type, perhaps p for pattern?

@blefloch blefloch added expl3 xparse Historical: see latex3/latex2e enhancement New feature or request l3regex labels Sep 23, 2018
@blefloch blefloch self-assigned this Mar 3, 2019
@josephwright
Copy link
Member

I'm going to 'forward dupe' to #820.

@josephwright josephwright added duplicate This issue or pull request already exists and removed expl3 labels Feb 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request l3regex xparse Historical: see latex3/latex2e
Projects
None yet
Development

No branches or pull requests

2 participants