Board index » cppbuilder » String Parser?

String Parser?


2006-08-19 10:07:57 PM
cppbuilder111
I am looking for string parsers. Can anyone help?
 
 

Re:String Parser?

At 16:07:57, 19.08.2006, JVines wrote:
Quote
I am looking for string parsers. Can anyone help?
Parsing for what? Parsers for something specific, or generic parsers that
can parse anything, depending on the syntax you give it, or simple
parsers that can split strings with items delimited by a few specified
delimiters, or what?
--
Rudy Velthuis [TeamB] rvelthuis.de/
"Success usually comes to those who are too busy to be looking
for it" -- Henry David Thoreau (1817-1862)
 

Re:String Parser?

Quote
Parsing for what? Parsers for something specific, or generic parsers that
can parse anything, depending on the syntax you give it, or simple
parsers that can split strings with items delimited by a few specified
delimiters, or what?
All of the above.
 

{smallsort}

Re:String Parser?

You are going to have to be more specific. You need to provide the purpose
of the parser. If you want all kinds of parsers then at least start with
one use that you have for a parser because the answer will vary depending on
your need.
XML?
HTML?
C/C++?
PAS?
CSV?
...
- Clayton
 

Re:String Parser?

Quote
You are going to have to be more specific. You need to provide the purpose
of the parser. If you want all kinds of parsers then at least start with
one use that you have for a parser because the answer will vary depending on
your need.
User supplied formatting strings, command lines, text files, etc. I
would like to know where I can find parsers so that I may build a
library of them so that when I need one, I will not have far to look.
Quote
XML?
HTML?
C/C++?
PAS?
CSV?
...
What is the name of this group?
 

Re:String Parser?

"JVines" < XXXX@XXXXX.COM >wrote in message
Quote
>You are going to have to be more specific. You need to provide the
>purpose of the parser. If you want all kinds of parsers then at least
>start with one use that you have for a parser because the answer will
>vary depending on your need.

User supplied formatting strings, command lines, text files, etc. I would
like to know where I can find parsers so that I may build a library of
them so that when I need one, I will not have far to look.


>XML?
>HTML?
>C/C++?
>PAS?
>CSV?
>...

What is the name of this group?
Name? It doesn't have a name. It's just a list of various text file
formats.
I created a text parser class hierarchy quite easily using the
boost::tokenizer library. It is not an all-in-one solution, but it is
flexible enough to let you parse a number of different text formats. Of
course, the more complex the format, the more work you have to do yourself.
I've heard a lot of people promote the boost::spirit library for more
complex parsing. However, the more recent versions cannot be compiled with
BCB, so it is my understanding that you would have to use an older version.
- Dennis
 

Re:String Parser?

"JVines" < XXXX@XXXXX.COM >wrote in message
Quote
User supplied formatting strings, command lines, text files, etc. I would
like to know where I can find parsers so that I may build a library of
them so that when I need one, I will not have far to look.
That request is about the same as asking the question: "I would like a list
of some functions that work with strings so that I may easier search for one
when I need it."
What you are asking for is a listing of hundreds if not thousands of
classes/functions which most will probably never be helpful to you. Google
groups groups.google.com/grphp is your friend. If you want a
specific parser then "Google" for it.
BTW, for giggles a search for "String Parser" returns a list of 60,000+
entries. Would you like me to give you the links to all of them?
Quote
What is the name of this group?
Sarcasm aside, your question is technical in nature whether you think so or
not. I was offering suggestions to help you ask your question more
effectively. Also, this group quite frequently has questions that are
generally technical in nature (as was yours) that do not belong in any other
specific technical group. Borland does not provide a "misc" or "general"
group.
An example of a real non-technical question might be "Hey, did you guys hear
that Borland is selling off its development tools?". The question relates
to the products we use but it doesn't ask for code.
- Clayton
 

Re:String Parser?

Hi:
JVines escribi?
Quote
I am looking for string parsers. Can anyone help?
You might like to check out:
www.tropicsoft.com/Components/RegularExpression/index.html
It's a RegEx implementation, and it's free.
HTH,
MartinH.
 

Re:String Parser?

"Martin Hart Turner" <"martin at memorysoft dot es">wrote in message
Quote
Hi:


JVines escribi?
>I am looking for string parsers. Can anyone help?

You might like to check out:
www.tropicsoft.com/Components/RegularExpression/index.html

It's a RegEx implementation, and it's free.
Unfortunately, Edward Diener has clearly stated that he will not support BDS
with his component. A similar component though, TPerlRegEx
(www.regular-expressions.info/download/TPerlRegEx.zip), is also free,
includes source code, and builds with BCB6 and BDS (and I easily replaced
Edward's component with TPerlRegEx in my applications). Of course, there is
also boost::regex, which will probably be (if not already) a part of the
next C++ standard. Having said that however, a regular expression parser is
almost certainly overkill for simple text parsing.
- Dennis
 

Re:String Parser?

Quote
next C++ standard. Having said that however, a regular expression parser is
almost certainly overkill for simple text parsing.

Exactly! A regular expression parser can come in handy, sometimes. One
parser, I have seen, takes a string and breaks it down into an array or
linked list of tokens. The tokens can be numbers, text, whitespace
characters, etc. I am looking for parsers with a little bit more
control. Instead of ending a token where a string of text ends and a
number begins, I would like to be able to define delimiters, pictures
(see your nearest database system for a definition), etc.
 

Re:String Parser?

JVines < XXXX@XXXXX.COM >writes:
Quote
>You are going to have to be more specific. You need to provide the
>purpose of the parser. If you want all kinds of parsers then at
>least start with one use that you have for a parser because the
>answer will vary depending on your need.

User supplied formatting strings, command lines, text files, etc. I
would like to know where I can find parsers so that I may build a
library of them so that when I need one, I will not have far to look.
You're asking an extremely vague question. There are probably
hundreds of parsing libraries for different tasks. There are external
tools that generate C or C++ parsers using a spec file (like YACC,
ANTLR, or others) and so on.
If you won't say what you want with specificity, then the answers you
will get will be equally vague. "There are many parsing libraries."
Check out boost for some regular-expression and tokenizer libraries,
as well as meta-programming parser-generators (Spirit).
--
Chris (TeamB);
 

Re:String Parser?

I'll strongly recomend Boost::Spirit. You can do parsers for almost anything you want, and
it works really well. You will need to use some older version, as others have said, the
newest one doesn't compile with BCB (don't know about BDS, though).
There you can write the parser you need when you need it. I have done parsers for very
simple stuff (lists of things, for instance), and some other more complex stuff
(instructions for a process or some kind of script).
JVines wrote:
Quote
>next C++ standard. Having said that however, a regular expression
>parser is almost certainly overkill for simple text parsing.
>

Exactly! A regular expression parser can come in handy, sometimes. One
parser, I have seen, takes a string and breaks it down into an array or
linked list of tokens. The tokens can be numbers, text, whitespace
characters, etc. I am looking for parsers with a little bit more
control. Instead of ending a token where a string of text ends and a
number begins, I would like to be able to define delimiters, pictures
(see your nearest database system for a definition), etc.
 

Re:String Parser?

JVines wrote:
Quote
>next C++ standard. Having said that however, a regular expression
>parser is almost certainly overkill for simple text parsing.
>

Exactly! A regular expression parser can come in handy, sometimes. One
parser, I have seen, takes a string and breaks it down into an array or
linked list of tokens. The tokens can be numbers, text, whitespace
characters, etc. I am looking for parsers with a little bit more
control. Instead of ending a token where a string of text ends and a
number begins, I would like to be able to define delimiters, pictures
(see your nearest database system for a definition), etc.
Is strtok() in the C Standard Library too simple? It does let you
define the delimiter but is limited to C-style strings (so you can't
include 0 (zero) in the token.
Jim Dodd