const Token = require('{%= name %}');
{%= apidocs("index.js") %}
See the changelog.
Lexer tokens are represented as Token
objects that implement the following interface:
interface Token {
type: string;
value: string;
match: array | undefined;
}
type
{string} - A string representing the token variant type. This property is necessary for classifying one or more characters so that parsers or compilers can determine what to do with the token.value
{string} - The substring (or lexeme) that was captured for the token.match
{array|undefined} - If a regular expression was used to capture a substring, theRegExp.exec()
orString.match()
arguments array can be stored on the token.
Source location
Add the source location (start, end, index and range) information to tokens using either of the following plugins (depending on preference for property naming conventions):
- [snapdragon-position][]
- [snapdragon-location][]