OILS / cpp / osh.h View on Github | oilshell.org

50 lines, 26 significant
1// osh.h
2
3#ifndef LEAKY_OSH_H
4#define LEAKY_OSH_H
5
6#include "_gen/frontend/syntax.asdl.h"
7#include "cpp/osh_tdop.h"
8#include "mycpp/runtime.h"
9
10namespace arith_parse {
11
12extern tdop::ParserSpec* kArithSpec;
13
14inline tdop::ParserSpec* Spec() {
15 return kArithSpec;
16}
17
18// Generated tables in _devbuild/gen-cpp/
19extern tdop::LeftInfo kLeftLookup[];
20extern tdop::NullInfo kNullLookup[];
21
22} // namespace arith_parse
23
24namespace bool_stat {
25
26using syntax_asdl::word_t;
27
28bool isatty(BigStr* fd_str, word_t* blame_word);
29bool DoUnaryOp(Id_t op_id, BigStr* s);
30bool DoBinaryOp(Id_t op_id, BigStr* s1, BigStr* s2);
31
32} // namespace bool_stat
33
34namespace sh_expr_eval {
35
36inline bool IsLower(BigStr* ch) {
37 assert(len(ch) == 1);
38 uint8_t c = ch->data_[0];
39 return ('a' <= c && c <= 'z');
40}
41
42inline bool IsUpper(BigStr* ch) {
43 assert(len(ch) == 1);
44 uint8_t c = ch->data_[0];
45 return ('A' <= c && c <= 'Z');
46}
47
48} // namespace sh_expr_eval
49
50#endif // LEAKY_OSH_H