Re: [Parser-devel] [token.c] A new functionality
Status: Beta
Brought to you by:
jineshkj
From: Jinesh K J <jin...@gm...> - 2006-10-06 05:00:18
|
On 10/6/06, Noam Postavsky <npo...@uw...> wrote: > Jinesh K J wrote: > There are a few more work to be done as follows: > > > > =====1===== > > > > So, firstly let us make a modification over our gettoken - there need > > to have a slight change in its prototype: > > > > char * gettoken(const char *str, const char **end); > > > > ======2======= > > > > Secondly, we need a new function to dissect a comment from a line: > > > > char *cutcomment(char *str); > > > > =====end===== > > > > Try these and let me know. > > > > Jinesh. > > Done and Done. Both the functions are working fine. While gettoken is perfect there's a flaw with cutcomment. I think I didn't take much time to explain what 'str' can contain. 'str' contains a line inside the configuration file. For example: server=192.168.0.1 port=2183 # This is our server A line can also contain quoted values like: server="192.168.0.1" port="2183" # This is our server In any case, the '#' inside the quote should be counted as the start of the comment. I've added a few test cases for that too. All the rules for quotes that we've followed till now applies here also. I hope now things are clear. What do you say? > Noam > Jinesh. |