Merged
Conversation
OTP 28 is using a new regexp engine, PCRE2. Prior to OTP 28, Erlang regexps were using a binary:
```elixir
iex> ~r// |> Map.from_struct()
%{
re_pattern: {:re_pattern, 0, 0, 0,
<<69, 82, 67, 80, 71, 0, 0, 0, 0, 0, 0, 0, 1, 128, 0, 0, 255, 255, 255, 255,
255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0,
0, 0, ...>>},
opts: [],
source: "",
re_version: {"8.44 2020-02-12", :little}
}
```
Now it's:
```elixir
iex> ~r// |> Map.from_struct()
%{
re_pattern: {:re_pattern, 0, 0, 0, #Reference<0.3488040677.452067330.62636>},
opts: [],
source: ""
}
```
Having reference as part of term is problematic, this now crashes during
compilation:
```elixir
defmodule Main do
@regexp ~r//
def main do
@regexp
end
end
```
```
** (ArgumentError) cannot inject attribute @regexp into function/macro because cannot escape #Reference<0.3597165861.3136946177.250217>. The supported values are: lists, tuples, maps, atoms, numbers, bitstrings, PIDs and remote functions in the format &Mod.fun/arity
```
|
Would be great if this can be merged and released now that OTP 28 is out 🙏 |
Collaborator
|
Sorry for the delay I guess I have to take care of Earmark again @amit-chaudhari1 are you still willing to maintain Earmark. There is absolutely no shame not to find the time, but it would be good to know. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OTP 28 is using a new regexp engine, PCRE2. Prior to OTP 28, Erlang regexps were using a binary:
Now it's:
Having reference as part of term is problematic, this now crashes during compilation: