Lets say I want to do something like this @Start Blah int a,b void func() { beep() } float c @end
Then I will use Blah in place of declaring all that. Kind of like a C define. Now here is the twist @Start Blah int a,b void func() { beep() float c @end I want this to fail because it doesn't end in the same scope. Doing } } should fail as well as it end one scope to many. What is the best way to implement this? I believe I can use unput when I see Blah but the problem is ensuring the same scope. If I do it in multiple code blocks I believe ending to little or many would still have the parser in the same state so I can't simply look at state. I'd need a way to look at the stack AND state. An easy hack would be to count '{' and '}' however that will not work because what if i ended it with float c=. So my question is how do I look at the state so I know it wasn't ended at something like '=' (theres not that many valid states to do this. I believe only in the body of namespace, function and class). How do I look at the stack to know if I am in the right depth? _______________________________________________ help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison