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

elixir allow metavariables as atoms #474

Merged
merged 1 commit into from
Jan 31, 2024
Merged

Conversation

amchiclet
Copy link
Contributor

@amchiclet amchiclet commented Jan 31, 2024

Elixir has atoms that are pretty much identifiers that start with a colon, e.g. :foo.

Metavars can match expressions, but not atoms

  • $ATOM matches :foo
  • :$ATOM doesn't parse

This PR allows metavars as atoms so :$ATOM matches :foo.

Also fixed some indentation in some previous code.

Test plan: added test in https://github.com/semgrep/semgrep-proprietary/pull/1274

Security

  • Change has no security implications (otherwise, ping the security team)

@amchiclet amchiclet marked this pull request as ready for review January 31, 2024 03:05
@amchiclet amchiclet requested a review from a team as a code owner January 31, 2024 03:05
@amchiclet amchiclet removed the request for review from a team January 31, 2024 03:06
Copy link
Collaborator

@aryx aryx left a comment

Choose a reason for hiding this comment

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

We have other languages with atoms.
Do we support this also for Ruby?

@amchiclet
Copy link
Contributor Author

I will check and report back.

@amchiclet
Copy link
Contributor Author

amchiclet commented Jan 31, 2024

Yes, this same behavior in supported in Ruby.

@amchiclet
Copy link
Contributor Author

Ran make setup, make install, make -C core test, and make lang locally. All of them passed, so I'm merging now.

Filed a linear ticket to fix CI.

@amchiclet amchiclet merged commit b52bcb7 into main Jan 31, 2024
2 of 3 checks passed
@amchiclet amchiclet deleted the amarin/elixir-metavar-atom branch January 31, 2024 08:46
@amchiclet
Copy link
Contributor Author

cc @p4p3r here's the metavar atom parsing fix.

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