UEFI requires us to work with a plethora of different BIOS-specific file types.  Among them are .dec, .dsc, .fdf, .inf, .uni, and .vfr files.  I went through the exercise of configuring syntax highlighting for these six file types in my text editor.  I share my configuration below, for both my text editor and for any text editor in general.

 

What is Syntax Highlighting?

From Wikipedia:

Syntax highlighting is a feature of text editors that are used for programming, scripting, or markup languages, such as HTML. The feature displays text, especially source code, in different colors and fonts according to the category of terms. This feature facilitates writing in a structured language such as a programming language or a markup language as both structures and syntax errors are visually distinct. Highlighting does not affect the meaning of the text itself; it is intended only for human readers.

I love syntax highlighting, and can’t live without it.  Here’s an example of my configuration for the file Nt32Pkg.fdf from the EDK:

image

 

Similarly, here’s PcAtChipsetPkg.dec:

image

 

The color helps your eye to quickly pick apart the various sections and subsections of the documents.  It alerts you to possible errors before you commit the files.  You can separate the parameters from the values instantly.

 

Spec Revisions

I used the BNF from each of the file specifications to generate the syntax highlighting.  The lists of tokens were created from the following versions of the EDKII specifications:

DEC_Spec_1.24A.pdf
DSC_Spec_1.24.pdf
FDF_Spec_1.24.pdf
INF_Spec_1.24A.pdf
UNI_File_Spec_v1.2.pdf
VFR_V1.7.pdf

 

Download

Unfortunately, every text editor has its own way of handling syntax highlighting.  I’ve included a .zip file for my text editor, SlickEdit.  If you use SlickEdit, you can simply click:

Tools/Options/Export-Import Options/Import Options

… and direct the dialog to the .zip file.  This will install all six languages automatically.  If you use another text editor, you can download the text files I created to break down all the different keywords/reserved words into 4-5 different groupings.  Then, use your text editor’s facility for inputting these word tokens.

 

SlickEdit .zip of all six languages:

https://github.com/WilliamLeara/BasicInputOutput/raw/master/SyntaxHighlight/SlickEdit_EDKII_Syntax.zip

 

Token Files (Editor-Agnostic)

https://github.com/WilliamLeara/BasicInputOutput/tree/master/SyntaxHighlight/tokens

 

Did you find this helpful?  Leave a comment, thanks!

Post a Comment

  1. Thanks for posting this! I was about to start configuring my own editor (Sublime Text) for highlighting. This is quite helpful.

    ReplyDelete
  2. No problem Brandon, thanks for reading!

    ReplyDelete

Be sure to select an account profile (e.g. Google, OpenID, etc.) before typing your comment!