This is a simple Lexical Scanner that takes an object of regex patterns, and uses those patterns to process an input string into an array of tokens.
What is the difference between this and [snapdragon-lexer][]?
snapdragon-lexer uses registered handler functions to capture and handle tokens, snapdragon-scanner simply iterates over an object of regular expression patterns to create tokens. You can think of snapdragon-scanner as the "lite" version of snapdragon-lexer.
const Scanner = require('{%= name %}');
{%= apidocs("index.js") %}
Scanner tokens are plain JavaScript objects with the following properties:
{
type: String;
value: String
match: Array
}
type
{String} - The name of the regex that matched the substring.value
{String} - The substring that was captured by the regex.match
{Array} - The match array from RegExp.exec()
See the changelog.