mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-27 07:26:33 +01:00
28 lines
No EOL
552 B
Text
28 lines
No EOL
552 B
Text
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;
|
|
}
|
|
} |