Tokens.fs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. module Qsp.Tokens
  2. type Range = FParsec.Position * FParsec.Position
  3. type TokenType =
  4. /// в TS `var` называется `storage.type.js`
  5. | Type
  6. | Keyword
  7. /// `act`, `if`, `:`, `end`
  8. | KeywordControl
  9. | Function
  10. /// В QSP `comment.line` и `comment.block` объединены
  11. | Comment
  12. | Procedure
  13. | Variable
  14. /// `keyword.operator.assignment.js`
  15. ///
  16. /// `=`
  17. | OperatorAssignment
  18. /// `keyword.operator.arithmetic.js`
  19. ///
  20. /// `-` `+` `*` `/`
  21. | OperatorArithmetic
  22. /// `keyword.operator.comparison.js`
  23. ///
  24. /// `=`
  25. | OperatorComparison
  26. /// `keyword.operator.relational.js`
  27. ///
  28. /// `>` `>=` `<` `<=`
  29. | OperatorRelational
  30. /// `punctuation.terminator.statement.js`
  31. ///
  32. /// `&`
  33. | PunctuationTerminatorStatement
  34. // | PunctuationDefinitionStringBegin
  35. // | PunctuationDefinitionStringEnd
  36. | StringQuotedDouble
  37. | StringQuotedSingle
  38. | StringBraced
  39. // | ConstantCharacterEscape
  40. /// `entity.name.label.cs`
  41. | NameLabel
  42. /// `punctuation.separator.colon.cs`
  43. | LabelColon
  44. /// `punctuation.definition.interpolation.begin.cs`
  45. ///
  46. /// `<<`
  47. | InterpolationBegin
  48. /// `punctuation.definition.interpolation.end.cs`
  49. ///
  50. /// `>>`
  51. | InterpolationEnd
  52. | ConstantNumericInteger
  53. type InlineRange =
  54. {
  55. Line: int64
  56. Column1: int64
  57. Column2: int64
  58. }
  59. type Token =
  60. { TokenType: TokenType
  61. Range: InlineRange }