MCPcopy Create free account
hub / github.com/CoderLine/alphaTab / tokenize

Function tokenize

packages/monaco/src/textmate.ts:67–88  ·  view source on GitHub ↗
(line, state)

Source from the content-addressed store, hash-verified

65 return INITIAL;
66 },
67 tokenize(line, state) {
68 const tokenizerState = state as StateStack;
69 const textMateResult = grammar.tokenizeLine(line, tokenizerState, 500);
70 if (textMateResult.stoppedEarly) {
71 return {
72 endState: state,
73 tokens: textMateResult.tokens.map(t => ({ ...t, scopes: t.scopes.reverse().join(' ') }))
74 };
75 }
76
77 let endState: StateStack;
78 if (state.equals(textMateResult.ruleStack)) {
79 endState = tokenizerState;
80 } else {
81 endState = textMateResult.ruleStack;
82 }
83
84 return {
85 endState,
86 tokens: textMateResult.tokens.map(t => ({ ...t, scopes: t.scopes.reverse().join(' ') }))
87 };
88 }
89 });
90}

Callers

nothing calls this directly

Calls 4

mapMethod · 0.45
joinMethod · 0.45
reverseMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected