Constructor
new TokenIterator(tokens)
Creates an iterator that iterates through a token array.
It also features some useful methods
Parameters:
Name | Type | Description |
---|---|---|
tokens |
- Source:
Methods
current() → {*}
Returns the current token
- Source:
Returns:
- Type
- *
hasNext() → {boolean}
Returns whether there is a next token or not
- Source:
Returns:
- Type
- boolean
is(text) → {boolean}
Checks whether the current token equals the given text.
Parameters:
Name | Type | Description |
---|---|---|
text |
- Source:
Returns:
- Type
- boolean
iterate(func)
Iterates through the source code
Parameters:
Name | Type | Description |
---|---|---|
func |
Function that is called at the beginning of each line |
- Source:
match(text) → {*}
Matches the current token with the specified text, if it fails an error is raised
Parameters:
Name | Type | Description |
---|---|---|
text |
- Source:
Returns:
- Type
- *
next()
Moves to the next token. If there is none, an error is rised.
- Source:
optNext()
If there is a next token => next(), otherwise ignore
- Source:
restore()
Restores the TokenIterator to the next consistent state (used for multiple error messages)
- Source:
riseSyntaxError(msg)
Wrapper for the yasp.Assembler.riseSyntaxError function
Parameters:
Name | Type | Description |
---|---|---|
msg |
- Source: