ze
Loading...
Searching...
No Matches
Files | Functions
Collaboration diagram for Syntax:

Files

file  syntax.c
 Syntax highlighting engine implementation.
 

Functions

int is_separator (int c)
 Determine whether a byte is a token separator for highlighting.
 
void editorUpdateSyntax (erow *row)
 Compute highlighting for a row based on current filetype.
 
int editorSyntaxToColor (int hl)
 Map a highlight class to an ANSI color code.
 
void editorSelectSyntaxHighlight (void)
 Select appropriate language rules based on E.filename.
 

Detailed Description

Function Documentation

◆ editorSelectSyntaxHighlight()

void editorSelectSyntaxHighlight ( void  )

Select appropriate language rules based on E.filename.

Sets E.syntax to a matching entry in HLDB by extension or substring, and recomputes highlighting for all rows.

Postcondition
E.syntax may change; row highlights are updated accordingly.

◆ editorSyntaxToColor()

int editorSyntaxToColor ( int  hl)

Map a highlight class to an ANSI color code.

Parameters
[in]hlOne of HL_* constants.
Returns
ANSI color code suitable for 30–37 range.

◆ editorUpdateSyntax()

void editorUpdateSyntax ( erow row)

Compute highlighting for a row based on current filetype.

Updates row->hl based on the current filetype rules in E.syntax, marking comments, strings, numbers, and keywords. Propagates multi-line comment state to the following row when it changes.

Parameters
[in,out]rowRow whose render buffer has been prepared.
See also
editorUpdateRow(), editorSelectSyntaxHighlight()

◆ is_separator()

int is_separator ( int  c)

Determine whether a byte is a token separator for highlighting.

Separators include whitespace, NUL, and common punctuation.

Parameters
[in]cByte value to test.
Returns
Non-zero if c is a separator; 0 otherwise.