Skip to main content

Module syntax

Module syntax 

Source
Expand description

Syntax highlighting described by a config file, one per language.

A language file is a flat list of key value lines read by kv_parser:

extensions rs
line_comment //
block_comment /* */ nested
strings " \
keywords fn let mut if else match impl pub struct
types u8 u32 usize String Vec Option Result

Every key is optional. Syntax::spans scans a text once and reports what it found; picking colours for the Classes is left to the frontend.

Structs§

Syntax
The rules of one language, ready to scan text with.

Enums§

Class
What a span of text is, for the frontend to pick a colour for.
Error
Why a language file could not be read.

Functions§

directory
Where language files live: $XDG_CONFIG_HOME/idet/syntax, or $HOME/.config/idet/syntax when that variable is unset.
for_path
Loads the language covering paths extension, if one is configured.