Skip to content

Commit

Permalink
lib/format: add \e escape, fix typos in format spec, remove dbg print
Browse files Browse the repository at this point in the history
  • Loading branch information
classabbyamp authored and Duncaen committed Sep 18, 2023
1 parent e53c837 commit 0a47ba2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions bin/xbps-query/xbps-query.1
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,13 @@ Format strings are parsed by the following EBNF:
.Bd -literal
<grammar> ::= (prefix | "\\" (escape|[{}]) | substitution)*
<prefix> ::= [^\\{}]+ -- Literal text chunk.
<escape> ::= [abfnrtv0] -- POSIX-like espace character.
<escape> ::= [abefnrtv0] -- POSIX-like escape character.

<substitution> ::= "{" variable ["?" default] ["!" conversion] [":" format] "}"
<variable> ::= [a-zA-Z0-9_-]

<default> ::= ([-]?[0-9]+) -- default number.
| "true" | "false" -- default boolean.
<default> ::= ([-]?[0-9]+) -- default number.
| "true" | "false" -- default boolean.
| ('"' (("\\" (escape|'"')) | [^"])* '"') -- default string.

<conversion> ::= humanize | strmode | json
Expand All @@ -326,7 +326,7 @@ Format strings are parsed by the following EBNF:
it using one digit.
<width> ::= [0-9]+ -- Width of the output.
<scale> ::= multiplier -- Minimum scale multiplier and optionally
[multiplier] -- Maxium scale multiplier.
[multiplier] -- Maximum scale multiplier.
<multiplier> ::= "B" -- byte
| "K" -- kilo
| "M" -- mega
Expand All @@ -347,7 +347,7 @@ Format strings are parsed by the following EBNF:
<sign> ::= "+" -- Add sign to positive and negative numbers.
| "-" -- Add sign to negative numbers.
<width> ::= [0-9]+ -- The alignment width.
<precision> ::= [0-9]+ -- Percision for numbers.
<precision> ::= [0-9]+ -- Precision for numbers.
<type> ::= "d" -- Decimal number.
| "o" -- Octal number.
| "u" -- Unsigned number.
Expand Down
2 changes: 1 addition & 1 deletion lib/format.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ nexttok(enum tok *tok, const char **pos, struct strbuf *buf)
case '\\': r = strbuf_putc(buf, '\\'); break;
case 'a': r = strbuf_putc(buf, '\a'); break;
case 'b': r = strbuf_putc(buf, '\b'); break;
case 'e': r = strbuf_putc(buf, '\e'); break;
case 'f': r = strbuf_putc(buf, '\f'); break;
case 'n': r = strbuf_putc(buf, '\n'); break;
case 'r': r = strbuf_putc(buf, '\r'); break;
Expand Down Expand Up @@ -553,7 +554,6 @@ xbps_fmt_parse(const char *format)
if (r < 0)
goto err;
}
fprintf(stderr, "fmt: prefix='%s' var='%s'\n", fmt[n].prefix, fmt[n].var);
n++;
}
out:
Expand Down

0 comments on commit 0a47ba2

Please sign in to comment.