Skip to content

Add match function to addons#4268

Merged
danmar merged 1 commit intodanmar:mainfrom
pfultz2:addon-match
Jul 12, 2022
Merged

Add match function to addons#4268
danmar merged 1 commit intodanmar:mainfrom
pfultz2:addon-match

Conversation

@pfultz2
Copy link
Copy Markdown
Contributor

@pfultz2 pfultz2 commented Jul 11, 2022

This adds a match function to addons, it supports:

  • | for either-or tokens(ie struct|class to match either struct or class)
  • !! to negate a token
  • It supports the %any%, %assign%, %comp%, %name%, %op%, %or%, %oror%, and %var% keywords
  • It supports (*), {*}, [*], and <*> to match links
  • @ can be added to bind the token to a name

This returns MatcherResult when can be used as a boolean or you can read the bound tokens:

r = match(tok, "%name%@ftok (*)")
if (r.ftok.str == "strlen"):
...

Copy link
Copy Markdown
Owner

@danmar danmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really nice! 👍

@danmar danmar merged commit 7b549b6 into danmar:main Jul 12, 2022
@pfultz2 pfultz2 deleted the addon-match branch July 19, 2022 08:08
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

Successfully merging this pull request may close these issues.

2 participants