Try copying the examples and see where your issue is or use valgrind. I am yravellling this week so difficult to spend more time looking.
Jim On Jun 15, 2010, at 2:00, [email protected] wrote: > Hi, > > Is this the correct way to call the antlr-runtime from C++? (It > seems I > have some memory overwrite issues so that is why I am asking) > > I have a string with the content I want to parse (e.g. string s = > "1+1") > > > pANTLR3_INPUT_STREAM input = antlr3NewAsciiStringInPlaceStream( > reinterpret_cast<pANTLR3_UINT8>(const_cast<char*>(s.c_str())), > (ANTLR3_UINT64)s.length(), NULL); > pMAExpressionLexer lxr = MAExpressionLexerNew(input); > pANTLR3_COMMON_TOKEN_STREAM tstream = > antlr3CommonTokenStreamSourceNew(ANTLR3_SIZE_HINT, TOKENSOURCE(lxr)); > pMAExpressionParser psr = MAExpressionParserNew(tstream); > MAExpressionParser_ma_expression_return r = psr->ma_expression > (psr); > // calling the start rule for parsing > > when I later free psr it crashes > > psr->free(psr); psr = NULL; > Has anybody an idea what I am doing wrong? > Thank you and kind regards, > Anders > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: > http://www.antlr.org/mailman/options/antlr-interest/your-email-address 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.
