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

Allow pipe commands to start with $ #28

Merged
merged 2 commits into from
Aug 31, 2020
Merged

Allow pipe commands to start with $ #28

merged 2 commits into from
Aug 31, 2020

Conversation

schneems
Copy link
Member

Pipe commands can take two forms:

| tail

and:

| $ tail

So that fully qualified commands can be used. There was a bug that commands that started with $ were not being used.

Prior to this the parser was expecting a command which looks like this:

    # :::>> $ cat foo.rb
    rule(:command) {
      (
        start_command >>
        visability.as(:cmd_visability) >> spaces? >>
        method_call.as(:cmd_method_call) >> newline.maybe #>> match(/\z/)
      ).as(:command)
    }

Which would never be matched. So we were accidentally relying on the failure rescue mode from the parser to give us the behavior for | tail.

With this change any commands should be allowed such as | $ tail.

Pipe commands can take two forms:

```
| tail
```

and:

```
| $ tail
```

So that fully qualified commands can be used. There was a bug that commands that started with $ were not being used.

Prior to this the parser was expecting a `command` which looks like this:

```
    # :::>> $ cat foo.rb
    rule(:command) {
      (
        start_command >>
        visability.as(:cmd_visability) >> spaces? >>
        method_call.as(:cmd_method_call) >> newline.maybe #>> match(/\z/)
      ).as(:command)
    }
```

Which would never be matched. So we were accidentally relying on the failure rescue mode from the parser to give us the behavior for `| tail`.

With this change any commands should be allowed such as `| $ tail`.
@schneems schneems merged commit 6e0c564 into main Aug 31, 2020
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

Successfully merging this pull request may close these issues.

1 participant