typescript.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872
  1. package typescript
  2. type CodeInterface interface {
  3. BaseCodeInterface
  4. TypeAliase(test string) *Group
  5. Any() *Group
  6. As() *Group
  7. Boolean() *Group
  8. Case() *Group
  9. Catch() *Group
  10. Class() *Group
  11. Const() *Group
  12. Constructor(stmt ...CodeInterface) *Group
  13. Debugger() *Group
  14. Declare() *Group
  15. Default() *Group
  16. Delete() *Group
  17. Do() *Group
  18. Else() *Group
  19. Enum() *Group
  20. Export() *Group
  21. Extends() *Group
  22. False() *Group
  23. Finally() *Group
  24. For() *Group
  25. From() *Group
  26. Function() *Group
  27. Get() *Group
  28. If(test CodeInterface) *Group
  29. Implements() *Group
  30. Import() *Group
  31. In() *Group
  32. Instanceof() *Group
  33. Interface() *Group
  34. Let() *Group
  35. Module() *Group
  36. New() *Group
  37. Null() *Group
  38. Number() *Group
  39. Of() *Group
  40. Package() *Group
  41. Private() *Group
  42. Protected() *Group
  43. Public() *Group
  44. Require() *Group
  45. Return() *Group
  46. Set() *Group
  47. Static() *Group
  48. String() *Group
  49. Super() *Group
  50. Switch() *Group
  51. Symbol() *Group
  52. This() *Group
  53. Throw() *Group
  54. True() *Group
  55. Try() *Group
  56. Type() *Group
  57. Typeof() *Group
  58. Var() *Group
  59. Void() *Group
  60. While() *Group
  61. With() *Group
  62. Yield() *Group
  63. }
  64. func (g *Group) TypeAliase(test string) *Group {
  65. s := &Stmt{Template: " <%s> ", Value: test}
  66. g.Stmts = append(g.Stmts, s)
  67. return g
  68. }
  69. func TypeAliase(test string) *Group {
  70. return NewGroup().TypeAliase(test)
  71. }
  72. func (g *Group) Endnl() *Group {
  73. s := &Stmt{Template: " ;\n ", Value: "endnl"}
  74. g.Stmts = append(g.Stmts, s)
  75. return g
  76. }
  77. func Endnl() *Group {
  78. return NewGroup().Endnl()
  79. }
  80. func (g *Group) Injetable(inject string) *Group {
  81. s := &Stmt{Template: " @Injectable(" + inject + ")\n ", Value: "injetable"}
  82. g.Stmts = append(g.Stmts, s)
  83. return g
  84. }
  85. func Injetable(inject string) *Group {
  86. return NewGroup().Injetable(inject)
  87. }
  88. func (g *Group) Any() *Group {
  89. s := &Stmt{
  90. Template: " %s ",
  91. Value: "any",
  92. }
  93. g.Stmts = append(g.Stmts, s)
  94. return g
  95. }
  96. func Any() *Group {
  97. return NewGroup().Any()
  98. }
  99. func (g *Group) As() *Group {
  100. s := &Stmt{
  101. Template: " %s ",
  102. Value: "as",
  103. }
  104. g.Stmts = append(g.Stmts, s)
  105. return g
  106. }
  107. func As() *Group {
  108. return NewGroup().As()
  109. }
  110. func (g *Group) Boolean() *Group {
  111. s := &Stmt{
  112. Template: " %s ",
  113. Value: "boolean",
  114. }
  115. g.Stmts = append(g.Stmts, s)
  116. return g
  117. }
  118. func Boolean() *Group {
  119. return NewGroup().Boolean()
  120. }
  121. func (g *Group) Break() *Group {
  122. s := &Stmt{Template: " break; ", Value: "break"}
  123. g.Stmts = append(g.Stmts, s)
  124. return g
  125. }
  126. func Break() *Group {
  127. return NewGroup().Break()
  128. }
  129. func (g *Group) Case() *Group {
  130. s := &Stmt{
  131. Template: " %s ",
  132. Value: "case",
  133. }
  134. g.Stmts = append(g.Stmts, s)
  135. return g
  136. }
  137. func Case() *Group {
  138. return NewGroup().Case()
  139. }
  140. func (g *Group) Catch() *Group {
  141. s := &Stmt{
  142. Template: " %s ",
  143. Value: "catch",
  144. }
  145. g.Stmts = append(g.Stmts, s)
  146. return g
  147. }
  148. func Catch() *Group {
  149. return NewGroup().Catch()
  150. }
  151. func (g *Group) Class() *Group {
  152. s := &Stmt{
  153. Template: " %s ",
  154. Value: "class",
  155. }
  156. g.Stmts = append(g.Stmts, s)
  157. return g
  158. }
  159. func Class() *Group {
  160. return NewGroup().Class()
  161. }
  162. func (g *Group) Const() *Group {
  163. s := &Stmt{
  164. Template: " %s ",
  165. Value: "const",
  166. }
  167. g.Stmts = append(g.Stmts, s)
  168. return g
  169. }
  170. func Const() *Group {
  171. return NewGroup().Const()
  172. }
  173. func (g *Group) Constructor(stmt ...CodeInterface) *Group {
  174. s := &Stmt{Template: " constructor(%s) ", Group: Group{Stmts: stmt}, Value: "constructor", Delimiter: ", "}
  175. g.Stmts = append(g.Stmts, s)
  176. return g
  177. }
  178. func Constructor(stmt ...CodeInterface) *Group {
  179. return NewGroup().Constructor(stmt...)
  180. }
  181. func (g *Group) Continue() *Group {
  182. s := &Stmt{Template: " continue; ", Value: "continue"}
  183. g.Stmts = append(g.Stmts, s)
  184. return g
  185. }
  186. func Continue() *Group {
  187. return NewGroup().Continue()
  188. }
  189. func (g *Group) Debugger() *Group {
  190. s := &Stmt{
  191. Template: " %s ",
  192. Value: "debugger",
  193. }
  194. g.Stmts = append(g.Stmts, s)
  195. return g
  196. }
  197. func Debugger() *Group {
  198. return NewGroup().Debugger()
  199. }
  200. func (g *Group) Declare() *Group {
  201. s := &Stmt{
  202. Template: " %s ",
  203. Value: "declare",
  204. }
  205. g.Stmts = append(g.Stmts, s)
  206. return g
  207. }
  208. func Declare() *Group {
  209. return NewGroup().Declare()
  210. }
  211. func (g *Group) Default() *Group {
  212. s := &Stmt{
  213. Template: " %s ",
  214. Value: "default",
  215. }
  216. g.Stmts = append(g.Stmts, s)
  217. return g
  218. }
  219. func Default() *Group {
  220. return NewGroup().Default()
  221. }
  222. func (g *Group) Delete() *Group {
  223. s := &Stmt{
  224. Template: " %s ",
  225. Value: "delete",
  226. }
  227. g.Stmts = append(g.Stmts, s)
  228. return g
  229. }
  230. func Delete() *Group {
  231. return NewGroup().Delete()
  232. }
  233. func (g *Group) Do() *Group {
  234. s := &Stmt{
  235. Template: " %s ",
  236. Value: "do",
  237. }
  238. g.Stmts = append(g.Stmts, s)
  239. return g
  240. }
  241. func Do() *Group {
  242. return NewGroup().Do()
  243. }
  244. func (g *Group) Else() *Group {
  245. s := &Stmt{
  246. Template: " %s ",
  247. Value: "else",
  248. }
  249. g.Stmts = append(g.Stmts, s)
  250. return g
  251. }
  252. func Else() *Group {
  253. return NewGroup().Else()
  254. }
  255. func (g *Group) Endl() *Group {
  256. s := &Stmt{Template: " ; ", Value: "endl"}
  257. g.Stmts = append(g.Stmts, s)
  258. return g
  259. }
  260. func Endl() *Group {
  261. return NewGroup().Endl()
  262. }
  263. func (g *Group) Enum() *Group {
  264. s := &Stmt{
  265. Template: " %s ",
  266. Value: "enum",
  267. }
  268. g.Stmts = append(g.Stmts, s)
  269. return g
  270. }
  271. func Enum() *Group {
  272. return NewGroup().Enum()
  273. }
  274. func (g *Group) Export() *Group {
  275. s := &Stmt{
  276. Template: " %s ",
  277. Value: "export",
  278. }
  279. g.Stmts = append(g.Stmts, s)
  280. return g
  281. }
  282. func Export() *Group {
  283. return NewGroup().Export()
  284. }
  285. func (g *Group) Extends() *Group {
  286. s := &Stmt{
  287. Template: " %s ",
  288. Value: "extends",
  289. }
  290. g.Stmts = append(g.Stmts, s)
  291. return g
  292. }
  293. func Extends() *Group {
  294. return NewGroup().Extends()
  295. }
  296. func (g *Group) False() *Group {
  297. s := &Stmt{
  298. Template: " %s ",
  299. Value: "false",
  300. }
  301. g.Stmts = append(g.Stmts, s)
  302. return g
  303. }
  304. func False() *Group {
  305. return NewGroup().False()
  306. }
  307. func (g *Group) Finally() *Group {
  308. s := &Stmt{
  309. Template: " %s ",
  310. Value: "finally",
  311. }
  312. g.Stmts = append(g.Stmts, s)
  313. return g
  314. }
  315. func Finally() *Group {
  316. return NewGroup().Finally()
  317. }
  318. func (g *Group) For() *Group {
  319. s := &Stmt{
  320. Template: " %s ",
  321. Value: "for",
  322. }
  323. g.Stmts = append(g.Stmts, s)
  324. return g
  325. }
  326. func For() *Group {
  327. return NewGroup().For()
  328. }
  329. func (g *Group) From() *Group {
  330. s := &Stmt{
  331. Template: " %s ",
  332. Value: "from",
  333. }
  334. g.Stmts = append(g.Stmts, s)
  335. return g
  336. }
  337. func From() *Group {
  338. return NewGroup().From()
  339. }
  340. func (g *Group) Function() *Group {
  341. s := &Stmt{
  342. Template: " %s ",
  343. Value: "function",
  344. }
  345. g.Stmts = append(g.Stmts, s)
  346. return g
  347. }
  348. func Function() *Group {
  349. return NewGroup().Function()
  350. }
  351. func (g *Group) Get() *Group {
  352. s := &Stmt{
  353. Template: " %s ",
  354. Value: "get",
  355. }
  356. g.Stmts = append(g.Stmts, s)
  357. return g
  358. }
  359. func Get() *Group {
  360. return NewGroup().Get()
  361. }
  362. func (g *Group) If(test CodeInterface) *Group {
  363. s := &Stmt{Template: " if (%s) ", Group: Group{Stmts: []CodeInterface{test}}, Value: "if"}
  364. g.Stmts = append(g.Stmts, s)
  365. return g
  366. }
  367. func If(test CodeInterface) *Group {
  368. return NewGroup().If(test)
  369. }
  370. func (g *Group) Implements() *Group {
  371. s := &Stmt{
  372. Template: " %s ",
  373. Value: "implements",
  374. }
  375. g.Stmts = append(g.Stmts, s)
  376. return g
  377. }
  378. func Implements() *Group {
  379. return NewGroup().Implements()
  380. }
  381. func (g *Group) Import() *Group {
  382. s := &Stmt{
  383. Template: " %s ",
  384. Value: "import",
  385. }
  386. g.Stmts = append(g.Stmts, s)
  387. return g
  388. }
  389. func Import() *Group {
  390. return NewGroup().Import()
  391. }
  392. func (g *Group) In() *Group {
  393. s := &Stmt{
  394. Template: " %s ",
  395. Value: "in",
  396. }
  397. g.Stmts = append(g.Stmts, s)
  398. return g
  399. }
  400. func In() *Group {
  401. return NewGroup().In()
  402. }
  403. func (g *Group) Instanceof() *Group {
  404. s := &Stmt{
  405. Template: " %s ",
  406. Value: "instanceof",
  407. }
  408. g.Stmts = append(g.Stmts, s)
  409. return g
  410. }
  411. func Instanceof() *Group {
  412. return NewGroup().Instanceof()
  413. }
  414. func (g *Group) Interface() *Group {
  415. s := &Stmt{
  416. Template: " %s ",
  417. Value: "interface",
  418. }
  419. g.Stmts = append(g.Stmts, s)
  420. return g
  421. }
  422. func Interface() *Group {
  423. return NewGroup().Interface()
  424. }
  425. func (g *Group) Let() *Group {
  426. s := &Stmt{
  427. Template: " %s ",
  428. Value: "let",
  429. }
  430. g.Stmts = append(g.Stmts, s)
  431. return g
  432. }
  433. func Let() *Group {
  434. return NewGroup().Let()
  435. }
  436. func (g *Group) Module() *Group {
  437. s := &Stmt{
  438. Template: " %s ",
  439. Value: "module",
  440. }
  441. g.Stmts = append(g.Stmts, s)
  442. return g
  443. }
  444. func Module() *Group {
  445. return NewGroup().Module()
  446. }
  447. func (g *Group) New() *Group {
  448. s := &Stmt{
  449. Template: " %s ",
  450. Value: "new",
  451. }
  452. g.Stmts = append(g.Stmts, s)
  453. return g
  454. }
  455. func New() *Group {
  456. return NewGroup().New()
  457. }
  458. func (g *Group) Null() *Group {
  459. s := &Stmt{
  460. Template: " %s ",
  461. Value: "null",
  462. }
  463. g.Stmts = append(g.Stmts, s)
  464. return g
  465. }
  466. func Null() *Group {
  467. return NewGroup().Null()
  468. }
  469. func (g *Group) Number() *Group {
  470. s := &Stmt{
  471. Template: " %s ",
  472. Value: "number",
  473. }
  474. g.Stmts = append(g.Stmts, s)
  475. return g
  476. }
  477. func Number() *Group {
  478. return NewGroup().Number()
  479. }
  480. func (g *Group) Of() *Group {
  481. s := &Stmt{
  482. Template: " %s ",
  483. Value: "of",
  484. }
  485. g.Stmts = append(g.Stmts, s)
  486. return g
  487. }
  488. func Of() *Group {
  489. return NewGroup().Of()
  490. }
  491. func (g *Group) Package() *Group {
  492. s := &Stmt{
  493. Template: " %s ",
  494. Value: "package",
  495. }
  496. g.Stmts = append(g.Stmts, s)
  497. return g
  498. }
  499. func Package() *Group {
  500. return NewGroup().Package()
  501. }
  502. func (g *Group) Private() *Group {
  503. s := &Stmt{
  504. Template: " %s ",
  505. Value: "private",
  506. }
  507. g.Stmts = append(g.Stmts, s)
  508. return g
  509. }
  510. func Private() *Group {
  511. return NewGroup().Private()
  512. }
  513. func (g *Group) Protected() *Group {
  514. s := &Stmt{
  515. Template: " %s ",
  516. Value: "protected",
  517. }
  518. g.Stmts = append(g.Stmts, s)
  519. return g
  520. }
  521. func Protected() *Group {
  522. return NewGroup().Protected()
  523. }
  524. func (g *Group) Public() *Group {
  525. s := &Stmt{
  526. Template: " %s ",
  527. Value: "public",
  528. }
  529. g.Stmts = append(g.Stmts, s)
  530. return g
  531. }
  532. func Public() *Group {
  533. return NewGroup().Public()
  534. }
  535. func (g *Group) Require() *Group {
  536. s := &Stmt{
  537. Template: " %s ",
  538. Value: "require",
  539. }
  540. g.Stmts = append(g.Stmts, s)
  541. return g
  542. }
  543. func Require() *Group {
  544. return NewGroup().Require()
  545. }
  546. func (g *Group) Return() *Group {
  547. s := &Stmt{
  548. Template: " %s ",
  549. Value: "return",
  550. }
  551. g.Stmts = append(g.Stmts, s)
  552. return g
  553. }
  554. func Return() *Group {
  555. return NewGroup().Return()
  556. }
  557. func (g *Group) Set() *Group {
  558. s := &Stmt{
  559. Template: " %s ",
  560. Value: "set",
  561. }
  562. g.Stmts = append(g.Stmts, s)
  563. return g
  564. }
  565. func Set() *Group {
  566. return NewGroup().Set()
  567. }
  568. func (g *Group) Static() *Group {
  569. s := &Stmt{
  570. Template: " %s ",
  571. Value: "static",
  572. }
  573. g.Stmts = append(g.Stmts, s)
  574. return g
  575. }
  576. func Static() *Group {
  577. return NewGroup().Static()
  578. }
  579. func (g *Group) String() *Group {
  580. s := &Stmt{
  581. Template: " %s ",
  582. Value: "string",
  583. }
  584. g.Stmts = append(g.Stmts, s)
  585. return g
  586. }
  587. func String() *Group {
  588. return NewGroup().String()
  589. }
  590. func (g *Group) Super() *Group {
  591. s := &Stmt{
  592. Template: " %s ",
  593. Value: "super",
  594. }
  595. g.Stmts = append(g.Stmts, s)
  596. return g
  597. }
  598. func Super() *Group {
  599. return NewGroup().Super()
  600. }
  601. func (g *Group) Switch() *Group {
  602. s := &Stmt{
  603. Template: " %s ",
  604. Value: "switch",
  605. }
  606. g.Stmts = append(g.Stmts, s)
  607. return g
  608. }
  609. func Switch() *Group {
  610. return NewGroup().Switch()
  611. }
  612. func (g *Group) Symbol() *Group {
  613. s := &Stmt{
  614. Template: " %s ",
  615. Value: "symbol",
  616. }
  617. g.Stmts = append(g.Stmts, s)
  618. return g
  619. }
  620. func Symbol() *Group {
  621. return NewGroup().Symbol()
  622. }
  623. func (g *Group) This() *Group {
  624. s := &Stmt{
  625. Template: " %s ",
  626. Value: "this",
  627. }
  628. g.Stmts = append(g.Stmts, s)
  629. return g
  630. }
  631. func This() *Group {
  632. return NewGroup().This()
  633. }
  634. func (g *Group) Throw() *Group {
  635. s := &Stmt{
  636. Template: " %s ",
  637. Value: "throw",
  638. }
  639. g.Stmts = append(g.Stmts, s)
  640. return g
  641. }
  642. func Throw() *Group {
  643. return NewGroup().Throw()
  644. }
  645. func (g *Group) True() *Group {
  646. s := &Stmt{
  647. Template: " %s ",
  648. Value: "true",
  649. }
  650. g.Stmts = append(g.Stmts, s)
  651. return g
  652. }
  653. func True() *Group {
  654. return NewGroup().True()
  655. }
  656. func (g *Group) Try() *Group {
  657. s := &Stmt{
  658. Template: " %s ",
  659. Value: "try",
  660. }
  661. g.Stmts = append(g.Stmts, s)
  662. return g
  663. }
  664. func Try() *Group {
  665. return NewGroup().Try()
  666. }
  667. func (g *Group) Type() *Group {
  668. s := &Stmt{
  669. Template: " %s ",
  670. Value: "type",
  671. }
  672. g.Stmts = append(g.Stmts, s)
  673. return g
  674. }
  675. func Type() *Group {
  676. return NewGroup().Type()
  677. }
  678. func (g *Group) Typeof() *Group {
  679. s := &Stmt{
  680. Template: " %s ",
  681. Value: "typeof",
  682. }
  683. g.Stmts = append(g.Stmts, s)
  684. return g
  685. }
  686. func Typeof() *Group {
  687. return NewGroup().Typeof()
  688. }
  689. func (g *Group) Var() *Group {
  690. s := &Stmt{
  691. Template: " %s ",
  692. Value: "var",
  693. }
  694. g.Stmts = append(g.Stmts, s)
  695. return g
  696. }
  697. func Var() *Group {
  698. return NewGroup().Var()
  699. }
  700. func (g *Group) Void() *Group {
  701. s := &Stmt{
  702. Template: " %s ",
  703. Value: "void",
  704. }
  705. g.Stmts = append(g.Stmts, s)
  706. return g
  707. }
  708. func Void() *Group {
  709. return NewGroup().Void()
  710. }
  711. func (g *Group) While() *Group {
  712. s := &Stmt{
  713. Template: " %s ",
  714. Value: "while",
  715. }
  716. g.Stmts = append(g.Stmts, s)
  717. return g
  718. }
  719. func While() *Group {
  720. return NewGroup().While()
  721. }
  722. func (g *Group) With() *Group {
  723. s := &Stmt{
  724. Template: " %s ",
  725. Value: "with",
  726. }
  727. g.Stmts = append(g.Stmts, s)
  728. return g
  729. }
  730. func With() *Group {
  731. return NewGroup().With()
  732. }
  733. func (g *Group) Yield() *Group {
  734. s := &Stmt{
  735. Template: " %s ",
  736. Value: "yield",
  737. }
  738. g.Stmts = append(g.Stmts, s)
  739. return g
  740. }
  741. func Yield() *Group {
  742. return NewGroup().Yield()
  743. }