Skip to content

WIP: Parse multi-word parameters in command position #675

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

Conversation

danielshahaf
Copy link
Member

Fixes #674. Improves the behaviour for #670: there's no longer a BUG: message on stderr, but the tests don't pass (the error is recorded in the log message). Conflicts with #667.

The code is based on the aliases code. Some edge cases are probably missing.

In particular, I think what's happening is that in aliases alias_style is initialized to alias but in parameters, param_style isn't analogously initialized, so that's why the assign style never gets set. The return in _zsh_highlight_main_add_region_highlight makes assign not be recorded anywhere.

Hints welcome.

…already do for aliases.

Fixes zsh-users#674.

WIP: One test fails:

# commmand-parameter
1..8
ok 1 - [1,2] «$x»
ok 2 - [4,13] «"argument"»
ok 3 - [4,13] «"argument"»
ok 4 - [14,14] «;»
not ok 5 - [16,17] «$y» - expected (16 17 "precommand"), observed (16 17 "command").
ok 6 - [18,18] «;»
ok 7 - [20,21] «$z»
ok 8 - cardinality check
They fail as follows:

# commmand-parameter
1..8
ok 1 - [1,2] «$x»
ok 2 - [4,13] «"argument"»
ok 3 - [4,13] «"argument"»
ok 4 - [14,14] «;»
not ok 5 - [16,17] «$y» - expected (16 17 "precommand"), observed (16 17 "command").
ok 6 - [18,18] «;»
ok 7 - [20,21] «$z»
ok 8 - cardinality check
# parameter-value-contains-command-position1
1..2
not ok 1 - [1,7] «$foobar» - expected (1 7 "assign"), observed (1 7 "unknown_token").
ok 2 - cardinality check
# parameter-value-contains-command-position2
1..2
not ok 1 - [1,2] «$y» - expected (1 2 "assign"), observed (1 2 "unknown_token").
ok 2 - cardinality check
Current test failures:

Running test main
# parameter-value-contains-command-position1
1..2
ok 1 - [1,7] «$foobar»
not ok 2 - have 1 expectations and 2 region_highlight entries: «expected_region_highlight=( '1 7 assign' )» «region_highlight=( '0 7 assign' '0 7 assign' )»
# parameter-value-contains-command-position2
1..2
ok 1 - [1,2] «$y»
not ok 2 - have 1 expectations and 2 region_highlight entries: «expected_region_highlight=( '1 2 assign' )» «region_highlight=( '0 2 assign' '0 2 assign' )»
@danielshahaf
Copy link
Member Author

Pushed a few more commits. Now it passes tests except that it adds the style twice in the two new tests for #670. I still don't know if the patch is correct or not, though…

@danielshahaf
Copy link
Member Author

I've pushed a revised version of the branch to danielsh/parameters-multi-word-machinery-v2. The changes are:

  • Squash the oldest and third-oldest commits, so now there's three commits (rather than four) and the oldest of the remaining ones passes tests.
  • Extend the log message of the second commit.

@danielshahaf
Copy link
Member Author

I've pushed a revised version of the branch to danielsh/parameters-multi-word-machinery-v2. The changes are:

That's #684, now merged. It supersedes this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parse array parameters in command position
1 participant