Commit graph

348 commits

Author SHA1 Message Date
068a7c85c0
norm: fix 42 header creation date being updated all the time
I have no idea how this happend
2025-02-21 12:41:25 +01:00
abf37eb7f5
wordsplit: set quote and dquote flags 2025-02-20 15:39:03 +01:00
ac8475c71d
wordsplit: implemet rule for variable substitution detection (rule 5) 2025-02-20 15:00:48 +01:00
e10ed04169
matcher: is_quote 2025-02-20 15:00:48 +01:00
591518e9bc
rule utils: operator combo 2025-02-20 15:00:48 +01:00
b13f8f096b
rule utils: unquoted 2025-02-20 15:00:48 +01:00
f86de825bd
rule utils: unquoted operator 2025-02-20 15:00:48 +01:00
edf8946fe3
wordsplit rules: fix basic norm problems
also make notes for future refactorings
2025-02-20 15:00:48 +01:00
f2469f1600
token_build: rename current_index to idx 2025-02-20 15:00:48 +01:00
6f8a86732b
wordsplit: rename token_build to builder in argument names 2025-02-20 15:00:48 +01:00
b23eb0f244
wordsplit: increment index + rename rules 2025-02-20 15:00:48 +01:00
6c8dd312c0
wordsplit: make it compile 2025-02-20 15:00:48 +01:00
3e64ac3769
wordsplit: use individual rule funcs 2025-02-20 15:00:32 +01:00
Jérôme Guélen
58be71725b Wordsplitting: the preparation for a reswitch. 2025-02-20 15:00:32 +01:00
Jérôme Guélen
0d0a14d21a Word splitting refactor: Prototypes to be modified 2025-02-20 15:00:32 +01:00
f92763e479
wordsplit: handle operators 2025-02-20 15:00:32 +01:00
558ddb4096
wordsplit: return error for unclosed quotes 2025-02-20 15:00:32 +01:00
452d35acdf
wordsplit: handle mixed quotes 2025-02-20 15:00:32 +01:00
1676cf6696
wordsplit: handle double quotes 2025-02-20 15:00:32 +01:00
5276aba278
wordsplit: handle single quotes 2025-02-20 15:00:32 +01:00
81d28c15d4
wordsplit refactor: follow the specification more closesly
This will make it easier to implement the rest of the specification.

I probably should have started like this..
2025-02-20 15:00:32 +01:00
65b57987b5
buffer: add buffer struct and related functions 2025-02-20 15:00:32 +01:00
4171a3d07b
wordsplit: handle multiple words 2025-02-20 15:00:11 +01:00
00fd2380cf
wordsplit: handle a sigle word separated surrounded by blanks
a blank here is as defined by POSIX
https://pubs.opengroup.org/onlinepubs/9699919799/
section 7.3.1
2025-02-20 15:00:11 +01:00
aa12f7c971
matchers: add matcher for <blank> character class 2025-02-20 15:00:11 +01:00
8defbf4d13
wordsplit: handle single word with spaces before or after 2025-02-20 14:55:29 +01:00
a083800506
word splitting: a single word is not split
Sorry this commit is a bit big, lots of groudwork is being established here
2025-02-20 14:55:29 +01:00
abea59eba4
get_command refactor: put into own file 2025-02-20 14:40:57 +01:00
486dec7bb7
get_command: if input is not a tty, use get next line
This simplifies tests
2025-02-20 14:40:57 +01:00
dff68d5a8b
env refactor: split imports over multiple files
This allows for potentially faster recompilation, by not triggering
recompilation for all env files if env_manip changes
2025-02-19 16:43:37 +01:00
e445f668b3
env_manip: sort funcs per structure that is being manipulated
This is instead of the operation that is being performed.

I find it more logical this way, but if you prefer we can keep it as-is.

I also put the identifier_isvalid func into parser/matchers
2025-02-19 14:47:10 +01:00
Jérôme Guélen
e985fcc562 env_set_entry: use ft_errno to indicate error conditions 2025-02-19 14:34:09 +01:00
Jérôme Guélen
df8aec148f env_manip: add function to check if a str is a valid variable identifier 2025-02-19 14:34:09 +01:00
Jérôme Guélen
622a9caa53 refactor: move env_get_size to env_get.c 2025-02-19 14:34:09 +01:00
Jérôme Guélen
30d32a1d53 ft_errno: integrate ft_errno library 2025-02-19 14:34:09 +01:00
Jérôme Guélen
660d785237 ENV: A small set of functions for internal env 2025-02-19 14:34:09 +01:00
Jérôme Guélen
5b00059526 refactor: rename env_get_set.c to env_get.c 2025-02-19 14:34:09 +01:00
ab6a4d6368
envp_get_val: add tests + make it more consistent with envp_get_key
In particular, this is what is now changed:
 - if line is null or empty, return null
 - if line contains no =, return an empty string

This way, if non-null is returned, that means that line was valid. If null is
returned, there is either an error with line, or malloc failed.
2025-02-19 14:34:09 +01:00
af90bec318
envp_get_key: fix buffer overflow if line contains no '=' 2025-02-19 14:34:09 +01:00
da447a2491
env_manip: make it compile 2025-02-19 14:34:08 +01:00
Jérôme Guélen
f0a181315b WIP: env: getting key and value from an envp entry 2025-02-19 14:34:08 +01:00
6e1552a35d
fix: ';' is not a metacharacter
Co-authored-by: jguelen <jguelen@student.42lehavre.fr>
2025-02-11 19:04:05 +01:00
71a4df1bb0
fix: stdio needs to be included before readline for compilation to work 2025-02-11 16:38:49 +01:00
Khaïs COLIN
7a99014485
new matcher: metacharacter (separates words) 2025-02-07 15:29:43 +01:00
Khaïs COLIN
6aabe49df1
read: do not display prompt if not in a tty 2025-02-07 15:29:43 +01:00
Khaïs COLIN
8bfdb04630
read: add commands to history 2025-02-07 15:29:43 +01:00
Khaïs COLIN
a23b639f78
read: read a line with readline and echo it back 2025-02-07 15:29:43 +01:00
Khaïs COLIN
08101e295a
minishell: add basic main function 2025-02-07 15:29:43 +01:00