On Mon, 1 Oct 2007, Sebastian Pipping wrote: > Joel E. Denny wrote: > > Well, if we document how the splitting is done, then I figure they can't > > complain too much. I certainly don't want to see Bison parse complex C++ > > constructs. Let the C++ compiler catch those errors. > > Wouldn't it be both easy and powerful to solve that namespace thing > using "%define"s? > > > What I have in mind is one %define each for begin and end of the > namespace, something like this: > > %define "namespace_intro" "namespace Gnu { namespace Bison {" > %define "namespace_outro" "} }" > > The default would be set to > > %define "namespace_intro" "namespace <prefix> {" > %define "namespace_outro" "}"
I see this as more work for the user. > If that's possible that would > * take namespace parsing off Bison's shoulders and When I spoke of Bison parsing complex C++ constructs, I was responding to this: On Sun, 30 Sep 2007, Akim Demaille wrote: > it's just that if we start looking at > what it contains, someday someone might complain that we generated > invalid C++ code instead of rejecting invalid prefixes. I think Akim was worried that I might try to report syntactically invalid namespace references. For example, "ns1::%bogus$::ns2". Leave that to the compiler. We can document that Bison just splits on "::" blindly, and that should be straightforward to implement. For syntactically valid namespace references minus any leading "::", I believe this approach will always work. On Mon, 1 Oct 2007, Sebastian Pipping wrote: > * be flexible at the same time. Do you have some use cases in mind that we can't handle with the approach we've been discussing? _______________________________________________ help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison