scheme.test.ts 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. 'use strict';
  6. import { testTokenization } from '../test/testRunner';
  7. testTokenization('scheme', [
  8. // Keywords
  9. [
  10. {
  11. line: 'define-macro some',
  12. tokens: [
  13. { startIndex: 0, type: 'keyword.scheme' },
  14. { startIndex: 12, type: 'white.scheme' },
  15. { startIndex: 13, type: 'variable.scheme' },
  16. ],
  17. },
  18. ],
  19. // comments
  20. [
  21. {
  22. line: '; comment',
  23. tokens: [{ startIndex: 0, type: 'comment.scheme' }],
  24. },
  25. ],
  26. [
  27. {
  28. line: '#| comment',
  29. tokens: [{ startIndex: 0, type: 'comment.scheme' }],
  30. },
  31. {
  32. line: 'multiline',
  33. tokens: [{ startIndex: 0, type: 'comment.scheme' }],
  34. },
  35. {
  36. line: '|# cons',
  37. tokens: [
  38. { startIndex: 0, type: 'comment.scheme' },
  39. { startIndex: 2, type: 'white.scheme' },
  40. { startIndex: 3, type: 'keyword.scheme' },
  41. ],
  42. },
  43. ],
  44. // strings
  45. [
  46. {
  47. line: '"\\n string "',
  48. tokens: [
  49. { startIndex: 0, type: 'string.scheme' },
  50. { startIndex: 1, type: 'string.escape.scheme' },
  51. { startIndex: 3, type: 'string.scheme' },
  52. ],
  53. },
  54. ],
  55. [
  56. {
  57. line: '" string \\',
  58. tokens: [{ startIndex: 0, type: 'string.scheme' }],
  59. },
  60. {
  61. line: 'multiline',
  62. tokens: [{ startIndex: 0, type: 'string.scheme' }],
  63. },
  64. {
  65. line: ' ',
  66. tokens: [
  67. // previous line needs to be terminated with \
  68. { startIndex: 0, type: 'white.scheme' },
  69. ],
  70. },
  71. ],
  72. // numbers
  73. [
  74. {
  75. line: '1e2',
  76. tokens: [{ startIndex: 0, type: 'number.float.scheme' }],
  77. },
  78. ],
  79. [
  80. {
  81. line: '#x03BB',
  82. tokens: [{ startIndex: 0, type: 'number.hex.scheme' }],
  83. },
  84. ],
  85. ]);