NeoMutt  2023-11-03-85-g512e01
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
extract.h
Go to the documentation of this file.
1
23#ifndef MUTT_PARSE_EXTRACT_H
24#define MUTT_PARSE_EXTRACT_H
25
26#include <ctype.h>
27#include <stdint.h>
28
29struct Buffer;
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 (!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
44typedef uint16_t TokenFlags;
45#define TOKEN_NO_FLAGS 0
46#define TOKEN_EQUAL (1 << 0)
47#define TOKEN_CONDENSE (1 << 1)
48#define TOKEN_SPACE (1 << 2)
49#define TOKEN_QUOTE (1 << 3)
50#define TOKEN_PATTERN (1 << 4)
51#define TOKEN_COMMENT (1 << 5)
52#define TOKEN_SEMICOLON (1 << 6)
53#define TOKEN_BACKTICK_VARS (1 << 7)
54#define TOKEN_NOSHELL (1 << 8)
55#define TOKEN_QUESTION (1 << 9)
56#define TOKEN_PLUS (1 << 10)
57#define TOKEN_MINUS (1 << 11)
58
59int parse_extract_token(struct Buffer *dest, struct Buffer *tok, TokenFlags flags);
60
61#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:48
uint16_t TokenFlags
Flags for parse_extract_token(), e.g. TOKEN_EQUAL.
Definition: extract.h:44
String manipulation buffer.
Definition: buffer.h:34