>>13
If it doesn't fucking handle all the basic operations like alternation you cannot call your pile of shit a regex parser.
Name:
Anonymous2008-10-03 0:13
>>15
In my experience, ^, $, . and * is enough to cover 99% of use cases. Besides, the purpose wasn't to demonstrate anything usable, just something which is clear, concise and elegant. If you can't see how a recursive regex parser in 21 C statements doesn't meet this criteria, then just sage and begone.
Otherwise, I eagerly await your contribution to this thread, if you already haven't done so.
No code snippet from me because I am man enough to openly admit that my code is shit.
Name:
Anonymous2008-10-03 0:27
>>17
No, that makes you a defensive coward.
You seem like the type of person who is reluctant to participate in anything, due to an irrational fear of being hurt. What are you afraid of, what are you running away from? Yourself.
>>13,16,18
ITT: butthurt faggots get overly defensive because anonymous ``programmers" don't appreciate useless code
Name:
Anonymous2008-10-03 1:16
>>16
Uh, regexes are all about grouping. Your trivial program is absolutely useless, and I don't want to know what you experienced if it covers 99% of your needs.
Name:
Anonymous2008-10-03 1:20
>>9,14
guys, I'm running windows and don't have rm.
Name:
Anonymous2008-10-03 1:22
>>22 rot13 = map (find charMap)
where find [] char = char
find (c:cs) char | (fst c) == char = snd c
find (c:cs) char | (snd c) == char = fst c
find (_:cs) char = find cs char
charMap = zip (['a'..'m'] ++ ['A'..'M'] ++ ['0'..'4'])
(['n'..'z'] ++ ['N'..'Z'] ++ ['5'..'9'])
>>31
``Duff's Device'' is not beautiful in the least.
Name:
Anonymous2008-10-03 21:00
this is a recursive getline that I did for this bookgoogle I had to do implementing a left leaning red-black tree in C
I did this function to get the lines of the book using malloc just once, with the exact size of the line...
char *getLineR(FILE *in_file, char *line, int n)
{
char c = fgetc(in_file);
if (c != '\n') {
line = getLineR(in_file, line, n + 1);
}
else {
line = malloc((n+2)*sizeof(char));
if (line == NULL) exit(1);
line[(n+1)] = '\0';
}
line[n] = c;
return line;
}
it's beautiful, works and I'm proud of it
oh, and in the same program I did a faster tolower() to get my chars in lowercase, since I already knew they were letters, I didn't need to check if they were (the original tolower from the ctype does that), so I did this:
#define my_tolower(A) (((A) % 32) + 96)
Name:
Anonymous2008-10-03 21:04
>>37
actually I just thought a even faster to lower
#define my_tolower(A) (((A)<<5 >>5) + 96)