summaryrefslogtreecommitdiffhomepage
path: root/src/expand.h
blob: 161f9f3c9e4e5764c57b5c1cb64461763120810c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
 * @file expand.h
 * @brief Word expansion, pattern matching and arithmetic.
 */
#ifndef ZASH_EXPAND_H
#define ZASH_EXPAND_H

#include "ast.h"

/**
 * @brief Flags for expand_string().
 */
enum {
    XS_TILDE = 1u << 0, /**< expand a leading ~ */
};

/* All results are allocated in `scratch`. */
char **expand_words(const word *list, int *argc);
char *expand_string(const wpart *parts, unsigned flags);
char *expand_pattern(const wpart *parts);
char *expand_assign(const word *w); /* "name=value" */

/* pattern.c */
bool pat_match(const char *pat, const char *s, const char *send);
void glob_expand(const char *pat, void (*add)(void *ctx, const char *path),
                 void *ctx);

/* arith.c */
intmax_t arith_eval(const char *expr);

#endif