mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-11-10 20:45:35 +01:00
28 lines
552 B
Plaintext
28 lines
552 B
Plaintext
function regex_node(val, accept = false) constructor {
|
|
self.val = val;
|
|
self.accept = accept;
|
|
|
|
states = {};
|
|
|
|
static setNext = function(key, node) {
|
|
states[$ key] = node;
|
|
}
|
|
|
|
static consume = function(key) {
|
|
return struct_has(states, key)? states[$ key] : self;
|
|
}
|
|
}
|
|
|
|
function regex_tree(regx) constructor {
|
|
regs = string_splice(regx, ";", false, false);
|
|
|
|
static isMatch = function(str) {
|
|
for (var i = 0, n = array_length(regs); i < n; i++) {
|
|
var rgx = regs[i];
|
|
if(RegexMatch(str, rgx))
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
} |