package higlo
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Module Higlo.Lang
Source
Syntax highligthing
Source
type token =
| Bcomment of string
(*block comment
*)| Constant of string
| Directive of string
| Escape of string
(*Escape sequence like
*)\123
| Id of string
| Keyword of int * string
| Lcomment of string
(*one line comment
*)| Numeric of string
| String of string
| Symbol of int * string
| Text of string
(*Used for everything else
*)
Tokens read in the given code. These names are inspired from the highlight
tool. Keyword
and Symbol
are parametrized by an integer to be able to distinguish different families of keywords and symbols, as kwa
, kwb
, ..., in highlight
.
Source
type error =
| Unknown_lang of string
(*when the required language is not found.
*)| Lex_error of Location.t * string
Lexers are based on Sedlex. A lexer returns a list of tokens, in the same order they appear in the read string. Text
tokens are merged by the parse
function.
get_lexer lang
returns the lexer registered for the given language lang
or raises Unknown_lang
if no such language was registered.
If a lexer was registered for the same language, it is not available any more.