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

Fix strings in bash #2586

Open
pokey opened this issue Jul 26, 2024 · 4 comments
Open

Fix strings in bash #2586

pokey opened this issue Jul 26, 2024 · 4 comments

Comments

@pokey
Copy link
Member

pokey commented Jul 26, 2024

In bash, we don't properly support strings. For example:

commit_message="$(git log -1 --pretty=format:"%s" HEAD)"

This is actually two nested strings: "$(git log -1 --pretty=format:"%s" HEAD)" and "%s". Instead we treat it as two strings in sequence: "$(git log -1 --pretty=format:" and " HEAD)". We should figure out how to make this work, probably using the parse tree, and/or some flavour of #1812 (comment)

@pokey
Copy link
Member Author

pokey commented Jul 26, 2024

@AndreasArvidsson fyi this doesn't work either on today's main or on #2457

@AndreasArvidsson
Copy link
Member

This is one of those things we probably need to use the parse tree

(program
  (variable_assignment
    name: (variable_name)
    "="
    value: (string
      """
      (command_substitution
        "$("
        (command
          name: (command_name
            (word)
          )
          argument: (word)
          argument: (number)
          argument: (concatenation
            (word)
            (string
              """
              (string_content)
              """
            )
          )
          argument: (word)
        )
        ")"
      )
      """
    )
  )
)

@pokey
Copy link
Member Author

pokey commented Jul 28, 2024

I think we could just use parse tree to tell us if it's opening or closing?

@pokey
Copy link
Member Author

pokey commented Jul 28, 2024

Text fragment thing will get in the way a bit tho I fear as well treat the string as a fragment

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

No branches or pull requests

2 participants