Vixen
02b45cc4
csharp
public interface ICodeTokenizer

Turns a line into coloured runs.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

⚠ A line at a time, carrying a state across the boundary. Highlighting is asked for one screenful at a time by a virtualised editor, so a tokenizer that needed the whole file would defeat the virtualisation it is being called from. The state is what makes a block comment work: line 40 is inside one because line 39 ended inside one.

⚠ An Int32 rather than an object. The editor caches one per line of the file, and a boxed state per line would be a per-file allocation the size of the file.

This is where a Vixen.Core.Syntax-backed highlighter plugs in. It is not the default because a control assembly that referenced a parser would drag one language's grammar into every application that wanted a text box with colours in it — and because the editor has to colour a file that does not parse, which is most of them, most of the time somebody is looking at one.

Fields and properties (1)

  • int InitialState

    The state a file starts in.

Methods (1)

  • int Tokenize(string line, int state, List<CodeToken> into)

    Splits one line into runs.

Used by (7)

  • CStyleTokenizerVixen.Ui.Controls.Advanced
  • CodeEditorVixen.Ui.Controls.Advanced
  • PlainTokenizerVixen.Ui.Controls.Advanced
  • CodeDocumentVixen.Editor.AssetEditors
  • MarkupDocumentVixen.Editor.AssetEditors
  • ShaderDocumentVixen.Editor.AssetEditors
  • StyleSheetDocumentVixen.Editor.AssetEditors