command-parsing: Put balanced string examples in the right section.
Addressing code-review comments.
This commit is contained in:
parent
1b8381461d
commit
cc66237bf5
|
@ -51,33 +51,7 @@ delimiter matches that of its opening delimiter (respectively, `)`, `]`,
|
||||||
`}`, and `>`).
|
`}`, and `>`).
|
||||||
|
|
||||||
There is no way to escape the opening and closing characters, even if they
|
There is no way to escape the opening and closing characters, even if they
|
||||||
are nested inside some other kind of string. For example, this will **not**
|
are nested inside some other kind of string.
|
||||||
work, because the `{` in the map command interferes with the delimiters for the
|
|
||||||
hook's command block:
|
|
||||||
|
|
||||||
----
|
|
||||||
# DOES NOT WORK
|
|
||||||
hook global WinSetOption filetype=latex %{
|
|
||||||
map window user b 'o\begin{'
|
|
||||||
}
|
|
||||||
----
|
|
||||||
|
|
||||||
You can solve this by using a different outer delimiter:
|
|
||||||
|
|
||||||
----
|
|
||||||
hook global WinSetOption filetype=latex %[
|
|
||||||
# Note different delimiter used -----^
|
|
||||||
map window user b o\begin{
|
|
||||||
]
|
|
||||||
----
|
|
||||||
|
|
||||||
...or just by including matching delimiters inside comments:
|
|
||||||
|
|
||||||
----
|
|
||||||
hook global WinSetOption filetype=latex %{
|
|
||||||
map window user b o\begin{ # matched pair to keep Kakoune happy: }
|
|
||||||
}
|
|
||||||
----
|
|
||||||
|
|
||||||
=== Balanced Strings Examples
|
=== Balanced Strings Examples
|
||||||
|
|
||||||
|
@ -89,6 +63,10 @@ hook global WinSetOption filetype=latex %{
|
||||||
|
|
||||||
- `"foo %{bar}"` is a single word whose content is *foo bar*.
|
- `"foo %{bar}"` is a single word whose content is *foo bar*.
|
||||||
|
|
||||||
|
- `%{foo\{}` is a parse error, since the `{}` delimiters are not balanced.
|
||||||
|
|
||||||
|
- `%[foo\{]` contains *foo\{*, since it uses different delimiters.
|
||||||
|
|
||||||
== Non-Quoted words
|
== Non-Quoted words
|
||||||
|
|
||||||
Other words are non-quoted. Non-quoted words are terminated by either a
|
Other words are non-quoted. Non-quoted words are terminated by either a
|
||||||
|
|
Loading…
Reference in New Issue
Block a user