Added dev target in makefile, added regexp-dispatch and example
This commit is contained in:
15
experiments/regexp-tokenizer.mjs
Normal file
15
experiments/regexp-tokenizer.mjs
Normal file
@@ -0,0 +1,15 @@
|
||||
import { RegExp_Tokenizer, RegExp_Token_Rule } from '@efforting.tech/parsing/regexp-dispatch';
|
||||
|
||||
|
||||
const rt = new RegExp_Tokenizer();
|
||||
|
||||
rt.add_rules(new RegExp_Token_Rule(/\w+/, 'word'));
|
||||
rt.set_default_identifier('random stuff');
|
||||
|
||||
//console.log(rt.rules);
|
||||
|
||||
//console.log(rt.closest_scanning_match('#Hello World!'));
|
||||
|
||||
for (const m of rt.iter_matches('#Hello World!')) {
|
||||
console.log({class: m.constructor.name, identifier: m.identifier, value: m.value, captured: m.captured });
|
||||
};
|
||||
Reference in New Issue
Block a user