Language definitions
A language definition describes all elements of a programming language which
will be highlighted by different colours.
Save the new file in HL_DIR/langDefs, using the following name convention:
<usual extension of sourcecode files>.lang
Examples: PHP -> php.lang, Java -> java.lang
If there exist multiple suffixes, list them in HL_DIR/extensions.conf.
Format:
# Regular expression to describe valid number tokens # Default value: (?:0x|0X)[0-9a-fA-F]+|\d*[\.]?\d+(?:[eE][\-\+]\\d+)?[lLuU]? $DIGIT=regex(<RE>) # Regular expression to describe valid identifier tokens # Default value: [a-zA-Z_]\w* $IDENTIFIER=regex(<RE>) # List of keywords or regular expression. # <group> is the name of the keyword group # The group must be defined in the applied colour theme to provide a matching # highlighting style. # If the regex contains multiple grouping parantheses, GROUP-NUM may be defined. # This parameter contains the number of the group, whose match should be # returned as keyword (count number from left to right) # The capturing states of the groups are irrelevant for counting. # Legal index values: 0 <= GROUP-NUM <= highest group index # 0 describes the complete regex match # If GROUP-NUM is undefined, the group match with the highest number will be # returned. $KEYWORDS(<group>)=regex(<RE> <, GROUP-NUM>) | <List> # List of String delimiters $STRINGDELIMITERS=<List> # List of string delimiters which are not equal (open != close) $STRING_UNEQUAL=<open close> # List of escape characters in Strings (ie. "\") or regular expression $ESCCHAR=<List> | regex(<RE>) # Escape characters may appear outside of strings $ALLOWEXTESCAPE=<true|false> # Prefix which disables highlighting of escape characters within a string $RAWSTRINGPREFIX=<character> # Delimiters of multi line comments $ML_COMMENT=<comment_begin comment_close> # List of strings which start single line comments $SL_COMMENT=<List> | regex(<RE>) # Opening string of preprocessor directive lines $DIRECTIVE=<prefix> | regex(<RE>) # Character which continues a compiler directive after a line break $CONTINUATIONSYMBOL=<symbol> # Language source code may be reformatted (only C-style languages!) $REFORMATTING=<true | false> # Symbols (brackets or operators) $SYMBOLS=<List> # Multiple line comments may be nested $ALLOWNESTEDCOMMENTS=<true | false> # Programming language is case sensitive $IGNORECASE=<true | false> # Include another language definition stored in the same data directory $INCLUDE=<language definition> # define the opening and closing expressions of the embedded language. # There may be multiple entries for the same language $NESTED(language)=regex(<RE open>) regex(<RE close>)
See the file README_REGEX for a detailed description of the regular expression syntax.
Example:
#Content of pas.lang (Pascal/Objekt Pascal)
$KEYWORDS(kwa)= absolute abstract and array as asm assembler automated begin case
cdecl class const constructor destructor dispid dispinterface div do downto
# [...]
$KEYWORDS(kwb)=boolean char integer pointer real text
true false cardinal longint byte word single double int64
$KEYWORDS(kwc)=if else then downto do for repeat while to until with
$KEYWORDS(kwd)=regex((\w+?)\s*\()
$STRINGDELIMITERS=" '
$SL_COMMENT=//
$ML_COMMENT={ } (* *)
$IGNORECASE=true
$SYMBOLS= ( ) [ ] , ; : & | < > ! = / * % + - @
$ESCCHAR=#
$ALLOWEXTESCAPE=true
Back
