-
Notifications
You must be signed in to change notification settings - Fork 1
mint.lexical handler
load mint.lexical-handler
This module provides the LexicalHandler class which provides an interface to parse a mint script and get callbacks on each token.
This enum describes the token types used in the onToken method.
| Constant | Value | Description |
|---|---|---|
| Amp | 49 |
The token is a & operator. |
| AmpEqual | 63 |
The token is a &= operator. |
| Assert | 0 |
The token is an assert keyword. |
| Asterisk | 85 |
The token is a * operator. |
| AsteriskEqual | 58 |
The token is a *= operator. |
| Async | 1 |
The token is an async keyword. |
| At | 41 |
The token is a @ operator. |
| Await | 2 |
The token is an await keyword. |
| BackSlash | 43 |
The token is a \ operator. |
| Break | 3 |
The token is a break keyword. |
| Caret | 48 |
The token is a ^ or xor operator. |
| CaretEqual | 65 |
The token is a ^= operator. |
| Case | 4 |
The token is a case keyword. |
| Catch | 5 |
The token is a catch keyword. |
| Class | 6 |
The token is a class keyword. |
| CloseBrace | 102 |
The token is a } operator. |
| CloseBracket | 100 |
The token is a ] operator. |
| CloseBracketEqual | 55 |
The token is a ]= operator. |
| CloseParenthesis | 98 |
The token is a ) operator. |
| Colon | 53 |
The token is a : operator. |
| ColonEqual | 54 |
The token is a := operator. |
| Comma | 44 |
The token is a , operator. |
| Comment | 39 |
The token is a comment. |
| Const | 7 |
The token is a const keyword. |
| Constant | 32 |
The token is a constant value like true, false, null or none. |
| Continue | 8 |
The token is a continue keyword. |
| DblAmp | 46 |
The token is a && or and operator. |
| DblAsterisk | 95 |
The token is a ** operator. |
| DblDot | 68 |
The token is a .. operator. |
| DblEqual | 70 |
The token is a == operator. |
| DblLeftAngled | 81 |
The token is a << operator. |
| DblLeftAngledEqual | 61 |
The token is a <<= operator. |
| DblMinus | 94 |
The token is a -- operator. |
| DblPipe | 45 |
The token is a || or or operator. |
| DblPlus | 93 |
The token is a ++ operator. |
| DblRightAngled | 82 |
The token is a >> operator. |
| DblRightAngledEqual | 62 |
The token is a >>= operator. |
| Def | 9 |
The token is a def keyword. |
| Default | 10 |
The token is a default keyword. |
| Defined | 92 |
The token is a defined operator. |
| Dollar | 40 |
The token is a $ operator. |
| Dot | 96 |
The token is a . operator. |
| Elif | 11 |
The token is a elif keyword. |
| Else | 12 |
The token is a else keyword. |
| Enum | 13 |
The token is a enum keyword. |
| Equal | 50 |
The token is a = operator. |
| EqualColon | 66 |
The token is a =: operator. |
| EqualRightAngled | 67 |
The token is a => operator. |
| EqualTilde | 75 |
The token is a =~ operator. |
| Exclamation | 88 |
The token is a ! or not operator. |
| ExclamationDblEqual | 73 |
The token is a !== operator. |
| ExclamationEqual | 72 |
The token is a != operator. |
| ExclamationTilde | 76 |
The token is a !~ operator. |
| Exit | 14 |
The token is a exit keyword. |
| FileEnd | 38 |
The token is an end of file. |
| Final | 15 |
The token is a final keyword. |
| For | 16 |
The token is a for keyword. |
| If | 17 |
The token is a if keyword. |
| In | 18 |
The token is a in keyword. |
| Is | 74 |
The token is a is operator. |
| LeftAngled | 77 |
The token is a < operator. |
| LeftAngledEqual | 79 |
The token is a <= operator. |
| Let | 19 |
The token is a let keyword. |
| Lib | 20 |
The token is a lib keyword. |
| LineEnd | 37 |
The token is a non escaped end of line. |
| Load | 21 |
The token is a load keyword. |
| Membersof | 91 |
The token is a membersof operator. |
| Minus | 84 |
The token is a - operator. |
| MinusEqual | 57 |
The token is a -= operator. |
| ModulePath | 103 |
The token is a module path element. |
| NoLineEnd | 36 |
The token is an escaped end of line. |
| Number | 34 |
The token is a number. |
| OpenBrace | 101 |
The token is a { operator. |
| OpenBracket | 99 |
The token is a [ operator. |
| OpenParenthesis | 97 |
The token is a ( operator. |
| Override | 22 |
The token is a override keyword. |
| Package | 23 |
The token is a package keyword. |
| Percent | 87 |
The token is a % operator. |
| PercentEqual | 60 |
The token is a %= operator. |
| Pipe | 47 |
The token is a | operator. |
| PipeEqual | 64 |
The token is a |= operator. |
| Plus | 83 |
The token is a + operator. |
| PlusEqual | 56 |
The token is a += operator. |
24 |
The token is a print keyword. |
|
| Question | 51 |
The token is a ? operator. |
| QuestionDot | 52 |
The token is a ?. operator. |
| Raise | 25 |
The token is a raise keyword. |
| Regex | 104 |
The token is a regular expression literal. |
| Return | 26 |
The token is a return keyword. |
| RightAngled | 78 |
The token is a > operator. |
| RightAngledEqual | 80 |
The token is a >= operator. |
| Sharp | 42 |
The token is a # operator. |
| Slash | 86 |
The token is a / operator. |
| SlashEqual | 59 |
The token is a /= operator. |
| String | 33 |
The token is a string literal. |
| Switch | 27 |
The token is a switch keyword. |
| Symbol | 35 |
The token is a symbol. |
| Tilde | 89 |
The token is a ~ operator. |
| TplDot | 69 |
The token is a ... operator. |
| TplEqual | 71 |
The token is a === operator. |
| Try | 28 |
The token is a try keyword. |
| Typeof | 90 |
The token is a typeof operator. |
| Var | 31 |
The token is a var keyword. |
| While | 29 |
The token is a while keyword. |
| Yield | 30 |
The token is a yield keyword. |
This class provides an interface to parse mint scripts using the parse method. Each encountered token will be provided to a callback method like onToken.
| Modifiers | Member | Description |
|---|---|---|
enum |
Token | This enum describes the token types used in the LexicalHandler.Token.onToken ... |
const |
new | Creates a new handler. |
| onComment | The parser calls this method when it has parsed a line of comment. The token ... |
|
| onCommentBegin | The parser calls this method when it has parsed the begin of a comment. The o... |
|
| onCommentEnd | The parser calls this method when it has parsed the end of a comment. The offset... |
|
| onModulePathToken | The parser calls this method when it has parsed an element of a module path. ... | |
| onNewLine | The parser calls this method when it is about to parse a new line. The lineNu... |
|
| onScriptBegin | The parser calls this method when it begin the parsing of the script. The par... | |
| onScriptEnd | The parser calls this method when the parsing reach the end of the script. Th... | |
| onSymbolToken | The parser calls this method when it has parsed an user defined symbol. The c... |
|
| onToken | The parser calls this method when it has parsed a token. The type parameter i... |
|
| onWhiteSpace | The parser calls this method when it has parsed blank characters. The token p... |
|
const |
parse | Parses the script provided by stream. The stream parameter must implement the... |
| Modifiers | Member | Description |
|---|---|---|
final |
d_ptr | Object data. |
@ const
|
g_lib | Global library handle. |
49
The token is a & operator.
63
The token is a &= operator.
0
The token is an assert keyword.
85
The token is a * operator.
58
The token is a *= operator.
1
The token is an async keyword.
41
The token is a @ operator.
2
The token is an await keyword.
43
The token is a \ operator.
3
The token is a break keyword.
48
The token is a ^ or xor operator.
65
The token is a ^= operator.
4
The token is a case keyword.
5
The token is a catch keyword.
6
The token is a class keyword.
102
The token is a } operator.
100
The token is a ] operator.
55
The token is a ]= operator.
98
The token is a ) operator.
53
The token is a : operator.
54
The token is a := operator.
44
The token is a , operator.
39
The token is a comment.
7
The token is a const keyword.
32
The token is a constant value like true, false, null or none.
8
The token is a continue keyword.
46
The token is a && or and operator.
95
The token is a ** operator.
68
The token is a .. operator.
70
The token is a == operator.
81
The token is a << operator.
61
The token is a <<= operator.
94
The token is a -- operator.
45
The token is a || or or operator.
93
The token is a ++ operator.
82
The token is a >> operator.
62
The token is a >>= operator.
9
The token is a def keyword.
10
The token is a default keyword.
92
The token is a defined operator.
40
The token is a $ operator.
96
The token is a . operator.
11
The token is a elif keyword.
12
The token is a else keyword.
13
The token is a enum keyword.
50
The token is a = operator.
66
The token is a =: operator.
67
The token is a => operator.
75
The token is a =~ operator.
88
The token is a ! or not operator.
73
The token is a !== operator.
72
The token is a != operator.
76
The token is a !~ operator.
14
The token is a exit keyword.
38
The token is an end of file.
15
The token is a final keyword.
16
The token is a for keyword.
17
The token is a if keyword.
18
The token is a in keyword.
74
The token is a is operator.
77
The token is a < operator.
79
The token is a <= operator.
19
The token is a let keyword.
20
The token is a lib keyword.
37
The token is a non escaped end of line.
21
The token is a load keyword.
91
The token is a membersof operator.
84
The token is a - operator.
57
The token is a -= operator.
103
The token is a module path element.
36
The token is an escaped end of line.
34
The token is a number.
101
The token is a { operator.
99
The token is a [ operator.
97
The token is a ( operator.
22
The token is a override keyword.
23
The token is a package keyword.
87
The token is a % operator.
60
The token is a %= operator.
47
The token is a | operator.
64
The token is a |= operator.
83
The token is a + operator.
56
The token is a += operator.
24
The token is a print keyword.
51
The token is a ? operator.
52
The token is a ?. operator.
25
The token is a raise keyword.
104
The token is a regular expression literal.
26
The token is a return keyword.
78
The token is a > operator.
80
The token is a >= operator.
42
The token is a # operator.
86
The token is a / operator.
59
The token is a /= operator.
33
The token is a string literal.
27
The token is a switch keyword.
35
The token is a symbol.
89
The token is a ~ operator.
69
The token is a ... operator.
71
The token is a === operator.
28
The token is a try keyword.
90
The token is a typeof operator.
31
The token is a var keyword.
29
The token is a while keyword.
30
The token is a yield keyword.
null
Object data.
lib ('libmint-mint')
Global library handle.
def (self)
Creates a new handler.
def (self, token, offset)
The parser calls this method when it has parsed a line of comment. The
token parameter is a string containing the characters that were read.
The offset parameter is the position of the token in the script. If the
comment is split into multiple lines, this method is called for each lines
of the comment.
If this method returns false the parser stops and reports an error.
def (self, offset)
The parser calls this method when it has parsed the begin of a comment.
The offset parameter is the position of the comment in the script.
If this method returns false the parser stops and reports an error.
def (self, offset)
The parser calls this method when it has parsed the end of a comment.
The offset parameter is the position after the comment in the script.
If this method returns false the parser stops and reports an error.
def (self, context, token, offset)
The parser calls this method when it has parsed an element of a module
path. The context is an array containing the previous elements of the
module path as strings and the token parameter is the current element
being parsed. The offset parameter is the position of the token in the
script.
If this method returns false the parser stops and reports an error.
def (self, lineNumber, offset)
The parser calls this method when it is about to parse a new line. The
lineNumber parameter is the number of the next line starting from 1.
The offset parameter is the position of the new line in the script.
If this method returns false the parser stops and reports an error.
def (self)
The parser calls this method when it begin the parsing of the script. The parser calls this method just once, after the call to parse, and before any other method in this class are called.
If this method returns false the parser stops and reports an error.
def (self)
The parser calls this method when the parsing reach the end of the script. The parser calls this method just once and is the last handler function called.
If this method returns false the parser stops and reports an error.
def (self, context, token, offset)
The parser calls this method when it has parsed an user defined symbol.
The context is an array containing the path to the symbol as strings
(e.g. ['System', 'OS'] for System.OS.getType) and the token parameter
is the current symbol being parsed. The offset parameter is the position
of the token in the script.
If this method returns false the parser stops and reports an error.
def (self, context, offset)
The parser calls this method when it was expecting an user defined symbol
but found nothing. The context is an array containing the path to the
expected symbol as strings (e.g. ['System', 'OS'] for System.OS.). The
offset parameter is the position where the token was expected in the
script.
If this method returns false the parser stops and reports an error.
def (self, % type, token, offset)
The parser calls this method when it has parsed a token. The type
parameter is a value of Token that provides the type of the token
and the token parameter is the string representation of the token. The
offset parameter is the position of the token in the script.
If this method returns false the parser stops and reports an error.
def (self, token, offset)
The parser calls this method when it has parsed blank characters. The
token parameter is a string containing the characters that were read.
The offset parameter is the position of the token in the script.
If this method returns false the parser stops and reports an error.
def (const self, stream)
Parses the script provided by stream. The stream parameter must
implement the read part of the serializer interface and provide
a getChar method. Returns true on success; otherwise returns false.
- Introduction
- Variables
-
Built-in-types
- Built-in-types#none
- Built-in-types#null
- Built-in-types#boolean
- Built-in-types#number
- Built-in-types#string
- Built-in-types#regex
- Built-in-types#array
- Built-in-types#hash
- Built-in-types#iterator
- Built-in-types#async_iterator
- Built-in-types#package
- Built-in-types#function
- Built-in-types#coroutine
- Built-in-types#library
- Built-in-types#libobject
- Arithmetic-operations
- Type-casting
- Control-structures
- Function-definition
- User-defined-types
- Work-with-modules