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

Better document AST metadata in Macro #14120

Merged
merged 3 commits into from
Dec 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions lib/elixir/lib/macro.ex
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ defmodule Macro do
* `:delimiter` - contains the opening delimiter for sigils, strings,
and charlists as a string (such as `"{"`, `"/"`, `"'"`, and the like)

* `:format` - set to `:keyword` when an atom is defined as a keyword

* `:do` - contains metadata about the `do` location in a function call with
`do`-`end` blocks (when `:token_metadata` is true)

Expand All @@ -159,10 +157,17 @@ defmodule Macro do
expressions inside "blocks of code", which are either direct children
of a `__block__` or the right side of `->`. The last expression of the
block does not have metadata if it is not followed by an end of line
character (either a newline or `;`)
character (either a newline or `;`). This entry may appear multiple times
in the same metadata if the expression is surround by parens

* `:format` - set to `:keyword` when an atom is defined as a keyword
Copy link
Member

Choose a reason for hiding this comment

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

It can also be :atom as of #13999.

josevalim marked this conversation as resolved.
Show resolved Hide resolved

* `:indentation` - indentation of a sigil heredoc

* `:parens` - denote a node was surrounded by parens for grouping.
josevalim marked this conversation as resolved.
Show resolved Hide resolved
This entry may appear multiple times in the same metadata if
multiple pairs are used for grouping

The following metadata keys are private:

* `:alias` - Used for alias hygiene.
Expand Down
Loading