[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
String concatenation?
From: |
Kevin Milner |
Subject: |
String concatenation? |
Date: |
Mon, 2 Jun 2003 17:03:07 -0500 |
Hello, I'm using Bison and Flex to make a specialized XML parser to handle a
SOAP response. The problem I am having is that when I try to assign a value
to a nonterminal, as in the following:
xmlopen: OPENTAG tagname paramlist CLOSETAG { $$.value = $2.value;
sprintf(buff, "xmlopen(%s)-> < tagname paramlist >",
$$.value);
PrintRule(buff);
}
I get $2.value = "whatevertagname whateverparams >", as if xmlopen is
assigned the value of everything from the point I am interested in to the
end of the statement. I am having this problem systematically on every part
that I assign a value on. If I use $1, I get everything in one line string.
Here is the output of this statement from my rule output:
Reading: < (269)
----------------------------------------------------------------------
Reading: LongSecond (257)
tagname-> IDENT(LongSecond)
----------------------------------------------------------------------
Reading: > (271)
parameter-> /*EMPTY*/
paramlist-> parameter
xmlopen( LongSecond> ) -> < tagname paramlist >
I'm using a struct that simply contains a char * called value. I tried this
thinking that it would solve the problem, but the same thing happens if I
simply use %type char* on everything.
Can anyone help me understand the way that strings are assigned to
nonterminals in Bison?
Thanks,
Kevin Milner
- String concatenation?,
Kevin Milner <=