Capture groups to subscopes? Or other approach?

I’m working on the HCL grammar for Nova, and one of the things I want to be able to do is support indented HEREDOC statements, such as

a_dictionary = {
  value = <<-SHELL
  some shellcode
  SHELL
}

Right now I have assignments defined as just catching the left side and the equals, and HEREDOCs are evaluated separately.

HOWEVER.

As a result of evaluating the HEREDOC separately, I don’t end up with access to the opening whitespace of the line, unless I capture the whole line and override the assignment match, which seems extremely cursed, and not what I want to do.

I could create custom assignment matches for each HEREDOC type, but that also seems to not be a great approach here.

Any thoughts on how to handle this?

EDIT: The title was me thinking, maybe capture groups from a scope could pass down to subscopes, so I could somehow get the opening whitespace to my HEREDOC match.