NeoMutt  2025-12-11-911-gd8d604
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
extract.h
Go to the documentation of this file.
1
24
25#ifndef MUTT_PARSE_EXTRACT_H
26#define MUTT_PARSE_EXTRACT_H
27
28#include <stdint.h>
29#include "mutt/lib.h" // IWYU pragma: keep
30
31#define MoreArgs(buf) (*(buf)->dptr && (*(buf)->dptr != ';') && (*(buf)->dptr != '#'))
32
33/* The same conditions as in mutt_extract_token() */
34#define MoreArgsF(buf, flags) (*(buf)->dptr && \
35 (!mutt_isspace(*(buf)->dptr) || ((flags) & TOKEN_SPACE)) && \
36 ((*(buf)->dptr != '#') || ((flags) & TOKEN_COMMENT)) && \
37 ((*(buf)->dptr != '+') || !((flags) & TOKEN_PLUS)) && \
38 ((*(buf)->dptr != '-') || !((flags) & TOKEN_MINUS)) && \
39 ((*(buf)->dptr != '=') || !((flags) & TOKEN_EQUAL)) && \
40 ((*(buf)->dptr != '?') || !((flags) & TOKEN_QUESTION)) && \
41 ((*(buf)->dptr != ';') || ((flags) & TOKEN_SEMICOLON)) && \
42 (!((flags) & TOKEN_PATTERN) || strchr("~%=!|", *(buf)->dptr)))
43
48{
50 TOKEN_EQUAL = 1U << 0,
51 TOKEN_CONDENSE = 1U << 1,
52 TOKEN_SPACE = 1U << 2,
53 TOKEN_QUOTE = 1U << 3,
54 TOKEN_PATTERN = 1U << 4,
55 TOKEN_COMMENT = 1U << 5,
56 TOKEN_SEMICOLON = 1U << 6,
58 TOKEN_NOSHELL = 1U << 8,
59 TOKEN_QUESTION = 1U << 9,
60 TOKEN_PLUS = 1U << 10,
61 TOKEN_MINUS = 1U << 11,
62};
63typedef uint16_t TokenFlags;
64
65int parse_extract_token(struct Buffer *dest, struct Buffer *line, TokenFlags flags);
66
67#endif /* MUTT_PARSE_EXTRACT_H */
uint16_t TokenFlags
Definition extract.h:63
TokenFlag
Flags for parse_extract_token(), e.g.
Definition extract.h:48
@ TOKEN_COMMENT
Don't reap comments.
Definition extract.h:55
@ TOKEN_MINUS
Treat '-' as a special.
Definition extract.h:61
@ TOKEN_SPACE
Don't treat whitespace as a term.
Definition extract.h:52
@ TOKEN_EQUAL
Treat '=' as a special.
Definition extract.h:50
@ TOKEN_QUOTE
Don't interpret quotes.
Definition extract.h:53
@ TOKEN_PATTERN
~%=!| are terms (for patterns)
Definition extract.h:54
@ TOKEN_CONDENSE
^(char) to control chars (macros)
Definition extract.h:51
@ TOKEN_PLUS
Treat '+' as a special.
Definition extract.h:60
@ TOKEN_NOSHELL
Don't expand environment variables.
Definition extract.h:58
@ TOKEN_BACKTICK_VARS
Expand variables within backticks.
Definition extract.h:57
@ TOKEN_SEMICOLON
Don't treat ; as special.
Definition extract.h:56
@ TOKEN_NONE
No flags are set.
Definition extract.h:49
@ TOKEN_QUESTION
Treat '?' as a special.
Definition extract.h:59
int parse_extract_token(struct Buffer *dest, struct Buffer *line, TokenFlags flags)
Extract one token from a string.
Definition extract.c:49
Convenience wrapper for the library headers.
String manipulation buffer.
Definition buffer.h:36