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

Parse variable substitution #64

Open
jcubic opened this issue Jul 21, 2021 · 0 comments
Open

Parse variable substitution #64

jcubic opened this issue Jul 21, 2021 · 0 comments

Comments

@jcubic
Copy link

jcubic commented Jul 21, 2021

It seems that variable substitutions are not parsed, they are single expressions. I think that they should be split up if this to be a full bash parser.

replace:

${i/jcubic/JCUBIC}

as AST is:

{
  type: 'Script',
  commands: [
    {
      type: 'Command',
      name: {
        text: '${i/jcubic/JCUBIC}',
        expansion: [
          {
            loc: { start: 0, end: 17 },
            parameter: 'i/jcubic/JCUBIC',
            type: 'ParameterExpansion'
          }
        ],
        type: 'Word'
      }
    }
  ]
}

if anyone wants to use this parser she needs to parse the parameter herself.

Substitution is documented here https://tldp.org/LDP/abs/html/parameter-substitution.html

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

1 participant