parser.h 382 B

12345678910111213141516171819202122232425
  1. typedef enum {
  2. NODE_COMMAND = 0,
  3. NODE_PIPE = 1,
  4. NODE_CONJ = 2,
  5. NODE_DISJ = 3,
  6. } NodeType;
  7. struct AST {
  8. NodeType type;
  9. union {
  10. char **tokens;
  11. struct {
  12. struct AST *l;
  13. struct AST *r;
  14. } child;
  15. } node;
  16. };
  17. extern char *operator_for[];
  18. struct AST* parse_tokens(region *r, char **tokens, int *bg_flag);
  19. struct AST* parse(region *r, string_port *port, int *bg_flag);