mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
11 lines
413 B
TypeScript
11 lines
413 B
TypeScript
/// <reference path="./first-mate.d.ts" />
|
|
|
|
import { GrammarRegistry, Grammar, IToken } from "first-mate";
|
|
|
|
var registry = new GrammarRegistry({ maxTokensPerLine: 100 });
|
|
var grammar = registry.loadGrammarSync('javascript.json');
|
|
var result = grammar.tokenizeLine('var text = "hello world";');
|
|
result.tokens.forEach((token) => {
|
|
console.log("Token text: '" + token.value + "' with scopes: " + token.scopes);
|
|
});
|