This commit is contained in:
Maix0 2024-05-26 17:30:51 +02:00
parent 7e14390441
commit a4476eb47d
7 changed files with 139 additions and 44 deletions

View file

@ -1,5 +1,7 @@
CompileFlags: # Tweak the parse settings
Compiler: clang
Add:
- "-xc"
- "-I/usr/include/"
- "-I/home/maiboyer/Documents/ring-2/shcat/vendor/"
- "-I/home/maiboyer/Documents/ring-2/shcat/stdme/include/"

View file

@ -6,7 +6,7 @@
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/04/28 17:28:30 by maiboyer #+# #+# #
# Updated: 2024/05/25 16:35:04 by maiboyer ### ########.fr #
# Updated: 2024/05/26 16:21:15 by maiboyer ### ########.fr #
# #
# **************************************************************************** #

View file

@ -6,19 +6,19 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/25 19:30:30 by maiboyer #+# #+# */
/* Updated: 2024/05/25 20:42:26 by maiboyer ### ########.fr */
/* Updated: 2024/05/26 17:25:10 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef AST_H
#define AST_H
#include "me/types.h"
#include "ast/forward.h"
#include "me/types.h"
/// @brief Node types enumeration
/// @details This enumeration is used to identify the type of a node
typedef enum e_ast_type
enum e_ast_type
{
TY_EMPTY = 0,
TY_PROGRAM,
@ -30,7 +30,7 @@ typedef enum e_ast_type
TY_AND_OR_LIST,
TY_NOT,
TY_PIPE_LIST
} t_ast_type;
};
/// Can be either a t_sequential_list, t_async_command, t_and_or_list, t_not,
/// t_pipe_list or an t_command
@ -217,13 +217,13 @@ struct s_simple_command
t_usize suffix_len;
};
typedef enum e_assignement_modifier
enum e_assignement_modifier
{
AM_NONE = 0,
AM_EXPORT,
AM_LOCAL,
AM_READONLY,
} t_assignement_modifier;
};
struct s_assignment_list
{
@ -363,7 +363,7 @@ union u_redirect {
t_redirect_heredoc *heredoc;
};
typedef enum e_redirect_file_op
enum e_redirect_file_op
{
RO_INPUT, // <
RO_OUTPUT, // >
@ -372,7 +372,7 @@ typedef enum e_redirect_file_op
RO_DUP_OUTPUT, // >&
RO_CLOBBER, // >|
RO_INPUT_OUPUT, // <>
} t_redirect_file_op;
};
struct s_redirect_file
{
@ -382,11 +382,11 @@ struct s_redirect_file
t_word *file;
};
typedef enum e_redirect_heredoc_op
enum e_redirect_heredoc_op
{
RH_HEREDOC, // <<
RH_HEREDOC_IDENT // <<-
} t_redirect_heredoc_op;
};
struct s_redirect_heredoc
{
@ -432,12 +432,12 @@ struct s_word
#define OP_NONE 0
typedef enum e_op_pre
enum e_op_pre
{
OP_PRE_HASH = 1, // '#'
} t_op_pre;
};
typedef enum e_op_in
enum e_op_in
{
OP_IN_COLON_MINUS = 1, // ':-'
OP_IN_MINUS, // '-'
@ -454,7 +454,7 @@ typedef enum e_op_in
OP_IN_COLON, // ':'
OP_IN_SLASH_SLASH, // '//'
OP_IN_SLASH, // '/'
} t_op_in;
};
/// is either a t_parameter_expansion, t_arithmetic_expansion,
/// t_command_substitution or t_command_backticks

View file

@ -1,16 +1,22 @@
typedef enum e_assignement_modifier t_assignement_modifier;
typedef enum e_ast_type t_ast_type;
typedef enum e_op_in t_op_in;
typedef enum e_op_pre t_op_pre;
typedef enum e_redirect_file_op t_redirect_file_op;
typedef enum e_redirect_heredoc_op t_redirect_heredoc_op;
typedef struct s_and_list t_and_list;
typedef struct s_and_or_list t_and_or_list;
typedef struct s_arithmetic_expansion t_arithmetic_expansion;
typedef struct s_assignment t_assignment;
typedef struct s_assignment_list t_assignment_list;
typedef struct s_assignment t_assignment;
typedef struct s_ast_string t_ast_string;
typedef struct s_async_command t_async_command;
typedef struct s_brace_command t_brace_command;
typedef struct s_case_command t_case_command;
typedef struct s_case_item t_case_item;
typedef struct s_command t_command;
typedef struct s_command_backticks t_command_backticks;
typedef struct s_command_substitution t_command_substitution;
typedef struct s_command t_command;
typedef struct s_compound_list t_compound_list;
typedef struct s_elif_clause t_elif_clause;
typedef struct s_else_clause t_else_clause;
@ -39,13 +45,13 @@ typedef union u_async_command_body t_async_command_body;
typedef union u_command_inner t_command_inner;
typedef union u_compound_command t_compound_command;
typedef union u_compound_list_body t_compound_list_body;
typedef union u_expension t_expension;
typedef union u_expension_or_string t_expension_or_string;
typedef union u_expension t_expension;
typedef union u_if_clauses t_if_clauses;
typedef union u_not_body t_not_body;
typedef union u_or_list_body t_or_list_body;
typedef union u_program_body t_program_body;
typedef union u_redirect t_redirect;
typedef union u_redirect_or_assign t_redirect_or_assign;
typedef union u_redirect_or_word t_redirect_or_word;
typedef union u_redirect t_redirect;
typedef union u_sequential_list_body t_sequential_list_body;

124
flake.lock generated
View file

@ -1,15 +1,51 @@
{
"nodes": {
"c_formatter_42": {
"inputs": {
"c_formatter_42_src": "c_formatter_42_src",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1700259489,
"narHash": "sha256-Ye2zwphDUY/eDjyFCPFt0r9RyqMr4ZQprCE4bydNdpw=",
"owner": "Maix0",
"repo": "c_formatter_42-flake",
"rev": "3d4f6a40bd1edf9fdb4959051edc172473d9544d",
"type": "github"
},
"original": {
"owner": "Maix0",
"repo": "c_formatter_42-flake",
"type": "github"
}
},
"c_formatter_42_src": {
"flake": false,
"locked": {
"lastModified": 1696506114,
"narHash": "sha256-jUScF2lAHhjTWOWZsIAocE6FN8+HG+kLdpbYsEA1SZs=",
"owner": "dawnbeen",
"repo": "c_formatter_42",
"rev": "ef91ff383966885374695c327fa6015f9cfbc364",
"type": "github"
},
"original": {
"owner": "dawnbeen",
"repo": "c_formatter_42",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
@ -23,11 +59,11 @@
"systems": "systems_2"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
@ -54,11 +90,29 @@
"type": "github"
}
},
"flake-utils_4": {
"inputs": {
"systems": "systems_4"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"generic_c": {
"inputs": {
"flake-utils": "flake-utils_2",
"flake-utils": "flake-utils_3",
"naersk": "naersk",
"nixpkgs": "nixpkgs_2",
"nixpkgs": "nixpkgs_3",
"rust-overlay": "rust-overlay"
},
"locked": {
@ -77,7 +131,7 @@
},
"naersk": {
"inputs": {
"nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1698420672,
@ -95,11 +149,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1706683685,
"narHash": "sha256-FtPPshEpxH/ewBOsdKBNhlsL2MLEFv1hEnQ19f/bFsQ=",
"lastModified": 1700108881,
"narHash": "sha256-+Lqybl8kj0+nD/IlAWPPG/RDTa47gff9nbei0u7BntE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5ad9903c16126a7d949101687af0aa589b1d7d3d",
"rev": "7414e9ee0b3e9903c24d3379f577a417f0aae5f1",
"type": "github"
},
"original": {
@ -108,6 +162,20 @@
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1706683685,
"narHash": "sha256-FtPPshEpxH/ewBOsdKBNhlsL2MLEFv1hEnQ19f/bFsQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5ad9903c16126a7d949101687af0aa589b1d7d3d",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1706683685,
"narHash": "sha256-FtPPshEpxH/ewBOsdKBNhlsL2MLEFv1hEnQ19f/bFsQ=",
@ -123,7 +191,7 @@
"type": "github"
}
},
"nixpkgs_3": {
"nixpkgs_4": {
"locked": {
"lastModified": 1706487304,
"narHash": "sha256-LE8lVX28MV2jWJsidW13D2qrHU/RUUONendL2Q/WlJg=",
@ -139,11 +207,11 @@
"type": "github"
}
},
"nixpkgs_4": {
"nixpkgs_5": {
"locked": {
"lastModified": 0,
"narHash": "sha256-XtTSSIB2DA6tOv+l0FhvfDMiyCmhoRbNB+0SeInZkbk=",
"path": "/nix/store/v4pcs3nzx54m5bmxd39win0rgl2d2hbx-source",
"narHash": "sha256-sowPU+tLQv8GlqtVtsXioTKeaQvlMz/pefcdwg8MvfM=",
"path": "/nix/store/r8nhgnkxacbnf4kv8kdi8b6ks3k9b16i-source",
"type": "path"
},
"original": {
@ -153,15 +221,16 @@
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"c_formatter_42": "c_formatter_42",
"flake-utils": "flake-utils_2",
"generic_c": "generic_c",
"nixpkgs": "nixpkgs_4"
"nixpkgs": "nixpkgs_5"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_3"
"flake-utils": "flake-utils_4",
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1706753617,
@ -221,6 +290,21 @@
"repo": "default",
"type": "github"
}
},
"systems_4": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

View file

@ -3,12 +3,14 @@
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.generic_c.url = "github:Maix0/generic_c";
inputs.c_formatter_42.url = "github:Maix0/c_formatter_42-flake";
outputs = {
self,
nixpkgs,
flake-utils,
generic_c,
c_formatter_42
}:
flake-utils.lib.eachDefaultSystem (
system: let
@ -23,6 +25,7 @@
readline.out
readline.dev
generic_c.packages.${system}.default
c_formatter_42.packages.${system}.default
llvmPackages.bintools
norminette
];