Files
fish-shell/src/parser_keywords.cpp
Kurtis Rader 1f06e5f0b9 add better support for IWYU and fix things
Remove the "make iwyu" build target. Move the functionality into the
recently introduced lint.fish script. Fix a lot, but not all, of the
include-what-you-use errors. Specifically, it fixes all of the IWYU errors
on my OS X server but only removes some of them on my Ubuntu 14.04 server.

Fixes #2957
2016-04-26 15:02:22 -07:00

57 lines
1.3 KiB
C++

/** \file parser_keywords.c
Functions having to do with parser keywords, like testing if a function is a block command.
*/
#include "fallback.h" // IWYU pragma: keep
#include "common.h"
#include "parser_keywords.h"
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");
}