Skip to the content.
‹‹ Overview
Building 』 『 Translating 』 「 Grammars

Writing Grammars

A language is defined as a .qnfa file and placed at utilities/qxs.

Resources

Highlighting

To bring color to your syntax, you have to add the format attribute
and either specify an existing format name or create a new one.

You also have to provide the id attribute, which is just an internal
name that you can choose yourself except for certain Edge Cases.

Editable

If a used format should be user-editable, it will have to
be registered in the ConfigDialog constructor from
configdialog.cpp with fmConfig -> addCategory().

Template
fmConfig -> addCategory(tr("<Grammar Name>"))
    << "<Format1>"
    << "<Format2>";
Example
fmConfig -> addCategory(tr("QtScript"))
    << "qtscript:comment"
    << "qtscript:string"
    << "qtscript:number"
    << "qtscript:keyword"
    << "qtscript:txs-variable"
    << "qtscript:txs-function";