| 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 | 
 | 
| 10 | namespace arith_parse {
 | 
| 11 | 
 | 
| 12 | extern tdop::ParserSpec* kArithSpec;
 | 
| 13 | 
 | 
| 14 | inline tdop::ParserSpec* Spec() {
 | 
| 15 |   return kArithSpec;
 | 
| 16 | }
 | 
| 17 | 
 | 
| 18 | // Generated tables in _devbuild/gen-cpp/
 | 
| 19 | extern tdop::LeftInfo kLeftLookup[];
 | 
| 20 | extern tdop::NullInfo kNullLookup[];
 | 
| 21 | 
 | 
| 22 | }  // namespace arith_parse
 | 
| 23 | 
 | 
| 24 | namespace bool_stat {
 | 
| 25 | 
 | 
| 26 | using syntax_asdl::word_t;
 | 
| 27 | 
 | 
| 28 | bool isatty(BigStr* fd_str, word_t* blame_word);
 | 
| 29 | bool DoUnaryOp(Id_t op_id, BigStr* s);
 | 
| 30 | bool DoBinaryOp(Id_t op_id, BigStr* s1, BigStr* s2);
 | 
| 31 | 
 | 
| 32 | }  // namespace bool_stat
 | 
| 33 | 
 | 
| 34 | namespace sh_expr_eval {
 | 
| 35 | 
 | 
| 36 | inline bool IsLower(BigStr* ch) {
 | 
| 37 |   assert(len(ch) == 1);
 | 
| 38 |   uint8_t c = ch->data_[0];
 | 
| 39 |   return ('a' <= c && c <= 'z');
 | 
| 40 | }
 | 
| 41 | 
 | 
| 42 | inline 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
 |