Closed lawrancej closed 12 years ago
MINE!
Question about code. I have completed the code in question, though I am unsure as to where to put it. If you could tell me where to put this I will commit it and request a pull.
GObject* compilerkit_character_class_new(gunichar hi, gunichar lo)
{
GObject* newExpression = G_OBJECT(compilerkit_symbol_new(lo));
int i;
for(i = lo+1;i <= hi;i++)
{
if(i == 58)
i = 65;
else if(i == 91)
i = 97;
newExpression = G_OBJECT(compilerkit_alternation_new(newExpression,G_OBJECT(compilerkit_symbol_new((gunichar)i))));
}
return newExpression;
}
Hmm.. How about we put this in a new file, src/convenience.c
and have the corresponding include in include/CompilerKit/convenience.h
?
Also, what are the if statements doing?
Alright, sounds good. Thank you.
They allow you to perform actions like 0-h and have all values in between work.
Hi Mike! I merged in your changes with some revisions. Please look it over and let me know what you think!
Using the existing regular expression classes, write a function that converts two characters,
lo
andhi
into a character class. For example, iflo=a
andhi=z
, then the character class to match is[a-z]
. Using the existing regular expression classes, this becomes the alternationa|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z
.GObject *compilerkit_character_class_new (gunichar lo, gunichar hi)