Files
fish-shell/src/parser_keywords.cpp
Kurtis Rader 80250c0729 restyle parser module to match project style
Reduces lint errors from 72 to 44 (-43%). Line count from 1698 to 1313 (-23%).

Another step in resolving issue #2902.
2016-05-02 19:24:52 -07:00

23 lines
879 B
C++

// Functions having to do with parser keywords, like testing if a function is a block command.
#include "parser_keywords.h"
#include "common.h"
#include "fallback.h" // IWYU pragma: keep
bool parser_keywords_skip_arguments(const wcstring &cmd) {
return contains(cmd, L"else", L"begin");
}
bool parser_keywords_is_subcommand(const wcstring &cmd) {
return parser_keywords_skip_arguments(cmd) ||
contains(cmd, L"command", L"builtin", L"while", L"exec", L"if", L"and", L"or", L"not");
}
bool parser_keywords_is_block(const wcstring &word) {
return contains(word, L"for", L"while", L"if", L"function", L"switch", L"begin");
}
bool parser_keywords_is_reserved(const wcstring &word) {
return parser_keywords_is_block(word) || parser_keywords_is_subcommand(word) ||
contains(word, L"end", L"case", L"else", L"return", L"continue", L"break");
}