e8e8352af25759df0e0efdae040d3c85bfa37c62d213147c1d059bc5c8a28b5c938e598d318d0eb8f9730936c76812fb60175e5ea44403801f55d326f25df5 1.3 KB

1234567891011121314151617181920212223242526
  1. /*---------------------------------------------------------------------------------------------
  2. * Copyright (c) Microsoft Corporation. All rights reserved.
  3. * Licensed under the MIT License. See License.txt in the project root for license information.
  4. *--------------------------------------------------------------------------------------------*/
  5. import { Token, TokenizationResult, EncodedTokenizationResult } from '../languages.js';
  6. export const NullState = new class {
  7. clone() {
  8. return this;
  9. }
  10. equals(other) {
  11. return (this === other);
  12. }
  13. };
  14. export function nullTokenize(languageId, state) {
  15. return new TokenizationResult([new Token(0, '', languageId)], state);
  16. }
  17. export function nullTokenizeEncoded(languageId, state) {
  18. const tokens = new Uint32Array(2);
  19. tokens[0] = 0;
  20. tokens[1] = ((languageId << 0 /* MetadataConsts.LANGUAGEID_OFFSET */)
  21. | (0 /* StandardTokenType.Other */ << 8 /* MetadataConsts.TOKEN_TYPE_OFFSET */)
  22. | (0 /* FontStyle.None */ << 11 /* MetadataConsts.FONT_STYLE_OFFSET */)
  23. | (1 /* ColorId.DefaultForeground */ << 15 /* MetadataConsts.FOREGROUND_OFFSET */)
  24. | (2 /* ColorId.DefaultBackground */ << 24 /* MetadataConsts.BACKGROUND_OFFSET */)) >>> 0;
  25. return new EncodedTokenizationResult(tokens, state === null ? NullState : state);
  26. }