[antlr-interest] Re: Newbie ANTLR C++
PAQ2000
paq2000 at yahoo.com
Wed Oct 6 18:40:19 PDT 2004
haha, thanks Thierry! I guess I'm rusty at the C++. Admittedly, I
always avoid it whenever possible. I guess I shoulda just did what
pilots do: "check six!"
Thanks again,
- Jason
--- In antlr-interest at yahoogroups.com, "Thierry Miceli"
<tmiceli at s...> wrote:
>
> >But at any rate, my question is to know how I would take each
token I
> >scan and put it into an array. My problem is is that
> >getText() returns a string, and in C/C++ there's no string
datatype.
>
> Wrong, there is a 'string' type that is part of the STL (standard
template
> library) that should come with your C++ compiler.
>
> > How do I get around this problem?
>
> This way:
>
> std::string tokenText = token->getText();
>
> If you want to store token text in an array, it is better to use a
vector
> object.
>
> // Definition of the vector of strings object std::vector<
std::string >
> tokenTexts;
>
> // Add a token text string at the end of the vector
tokenTexts.push_back(
> token->getText() );
>
> For more take the time to read a good C++ manual.
>
>
> Cheers,
>
> Thierry
> www.ideat-solutions.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list