Hi, Sorry to keep spamming this list with my problems.
I am trying to create an ID node that is usually recognized by the lexer by hand. I create my node in the following way: pANTLR3_STRING_FACTORY strFactory = antlr3StringFactoryNew(); pANTLR3_BASE_TREE_ADAPTOR ADAPTOR = ANTLR3_TREE_ADAPTORNew(strFactory); MyParser_compilationUnit_return retval; pANTLR3_BASE_TREE compilationUnit = (pANTLR3_BASE_TREE)ADAPTOR->createTypeText(ADAPTOR, COMPILATIONUNIT, NULL); // create some more pANTLR3_BASE_TREE instances... pANTLR3_COMMON_TOKEN token = ADAPTOR->createToken(ADAPTOR, ID, (pANTLR3_UINT8)"Sample"); pANTLR3_BASE_TREE id = (pANTLR3_BASE_TREE)ADAPTOR->create(ADAPTOR, token); // add children using calls like: ADAPTOR->addChild(ADAPTOR, compilationUnit, <trees>); retval.tree = compilationUnit; Later, though, when I try to print, I am getting a crash: Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x00000004 0x00004503 in pt (ctx=0x803800, t=0x2b81f0) at Printer.cpp:16642 16642 cout << t->getText(t)->chars; (gdb) I don't see what I'm doing wrong when I am creating my AST. I've been looking at the documentation, and the source itself, but I can't figure out what I did wrong.. When I print the tree I constucted with ast.tree->toStringTree(ast.tree)->char, I see: ( ( ( ) )) but I expect: ( ( ( Sample ) )) thanks, Robert List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---
