Another kind of domain specific

On the lighter side of DSLs, Xtext 0.8M5 fixes a bug with unicode characters. It is now possible to use Unicode characters in literals of your grammar.

So the example grammar of new Xtext Projects in Chinese could look like this:

xtext-zh

Of course, content assist and outline are fully supported:

xtext-zh2

All you have to do is to set Eclipse to use UTF-8 for the workspace through Window->Preferences->General->Workspace.

And, with a little overloading of the ID terminal, like this:

terminal ID :
‘^’?(‘a’..’z’|’A’..’Z’|’_’|’一’..’é¾¥’) (‘a’..’z’|’A’..’Z’|’_’|’0′..’9’|’一’..’é¾¥’)* ;

You can even use chinese characters as IDs:

xtext-zh3

Leave a Reply

Your email address will not be published. Required fields are marked *