I used your parsing code in a sample service, and it seems to work 
correctly for me.  Can you provide a complete .cpp file that reproduces 
the parsing problem?

David Bender
STAF/STAX Development
(512-286-5315)
IBM Austin Bldg. 903-5B002
Internet: bda...@us.ibm.com




"jander...@talentex.co.uk" <jander...@talentex.co.uk> 
04/28/2009 05:05 AM

To
staf <staf-users@lists.sourceforge.net>
cc

Subject
[staf-users] Parser problem (?)






Using STAF 3.3.2 on Linux; I have created a parser in a service 
(infares), that is causing me some peculiar problems and I am a bit at a 
loss. This is what happens:

First time I enter a command, eg:

staf local infares list resclass xxx restype yyy ...

- it works fine. Next time, if I change the command a bit to:

staf local infares request resclass xxx restype yyy ...

- the parameter names (resclass ...) and values (xxx ...) come out with 
strange character stuck on the end. "request" and "list" are handled by 
the same function (handleRequest) and the parser is like:

                 //REQUEST/LIST options
                 pData->fRequestParser=STAFCommandParserPtr(
                         new STAFCommandParser,
                         STAFCommandParserPtr::INIT
                 );
                 pData->fRequestParser->addOption(
                         "REQUEST",
                         1,
                         STAFCommandParser::kValueNotAllowed
                 );
                 pData->fRequestParser->addOption(
                         "LIST",
                         1,
                         STAFCommandParser::kValueNotAllowed
                 );
                 pData->fRequestParser->addOption(
                         "RESCLASS",
                         1,
                         STAFCommandParser::kValueRequired
                 );
                 pData->fRequestParser->addOption(
                         "RESNAME",
                         1,
                         STAFCommandParser::kValueRequired
                 );
                 pData->fRequestParser->addOption(
                         "RESTYPE",
                         1,
                         STAFCommandParser::kValueRequired
                 );

...

                 pData->fRequestParser->addOptionNeed(
                         "RESCLASS RESNAME RESTYPE RESVERSION TIMEOUT LOC 
"
                         "OS OSVERSION OSBITS DISK ROLE SCHEMA INSTANCE 
DURATION "
                         "PERSISTENT LOCKNAME",
                         "REQUEST LIST");
                 pData->fRequestParser->addOptionNeed("RDBMS 
FILE","RESCLASS");
                 pData->fRequestParser->addOptionGroup("RESCLASS",1,1);
                 pData->fRequestParser->addOptionGroup("RESNAME",1,1);
                 pData->fRequestParser->addOptionGroup("RESTYPE",1,1);
                 pData->fRequestParser->addOptionGroup("RESVERSION",1,1);
                 pData->fRequestParser->addOptionGroup("REQUEST 
LIST",1,1);

Am I doing something wrong here?

------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to