NeoMutt  2024-11-14-34-g5aaf0d
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
extract.h
Go to the documentation of this file.
1
24#ifndef MUTT_PARSE_EXTRACT_H
25#define MUTT_PARSE_EXTRACT_H
26
27#include <ctype.h>
28#include <stdint.h>
29
30struct Buffer;
31
32#define MoreArgs(buf) (*(buf)->dptr && (*(buf)->dptr != ';') && (*(buf)->dptr != '#'))
33
34/* The same conditions as in mutt_extract_token() */
35#define MoreArgsF(buf, flags) (*(buf)->dptr && \
36 (!isspace(*(buf)->dptr) || ((flags) & TOKEN_SPACE)) && \
37 ((*(buf)->dptr != '#') || ((flags) & TOKEN_COMMENT)) && \
38 ((*(buf)->dptr != '+') || !((flags) & TOKEN_PLUS)) && \
39 ((*(buf)->dptr != '-') || !((flags) & TOKEN_MINUS)) && \
40 ((*(buf)->dptr != '=') || !((flags) & TOKEN_EQUAL)) && \
41 ((*(buf)->dptr != '?') || !((flags) & TOKEN_QUESTION)) && \
42 ((*(buf)->dptr != ';') || ((flags) & TOKEN_SEMICOLON)) && \
43 (!((flags) & TOKEN_PATTERN) || strchr("~%=!|", *(buf)->dptr)))
44
45typedef uint16_t TokenFlags;
46#define TOKEN_NO_FLAGS 0
47#define TOKEN_EQUAL (1 << 0)
48#define TOKEN_CONDENSE (1 << 1)
49#define TOKEN_SPACE (1 << 2)
50#define TOKEN_QUOTE (1 << 3)
51#define TOKEN_PATTERN (1 << 4)
52#define TOKEN_COMMENT (1 << 5)
53#define TOKEN_SEMICOLON (1 << 6)
54#define TOKEN_BACKTICK_VARS (1 << 7)
55#define TOKEN_NOSHELL (1 << 8)
56#define TOKEN_QUESTION (1 << 9)
57#define TOKEN_PLUS (1 << 10)
58#define TOKEN_MINUS (1 << 11)
59
60int parse_extract_token(struct Buffer *dest, struct Buffer *tok, TokenFlags flags);
61
62#endif /* MUTT_PARSE_EXTRACT_H */
int parse_extract_token(struct Buffer *dest, struct Buffer *tok, TokenFlags flags)
Extract one token from a string.
Definition: extract.c:50
uint16_t TokenFlags
Flags for parse_extract_token(), e.g. TOKEN_EQUAL.
Definition: extract.h:45
String manipulation buffer.
Definition: buffer.h:36