1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-24 17:00:32 +02:00

zsh-workers/7989

This commit is contained in:
Tanaka Akira 1999-09-22 13:17:25 +00:00
parent 5d20d8fcba
commit 7d30343f32
4 changed files with 416 additions and 382 deletions

View file

@ -1011,6 +1011,93 @@ arguments) should be printed, the configuration key
tt(describe_values) is used in the same way as the key
tt(describe_options) is used by the tt(_arguments) function.
)
item(tt(_regex_arguments))(
This function is a compiler to generate a completion function. The
first argument specifies the name of generated function and rest arguments
specifies a completion specification in the notation like regular
expression with acions. The generated function is formed as a state
machine whose state corresponds each part of the specification of the
completion. The state machine runs on a command line and evaluate actions
when the command line is exhausted. The command line is represented by
single string that is generated by concatinating unquoted tt(words)
(before tt(CURRENT)) and tt(PREFIX) using the null character as a
separator.
The specification is one of following forms. (Metacharacters such as
`tt(LPAR())', `tt(RPAR())', `tt(#)' and `tt(|)' should be quoted.)
startitem()
item(tt(/)var(pattern)tt(/) [tt(%)var(lookahead)tt(%)] [tt(-)var(guard)] [tt(:)var(action)])(
This is a primitive element for the specification and corresponds to the
state of the compiled state machine. When the state machine is trying to
enter to this state, the state machine tries to match the pattern
`tt((#b)LPAR()(#B))var(pattern)tt(RPAR()(#B))var(lookahead)tt(*)' against to
the command line string. If it is matched, `var(guard)' is evaluated and
its return status is examined. If it is success, the state machine is
entered to this state. Otherwise when the pattern match or the guard
evaluation is failed, the state machine is failed to enter to this state
and other candidates are tried. If `var(pattern)' is the string `tt([])',
it is treated as the pattern which never match.
When the state machine is entered to this state, the left part of the
command line string matched against to `var(pattern)' is removed and next
states of this state are tried to enter with inner-to-outer, left-to-right
fashion.
If all tries are failed and remaining command line string contains no null
character, completion target is restricted to correspondence of remaining
command line string and `var(action)'s for the target is evaluated. Since
this state may not remove non-empty string from command line string,
prior states and its neighborhoods may have `var(actions)'s for the
target.
)
item(tt(/)var(pattern)tt(/+) [tt(%)var(lookahead)tt(%)] [tt(-)var(guard)] [tt(:)var(action)])(
This is similar to `tt(/)var(pattern)tt(/) ...' but the left part of
command line string is also considered as part of the completion target.
)
item(tt(/)var(pattern)tt(/-) [tt(%)var(lookahead)tt(%)] [tt(-)var(guard)] [tt(:)var(action)])(
This is similar to `tt(/)var(pattern)tt(/) ...' but `var(action)'s of this
and prior states are ignored even if following state's `var(pattern)'
matches empty string.
)
item(tt(LPAR()) var(spec) tt(RPAR()))(
This groups `var(spec)'.
)
item(var(spec) tt(#))(
This is repetation of `var(spec)'.
)
item(var(spec) var(spec))(
This is concatination of two `var(spec)'s.
)
item(var(spec) tt(|) var(spec))(
This is alternation of two `var(spec)'s.
)
enditem()
)
item(tt(_combination))(
This function uses a array to represent combinations of completing texts.
The first argument is a name of the array optionally appended completing
field names separated by colon. If it contains no colon, it is assumed
that the name is formed as `var(prefix)_var(fieldname)_..._var(fieldname)'
which `var(prefix)' and `var(fieldname)'s does not contain a underscore.
A each element of the array should be colon-separated completing texts
which correspond to the field names. The option `tt(-s) var(sepchar)'
can be given before the array name to change the delimiter in the array
element from colon.
Since second argument, zero or more arguments formed as
`var(fieldname)tt(=)var(pattern)' can be given. It restricts completion
candidates from the array by maching a text that corresponds to
`var(fieldname)' against to `var(pattern)'. If `tt(:)var(num)' is
specified between `var(fieldname)' and `tt(=)', `var(num)'th field in
named as `var(fieldname)' is used instead of the first.
After above arguments, completing field name should be given. It may have
suffix `tt(:)var(num)' to use a arbitrary field instead of the first as
above.
If there are no array element to match all of specified pattern and the
function `tt(_)var(fieldname)' exists, the function is called.
)
enditem()
texinode(Completion Directories)(Bindable Commands)(Completion Functions)(Completion System)
@ -1527,4 +1614,12 @@ is set to a non-empty value, this function will not try to use the
tt(stat) module to generate only names of modified files in the
appropriate places.
)
item(tt(regex_arguments_path))(
This specifies cache directory for the tt(_regex_arguments). If it is
empty, tt($HOME/.zsh/regex_arguments) is assumed.
If tt(regex_arguments_path) is an existing writable directory,
tt(_regex_arguments) sotores a compiled function definition into the
directory.
)
enditem()