Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

acorn.d.ts 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. export as namespace acorn
  2. export = acorn
  3. declare namespace acorn {
  4. function parse(input: string, options?: Options): Node
  5. function parseExpressionAt(input: string, pos?: number, options?: Options): Node
  6. function tokenizer(input: string, options?: Options): {
  7. getToken(): Token
  8. [Symbol.iterator](): Iterator<Token>
  9. }
  10. interface Options {
  11. ecmaVersion?: 3 | 5 | 6 | 7 | 8 | 9 | 10 | 2015 | 2016 | 2017 | 2018 | 2019
  12. sourceType?: 'script' | 'module'
  13. onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
  14. onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
  15. allowReserved?: boolean
  16. allowReturnOutsideFunction?: boolean
  17. allowImportExportEverywhere?: boolean
  18. allowHashBang?: boolean
  19. locations?: boolean
  20. onToken?: ((token: Token) => any) | Token[]
  21. onComment?: ((
  22. isBlock: boolean, text: string, start: number, end: number, startLoc?: Position,
  23. endLoc?: Position
  24. ) => void) | Comment[]
  25. ranges?: boolean
  26. program?: Node
  27. sourceFile?: string
  28. directSourceFile?: string
  29. preserveParens?: boolean
  30. }
  31. class Parser {
  32. constructor(options: Options, input: string, startPos?: number)
  33. parse(): Node
  34. static parse(input: string, options?: Options): Node
  35. static parseExpressionAt(input: string, pos: number, options?: Options): Node
  36. static tokenizer(input: string, options?: Options): {
  37. getToken(): Token
  38. [Symbol.iterator](): Iterator<Token>
  39. }
  40. static extend(...plugins: (typeof Parser)[]): typeof Parser
  41. }
  42. interface Position { line: number; column: number; offset: number }
  43. const defaultOptions: Options
  44. function getLineInfo(input: string, offset: number): Position
  45. class SourceLocation {
  46. start: Position
  47. end: Position
  48. source?: string | null
  49. constructor(p: Parser, start: Position, end: Position)
  50. }
  51. class Node {
  52. type: string
  53. start: number
  54. end: number
  55. loc?: SourceLocation
  56. sourceFile?: string
  57. range?: [number, number]
  58. constructor(parser: Parser, pos: number, loc?: SourceLocation)
  59. }
  60. class TokenType {
  61. label: string
  62. keyword: string
  63. beforeExpr: boolean
  64. startsExpr: boolean
  65. isLoop: boolean
  66. isAssign: boolean
  67. prefix: boolean
  68. postfix: boolean
  69. binop: number
  70. updateContext?: (prevType: TokenType) => void
  71. constructor(label: string, conf?: any)
  72. }
  73. const tokTypes: {
  74. num: TokenType
  75. regexp: TokenType
  76. string: TokenType
  77. name: TokenType
  78. eof: TokenType
  79. bracketL: TokenType
  80. bracketR: TokenType
  81. braceL: TokenType
  82. braceR: TokenType
  83. parenL: TokenType
  84. parenR: TokenType
  85. comma: TokenType
  86. semi: TokenType
  87. colon: TokenType
  88. dot: TokenType
  89. question: TokenType
  90. arrow: TokenType
  91. template: TokenType
  92. ellipsis: TokenType
  93. backQuote: TokenType
  94. dollarBraceL: TokenType
  95. eq: TokenType
  96. assign: TokenType
  97. incDec: TokenType
  98. prefix: TokenType
  99. logicalOR: TokenType
  100. logicalAND: TokenType
  101. bitwiseOR: TokenType
  102. bitwiseXOR: TokenType
  103. bitwiseAND: TokenType
  104. equality: TokenType
  105. relational: TokenType
  106. bitShift: TokenType
  107. plusMin: TokenType
  108. modulo: TokenType
  109. star: TokenType
  110. slash: TokenType
  111. starstar: TokenType
  112. _break: TokenType
  113. _case: TokenType
  114. _catch: TokenType
  115. _continue: TokenType
  116. _debugger: TokenType
  117. _default: TokenType
  118. _do: TokenType
  119. _else: TokenType
  120. _finally: TokenType
  121. _for: TokenType
  122. _function: TokenType
  123. _if: TokenType
  124. _return: TokenType
  125. _switch: TokenType
  126. _throw: TokenType
  127. _try: TokenType
  128. _var: TokenType
  129. _const: TokenType
  130. _while: TokenType
  131. _with: TokenType
  132. _new: TokenType
  133. _this: TokenType
  134. _super: TokenType
  135. _class: TokenType
  136. _extends: TokenType
  137. _export: TokenType
  138. _import: TokenType
  139. _null: TokenType
  140. _true: TokenType
  141. _false: TokenType
  142. _in: TokenType
  143. _instanceof: TokenType
  144. _typeof: TokenType
  145. _void: TokenType
  146. _delete: TokenType
  147. }
  148. class TokContext {
  149. constructor(token: string, isExpr: boolean, preserveSpace: boolean, override?: (p: Parser) => void)
  150. }
  151. const tokContexts: {
  152. b_stat: TokContext
  153. b_expr: TokContext
  154. b_tmpl: TokContext
  155. p_stat: TokContext
  156. p_expr: TokContext
  157. q_tmpl: TokContext
  158. f_expr: TokContext
  159. }
  160. function isIdentifierStart(code: number, astral?: boolean): boolean
  161. function isIdentifierChar(code: number, astral?: boolean): boolean
  162. interface AbstractToken {
  163. }
  164. interface Comment extends AbstractToken {
  165. type: string
  166. value: string
  167. start: number
  168. end: number
  169. loc?: SourceLocation
  170. range?: [number, number]
  171. }
  172. class Token {
  173. type: TokenType
  174. value: any
  175. start: number
  176. end: number
  177. loc?: SourceLocation
  178. range?: [number, number]
  179. constructor(p: Parser)
  180. }
  181. function isNewLine(code: number): boolean
  182. const lineBreak: RegExp
  183. const lineBreakG: RegExp
  184. const version: string
  185. }