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

[request] Add support for local, global, and export #72

Open
BlankCanvasStudio opened this issue Jan 4, 2022 · 3 comments
Open

[request] Add support for local, global, and export #72

BlankCanvasStudio opened this issue Jan 4, 2022 · 3 comments

Comments

@BlankCanvasStudio
Copy link
Contributor

If an assign statement is used after local, global, and export it is treated as a word node, not an assignment node.

@curtisforrester
Copy link

Agree. I often will declare functions as:

foo() {
  local key="$1"
  local value="$2"
  # Do the "needful"
}

@samlikins
Copy link

I was unable to reproduce an issue with local, global, or export using version 0.18.

@samlikins
Copy link

In a Python interactive session (using bashlex v0.18):

Python 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import bashlex
>>> bashlex.parse('local key=1')
[CommandNode(parts=[WordNode(parts=[] pos=(0, 5) word='local'), WordNode(parts=[] pos=(6, 11) word='key=1')] pos=(0, 11))]
>>> bashlex.parse('global key=1')
[CommandNode(parts=[WordNode(parts=[] pos=(0, 6) word='global'), WordNode(parts=[] pos=(7, 12) word='key=1')] pos=(0, 12))]
>>> bashlex.parse('export key=1')
[CommandNode(parts=[WordNode(parts=[] pos=(0, 6) word='export'), WordNode(parts=[] pos=(7, 12) word='key=1')] pos=(0, 12))]

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

3 participants