Provides a subset of the Haxe standard library as a reusable PHP package. https://docs.belin.io/haxe.php
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.
 
 
 
 

101 lines
2.2 KiB

  1. import haxe.*;
  2. import haxe.ds.*;
  3. import sys.*;
  4. import sys.io.*;
  5. import sys.net.*;
  6. import tink.*;
  7. import tink.cli.*;
  8. import tink.core.*;
  9. using DateTools;
  10. using Lambda;
  11. using StringTools;
  12. using haxe.EnumTools;
  13. using thenshim.PromiseTools;
  14. /** The main class. **/
  15. @:keep class Main {
  16. // Root package.
  17. var array: Array<Any> = null;
  18. var boolean: Bool = false;
  19. var date: Date = null;
  20. var ereg: EReg = ~/.*/;
  21. var integer: Int = 0;
  22. var number: Float = 0.0;
  23. var string: String = "";
  24. var stringBuffer: StringBuf = null;
  25. var unsignedInteger: UInt = 0;
  26. var unicodeString: UnicodeString = "";
  27. var xml: Xml = null;
  28. // "haxe" package.
  29. var dynamicAccess: DynamicAccess<Any> = {};
  30. var exception: Exception = null;
  31. var serializer: Serializer = null;
  32. var template: Template = null;
  33. var timer: Timer = null;
  34. var unserializer: Unserializer = null;
  35. var valueException: ValueException = null;
  36. // "haxe.ds" package.
  37. var either: Either<Any, Any> = Left(0);
  38. var genericStack: GenericStack<Any> = null;
  39. var intMap: IntMap<Any> = null;
  40. var list: List<Any> = null;
  41. var objectMap: ObjectMap<String, Any> = null;
  42. var option: Option<Any> = Some(0);
  43. var stringMap: StringMap<Any> = null;
  44. var vector: Vector<Any> = null;
  45. var weakMap: WeakMap<String, Any> = null;
  46. // "sys" package.
  47. var http: Http = null;
  48. // "sys.io" package.
  49. var process: Process = null;
  50. // "sys.net" package.
  51. var address: Address = null;
  52. var host: Host = null;
  53. // "thenshim" package.
  54. var promise: thenshim.Promise<Any> = null;
  55. // "tink_url" package.
  56. var url: Url = null;
  57. /** Application entry point. **/
  58. static function main(): Void {
  59. // Root package.
  60. Math.abs(-1);
  61. Reflect.hasField({}, "foo");
  62. Std.isOfType("", String);
  63. Sys.exit(0);
  64. // "haxe" package.
  65. Http.requestUrl("https://belin.io");
  66. Json.stringify(123);
  67. Resource.listNames();
  68. SysTools.quoteUnixArg("foo");
  69. // "sys" package.
  70. FileSystem.exists("build.hxml");
  71. // "sys.io" package.
  72. File.getContent("build.hxml");
  73. // "tink_cli" package.
  74. Cli.process(Sys.args(), new Main()).handle(Cli.exit);
  75. }
  76. /** Creates a new program. **/
  77. public function new() {}
  78. /** A dummy "tink_cli" command. **/
  79. @:defaultCommand
  80. public function run(rest: Rest<String>): Void {
  81. Cli.getDoc(this);
  82. }
  83. }