Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add in a new Tokenizer.Iterator for String. Add a few other enhanceme…
…nts to make tokenizers and tokens easier to use
- Loading branch information
1 parent
d49252c
commit 856b944
Showing
4 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
namespace Rosella.String.Tokenizer | ||
{ | ||
class Iterator | ||
{ | ||
var tokenizer; | ||
|
||
function Iterator(var tokenizer) | ||
{ | ||
self.tokenizer = tokenizer; | ||
} | ||
|
||
function set_integer_native[vtable](int direction) | ||
{ | ||
// ignored | ||
} | ||
|
||
function get_bool[vtable]() | ||
{ | ||
return self.tokenizer != null && self.tokenizer.has_tokens(); | ||
} | ||
|
||
function shift_pmc[vtable]() | ||
{ | ||
say("shift_pmc"); | ||
return self.tokenizer.get_token(); | ||
} | ||
|
||
function shift_string[vtable]() | ||
{ | ||
say("shift_string"); | ||
return self.tokenizer.get_token().data(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters