This project has moved and is read-only. For the latest updates, please go here.

% Prefix on Keywords

Jun 7, 2010 at 6:34 PM

In the language I'm building a grammar for, all the reserved words are decorated with a % sign at the beginning.  If I build the grammar without this, the syntax highlighting works fine, but doesn't work with the %prefix.  If I remember correctly, it actually still parses just fine, it's just the syntax highlighting.  Does anyone have an idea as to why?  All my reserved words are just the standard KeyTerm type terminal.  Do I need a custom terminal?  Or is there some other property I can set on the standard KeyTerm terminal to do it?



Jun 7, 2010 at 6:55 PM
I think the reason is the default guess that Irony makes about keywords. All key symbols used in grammar Irony treats as special terms that it marks either as "keyword" (like "if", "while" "for") or key symbol - special symbol which is not a word, like "{", "}" etc. In your case it looks like Irony decides that all these %-starting words are key symbols, so it does not mark them as keywords. You need to set the IsKeyword flag explicitly. You can either explicitly set it on each of your %-words, or make some automatic loop at the end of grammar constructor and go thru all Symbol terminals and sets this flag if symbol starts with %. I don't have the source on my machine here, so I can't give more explicit instructions, but you can easily find it out I hope Roman
Jun 8, 2010 at 12:38 PM

That did the trick.  Thanks.