diff options
Diffstat (limited to 'src/parser.c')
| -rw-r--r-- | src/parser.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/parser.c b/src/parser.c index 9303130..28ea5b6 100644 --- a/src/parser.c +++ b/src/parser.c @@ -134,7 +134,7 @@ static node *parse_substring(const char *s, size_t len); void parser_reset(void) { in_cond = false; tok_pushed = false; - here_head = NULL; + here_head = nullptr; here_tail = &here_head; } @@ -195,7 +195,7 @@ static void read_parts(pbuild *b, lex_mode mode, bool litq); * @brief Start building a word. */ static void pb_init(pbuild *b) { - b->head = NULL; + b->head = nullptr; b->tail = &b->head; sb_init(&b->lit, pa); b->litq = false; @@ -291,7 +291,7 @@ static param *new_param(const char *name, size_t nlen) { /** * @brief Read the name that follows `$` when it is not in braces. - * @return The parameter, or NULL if `$` is not followed by a name (it + * @return The parameter, or nullptr if `$` is not followed by a name (it * is then an ordinary character). */ static param *read_param_name(int c, bool braced) { @@ -401,7 +401,7 @@ static void parse_braced_param(pbuild *b, bool q, bool dq) { * * Recursing into the parser (and not scanning for the closing * parenthesis) is what makes `$(case x in x) ;; esac)` work. - * @return The command, or NULL if the substitution is empty. + * @return The command, or nullptr if the substitution is empty. */ static node *parse_cmdsub(void) { token saved = tok; @@ -930,7 +930,7 @@ static void lex_token(void) { while ((c = pgetc()) != '\n' && c != PEOF) ; } - tok.word = NULL; + tok.word = nullptr; tok.kw = KW_NONE; switch (c) { case PEOF: @@ -1185,7 +1185,7 @@ static void read_heredoc_body(heredoc *h) { */ static void read_heredocs(void) { heredoc *h = here_head; - here_head = NULL; + here_head = nullptr; here_tail = &here_head; for (; h; h = h->next) read_heredoc_body(h); @@ -1457,10 +1457,10 @@ static node *parse_case(void) { * Inside `[[ ]]` only an unquoted word can be an operator: `[[ "-f" ]]` * tests the string `-f`. * - * @return The text, or NULL. + * @return The text, or nullptr. */ static const char *cond_bare(void) { - return tok.t == T_WORD && tok.bare ? tok.word->parts->u.lit.s : NULL; + return tok.t == T_WORD && tok.bare ? tok.word->parts->u.lit.s : nullptr; } /** @@ -1486,7 +1486,7 @@ static char cond_unary_op(const char *s) { /** * @brief Is `s` a binary operator of `[[ ]]`? - * @param s Candidate text, or NULL. + * @param s Candidate text, or nullptr. * @param op Receives the operator. */ static bool cond_binary_op(const char *s, cond_op *op) { @@ -1712,7 +1712,7 @@ static node *parse_function_kw(void) { * @brief Give back text read while testing for `(( ))`, as a subshell. * @param sb What was read after the "((". * @param last The character read after that, or PEOF. - * @return NULL, for the caller to return. + * @return nullptr, for the caller to return. */ static node *arith_fallback(strbuf *sb, int last) { strbuf back; @@ -1723,7 +1723,7 @@ static node *arith_fallback(strbuf *sb, int last) { sb_putc(&back, (char)last); size_t len = back.len; input_push_back(sb_cstr(&back), len); - return NULL; + return nullptr; } /** @@ -1746,7 +1746,7 @@ static node *arith_fallback(strbuf *sb, int last) { * parentheses or a very long body, so that deeply nested subshells do not * get rescanned at every level. * - * @return An N_ARITH node, or NULL if this is not arithmetic. + * @return An N_ARITH node, or nullptr if this is not arithmetic. */ static node *parse_arith_command(void) { const size_t max_body = 4096; @@ -1835,7 +1835,7 @@ static node *parse_command_node(void) { if (tok.t == T_LP) { consume(); int c = pgetc(); - if (c == '(' && (n = parse_arith_command()) != NULL) { + if (c == '(' && (n = parse_arith_command()) != nullptr) { parse_redirs(n); return n; } @@ -2009,7 +2009,7 @@ static node *parse_list_item(tok_kind *term) { * on. */ static node *parse_clist(void) { - node *head = NULL; + node *head = nullptr; node **slot = &head; skip_newlines(); while (command_start() || peek_kw(KW_BANG)) { @@ -2027,11 +2027,11 @@ static node *parse_clist(void) { * * @param a Arena for the tree. * @param eof Set when the input has ended. - * @return The command, or NULL for an empty line. + * @return The command, or nullptr for an empty line. */ node *parse_command(arena *a, bool *eof) { pa = a; - node *head = NULL; + node *head = nullptr; node **slot = &head; for (;;) { tok_kind t = peek(); @@ -2128,7 +2128,7 @@ void parser_save(void *state) { parser_state *ps = state; *ps = (parser_state){pa, tok, tok_pushed, here_head, here_tail}; if (here_tail == &here_head) - ps->here_tail = NULL; + ps->here_tail = nullptr; parser_reset(); } |
