OpenBSD CVS

CVS log for src/usr.bin/tmux/cmd-parse.y


[BACK] Up to [local] / src / usr.bin / tmux

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.50 / (download) - annotate - [select for diffs], Wed Mar 15 08:15:39 2023 UTC (14 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, HEAD
Changes since 1.49: +15 -4 lines
Diff to previous 1.49 (colored)

Fix command prompt not to always append argument but only if there has
actually been expansion. GitHub issue 3493.

Revision 1.49 / (download) - annotate - [select for diffs], Tue Oct 25 09:12:05 2022 UTC (18 months, 3 weeks ago) by nicm
Branch: MAIN
Changes since 1.48: +3 -2 lines
Diff to previous 1.48 (colored)

Fix a memory leak, from Japin Li in GitHub issue 3358.

Revision 1.48 / (download) - annotate - [select for diffs], Fri Sep 10 08:52:46 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.47: +8 -4 lines
Diff to previous 1.47 (colored)

Disable aliases inside aliases for the moment.

Revision 1.47 / (download) - annotate - [select for diffs], Thu Sep 9 06:57:48 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.46: +23 -26 lines
Diff to previous 1.46 (colored)

Fix parsing of aliases again (GitHub issue 2842), also make argument
parsing a bit simpler and fix the names of some client flags.

Revision 1.46 / (download) - annotate - [select for diffs], Fri Aug 27 17:25:55 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.45: +66 -60 lines
Diff to previous 1.45 (colored)

Replace %% in command lists (by copying them) for template arguments ,
this means they can be used with {} as well. Also make argument
processing from an existing vector preserve commands. GitHub issue 2858.

Revision 1.45 / (download) - annotate - [select for diffs], Mon Aug 23 11:48:21 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.44: +1 -2 lines
Diff to previous 1.44 (colored)

Key bindings steal a reference to the command instead of adding their
own, it was correct not to add a reference when parsing, but the
bind-key then needs to add one.

Revision 1.44 / (download) - annotate - [select for diffs], Mon Aug 23 11:08:26 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.43: +2 -1 lines
Diff to previous 1.43 (colored)

Revert one of previous, for some reason it is being freed.

Revision 1.43 / (download) - annotate - [select for diffs], Mon Aug 23 11:04:21 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.42: +5 -6 lines
Diff to previous 1.42 (colored)

Fix a few memory leaks.

Revision 1.42 / (download) - annotate - [select for diffs], Sun Aug 22 13:00:28 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.41: +2 -2 lines
Diff to previous 1.41 (colored)

Insert alias in the right place, GitHub issue 2842.

Revision 1.41 / (download) - annotate - [select for diffs], Sat Aug 21 20:46:43 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.40: +3 -2 lines
Diff to previous 1.40 (colored)

Preserve argument type in command and convert to string on demand.

Revision 1.40 / (download) - annotate - [select for diffs], Sat Aug 21 18:39:07 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.39: +20 -11 lines
Diff to previous 1.39 (colored)

Pass typed arguments out of the parser into the arguments list and let
it convert them into strings.

Revision 1.39 / (download) - annotate - [select for diffs], Sat Aug 21 17:25:32 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.38: +7 -10 lines
Diff to previous 1.38 (colored)

Stop caring about empty commands, just treat as a null command.

Revision 1.38 / (download) - annotate - [select for diffs], Sat Aug 21 14:06:17 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.37: +2 -2 lines
Diff to previous 1.37 (colored)

Preserve command group when moving temporary list to current list being
buit.

Revision 1.37 / (download) - annotate - [select for diffs], Fri Aug 20 20:08:30 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.36: +2 -2 lines
Diff to previous 1.36 (colored)

A couple more spacing fixes.

Revision 1.36 / (download) - annotate - [select for diffs], Fri Aug 20 09:06:26 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.35: +128 -147 lines
Diff to previous 1.35 (colored)

Actually parse contents of {} as a command and then convert to a string
instead of just copying arguments around as strings.

Revision 1.35 / (download) - annotate - [select for diffs], Fri Aug 20 06:30:57 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.34: +34 -23 lines
Diff to previous 1.34 (colored)

Add a helper function for actually parsing the command.

Revision 1.34 / (download) - annotate - [select for diffs], Wed Aug 18 15:16:33 2021 UTC (2 years, 9 months ago) by nicm
Branch: MAIN
Changes since 1.33: +2 -1 lines
Diff to previous 1.33 (colored)

Need to flatten arguments for aliases.

Revision 1.33 / (download) - annotate - [select for diffs], Wed Aug 18 10:15:08 2021 UTC (2 years, 9 months ago) by nicm
Branch: MAIN
Changes since 1.32: +190 -79 lines
Diff to previous 1.32 (colored)

Push the conversion of {} to string up out of the parser and into the
command builder.

Revision 1.32 / (download) - annotate - [select for diffs], Tue Dec 1 10:48:03 2020 UTC (3 years, 5 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.31: +6 -2 lines
Diff to previous 1.31 (colored)

Leave newlines inside multiline quotes.

Revision 1.31 / (download) - annotate - [select for diffs], Mon Jul 13 10:10:10 2020 UTC (3 years, 10 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.30: +2 -2 lines
Diff to previous 1.30 (colored)

Do not dereference NULL environment variable value, GitHub issue 2304.

Revision 1.30 / (download) - annotate - [select for diffs], Thu Jun 4 16:06:01 2020 UTC (3 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.29: +4 -2 lines
Diff to previous 1.29 (colored)

A } can go on the same line as a command.

Revision 1.29 / (download) - annotate - [select for diffs], Thu Jun 4 08:30:44 2020 UTC (3 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.28: +24 -19 lines
Diff to previous 1.28 (colored)

Allow strings to span multiple lines - newlines and any leading
whitespace are removed, as well as any following comments that couldn't
be part of a format. This allows long formats or other strings to be
annotated and indented.

Revision 1.28 / (download) - annotate - [select for diffs], Thu Jun 4 07:12:05 2020 UTC (3 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.27: +64 -143 lines
Diff to previous 1.27 (colored)

Instead of using a custom parse function to process {}, treat it as a
set of statements and parse with yacc, then convert back to a string as
the last step. This means the rules are consistent inside and outside
{}, %if and friends work at the right time, and the final result isn't
littered with unnecessary newlines.

Revision 1.27 / (download) - annotate - [select for diffs], Mon May 25 18:57:24 2020 UTC (3 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.26: +8 -7 lines
Diff to previous 1.26 (colored)

Use the internal representation for UTF-8 keys instead of wchar_t and
drop some code only needed for that.

Revision 1.26 / (download) - annotate - [select for diffs], Mon Apr 13 18:59:41 2020 UTC (4 years, 1 month ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.25: +53 -1 lines
Diff to previous 1.25 (colored)

Add helpers for the simple case of parse string and add to command queue.

Revision 1.25 / (download) - annotate - [select for diffs], Mon Apr 13 16:19:37 2020 UTC (4 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.24: +19 -4 lines
Diff to previous 1.24 (colored)

When parsing strings, put all commands in one group even if there are
newlines. This means that for example bind q { a \n b } and bind q "a ;
b" are the same. Also log commands in different groups separated by ;;
rather than ; (a command list like this should never be user visible).

Revision 1.24 / (download) - annotate - [select for diffs], Tue Mar 31 17:14:40 2020 UTC (4 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.23: +23 -2 lines
Diff to previous 1.23 (colored)

Add a way to mark environment variables as "hidden" so they can be used
by tmux but are not passed into the environment of new panes.

Revision 1.23 / (download) - annotate - [select for diffs], Tue Jan 28 13:10:14 2020 UTC (4 years, 3 months ago) by nicm
Branch: MAIN
Changes since 1.22: +5 -7 lines
Diff to previous 1.22 (colored)

Ignore empty commands rather than adding them to the command list rather
than trying to skip them later, fixes problem reported by M Kelly.

Revision 1.22 / (download) - annotate - [select for diffs], Mon Jan 27 08:23:42 2020 UTC (4 years, 3 months ago) by nicm
Branch: MAIN
Changes since 1.21: +25 -11 lines
Diff to previous 1.21 (colored)

Change so that assignments may be specified alone - a command isn't
required. GitHub issue 2062.

Revision 1.21 / (download) - annotate - [select for diffs], Thu Dec 12 15:01:54 2019 UTC (4 years, 5 months ago) by nicm
Branch: MAIN
Changes since 1.20: +9 -3 lines
Diff to previous 1.20 (colored)

Add function to the right file.

Revision 1.20 / (download) - annotate - [select for diffs], Mon Oct 14 08:38:07 2019 UTC (4 years, 7 months ago) by nicm
Branch: MAIN
Changes since 1.19: +2 -1 lines
Diff to previous 1.19 (colored)

Memory leaks, from Igor Wong in GitHub issue 1934.

Revision 1.19 / (download) - annotate - [select for diffs], Thu Oct 3 10:24:05 2019 UTC (4 years, 7 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.18: +3 -3 lines
Diff to previous 1.18 (colored)

Do not lazily use BUFSIZ for "I don't care what size" when building
strings because it is only guaranteed to be 256 bytes and even the
default 1024 is not always enough. Reported by Gregory Pakosz.

Revision 1.18 / (download) - annotate - [select for diffs], Tue Sep 10 07:50:33 2019 UTC (4 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.17: +9 -9 lines
Diff to previous 1.17 (colored)

Set up format tree for %if, GitHub issue 1896.

Revision 1.17 / (download) - annotate - [select for diffs], Tue Jun 18 11:17:40 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.16: +29 -9 lines
Diff to previous 1.16 (colored)

Handle comments more correctly inside {}, from Avi Halachmi.

Revision 1.16 / (download) - annotate - [select for diffs], Fri Jun 14 13:34:45 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.15: +5 -2 lines
Diff to previous 1.15 (colored)

Show filename with -v for source-file.

Revision 1.15 / (download) - annotate - [select for diffs], Fri Jun 14 12:04:11 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.14: +21 -7 lines
Diff to previous 1.14 (colored)

A couple of minor parser changes around conditions: 1) only treat #{
specially after a condition, otherwise as a comment (which is more as
most people expect) 2) allow formats to be quoted after a condition.

Revision 1.14 / (download) - annotate - [select for diffs], Wed Jun 5 20:00:53 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.13: +18 -1 lines
Diff to previous 1.13 (colored)

Add a -v flag to source-file to show the commands and line numbers.

Revision 1.13 / (download) - annotate - [select for diffs], Sun Jun 2 07:10:15 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.12: +143 -126 lines
Diff to previous 1.12 (colored)

yacc(1) copies its union so it is not a good place to store
TAILQ_HEADs. Allocate them instead. Found from a problem reported by
sthen@.

Revision 1.12 / (download) - annotate - [select for diffs], Sat Jun 1 06:20:22 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.11: +2 -1 lines
Diff to previous 1.11 (colored)

Need stdlib.h, from Ben Boeckel.

Revision 1.11 / (download) - annotate - [select for diffs], Fri May 31 11:34:09 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.10: +8 -4 lines
Diff to previous 1.10 (colored)

Allow % strings that are all numbers or %s, and fix a double free. Both
reported by George Nachman, GitHub issues 1765 and 1766.

Revision 1.10 / (download) - annotate - [select for diffs], Thu May 30 10:04:33 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.9: +3 -3 lines
Diff to previous 1.9 (colored)

No longer need to reduce line number by one.

Revision 1.9 / (download) - annotate - [select for diffs], Wed May 29 20:05:14 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.8: +16 -1 lines
Diff to previous 1.8 (colored)

Use VIS_CSTYLE for the arguments and add the missing escapes it can
generate to the parser.

Revision 1.8 / (download) - annotate - [select for diffs], Wed May 29 19:34:42 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.7: +7 -2 lines
Diff to previous 1.7 (colored)

The line number needs to be updated only after the \n is processed by
the parser, so store a flag and update it next time around. Also each
new line needs its own shared data.

Revision 1.7 / (download) - annotate - [select for diffs], Wed May 29 10:08:36 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.6: +25 -3 lines
Diff to previous 1.6 (colored)

Support \ooo escapes, from Avi Halachmi.

Revision 1.6 / (download) - annotate - [select for diffs], Mon May 27 12:16:27 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.5: +101 -1 lines
Diff to previous 1.5 (colored)

Add an additional {} syntax for defining strings in the configuration
file, making it much tidier to define commands that contain other tmux
or shell commands (like if-shell). Also tweak bind-key to expect a
string if it is only given one argument, so {} can be used with it as
well. From Avi Halachmi.

Revision 1.5 / (download) - annotate - [select for diffs], Sun May 26 10:08:50 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.4: +77 -52 lines
Diff to previous 1.4 (colored)

Some other platforms doesn't support fmemopen(3) (not unexpectedly), so
don't use it - since we only use getc/ungetc on the file anyway it is
easy not to.

Revision 1.4 / (download) - annotate - [select for diffs], Sat May 25 07:18:20 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.3: +118 -20 lines
Diff to previous 1.3 (colored)

Merge cmd_list_parse into cmd-parse.y so it can use the new alias
processing code.

Revision 1.3 / (download) - annotate - [select for diffs], Thu May 23 18:39:00 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.2: +3 -3 lines
Diff to previous 1.2 (colored)

Fix line numbers - commands are added after the line ends so they need to
get line - 1.

Revision 1.2 / (download) - annotate - [select for diffs], Thu May 23 14:03:44 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.1: +2 -2 lines
Diff to previous 1.1 (colored)

Break the argument escaping code into a separate function and use it to
escape key bindings in list-keys. Also escape ~ and ; and $ properly.

Revision 1.1 / (download) - annotate - [select for diffs], Thu May 23 11:13:30 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN

Replace the split parser code (cfg.c and cmd-string.c) with a single
parser using yacc(1). This is a major change but is clearer and simpler
and allows some edge cases to be made more consistent, as well as
tidying up how aliases are handled. It will also allow some further
improvements later.

Entirely the same parser is now used for parsing the configuration file
and for string commands. This means that constructs previously only
available in .tmux.conf, such as %if, can now be used in string commands
(for example, those given to if-shell - not commands invoked from the
shell, they are still parsed by the shell itself).

The only syntax change I am aware of is that #{} outside quotes or a
comment is now considered a format and not a comment, so #{ is now a
syntax error (notably, if it is at the start of a line).

This also adds two new sections to the man page documenting the syntax
and outlining how parsing and command execution works.

Thanks to everyone who sent me test configs (they still all parse
without errors - but this doesn't mean they still work as intended!).

Thanks to Avi Halachmi for testing and man page improvements, also to
jmc@ for reviewing the man page changes.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.