Tokens.fs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. /// в TS `var` называется `storage.type.js`
  14. | Type
  15. | Keyword
  16. /// `keyword.symbol.fsharp`
  17. | KeywordSymbol
  18. | SharpBeginLoc
  19. | MinusEndLoc
  20. | Function
  21. /// В QSP `comment.line` и `comment.block` объединены
  22. | Comment
  23. | Procedure
  24. | Variable
  25. /// `keyword.operator.assignment.js`
  26. ///
  27. /// `=`
  28. | OperatorAssignment
  29. // /// `keyword.operator.arithmetic.js`
  30. // ///
  31. // /// `-` `+` `*` `/`
  32. // | OperatorArithmetic
  33. // /// `keyword.operator.comparison.js`
  34. // ///
  35. // /// `=`
  36. // | OperatorComparison
  37. // /// `keyword.operator.relational.js`
  38. // ///
  39. // /// `>` `>=` `<` `<=`
  40. // | OperatorRelational
  41. /// `punctuation.terminator.statement.js`
  42. ///
  43. /// `&`
  44. | PunctuationTerminatorStatement
  45. | UnaryOperator of UnaryOperator : Ast.UnarOp
  46. | BinaryOperator of BinaryOperator : Ast.Op
  47. // | PunctuationDefinitionStringBegin
  48. // | PunctuationDefinitionStringEnd
  49. | StringQuotedDouble
  50. | StringQuotedSingle
  51. | StringBraced
  52. // | ConstantCharacterEscape
  53. /// `entity.name.label.cs`
  54. | NameLabel
  55. /// `punctuation.separator.colon.cs`
  56. | LabelColon
  57. /// `punctuation.definition.interpolation.begin.cs`
  58. ///
  59. /// `<<`
  60. | InterpolationBegin
  61. /// `punctuation.definition.interpolation.end.cs`
  62. ///
  63. /// `>>`
  64. | InterpolationEnd
  65. | ConstantNumericInteger
  66. /// meta.brace.square.js
  67. ///
  68. /// `[`
  69. | BraceSquareOpened
  70. /// meta.brace.square.js
  71. ///
  72. /// `]`
  73. | BraceSquareClosed
  74. type InlineRange =
  75. {
  76. Line: int64
  77. Column1: int64
  78. Column2: int64
  79. }
  80. type Token =
  81. { TokenType: TokenType
  82. Range: InlineRange }