Tokens.fs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. module Qsp.Tokens
  2. type Range = FParsec.Position * FParsec.Position
  3. // [<Struct>]
  4. type TokenType =
  5. | If
  6. | ElseIf
  7. | Else
  8. | Act
  9. | Colon
  10. | End
  11. | Underscore
  12. | Exit
  13. | For
  14. | To
  15. | Step
  16. /// в TS `var` называется `storage.type.js`
  17. | Type
  18. | Keyword
  19. | SharpBeginLoc
  20. | MinusEndLoc
  21. | Function
  22. /// В QSP `comment.line` и `comment.block` объединены
  23. | Comment
  24. | Procedure
  25. | Variable
  26. /// `keyword.operator.assignment.js`
  27. ///
  28. /// `=`
  29. | OperatorAssignment
  30. // /// `keyword.operator.arithmetic.js`
  31. // ///
  32. // /// `-` `+` `*` `/`
  33. // | OperatorArithmetic
  34. // /// `keyword.operator.comparison.js`
  35. // ///
  36. // /// `=`
  37. // | OperatorComparison
  38. // /// `keyword.operator.relational.js`
  39. // ///
  40. // /// `>` `>=` `<` `<=`
  41. // | OperatorRelational
  42. /// `punctuation.terminator.statement.js`
  43. ///
  44. /// `&`
  45. | PunctuationTerminatorStatement
  46. // | UnaryOperator of UnaryOperator : Ast.UnarOp
  47. // | BinaryOperator of BinaryOperator : Ast.Op
  48. | UnaryOperator of Ast.UnarOp
  49. | BinaryOperator of Ast.Op
  50. // | PunctuationDefinitionStringBegin
  51. // | PunctuationDefinitionStringEnd
  52. | StringQuotedDouble
  53. | StringQuotedSingle
  54. | StringBraced
  55. // | ConstantCharacterEscape
  56. /// `entity.name.label.cs`
  57. | NameLabel
  58. /// `punctuation.separator.colon.cs`
  59. | LabelColon
  60. /// `punctuation.definition.interpolation.begin.cs`
  61. ///
  62. /// `<<`
  63. | InterpolationBegin
  64. /// `punctuation.definition.interpolation.end.cs`
  65. ///
  66. /// `>>`
  67. | InterpolationEnd
  68. | ConstantNumericInteger
  69. type InlineRange =
  70. {
  71. Line: int64
  72. Column1: int64
  73. Column2: int64
  74. }
  75. type Token =
  76. { TokenType: TokenType
  77. Range: InlineRange }