Hi, I have this project where C++ templates are being unfolded and wrapped in .NET. This wrapping is performed by some perl-scripts which over time have become quite messy, so I wanted to rewrite the wrapper using ANTLR.
The way the current template wrapper works is by parsing simple template expressions defined in the comments preceding a function definition. This is similar to documentation frameworks like doxygen, where the documentation is embedded in the comments above functions, classes, etc. The simple syntax contains elements like this: // @TEMPLATE <int, float> which tells the wrapper to unfold the template using an int for the first template type and a float for the second. My problem is that I am already stuck in defining the lexer. Since all wrapper expressions start with '@' I tried to define a token like: WRAPPERSTART : SLASHSLASH SPACE* '@' and some grammar rules based on that token. However that doesn't work since the lexer will always choose the longest matching rule, which would always be the normal single line comment rule. I can imagine that there are many approaches to tackle this problem and some hints would be greatly appreciated. Soren --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
