0

What is the right way of doing syntax coloring in a grammar? I believe it was like this:

syntax MappingName = @category="Constant" mappingname: Id mapping;

But it doesn't work for me. The file is just black text without parse errors (and it is open in the IMP editor, and I saw it create a parser).

Jasper
  • 478
  • 6
  • 19

1 Answers1

1

For inspiration, you can always look at the Rascal grammar. Where you can see that your syntax and category name seem correct.

Try what happens if you have no name for the production?

syntax MappingName = @category="Constant" Id mapping;
Davy Landman
  • 15,109
  • 6
  • 49
  • 73
  • As I found out, I had still a parse error at the end of the file. Eclipse didn't show an error though, so I was puzzled. Parsing on the commandline showed the error. – Jasper Jul 17 '14 at 19:21
  • 1
    also checkout the categories contribution: [IDE::Contribution::categories](https://github.com/cwi-swat/rascal-eclipse/blob/master/src/org/rascalmpl/eclipse/library/util/IDE.rsc#L34) where you can add new categories and their colouring. [Or completely change the colors to for example the Solarized scheme](https://github.com/cwi-swat/rascal-eclipse/blob/master/src/org/rascalmpl/eclipse/library/util/SyntaxHighlightingTemplates.rsc) – Davy Landman Jul 18 '14 at 12:36