Type Definitions
Grammar
- Source:
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
rest |
Grammar |
<optional> |
An optional grammar object that will be appended to this grammar. |
Type:
- Object.<string, (RegExp|GrammarToken|Array.<(RegExp|GrammarToken)>)>
GrammarToken
- Source:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
pattern |
RegExp | The regular expression of the token. |
||
lookbehind |
boolean |
<optional> |
false
|
If |
greedy |
boolean |
<optional> |
false
|
Whether the token is greedy. |
alias |
string | Array.<string> |
<optional> |
An optional alias or list of aliases. |
|
inside |
Grammar |
<optional> |
The nested grammar of this token. The This can be used to make nested and even recursive language definitions. Note: This can cause infinite recursion. Be careful when you embed different languages or even the same language into each another. |
The expansion of a simple RegExp
literal to support additional properties.
HighlightCallback(element) → {void}
- Source:
A function which will invoked after an element was successfully highlighted.
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | The element successfully highlighted. |
Returns:
- Type
- void
HookCallback(env) → {void}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
env |
Object.<string, any> | The environment variables of the hook. |
Returns:
- Type
- void
TokenStream
- Source:
A token stream is an array of strings and Token
objects.
Token streams have to fulfill a few properties that are assumed by most functions (mostly internal ones) that process them.
-
No adjacent strings.
-
No empty strings.
The only exception here is the token stream that only contains the empty string and nothing else.
Type:
- Array.<(string|Token)>