// Comments of the ; type are ignored.
// Operators are by default single characters. Multicharacter
-// operators can be made by supplying a string of prefix and
-// suffix characters.
+// operators can be made by supplying a string of multi_start and
+// multi_continue characters.
// characters. For example,
// '<>+-&', '=>&:'
// will match any of these:
/*jslint onevar: false
*/
-String.prototype.tokens = function (prefix, suffix) {
+String.prototype.tokens = function (multi_start, multi_continue) {
var c; // The current character.
var from; // The index of the start of the token.
var i = 0; // The index of the current character.
return;
}
-// If prefix and suffix strings are not provided, supply defaults.
+// If multi_start and multi_continue strings are not provided, supply defaults.
- if (typeof prefix !== 'string') {
- prefix = '';
+ if (typeof multi_start !== 'string') {
+ multi_start = '';
}
- if (typeof suffix !== 'string') {
- suffix = '';
+ if (typeof multi_continue !== 'string') {
+ multi_continue = '';
}
// multi-char operator.
- } else if (prefix.indexOf(c) >= 0) {
+ } else if (multi_start.indexOf(c) >= 0) {
str = c;
i += 1;
while (i < length) {
c = this.charAt(i);
- if (suffix.indexOf(c) < 0) {
+ if (multi_continue.indexOf(c) < 0) {
break;
}
str += c;