summaryrefslogtreecommitdiff
path: root/redes/syntax.h
diff options
context:
space:
mode:
Diffstat (limited to 'redes/syntax.h')
-rw-r--r--redes/syntax.h42
1 files changed, 24 insertions, 18 deletions
diff --git a/redes/syntax.h b/redes/syntax.h
index 8404d15..1c43e49 100644
--- a/redes/syntax.h
+++ b/redes/syntax.h
@@ -1,6 +1,6 @@
# pragma once
-#include "utils.h"
+#include "../src/utils.h"
// Stage 1
@@ -106,8 +106,9 @@ typedef struct {
typedef enum {
- REDIR_FILE_IN,
- REDIR_FILE_OUT,
+ REDIR_WRITE_TRUNC,
+ REDIR_WRITE_APPEND,
+ REDIR_READ,
REDIR_FDS,
} RedirectKind;
@@ -121,13 +122,23 @@ typedef struct {
DECLARE_VEC(Redirect, RedirectVec)
+typedef struct PlCommand PlCommand;
+
+typedef enum {
+ ARG_PS_IN,
+ ARG_PS_OUT,
+ ARG_LIT,
+} ArgKind;
+
typedef struct {
- char** args;
- RedirectVec redirects;
-} SimpleCommand;
+ ArgKind kind;
+ union {
+ char* lit_str;
+ PlCommand* sub_tree;
+ } as;
+} Arg;
-DECLARE_VEC(SimpleCommand, SimpleCommandVec)
-DECLARE_VEC(SimpleCommand*, SimpleCommandPtrVec)
+DECLARE_VEC(Arg, ArgVec)
typedef enum {
@@ -135,18 +146,13 @@ typedef enum {
CONN_EOL,
} Connector;
-typedef struct {
- SimpleCommand* cmd;
- SimpleCommandPtrVec deps;
+struct PlCommand {
+ ArgVec args;
+ RedirectVec redirects;
Connector conn;
-} PlCommand;
-
-DECLARE_VEC(PlCommand, PlCommandVec)
+};
-typedef struct {
- SimpleCommandVec commands;
- PlCommandVec pipeline;
-} ExecTree;
+DECLARE_VEC(PlCommand, Pipeline)