diff --git a/.gitignore b/.gitignore index c25becf2f7b..672db8163d4 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ /haxelib* /haxedoc* /lib +/prebuild /src/syntax/lexer.ml /libs/xml-light/xml_lexer.ml diff --git a/.travis.yml b/.travis.yml index 6d8885c49c9..d72a214121a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -89,6 +89,7 @@ install_linux: &install_linux # Build haxe - make package_src -s - opam config exec -- make -s STATICLINK=1 libs + - opam config exec -- make -s STATICLINK=1 prebuild - opam config exec -- make -s -j STATICLINK=1 haxe - opam config exec -- make -s haxelib - make package_bin -s @@ -140,6 +141,7 @@ install_osx: &install_osx - ocamlopt -v # Build haxe - make -s STATICLINK=1 "LIB_PARAMS=/usr/local/opt/zlib/lib/libz.a /usr/local/lib/libpcre.a" libs + - make -s STATICLINK=1 "LIB_PARAMS=/usr/local/opt/zlib/lib/libz.a /usr/local/lib/libpcre.a" prebuild - make -s -j STATICLINK=1 "LIB_PARAMS=/usr/local/opt/zlib/lib/libz.a /usr/local/lib/libpcre.a" haxe - make -s haxelib - make package_bin -s diff --git a/Makefile b/Makefile index 1157cc293d0..9d4cbf35a6d 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,7 @@ MAKEFILENAME?=Makefile PLATFORM?=unix OUTPUT=haxe +PREBUILD_OUTPUT=prebuild EXTENSION= LFLAGS= STATICLINK?=0 @@ -130,7 +131,16 @@ else echo let version_extra = None > _build/src/compiler/version.ml endif -build_src: | $(BUILD_SRC) _build/src/syntax/grammar.ml _build/src/compiler/version.ml +_build/src/core/defineList.ml: src-json/define.json prebuild + ./$(PREBUILD_OUTPUT) define $< > $@ + +_build/src/core/metaList.ml: src-json/meta.json prebuild + ./$(PREBUILD_OUTPUT) meta $< > $@ + +build_src: | $(BUILD_SRC) _build/src/syntax/grammar.ml _build/src/compiler/version.ml _build/src/core/defineList.ml _build/src/core/metaList.ml + +prebuild: _build/src/core/json/json.ml _build/src/prebuild/main.ml + $(COMPILER) -safe-string -linkpkg -g -o $(PREBUILD_OUTPUT) -package sedlex -package extlib -I _build/src/core/json _build/src/core/json/json.ml _build/src/prebuild/main.ml haxe: build_src $(MAKE) -f $(MAKEFILENAME) build_pass_1 @@ -297,10 +307,10 @@ clean_libs: $(foreach lib,$(EXTLIB_LIBS),$(MAKE) -C libs/$(lib) clean &&) true clean_haxe: - rm -f -r _build $(OUTPUT) + rm -f -r _build $(OUTPUT) $(PREBUILD_OUTPUT) clean_tools: - rm -f $(OUTPUT) haxelib + rm -f $(OUTPUT) $(PREBUILD_OUTPUT) haxelib clean_package: rm -rf $(PACKAGE_OUT_DIR) @@ -315,4 +325,4 @@ FORCE: .ml.cmo: $(CC_CMD) -.PHONY: haxe libs haxelib +.PHONY: prebuild haxe libs haxelib diff --git a/Makefile.win b/Makefile.win index 931c5cea4f6..0f142a6eff5 100644 --- a/Makefile.win +++ b/Makefile.win @@ -2,6 +2,7 @@ PLATFORM=win MAKEFILENAME=Makefile.win include Makefile OUTPUT=haxe.exe +PREBUILD_OUTPUT=prebuild.exe EXTENSION=.exe PACKAGE_SRC_EXTENSION=.zip diff --git a/appveyor.yml b/appveyor.yml index 78946f51cc5..2b369823b51 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -69,7 +69,7 @@ install: build_script: - 'cd %APPVEYOR_BUILD_FOLDER%' - - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\" && make -s -f Makefile.win libs && make -j -s -f Makefile.win haxe && make -s -f Makefile.win haxelib"' + - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\" && make -s -f Makefile.win libs && make -s -f Makefile.win prebuild && make -j -s -f Makefile.win haxe && make -s -f Makefile.win haxelib"' - 'set PATH=%PATH%;%APPVEYOR_BUILD_FOLDER%' - 'set HAXEPATH=%APPVEYOR_BUILD_FOLDER%' - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\" && cygcheck haxe.exe"' diff --git a/src-json/define.json b/src-json/define.json new file mode 100644 index 00000000000..2f59d67d5c0 --- /dev/null +++ b/src-json/define.json @@ -0,0 +1,599 @@ +[ + { + "name": "AbsolutePath", + "define": "absolute_path", + "doc": "Print absolute file path in trace output" + }, + { + "name": "AdvancedTelemetry", + "define": "advanced-telemetry", + "doc": "Allow the SWF to be measured with Monocle tool", + "platforms": ["flash"] + }, + { + "name": "AnnotateSource", + "define": "annotate_source", + "doc": "Add additional comments to generated source code", + "platforms": ["cpp"] + }, + { + "name": "As3", + "define": "as3", + "doc": "Defined when outputting flash9 as3 source code" + }, + { + "name": "CheckXmlProxy", + "define": "check_xml_proxy", + "doc": "Check the used fields of the xml proxy" + }, + { + "name": "CoreApi", + "define": "core_api", + "doc": "Defined in the core api context" + }, + { + "name": "CoreApiSerialize", + "define": "core_api_serialize", + "doc": "Mark some generated core api classes with the Serializable attribute on C#", + "platforms": ["cs"] + }, + { + "name": "Cppia", + "define": "cppia", + "doc": "Generate cpp instruction assembly" + }, + { + "name": "NoCppiaAst", + "define": "nocppiaast", + "doc": "Use legacy cppia generation" + }, + { + "name": "Dce", + "define": "dce", + "doc": " Set the dead code elimination mode (default std)" + }, + { + "name": "DceDebug", + "define": "dce_debug", + "doc": "Show DCE log" + }, + { + "name": "Debug", + "define": "debug", + "doc": "Activated when compiling with -debug" + }, + { + "name": "DisableUnicodeStrings", + "define": "disable_unicode_strings", + "doc": "Disable unicode support in String type on some platforms", + "platforms": ["cpp"] + }, + { + "name": "Display", + "define": "display", + "doc": "Activated during completion" + }, + { + "name": "DisplayStdin", + "define": "display_stdin", + "doc": "Read the contents of a file specified in --display from standard input" + }, + { + "name": "DllExport", + "define": "dll_export", + "doc": "GenCPP experimental linking", + "platforms": ["cpp"] + }, + { + "name": "DllImport", + "define": "dll_import", + "doc": "Handle Haxe-generated .NET dll imports", + "platforms": ["cs"] + }, + { + "name": "DocGen", + "define": "doc_gen", + "doc": "Do not perform any removal/change in order to correctly generate documentation" + }, + { + "name": "Dump", + "define": "dump", + "doc": " Dump typed AST in dump subdirectory using specified mode or non-prettified default" + }, + { + "name": "DumpDependencies", + "define": "dump_dependencies", + "doc": "Dump the classes dependencies in a dump subdirectory" + }, + { + "name": "DumpIgnoreVarIds", + "define": "dump_ignore_var_ids", + "doc": "Remove variable IDs from non-pretty dumps (helps with diff)" + }, + { + "name": "DynamicInterfaceClosures", + "define": "dynamic_interface_closures", + "doc": "Use slow path for interface closures to save space", + "platforms": ["cpp"] + }, + { + "name": "EraseGenerics", + "define": "erase_generics", + "doc": "Erase generic classes on C#", + "platforms": ["cs"] + }, + { + "name": "EvalCallStackDepth", + "define": "eval_call_stack_depth", + "doc": "Set maximum call stack depth for eval. Default: 1000.", + "platforms": ["eval"] + }, + { + "name": "EvalDebugger", + "define": "eval_debugger", + "doc": "Support debugger in macro/interp mode. Allows host:port value to open a socket. Implies eval_stack.", + "platforms": ["eval"] + }, + { + "name": "EvalStack", + "define": "eval_stack", + "doc": "Record stack information in macro/interp mode", + "platforms": ["eval"] + }, + { + "name": "EvalTimes", + "define": "eval_times", + "doc": "Record per-method execution times in macro/interp mode. Implies eval_stack.", + "platforms": ["eval"] + }, + { + "name": "FastCast", + "define": "fast_cast", + "doc": "Enables an experimental casts cleanup on C# and Java", + "platforms": ["cs", "java"] + }, + { + "name": "Fdb", + "define": "fdb", + "doc": "Enable full flash debug infos for FDB interactive debugging", + "platforms": ["flash"] + }, + { + "name": "FileExtension", + "define": "file_extension", + "doc": "Output filename extension for cpp source code", + "platforms": ["cpp"] + }, + { + "name": "FlashStrict", + "define": "flash_strict", + "doc": "More strict typing for flash target", + "platforms": ["flash"] + }, + { + "name": "FlashUseStage", + "define": "flash_use_stage", + "doc": "Keep the SWF library initial stage", + "platforms": ["flash"] + }, + { + "devcomment": "force_lib_check is only here as a debug facility - compiler checking allows errors to be found more easily", + "name": "ForceLibCheck", + "define": "force_lib_check", + "doc": "Force the compiler to check -net-lib and -java-lib added classes (internal)", + "platforms": ["cs", "java"] + }, + { + "name": "ForceNativeProperty", + "define": "force_native_property", + "doc": "Tag all properties with :nativeProperty metadata for 3.1 compatibility", + "platforms": ["cpp"] + }, + { + "name": "GencommonDebug", + "define": "gencommon_debug", + "doc": "GenCommon internal", + "platforms": ["cs", "java"] + }, + { + "name": "Haxe3Compat", + "define": "haxe3compat", + "doc": "Gives warnings about transition from Haxe 3.x to Haxe 4.0" + }, + { + "name": "HaxeBoot", + "define": "haxe_boot", + "doc": "Given the name 'haxe' to the flash boot class instead of a generated name", + "platforms": ["flash"] + }, + { + "name": "HaxeVer", + "define": "haxe_ver", + "doc": "The current Haxe version value" + }, + { + "name": "HxcppApiLevel", + "define": "hxcpp_api_level", + "doc": "Provided to allow compatibility between hxcpp versions", + "platforms": ["cpp"] + }, + { + "name": "HxcppGcGenerational", + "define": "HXCPP_GC_GENERATIONAL", + "doc": "Experimental Garbage Collector", + "platforms": ["cpp"] + }, + { + "name": "HxcppDebugger", + "define": "HXCPP_DEBUGGER", + "doc": "Include additional information for HXCPP_DEBUGGER", + "platforms": ["cpp"] + }, + { + "name": "HxcppSmartStings", + "define": "hxcpp_smart_strings", + "doc": "Use wide strings in hxcpp (Turned on by default unless `-D disable_unicode_strings` is specified)", + "platforms": ["cpp"] + }, + { + "name": "IncludePrefix", + "define": "include_prefix", + "doc": "prepend path to generated include files", + "platforms": ["cpp"] + }, + { + "name": "Interp", + "define": "interp", + "doc": "The code is compiled to be run with --interp" + }, + { + "name": "JavaVer", + "define": "java_ver", + "doc": " Sets the Java version to be targeted", + "platforms": ["java"] + }, + { + "name": "JsClassic", + "define": "js_classic", + "doc": "Don't use a function wrapper and strict mode in JS output", + "platforms": ["js"] + }, + { + "name": "JsEs", + "define": "js_es", + "doc": "Generate JS compliant with given ES standard version (default 5)", + "platforms": ["js"], + "params:": ["version number"] + }, + { + "name": "JsEnumsAsArrays", + "define": "js_enums_as_arrays", + "doc": "Generate enum representation as array instead of as object", + "platforms": ["js"] + }, + { + "name": "JsUnflatten", + "define": "js_unflatten", + "doc": "Generate nested objects for packages and types", + "platforms": ["js"] + }, + { + "name": "JsSourceMap", + "define": "js_source_map", + "doc": "Generate JavaScript source map even in non-debug mode", + "platforms": ["js"] + }, + { + "name": "Jvm", + "define": "jvm", + "doc": "Generate jvm directly", + "platforms": ["java"] + }, + { + "name": "SourceMap", + "define": "source_map", + "doc": "Generate source map for compiled files (Currently supported for php only)", + "platforms": ["php"] + }, + { + "name": "KeepOldOutput", + "define": "keep_old_output", + "doc": "Keep old source files in the output directory", + "platforms": ["cs", "java"] + }, + { + "name": "LoopUnrollMaxCost", + "define": "loop_unroll_max_cost", + "doc": "Maximum cost (number of expressions * iterations) before loop unrolling is canceled (default 250)" + }, + { + "name": "LuaJit", + "define": "lua_jit", + "doc": "Enable the jit compiler for lua (version 5.2 only)", + "platforms": ["lua"] + }, + { + "name": "LuaVanilla", + "define": "lua_vanilla", + "doc": "Generate code lacking compiled extern lib support (e.g. utf8)", + "platforms": ["lua"] + }, + { + "name": "LuaVer", + "define": "lua_ver", + "doc": "The lua version to target", + "platforms": ["lua"] + }, + { + "name": "Macro", + "define": "macro", + "doc": "Defined when code is compiled in the macro context" + }, + { + "name": "MacroTimes", + "define": "macro_times", + "doc": "Display per-macro timing when used with --times" + }, + { + "name": "NetVer", + "define": "net_ver", + "doc": " Sets the .NET version to be targeted", + "platforms": ["cs"] + }, + { + "name": "NetTarget", + "define": "net_target", + "doc": " Sets the .NET target. Defaults to \"net\". xbox, micro (Micro Framework), compact (Compact Framework) are some valid values", + "platforms": ["cs"] + }, + { + "name": "NekoSource", + "define": "neko_source", + "doc": "Output neko source instead of bytecode", + "platforms": ["neko"] + }, + { + "name": "NekoV1", + "define": "neko_v1", + "doc": "Keep Neko 1.x compatibility", + "platforms": ["neko"] + }, + { + "name": "NetworkSandbox", + "define": "network-sandbox", + "doc": "Use local network sandbox instead of local file access one", + "platforms": ["flash"] + }, + { + "name": "NoCompilation", + "define": "no-compilation", + "doc": "Disable final compilation", + "platforms": ["cs", "java", "cpp", "hl"] + }, + { + "name": "NoCOpt", + "define": "no_copt", + "doc": "Disable completion optimization (for debug purposes)" + }, + { + "name": "NoDebug", + "define": "no_debug", + "doc": "Remove all debug macros from cpp output" + }, + { + "name": "NoDeprecationWarnings", + "define": "no-deprecation-warnings", + "doc": "Do not warn if fields annotated with @:deprecated are used" + }, + { + "name": "NoFlashOverride", + "define": "no-flash-override", + "doc": "Change overrides on some basic classes into HX suffixed methods, flash only", + "platforms": ["flash"] + }, + { + "name": "NoOpt", + "define": "no_opt", + "doc": "Disable optimizations" + }, + { + "name": "NoInline", + "define": "no_inline", + "doc": "Disable inlining" + }, + { + "name": "NoRoot", + "define": "no_root", + "doc": "Generate top-level types into haxe.root namespace", + "platforms": ["cs"] + }, + { + "name": "NoMacroCache", + "define": "no_macro_cache", + "doc": "Disable macro context caching" + }, + { + "name": "NoSwfCompress", + "define": "no_swf_compress", + "doc": "Disable SWF output compression", + "platforms": ["flash"] + }, + { + "name": "NoTraces", + "define": "no_traces", + "doc": "Disable all trace calls" + }, + { + "name": "Objc", + "define": "objc", + "doc": "Sets the hxcpp output to objective-c++ classes. Must be defined for interop", + "platforms": ["cpp"] + }, + { + "name": "OldConstructorInline", + "define": "old-constructor-inline", + "doc": "Use old constructor inlining logic (from haxe 3.4.2) instead of the reworked version." + }, + { + "name": "OldErrorFormat", + "define": "old-error-format", + "doc": "Use Haxe 3.x zero-based column error messages instead of new one-based format." + }, + { + "name": "PhpPrefix", + "define": "php_prefix", + "doc": "Root namespace for generated php classes. E.g. if compiled with`-D php-prefix=some.sub`, then all classes will be generated in `\\some\\sub` namespace.", + "platforms": ["php"] + }, + { + "name": "PhpLib", + "define": "php_lib", + "doc": "Select the name for the php lib folder.", + "platforms": ["php"] + }, + { + "name": "PhpFront", + "define": "php_front", + "doc": "Select the name for the php front file (by default: `index.php`).", + "platforms": ["php"] + }, + { + "name": "PythonVersion", + "define": "python_version", + "doc": "The python version to target (default 3.3)", + "platforms": ["python"] + }, + { + "name": "RealPosition", + "define": "real_position", + "doc": "Disables Haxe source mapping when targetting C#, removes position comments in Java and Php output", + "platforms": ["cs", "java", "php"] + }, + { + "name": "ReplaceFiles", + "define": "replace_files", + "doc": "GenCommon internal", + "platforms": ["cs", "java"] + }, + { + "name": "Scriptable", + "define": "scriptable", + "doc": "GenCPP internal", + "platforms": ["cpp"] + }, + { + "name": "ShallowExpose", + "define": "shallow-expose", + "doc": "Expose types to surrounding scope of Haxe generated closure without writing to window object", + "platforms": ["js"] + }, + { + "name": "SourceHeader", + "define": "source-header", + "doc": "Print value as comment on top of generated files, use '' value to disable" + }, + { + "name": "SourceMapContent", + "define": "source-map-content", + "doc": "Include the hx sources as part of the JS source map", + "platforms": ["js"] + }, + { + "name": "Static", + "define": "static", + "doc": "Defined if the current target is static" + }, + { + "name": "Swc", + "define": "swc", + "doc": "Output a SWC instead of a SWF", + "platforms": ["flash"] + }, + { + "name": "SwfCompressLevel", + "define": "swf_compress_level", + "doc": " Set the amount of compression for the SWF output", + "platforms": ["flash"] + }, + { + "name": "SwfDebugPassword", + "define": "swf_debug_password", + "doc": "Set a password for debugging", + "platforms": ["flash"] + }, + { + "name": "SwfDirectBlit", + "define": "swf_direct_blit", + "doc": "Use hardware acceleration to blit graphics", + "platforms": ["flash"] + }, + { + "name": "SwfGpu", + "define": "swf_gpu", + "doc": "Use GPU compositing features when drawing graphics", + "platforms": ["flash"] + }, + { + "name": "SwfMetadata", + "define": "swf_metadata", + "doc": " Include contents of as metadata in the swf", + "platforms": ["flash"] + }, + { + "name": "SwfPreloaderFrame", + "define": "swf_preloader_frame", + "doc": "Insert empty first frame in swf", + "platforms": ["flash"] + }, + { + "name": "SwfProtected", + "define": "swf_protected", + "doc": "Compile Haxe private as protected in the SWF instead of public", + "platforms": ["flash"] + }, + { + "name": "SwfScriptTimeout", + "define": "swf_script_timeout", + "doc": "Maximum ActionScript processing time before script stuck dialog box displays (in seconds)", + "platforms": ["flash"] + }, + { + "name": "SwfUseDoAbc", + "define": "swf_use_doabc", + "doc": "Use DoAbc swf-tag instead of DoAbcDefine", + "platforms": ["flash"] + }, + { + "name": "Sys", + "define": "sys", + "doc": "Defined for all system platforms" + }, + { + "name": "Unsafe", + "define": "unsafe", + "doc": "Allow unsafe code when targeting C#", + "platforms": ["cs"] + }, + { + "name": "UseNekoc", + "define": "use_nekoc", + "doc": "Use nekoc compiler instead of internal one", + "platforms": ["neko"] + }, + { + "name": "Utf16", + "define": "utf16", + "doc": "Defined for all platforms that have utf16 encoding with ucs2 api" + }, + { + "name": "Vcproj", + "define": "vcproj", + "doc": "GenCPP internal", + "platforms": ["cpp"] + }, + { + "name": "WarnVarShadowing", + "define": "warn_var_shadowing", + "doc": "Warn about shadowing variable declarations" + } +] \ No newline at end of file diff --git a/src-json/meta.json b/src-json/meta.json new file mode 100644 index 00000000000..26d4ff020fb --- /dev/null +++ b/src-json/meta.json @@ -0,0 +1,1130 @@ +[ + { + "name": "Abi", + "metadata": ":abi", + "doc": "Function ABI/calling convention", + "platforms": ["cpp"] + }, + { + "name": "Abstract", + "metadata": ":abstract", + "doc": "Sets the underlying class implementation as 'abstract'", + "platforms": ["java", "cs"] + }, + { + "name": "Access", + "metadata": ":access", + "doc": "Forces private access to package, type or field", + "params": ["Target path"], + "targets": ["TClass", "TClassField"] + }, + { + "name": "Accessor", + "metadata": ":accessor", + "doc": "Used internally by DCE to mark property accessors", + "targets": ["TClassField"], + "internal": true + }, + { + "name": "Allow", + "metadata": ":allow", + "doc": "Allows private access from package, type or field", + "params": ["Target path"] + }, + { + "name": "Analyzer", + "metadata": ":analyzer", + "doc": "Used to configure the static analyzer" + }, + { + "name": "Annotation", + "metadata": ":annotation", + "doc": "Annotation (@interface) definitions on --java-lib imports will be annotated with this metadata. Has no effect on types compiled by Haxe", + "platforms": ["java"], + "targets": ["TClass"] + }, + { + "name": "ArrayAccess", + "metadata": ":arrayAccess", + "doc": "Allows [] access on an abstract", + "targets": ["TAbstract", "TAbstractField"] + }, + { + "name": "Ast", + "metadata": ":ast", + "doc": "Internally used to pass the AST source into the typed AST", + "internal": true + }, + { + "name": "AstSource", + "metadata": ":astSource", + "doc": "Filled by the compiler with the parsed expression of the field", + "targets": ["TClassField"] + }, + { + "name": "AutoBuild", + "metadata": ":autoBuild", + "doc": "Extends @:build metadata to all extending and implementing classes", + "params": ["Build macro call"], + "targets": ["TClass"] + }, + { + "name": "Bind", + "metadata": ":bind", + "doc": "Override SWF class declaration", + "platforms": ["flash"], + "targets": ["TClass"] + }, + { + "name": "Bitmap", + "metadata": ":bitmap", + "doc": "Embeds given bitmap data into the class (must extend flash.display.BitmapData)", + "platforms": ["flash"], + "params": ["Bitmap file path"], + "targets": ["TClass"] + }, + { + "name": "BridgeProperties", + "metadata": ":bridgeProperties", + "doc": "Creates native property bridges for all Haxe properties in this class", + "platforms": ["cs"], + "targets": ["TClass"] + }, + { + "name": "Build", + "metadata": ":build", + "doc": "Builds a class or enum from a macro", + "params": ["Build macro call"], + "targets": ["TClass", "TEnum"] + }, + { + "name": "BuildXml", + "metadata": ":buildXml", + "doc": "Specify xml data to be injected into Build.xml", + "platforms": ["cpp"] + }, + { + "name": "BypassAccessor", + "metadata": ":bypassAccessor", + "doc": "Do not call property accessor method and access the field directly", + "targets": ["TExpr"] + }, + { + "name": "Callable", + "metadata": ":callable", + "doc": "Abstract forwards call to its underlying type", + "targets": ["TAbstract"] + }, + { + "name": "Class", + "metadata": ":class", + "doc": "Used internally to annotate an enum that will be generated as a class", + "platforms": ["java", "cs"], + "targets": ["TEnum"], + "internal": true + }, + { + "name": "ClassCode", + "metadata": ":classCode", + "doc": "Used to inject platform-native code into a class", + "platforms": ["java", "cs"], + "targets": ["TClass"] + }, + { + "name": "Commutative", + "metadata": ":commutative", + "doc": "Declares an abstract operator as commutative", + "targets": ["TAbstractField"] + }, + { + "name": "CompilerGenerated", + "metadata": ":compilerGenerated", + "doc": "Marks a field as generated by the compiler. Shouldn't be used by the end user", + "platforms": ["java", "cs"] + }, + { + "name": "Const", + "metadata": ":const", + "doc": "Allows a type parameter to accept expression values", + "targets": ["TTypeParameter"] + }, + { + "name": "CoreApi", + "metadata": ":coreApi", + "doc": "Identifies this class as a core api class (forces API check)", + "targets": ["TClass", "TEnum", "TTypedef", "TAbstract"] + }, + { + "name": "CoreType", + "metadata": ":coreType", + "doc": "Identifies an abstract as core type so that it requires no implementation", + "targets": ["TAbstract"] + }, + { + "name": "CppFileCode", + "metadata": ":cppFileCode", + "doc": "Code to be injected into generated cpp file", + "platforms": ["cpp"] + }, + { + "name": "CppInclude", + "metadata": ":cppInclude", + "doc": "File to be included in generated cpp file", + "platforms": ["cpp"] + }, + { + "name": "CppNamespaceCode", + "metadata": ":cppNamespaceCode", + "doc": "", + "platforms": ["cpp"] + }, + { + "name": "CsNative", + "metadata": ":csNative", + "doc": "Automatically added by --net-lib on classes generated from .NET DLL files", + "platforms": ["cs"], + "targets": ["TClass", "TEnum"], + "internal": true + }, + { + "name": "Dce", + "metadata": ":dce", + "doc": "Forces dead code elimination even when --dce full is not specified", + "targets": ["TClass", "TEnum"] + }, + { + "name": "Debug", + "metadata": ":debug", + "doc": "Forces debug information to be generated into the SWF even without --debug", + "platforms": ["flash"], + "targets": ["TClass", "TClassField"] + }, + { + "name": "Decl", + "metadata": ":decl", + "doc": "", + "platforms": ["cpp"] + }, + { + "name": "DefParam", + "metadata": ":defParam", + "doc": "Default function argument value loaded from the SWF and used for documentation in Genxml", + "platforms": ["flash"], + "internal": true + }, + { + "name": "Delegate", + "metadata": ":delegate", + "doc": "Automatically added by --net-lib on delegates", + "platforms": ["cs"], + "targets": ["TAbstract"] + }, + { + "name": "Depend", + "metadata": ":depend", + "doc": "", + "platforms": ["cpp"] + }, + { + "name": "Deprecated", + "metadata": ":deprecated", + "doc": "Mark a type or field as deprecated" + }, + { + "name": "DirectlyUsed", + "metadata": ":directlyUsed", + "doc": "Marks types that are directly referenced by non-extern code", + "internal": true + }, + { + "name": "DynamicObject", + "metadata": ":dynamicObject", + "doc": "Used internally to identify the Dynamic Object implementation", + "platforms": ["java", "cs"], + "targets": ["TClass"], + "internal": true + }, + { + "name": "Eager", + "metadata": ":eager", + "doc": "Forces typedefs to be followed early", + "targets": ["TTypedef"] + }, + { + "name": "Enum", + "metadata": ":enum", + "doc": "Defines finite value sets to abstract definitions", + "targets": ["TAbstract"] + }, + { + "name": "EnumConstructorParam", + "metadata": ":enumConstructorParam", + "doc": "Used internally to annotate GADT type parameters", + "targets": ["TClass"], + "internal": true + }, + { + "name": "Event", + "metadata": ":event", + "doc": "Automatically added by --net-lib on events. Has no effect on types compiled by Haxe", + "platforms": ["cs"], + "targets": ["TClassField"] + }, + { + "name": "Exhaustive", + "metadata": ":exhaustive", + "doc": "", + "internal": true + }, + { + "name": "Expose", + "metadata": ":expose", + "doc": "Includes the class or field in Haxe exports", + "platforms": ["js", "lua"], + "params": ["?Name=Class path"] + }, + { + "name": "Extern", + "metadata": ":extern", + "doc": "Marks the field as extern so it is not generated", + "targets": ["TClassField"] + }, + { + "name": "File", + "metadata": ":file", + "doc": "Includes a given binary file into the target SWF and associates it with the class (must extend flash.utils.ByteArray)", + "platforms": ["flash"], + "params": ["File path"], + "targets": ["TClass"] + }, + { + "name": "FileXml", + "metadata": ":fileXml", + "doc": "Include xml attribute snippet in Build.xml entry for file", + "platforms": ["cpp"], + "targets": ["TClass"] + }, + { + "name": "Final", + "metadata": ":final", + "doc": "Prevents a class or interface from being extended or a method from being overridden", + "targets": ["TClass", "TClassField"] + }, + { + "devcomment": "this used to have UsedOn TObjectDecl(_)", + "name": "Fixed", + "metadata": ":fixed", + "doc": "Delcares an anonymous object to have fixed fields" + }, + { + "name": "FlashProperty", + "metadata": ":flash.property", + "doc": "", + "platforms": ["flash"], + "targets": ["TClassField"] + }, + { + "name": "FlatEnum", + "metadata": ":flatEnum", + "doc": "Internally used to mark an enum as being flat, i.e. having no function constructors", + "targets": ["TEnum"], + "internal": true + }, + { + "name": "Font", + "metadata": ":font", + "doc": "Embeds the given TrueType font into the class (must extend flash.text.Font)", + "params": ["TTF path", "Range String"], + "targets": ["TClass"] + }, + { + "name": "ForLoopVariable", + "metadata": ":forLoopVariable", + "doc": "Internally used to mark for-loop variables", + "internal": true + }, + { + "name": "Forward", + "metadata": ":forward", + "doc": "Forwards field access to underlying type", + "params": ["List of field names"], + "targets": ["TAbstract"] + }, + { + "name": "ForwardStatics", + "metadata": ":forwardStatics", + "doc": "Forwards static field access to underlying type", + "params": ["List of field names"], + "targets": ["TAbstract"] + }, + { + "name": "From", + "metadata": ":from", + "doc": "Specifies that the field of the abstract is a cast operation from the type identified in the function", + "targets": ["TAbstractField"] + }, + { + "name": "FunctionCode", + "metadata": ":functionCode", + "doc": "Used to inject platform-native code into a function", + "platforms": ["cpp", "java", "cs"] + }, + { + "name": "FunctionTailCode", + "metadata": ":functionTailCode", + "doc": "", + "platforms": ["cpp"] + }, + { + "name": "Generic", + "metadata": ":generic", + "doc": "Marks a class or class field as generic so each type parameter combination generates its own type/field" + }, + { + "name": "GenericBuild", + "metadata": ":genericBuild", + "doc": "Builds instances of a type using the specified macro", + "targets": ["TClass"] + }, + { + "name": "GenericInstance", + "metadata": ":genericInstance", + "doc": "Internally used to mark instances of @:generic methods", + "targets": ["TClassField"], + "internal": true + }, + { + "name": "Getter", + "metadata": ":getter", + "doc": "Generates a native getter function on the given field", + "platforms": ["flash"], + "params": ["Class field name"], + "targets": ["TClassField"] + }, + { + "name": "Hack", + "metadata": ":hack", + "doc": "Allows extending classes marked as @:final", + "targets": ["TClass"] + }, + { + "name": "HasUntyped", + "metadata": ":has_untyped", + "doc": "Used by the typer to mark fields that have untyped expressions", + "internal": true + }, + { + "name": "HaxeGeneric", + "metadata": ":haxeGeneric", + "doc": "Used internally to annotate non-native generic classes", + "platforms": ["cs"], + "targets": ["TClass", "TEnum"], + "internal": true + }, + { + "name": "HeaderClassCode", + "metadata": ":headerClassCode", + "doc": "Code to be injected into the generated class, in the header", + "platforms": ["cpp"] + }, + { + "name": "HeaderCode", + "metadata": ":headerCode", + "doc": "Code to be injected into the generated header file", + "platforms": ["cpp"] + }, + { + "name": "HeaderInclude", + "metadata": ":headerInclude", + "doc": "File to be included in generated header file", + "platforms": ["cpp"] + }, + { + "name": "HeaderNamespaceCode", + "metadata": ":headerNamespaceCode", + "doc": "", + "platforms": ["cpp"] + }, + { + "name": "HlNative", + "metadata": ":hlNative", + "doc": "Specifies hdll name and function prefix for native functions", + "platforms": ["hl"], + "targets": ["TClass", "TClassField"] + }, + { + "name": "HxGen", + "metadata": ":hxGen", + "doc": "Annotates that an extern class was generated by Haxe", + "platforms": ["java", "cs"], + "targets": ["TClass", "TEnum"] + }, + { + "name": "IfFeature", + "metadata": ":ifFeature", + "doc": "Causes a field to be kept by DCE if the given feature is part of the compilation", + "params": ["Feature name"], + "targets": ["TClassField"] + }, + { + "name": "Impl", + "metadata": ":impl", + "doc": "Used internally to mark abstract implementation fields", + "targets": ["TAbstractField"], + "internal": true + }, + { + "name": "PythonImport", + "metadata": ":pythonImport", + "doc": "Generates python import statement for extern classes", + "platforms": ["python"], + "targets": ["TClass"] + }, + { + "name": "ImplicitCast", + "metadata": ":implicitCast", + "doc": "Generated automatically on the AST when an implicit abstract cast happens", + "targets": ["TExpr"], + "internal": true + }, + { + "name": "Include", + "metadata": ":include", + "doc": "", + "platforms": ["cpp"] + }, + { + "name": "InitPackage", + "metadata": ":initPackage", + "doc": "Some weird thing for Genjs we want to remove someday", + "platforms": ["js"], + "internal": true + }, + { + "name": "Inline", + "metadata": ":inline", + "doc": "Inserted by the parser in case of `inline expr` and `inline function`", + "targets": ["TExpr"] + }, + { + "name": "InlineConstructorArgument", + "matchUnderscore": true, + "metadata": ":inlineConstructorArgument", + "doc": "Internally used to mark expressions that were passed as arguments of an inlined constructor", + "internal": true + }, + { + "name": "Internal", + "metadata": ":internal", + "doc": "Generates the annotated field/class with 'internal' access", + "platforms": ["java", "cs"], + "targets": ["TClass", "TEnum", "TClassField"] + }, + { + "name": "IsVar", + "metadata": ":isVar", + "doc": "Forces a physical field to be generated for properties that otherwise would not require one", + "targets": ["TClassField"] + }, + { + "name": "JavaCanonical", + "metadata": ":javaCanonical", + "doc": "Used by the Java target to annotate the canonical path of the type", + "platforms": ["java"], + "params": ["Output type package", "Output type name"], + "targets": ["TClass", "TEnum"] + }, + { + "name": "JavaNative", + "metadata": ":javaNative", + "doc": "Automatically added by --java-lib on classes generated from JAR/class files", + "platforms": ["java"], + "targets": ["TClass", "TEnum"], + "internal": true + }, + { + "name": "JsRequire", + "metadata": ":jsRequire", + "doc": "Generate JavaScript module require expression for given extern", + "platforms": ["js"], + "targets": ["TClass"] + }, + { + "name": "LuaRequire", + "metadata": ":luaRequire", + "doc": "Generate Lua module require expression for given extern", + "platforms": ["lua"], + "targets": ["TClass"] + }, + { + "name": "LuaDotMethod", + "metadata": ":luaDotMethod", + "doc": "Indicates that the given extern type instance should have dot-style invocation for methods instead of colon", + "platforms": ["lua"] + }, + { + "name": "Keep", + "metadata": ":keep", + "doc": "Causes a field or type to be kept by DCE" + }, + { + "name": "KeepInit", + "metadata": ":keepInit", + "doc": "Causes a class to be kept by DCE even if all its field are removed", + "targets": ["TClass"] + }, + { + "name": "KeepSub", + "metadata": ":keepSub", + "doc": "Extends @:keep metadata to all implementing and extending classes", + "targets": ["TClass"] + }, + { + "name": "LibType", + "metadata": ":libType", + "doc": "Used by --net-lib and --java-lib to mark a class that shouldn't be checked (overrides, interfaces, etc) by the type loader", + "platforms": ["java", "cs"], + "targets": ["TClass"], + "internal": true + }, + { + "name": "LoopLabel", + "metadata": ":loopLabel", + "doc": "Mark loop and break expressions with a label to support breaking from within switch", + "internal": true + }, + { + "name": "Markup", + "metadata": ":markup", + "doc": "Used as a result of inline XML parsing" + }, + { + "name": "Meta", + "metadata": ":meta", + "doc": "Internally used to mark a class field as being the metadata field" + }, + { + "name": "Macro", + "metadata": ":macro", + "doc": "(deprecated)" + }, + { + "name": "MaybeUsed", + "metadata": ":maybeUsed", + "doc": "Internally used by DCE to mark fields that might be kept", + "internal": true + }, + { + "name": "MergeBlock", + "metadata": ":mergeBlock", + "doc": "Merge the annotated block into the current scope", + "targets": ["TExpr"] + }, + { + "name": "MultiReturn", + "metadata": ":multiReturn", + "doc": "Annotates an extern class as the result of multi-return function", + "platforms": ["lua"], + "targets": ["TClass"] + }, + { + "name": "MultiType", + "metadata": ":multiType", + "doc": "Specifies that an abstract chooses its this-type from its @:to functions", + "params": ["Relevant type parameters"], + "targets": ["TAbstract"] + }, + { + "name": "Native", + "metadata": ":native", + "doc": "Rewrites the path of a class or enum during generation", + "params": ["Output type path"], + "targets": ["TClass", "TEnum"] + }, + { + "name": "NativeChildren", + "metadata": ":nativeChildren", + "doc": "Annotates that all children from a type should be treated as if it were an extern definition - platform native", + "platforms": ["java", "cs"], + "targets": ["TClass"] + }, + { + "name": "NativeGen", + "metadata": ":nativeGen", + "doc": "Annotates that a type should be treated as if it were an extern definition - platform native", + "platforms": ["java", "cs", "python"], + "targets": ["TClass", "TEnum"] + }, + { + "name": "NativeGeneric", + "metadata": ":nativeGeneric", + "doc": "Used internally to annotate native generic classes", + "platforms": ["cs"], + "targets": ["TClass", "TEnum"], + "internal": true + }, + { + "name": "NativeProperty", + "metadata": ":nativeProperty", + "doc": "Use native properties which will execute even with dynamic usage", + "platforms": ["cpp"] + }, + { + "name": "NativeStaticExtension", + "metadata": ":nativeStaticExtension", + "doc": "Converts static function syntax into member call", + "platforms": ["cpp"] + }, + { + "name": "NoCompletion", + "metadata": ":noCompletion", + "doc": "Prevents the compiler from suggesting completion on this field or type", + "targets": ["TClassField"] + }, + { + "name": "NoDebug", + "metadata": ":noDebug", + "doc": "Does not generate debug information even if --debug is set", + "platforms": ["flash", "cpp"], + "targets": ["TClass", "TClassField"] + }, + { + "name": "NoDoc", + "metadata": ":noDoc", + "doc": "Prevents a type from being included in documentation generation" + }, + { + "name": "NoExpr", + "metadata": ":noExpr", + "doc": "Internally used to mark abstract fields which have no expression by design", + "internal": true + }, + { + "name": "NoImportGlobal", + "metadata": ":noImportGlobal", + "doc": "Prevents a static field from being imported with import Class.*", + "targets": ["TAnyField"] + }, + { + "name": "NonVirtual", + "metadata": ":nonVirtual", + "doc": "Declares function to be non-virtual in cpp", + "platforms": ["cpp"] + }, + { + "name": "NoPackageRestrict", + "metadata": ":noPackageRestrict", + "doc": "Allows a module to be accessed across all targets if found on its first type", + "internal": true + }, + { + "name": "NoPrivateAccess", + "metadata": ":noPrivateAccess", + "doc": "Disallow private access to anything for the annotated expression", + "targets": ["TExpr"] + }, + { + "name": "NoStack", + "metadata": ":noStack", + "doc": "", + "platforms": ["cpp"] + }, + { + "name": "NotNull", + "metadata": ":notNull", + "doc": "Declares an abstract type as not accepting null values", + "targets": ["TAbstract"] + }, + { + "name": "NoUsing", + "metadata": ":noUsing", + "doc": "Prevents a field from being used with 'using'", + "targets": ["TClassField"] + }, + { + "name": "Ns", + "metadata": ":ns", + "doc": "Internally used by the SWF generator to handle namespaces", + "platforms": ["flash"] + }, + { + "name": "NullSafety", + "metadata": ":nullSafety", + "doc": "Enables null safety for classes or fields. Disables null safety for classes, fields or expressions if provided with `Off` as an argument (e.g. `@:nullSafety(Off)`)", + "targets": ["TClass", "TClassField", "TExpr"] + }, + { + "name": "Objc", + "metadata": ":objc", + "doc": "Declares a class or interface that is used to interoperate with Objective-C code", + "platforms": ["cpp"], + "targets": ["TClass"] + }, + { + "name": "ObjcProtocol", + "metadata": ":objcProtocol", + "doc": "Associates an interface with, or describes a function in, a native Objective-C protocol", + "platforms": ["cpp"] + }, + { + "name": "Op", + "metadata": ":op", + "doc": "Declares an abstract field as being an operator overload", + "params": ["The operation"], + "targets": ["TAbstractField"] + }, + { + "name": "Optional", + "metadata": ":optional", + "doc": "Marks the field of a structure as optional", + "targets": ["TClassField"] + }, + { + "name": "Overload", + "metadata": ":overload", + "doc": "Allows the field to be called with different argument types", + "params": ["Function specification (no expression)"], + "targets": ["TClassField"] + }, + { + "name": "PhpGlobal", + "metadata": ":phpGlobal", + "doc": "Indicates that static fields of an extern class actually are located in the global PHP namespace", + "platforms": ["php"], + "targets": ["TClass"] + }, + { + "name": "PhpClassConst", + "metadata": ":phpClassConst", + "doc": "Indicates that a static var of an extern class is a PHP class constant", + "platforms": ["php"], + "targets": ["TClassField"] + }, + { + "name": "PhpMagic", + "metadata": ":phpMagic", + "doc": "Treat annotated field as special PHP magic field - this meta makes compiler avoid renaming such fields on generating PHP code", + "platforms": ["php"], + "targets": ["TClassField"] + }, + { + "name": "PhpNoConstructor", + "metadata": ":phpNoConstructor", + "doc": "Special meta for extern classes which do not have native constructor in PHP, but need a constructor in Haxe extern", + "platforms": ["php"], + "targets": ["TClass"] + }, + { + "name": "Pos", + "metadata": ":pos", + "doc": "Sets the position of a reified expression", + "params": ["Position"], + "targets": ["TExpr"] + }, + { + "name": "Public", + "metadata": ":public", + "doc": "Marks a class field as being public", + "targets": ["TClassField"], + "internal": true + }, + { + "name": "PublicFields", + "metadata": ":publicFields", + "doc": "Forces all class fields of inheriting classes to be public", + "targets": ["TClass"] + }, + { + "name": "Private", + "metadata": ":private", + "doc": "Marks a class field as being private", + "platforms": ["cs"], + "targets": ["TClassField"] + }, + { + "name": "PrivateAccess", + "metadata": ":privateAccess", + "doc": "Allow private access to anything for the annotated expression", + "targets": ["TExpr"] + }, + { + "name": "Protected", + "metadata": ":protected", + "doc": "Marks a class field as being protected", + "platforms": ["cs", "java", "flash"], + "targets": ["TClassField"] + }, + { + "name": "Property", + "metadata": ":property", + "doc": "Marks a property field to be compiled as a native C# property", + "platforms": ["cs"], + "targets": ["TClassField"] + }, + { + "name": "Pure", + "metadata": ":pure", + "doc": "Marks a class field, class or expression as pure (side-effect free)", + "targets": ["TClass", "TClassField", "TExpr"] + }, + { + "name": "ReadOnly", + "metadata": ":readOnly", + "doc": "Generates a field with the 'readonly' native keyword", + "platforms": ["cs"], + "targets": ["TClassField"] + }, + { + "name": "RealPath", + "metadata": ":realPath", + "doc": "Internally used on @:native types to retain original path information", + "internal": true + }, + { + "name": "Remove", + "metadata": ":remove", + "doc": "Causes an interface to be removed from all implementing classes before generation", + "targets": ["TClass"] + }, + { + "name": "Require", + "metadata": ":require", + "doc": "Allows access to a field only if the specified compiler flag is set", + "params": ["Compiler flag to check"], + "targets": ["TClassField"] + }, + { + "name": "RequiresAssign", + "metadata": ":requiresAssign", + "doc": "Used internally to mark certain abstract operator overloads", + "internal": true + }, + { + "name": "Resolve", + "metadata": ":resolve", + "doc": "Abstract fields marked with this metadata can be used to resolve unknown fields", + "targets": ["TClassField"] + }, + { + "name": "Rtti", + "metadata": ":rtti", + "doc": "Adds runtime type information", + "targets": ["TClass"] + }, + { + "name": "Runtime", + "metadata": ":runtime", + "doc": "?" + }, + { + "name": "RuntimeValue", + "metadata": ":runtimeValue", + "doc": "Marks an abstract as being a runtime value", + "targets": ["TAbstract"] + }, + { + "name": "Scalar", + "metadata": ":scalar", + "doc": "Used by hxcpp to mark a custom coreType abstract", + "platforms": ["cpp"], + "targets": ["TAbstract"] + }, + { + "name": "SelfCall", + "metadata": ":selfCall", + "doc": "Translates method calls into calling object directly", + "platforms": ["js", "lua"], + "targets": ["TClassField"] + }, + { + "name": "Semantics", + "metadata": ":semantics", + "doc": "The native semantics of the type", + "params": ["value | reference | variable"], + "targets": ["TClass", "TTypedef", "TAbstract"] + }, + { + "name": "Setter", + "metadata": ":setter", + "doc": "Generates a native setter function on the given field", + "platforms": ["flash"], + "params": ["Class field name"], + "targets": ["TClassField"] + }, + { + "name": "SkipCtor", + "metadata": ":skipCtor", + "doc": "Used internally to generate a constructor as if it were a native type (no __hx_ctor)", + "platforms": ["java", "cs"], + "internal": true + }, + { + "name": "SkipReflection", + "metadata": ":skipReflection", + "doc": "Used internally to annotate a field that shouldn't have its reflection data generated", + "platforms": ["java", "cs"], + "targets": ["TClassField"], + "internal": true + }, + { + "name": "Sound", + "metadata": ":sound", + "doc": "Includes a given .wav or .mp3 file into the target SWF and associates it with the class (must extend flash.media.Sound)", + "platforms": ["flash"], + "params": ["File path"], + "targets": ["TClass"] + }, + { + "name": "SourceFile", + "metadata": ":sourceFile", + "doc": "Source code filename for external class", + "platforms": ["cpp"] + }, + { + "name": "StackOnly", + "metadata": ":stackOnly", + "doc": "Instances of this type can only appear on the stack", + "platforms": ["cpp"] + }, + { + "name": "StaticExtension", + "metadata": "haxe.internal.static_extension", + "doc": "Used internally to mark static extension fields", + "internal": true + }, + { + "name": "StoredTypedExpr", + "metadata": ":storedTypedExpr", + "doc": "Used internally to reference a typed expression returned from a macro", + "internal": true + }, + { + "name": "Strict", + "metadata": ":strict", + "doc": "Used to declare a native C# attribute or a native Java metadata; is type checked", + "platforms": ["java", "cs"] + }, + { + "name": "Struct", + "metadata": ":struct", + "doc": "Marks a class definition as a struct", + "platforms": ["cs", "hl"], + "targets": ["TClass"] + }, + { + "name": "StructAccess", + "metadata": ":structAccess", + "doc": "Marks an extern class as using struct access('.') not pointer('->')", + "platforms": ["cpp"], + "targets": ["TClass"] + }, + { + "name": "StructInit", + "metadata": ":structInit", + "doc": "Allows one to initialize the class with a structure that matches constructor parameters", + "targets": ["TClass"] + }, + { + "name": "SuppressWarnings", + "metadata": ":suppressWarnings", + "doc": "Adds a SuppressWarnings annotation for the generated Java class", + "platforms": ["java"], + "targets": ["TClass"] + }, + { + "name": "TemplatedCall", + "metadata": ":templatedCall", + "doc": "Indicates that the first parameter of static call should be treated as a template argument", + "platforms": ["cpp"], + "targets": ["TClassField"] + }, + { + "name": "Throws", + "metadata": ":throws", + "doc": "Adds a 'throws' declaration to the generated function", + "platforms": ["java"], + "params": ["Type as String"], + "targets": ["TClassField"] + }, + { + "name": "This", + "metadata": ":this", + "doc": "Internally used to pass a 'this' expression to macros", + "targets": ["TExpr"], + "internal": true + }, + { + "name": "To", + "metadata": ":to", + "doc": "Specifies that the field of the abstract is a cast operation to the type identified in the function", + "targets": ["TAbstractField"] + }, + { + "name": "ToString", + "metadata": ":toString", + "doc": "Internally used", + "internal": true + }, + { + "name": "Transient", + "metadata": ":transient", + "doc": "Adds the 'transient' flag to the class field", + "platforms": ["java"], + "targets": ["TClassField"] + }, + { + "name": "ValueUsed", + "metadata": ":valueUsed", + "doc": "Internally used by DCE to mark an abstract value as used", + "internal": true + }, + { + "name": "Volatile", + "metadata": ":volatile", + "doc": "", + "platforms": ["java", "cs"] + }, + { + "name": "UnifyMinDynamic", + "metadata": ":unifyMinDynamic", + "doc": "Allows a collection of types to unify to Dynamic", + "targets": ["TClassField"] + }, + { + "name": "Unreflective", + "metadata": ":unreflective", + "doc": "", + "platforms": ["cpp"] + }, + { + "name": "Unsafe", + "metadata": ":unsafe", + "doc": "Declares a class, or a method with the C#'s 'unsafe' flag", + "platforms": ["cs"], + "targets": ["TClass", "TClassField"] + }, + { + "name": "Used", + "metadata": ":used", + "doc": "Internally used by DCE to mark a class or field as used", + "internal": true + }, + { + "name": "Using", + "metadata": ":using", + "doc": "Automatically uses the argument types as static extensions for the annotated type", + "targets": ["TClass", "TEnum", "TAbstract"] + }, + { + "name": "Value", + "metadata": ":value", + "doc": "Used to store default values for fields and function arguments", + "targets": ["TClassField"] + }, + { + "name": "Void", + "metadata": ":void", + "doc": "Use Cpp native 'void' return type", + "platforms": ["cpp"] + } +] \ No newline at end of file diff --git a/src/core/define.ml b/src/core/define.ml index e9bfb207a72..c86c499e49e 100644 --- a/src/core/define.ml +++ b/src/core/define.ml @@ -1,232 +1,11 @@ open Globals +include DefineList type define = { mutable values : (string,string) PMap.t; mutable defines_signature : string option; } -type strict_defined = - | AbsolutePath - | AdvancedTelemetry - | AnnotateSource - (* | Analyzer *) - | As3 - | CheckXmlProxy - | CoreApi - | CoreApiSerialize - | Cppia - | NoCppiaAst - | Dce - | DceDebug - | Debug - | DisableUnicodeStrings - | Display - | DisplayStdin - | DllExport - | DllImport - | DocGen - | Dump - | DumpDependencies - | DumpIgnoreVarIds - | DynamicInterfaceClosures - | EraseGenerics - | EvalDebugger - | EvalStack - | EvalCallStackDepth - | EvalTimes - | FastCast - | Fdb - | FileExtension - | FlashStrict - | FlashUseStage - | ForceLibCheck - | ForceNativeProperty - | GencommonDebug - | Haxe3Compat - | HaxeBoot - | HaxeVer - | HxcppApiLevel - | HxcppGcGenerational - | HxcppDebugger - | HxcppSmartStings - | IncludePrefix - | Interp - | JavaVer - | JsClassic - | JsEs - | JsUnflatten - | JsSourceMap - | JsEnumsAsArrays - | Jvm - | SourceMap - | KeepOldOutput - | LoopUnrollMaxCost - | LuaJit - | LuaVanilla - | LuaVer - | Macro - | MacroTimes - | NekoSource - | NekoV1 - | NetworkSandbox - | NetVer - | NetTarget - | NoCompilation - | NoCOpt - | NoDeprecationWarnings - | NoFlashOverride - | NoDebug - | NoInline - | NoOpt - | NoRoot - | NoSwfCompress - | NoTraces - | Objc - | OldConstructorInline - | OldErrorFormat - | PhpLib - | PhpFront - | PhpPrefix - | PythonVersion - | RealPosition - | ReplaceFiles - | Scriptable - | ShallowExpose - | SourceHeader - | SourceMapContent - | Static - | Swc - | SwfCompressLevel - | SwfDebugPassword - | SwfDirectBlit - | SwfGpu - | SwfMetadata - | SwfPreloaderFrame - | SwfProtected - | SwfScriptTimeout - | Sys - | Unsafe - | UseNekoc - | Utf16 - | Vcproj - | WarnVarShadowing - | NoMacroCache - | Last (* must be last *) - -type define_parameter = - | HasParam of string - | Platform of platform - | Platforms of platform list - -let infos = function - | AbsolutePath -> "absolute_path",("Print absolute file path in trace output",[]) - | AdvancedTelemetry -> "advanced-telemetry",("Allow the SWF to be measured with Monocle tool",[Platform Flash]) - | AnnotateSource -> "annotate_source",("Add additional comments to generated source code",[Platform Cpp]) - (* | Analyzer -> "analyzer",("Use static analyzer for optimization (experimental)") *) - | As3 -> "as3",("Defined when outputting flash9 as3 source code",[]) - | CheckXmlProxy -> "check_xml_proxy",("Check the used fields of the xml proxy",[]) - | CoreApi -> "core_api",("Defined in the core api context",[]) - | CoreApiSerialize -> "core_api_serialize",("Mark some generated core api classes with the Serializable attribute on C#",[Platform Cs]) - | Cppia -> "cppia",("Generate cpp instruction assembly",[]) - | NoCppiaAst -> "nocppiaast",("Use legacy cppia generation",[]) - | Dce -> "dce",(" Set the dead code elimination mode (default std)",[]) - | DceDebug -> "dce_debug",("Show DCE log",[]) - | Debug -> "debug",("Activated when compiling with -debug",[]) - | DisableUnicodeStrings -> "disable_unicode_strings",("Disable unicode support in String type on some platforms",[Platform Cpp]) - | Display -> "display",("Activated during completion",[]) - | DisplayStdin -> "display_stdin",("Read the contents of a file specified in --display from standard input",[]) - | DllExport -> "dll_export",("GenCPP experimental linking",[Platform Cpp]) - | DllImport -> "dll_import",("Handle Haxe-generated .NET dll imports",[Platform Cs]) - | DocGen -> "doc_gen",("Do not perform any removal/change in order to correctly generate documentation",[]) - | Dump -> "dump",(" Dump typed AST in dump subdirectory using specified mode or non-prettified default",[]) - | DumpDependencies -> "dump_dependencies",("Dump the classes dependencies in a dump subdirectory",[]) - | DumpIgnoreVarIds -> "dump_ignore_var_ids",("Remove variable IDs from non-pretty dumps (helps with diff)",[]) - | DynamicInterfaceClosures -> "dynamic_interface_closures",("Use slow path for interface closures to save space",[Platform Cpp]) - | EraseGenerics -> "erase_generics",("Erase generic classes on C#",[Platform Cs]) - | EvalDebugger -> "eval_debugger",("Support debugger in macro/interp mode. Allows host:port value to open a socket. Implies eval_stack.",[Platform Eval]) - | EvalStack -> "eval_stack",("Record stack information in macro/interp mode",[Platform Eval]) - | EvalCallStackDepth -> "eval_call_stack_depth",("Set maximum call stack depth for eval. Default: 1000.",[Platform Eval]) - | EvalTimes -> "eval_times",("Record per-method execution times in macro/interp mode. Implies eval_stack.",[Platform Eval]) - | FastCast -> "fast_cast",("Enables an experimental casts cleanup on C# and Java",[Platforms [Cs;Java]]) - | Fdb -> "fdb",("Enable full flash debug infos for FDB interactive debugging",[Platform Flash]) - | FileExtension -> "file_extension",("Output filename extension for cpp source code",[Platform Cpp]) - | FlashStrict -> "flash_strict",("More strict typing for flash target",[Platform Flash]) - | FlashUseStage -> "flash_use_stage",("Keep the SWF library initial stage",[Platform Flash]) - (* force_lib_check is only here as a debug facility - compiler checking allows errors to be found more easily *) - | ForceLibCheck -> "force_lib_check",("Force the compiler to check -net-lib and -java-lib added classes (internal)",[Platforms [Cs;Java]]) - | ForceNativeProperty -> "force_native_property",("Tag all properties with :nativeProperty metadata for 3.1 compatibility",[Platform Cpp]) - | GencommonDebug -> "gencommon_debug",("GenCommon internal",[Platforms [Cs;Java]]) - | Haxe3Compat -> "haxe3compat", ("Gives warnings about transition from Haxe 3.x to Haxe 4.0",[]) - | HaxeBoot -> "haxe_boot",("Given the name 'haxe' to the flash boot class instead of a generated name",[Platform Flash]) - | HaxeVer -> "haxe_ver",("The current Haxe version value",[]) - | HxcppApiLevel -> "hxcpp_api_level",("Provided to allow compatibility between hxcpp versions",[Platform Cpp]) - | HxcppGcGenerational -> "HXCPP_GC_GENERATIONAL",("Experimental Garbage Collector",[Platform Cpp]) - | HxcppDebugger -> "HXCPP_DEBUGGER",("Include additional information for HXCPP_DEBUGGER",[Platform Cpp]) - | HxcppSmartStings -> "hxcpp_smart_strings",("Use wide strings in hxcpp (Turned on by default unless `-D disable_unicode_strings` is specified)",[Platform Cpp]) - | IncludePrefix -> "include_prefix",("prepend path to generated include files",[Platform Cpp]) - | Interp -> "interp",("The code is compiled to be run with --interp",[]) - | JavaVer -> "java_ver",(" Sets the Java version to be targeted",[Platform Java]) - | JsClassic -> "js_classic",("Don't use a function wrapper and strict mode in JS output",[Platform Js]) - | JsEs -> "js_es",("Generate JS compliant with given ES standard version (default 5)",[Platform Js; HasParam "version number"]) - | JsEnumsAsArrays -> "js_enums_as_arrays",("Generate enum representation as array instead of as object",[Platform Js]) - | JsUnflatten -> "js_unflatten",("Generate nested objects for packages and types",[Platform Js]) - | JsSourceMap -> "js_source_map",("Generate JavaScript source map even in non-debug mode",[Platform Js]) - | Jvm -> "jvm",("Generate jvm directly",[Platform Java]) - | SourceMap -> "source_map",("Generate source map for compiled files (Currently supported for php only)",[Platform Php]) - | KeepOldOutput -> "keep_old_output",("Keep old source files in the output directory (for C#/Java)",[Platforms [Cs;Java]]) - | LoopUnrollMaxCost -> "loop_unroll_max_cost",("Maximum cost (number of expressions * iterations) before loop unrolling is canceled (default 250)",[]) - | LuaJit -> "lua_jit",("Enable the jit compiler for lua (version 5.2 only)",[Platform Lua]) - | LuaVanilla -> "lua_vanilla",("Generate code lacking compiled extern lib support (e.g. utf8)",[Platform Lua]) - | LuaVer -> "lua_ver",("The lua version to target",[Platform Lua]) - | Macro -> "macro",("Defined when code is compiled in the macro context",[]) - | MacroTimes -> "macro_times",("Display per-macro timing when used with --times",[]) - | NetVer -> "net_ver",(" Sets the .NET version to be targeted",[Platform Cs]) - | NetTarget -> "net_target",(" Sets the .NET target. Defaults to \"net\". xbox, micro (Micro Framework), compact (Compact Framework) are some valid values",[Platform Cs]) - | NekoSource -> "neko_source",("Output neko source instead of bytecode",[Platform Neko]) - | NekoV1 -> "neko_v1",("Keep Neko 1.x compatibility",[Platform Neko]) - | NetworkSandbox -> "network-sandbox",("Use local network sandbox instead of local file access one",[Platform Flash]) - | NoCompilation -> "no-compilation",("Disable final compilation",[Platforms [Cs;Java;Cpp;Hl]]) - | NoCOpt -> "no_copt",("Disable completion optimization (for debug purposes)",[]) - | NoDebug -> "no_debug",("Remove all debug macros from cpp output",[]) - | NoDeprecationWarnings -> "no-deprecation-warnings",("Do not warn if fields annotated with @:deprecated are used",[]) - | NoFlashOverride -> "no-flash-override",("Change overrides on some basic classes into HX suffixed methods, flash only",[Platform Flash]) - | NoOpt -> "no_opt",("Disable optimizations",[]) - | NoInline -> "no_inline",("Disable inlining",[]) - | NoRoot -> "no_root",("Generate top-level types into haxe.root namespace",[Platform Cs]) - | NoMacroCache -> "no_macro_cache",("Disable macro context caching",[]) - | NoSwfCompress -> "no_swf_compress",("Disable SWF output compression",[Platform Flash]) - | NoTraces -> "no_traces",("Disable all trace calls",[]) - | Objc -> "objc",("Sets the hxcpp output to objective-c++ classes. Must be defined for interop",[Platform Cpp]) - | OldConstructorInline -> "old-constructor-inline",("Use old constructor inlining logic (from haxe 3.4.2) instead of the reworked version.",[]) - | OldErrorFormat -> "old-error-format",("Use Haxe 3.x zero-based column error messages instead of new one-based format.",[]) - | PhpPrefix -> "php_prefix",("Root namespace for generated php classes. E.g. if compiled with`-D php-prefix=some.sub`, then all classes will be generated in `\\some\\sub` namespace.",[Platform Php]) - | PhpLib -> "php_lib",("Select the name for the php lib folder.",[Platform Php]) - | PhpFront -> "php_front",("Select the name for the php front file (by default: `index.php`).", [Platform Php]) - | PythonVersion -> "python_version",("The python version to target (default 3.3)",[Platform Python]) - | RealPosition -> "real_position",("Disables Haxe source mapping when targetting C#, removes position comments in Java and Php output",[Platforms [Cs;Java;Php]]) - | ReplaceFiles -> "replace_files",("GenCommon internal",[Platforms [Java;Cs]]) - | Scriptable -> "scriptable",("GenCPP internal",[Platform Cpp]) - | ShallowExpose -> "shallow-expose",("Expose types to surrounding scope of Haxe generated closure without writing to window object",[Platform Js]) - | SourceHeader -> "source-header",("Print value as comment on top of generated files, use '' value to disable",[]) - | SourceMapContent -> "source-map-content",("Include the hx sources as part of the JS source map",[Platform Js]) - | Static -> "static",("Defined if the current target is static",[]) - | Swc -> "swc",("Output a SWC instead of a SWF",[Platform Flash]) - | SwfCompressLevel -> "swf_compress_level",(" Set the amount of compression for the SWF output",[Platform Flash]) - | SwfDebugPassword -> "swf_debug_password",("Set a password for debugging",[Platform Flash]) - | SwfDirectBlit -> "swf_direct_blit",("Use hardware acceleration to blit graphics",[Platform Flash]) - | SwfGpu -> "swf_gpu",("Use GPU compositing features when drawing graphics",[Platform Flash]) - | SwfMetadata -> "swf_metadata",(" Include contents of as metadata in the swf",[Platform Flash]) - | SwfPreloaderFrame -> "swf_preloader_frame",("Insert empty first frame in swf",[Platform Flash]) - | SwfProtected -> "swf_protected",("Compile Haxe private as protected in the SWF instead of public",[Platform Flash]) - | SwfScriptTimeout -> "swf_script_timeout",("Maximum ActionScript processing time before script stuck dialog box displays (in seconds)",[Platform Flash]) - | Sys -> "sys",("Defined for all system platforms",[]) - | Unsafe -> "unsafe",("Allow unsafe code when targeting C#",[Platform Cs]) - | UseNekoc -> "use_nekoc",("Use nekoc compiler instead of internal one",[Platform Neko]) - | Utf16 -> "utf16",("Defined for all platforms that have utf16 encoding with ucs2 api",[]) - | Vcproj -> "vcproj",("GenCPP internal",[Platform Cpp]) - | WarnVarShadowing -> "warn_var_shadowing",("Warn about shadowing variable declarations",[]) - | Last -> assert false - let get_documentation_list() = let m = ref 0 in let rec loop i = @@ -236,7 +15,6 @@ let get_documentation_list() = let pfs = ref [] in List.iter (function | HasParam s -> () (* TODO *) - | Platform p -> pfs := p :: !pfs; | Platforms pl -> pfs := pl @ !pfs; ) flags; let pfs = platform_list_help (List.rev !pfs) in diff --git a/src/core/display/completionItem.ml b/src/core/display/completionItem.ml index d5600701cd5..10ee8efff7c 100644 --- a/src/core/display/completionItem.ml +++ b/src/core/display/completionItem.ml @@ -655,10 +655,8 @@ let to_json ctx item = in let rec loop internal params platforms targets l = match l with | HasParam s :: l -> loop internal (s :: params) platforms targets l - | Platform pl :: l -> loop internal params (platform_name pl :: platforms) targets l | Platforms pls :: l -> loop internal params ((List.map platform_name pls) @ platforms) targets l - | UsedOn usage :: l -> loop internal params platforms (usage_to_string usage :: targets) l - | UsedOnEither usages :: l -> loop internal params platforms ((List.map usage_to_string usages) @ targets) l + | UsedOn usages :: l -> loop internal params platforms ((List.map usage_to_string usages) @ targets) l | UsedInternally :: l -> loop true params platforms targets l | [] -> internal,params,platforms,targets in diff --git a/src/core/meta.ml b/src/core/meta.ml index 1ca90108df5..950623a3478 100644 --- a/src/core/meta.ml +++ b/src/core/meta.ml @@ -1,184 +1,5 @@ open Globals - -type strict_meta = - | Abi - | Abstract - | Access - | Accessor - | Allow - | Analyzer - | Annotation - | ArrayAccess - | Ast - | AstSource - | AutoBuild - | Bind - | Bitmap - | BridgeProperties - | Build - | BuildXml - | BypassAccessor - | Callable - | Class - | ClassCode - | Commutative - | CompilerGenerated - | Const - | CoreApi - | CoreType - | CppFileCode - | CppInclude - | CppNamespaceCode - | CsNative - | Dce - | Debug - | Decl - | DefParam - | Delegate - | Depend - | Deprecated - | DirectlyUsed - | DynamicObject - | Eager - | Enum - | EnumConstructorParam - | Event - | Exhaustive - | Expose - | Extern - | File - | FileXml - | Final - | Fixed - | FlatEnum - | FlashProperty - | Font - | ForLoopVariable - | Forward - | ForwardStatics - | From - | FunctionCode - | FunctionTailCode - | Generic - | GenericBuild - | GenericInstance - | Getter - | Hack - | HasUntyped - | HaxeGeneric - | HeaderClassCode - | HeaderCode - | HeaderInclude - | HeaderNamespaceCode - | HlNative - | HxGen - | IfFeature - | Impl - | PythonImport - | ImplicitCast - | Include - | InitPackage - | Inline - | InlineConstructorArgument of int * int - | Internal - | IsVar - | JavaCanonical - | JavaNative - | JsRequire - | Keep - | KeepInit - | KeepSub - | LibType - | LoopLabel - | LuaRequire - | LuaDotMethod - | Markup - | Meta - | Macro - | MaybeUsed - | MergeBlock - | MultiReturn - | MultiType - | Native - | NativeChildren - | NativeGen - | NativeGeneric - | NativeProperty - | NativeStaticExtension - | NoCompletion - | NoDebug - | NoDoc - | NoExpr - | NoImportGlobal - | NonVirtual - | NoPackageRestrict - | NoPrivateAccess - | NoStack - | NotNull - | NoUsing - | Ns - | NullSafety - | Objc - | ObjcProtocol - | Op - | Optional - | Overload - | PhpGlobal - | PhpClassConst - | PhpMagic - | PhpNoConstructor - | Pos - | Private - | PrivateAccess - | Property - | Protected - | Public - | PublicFields - | Pure - | ReadOnly - | RealPath - | Remove - | Require - | RequiresAssign - | Resolve - | Rtti - | Runtime - | RuntimeValue - | Scalar - | SelfCall - | Semantics - | Setter - | SkipCtor - | SkipReflection - | Sound - | SourceFile - | StackOnly - | StaticExtension - | StoredTypedExpr - | Strict - | Struct - | StructAccess - | StructInit - | SuppressWarnings - | This - | Throws - | To - | ToString - | Transient - | TemplatedCall - | ValueUsed - | Volatile - | UnifyMinDynamic - | Unreflective - | Unsafe - | Using - | Used - | Value - | Void - | Last - (* do not put any custom metadata after Last *) - | Dollar of string - | Custom of string +include MetaList let has m ml = List.exists (fun (m2,_,_) -> m = m2) ml let has_one_of ml1 ml2 = List.exists (fun (m2,_,_) -> List.mem m2 ml1) ml2 @@ -189,206 +10,6 @@ let rec remove m = function | (m2,_,_) :: l when m = m2 -> l | x :: l -> x :: remove m l -type meta_usage = - | TClass - | TClassField - | TAbstract - | TAbstractField - | TEnum - | TTypedef - | TAnyField - | TExpr - | TTypeParameter - | TVariable - -type meta_parameter = - | HasParam of string - | Platform of platform - | Platforms of platform list - | UsedOn of meta_usage - | UsedOnEither of meta_usage list - | UsedInternally - -let get_info = function - | Abi -> ":abi",("Function ABI/calling convention",[Platforms [Cpp]]) - | Abstract -> ":abstract",("Sets the underlying class implementation as 'abstract'",[Platforms [Java;Cs]]) - | Access -> ":access",("Forces private access to package, type or field",[HasParam "Target path";UsedOnEither [TClass;TClassField]]) - | Accessor -> ":accessor",("Used internally by DCE to mark property accessors",[UsedOn TClassField;UsedInternally]) - | Allow -> ":allow",("Allows private access from package, type or field",[HasParam "Target path";UsedOnEither [TClass;TClassField]]) - | Analyzer -> ":analyzer",("Used to configure the static analyzer",[]) - | Annotation -> ":annotation",("Annotation (@interface) definitions on -java-lib imports will be annotated with this metadata. Has no effect on types compiled by Haxe",[Platform Java; UsedOn TClass]) - | ArrayAccess -> ":arrayAccess",("Allows [] access on an abstract",[UsedOnEither [TAbstract;TAbstractField]]) - | Ast -> ":ast",("Internally used to pass the AST source into the typed AST",[UsedInternally]) - | AstSource -> ":astSource",("Filled by the compiler with the parsed expression of the field",[UsedOn TClassField]) - | AutoBuild -> ":autoBuild",("Extends @:build metadata to all extending and implementing classes",[HasParam "Build macro call";UsedOn TClass]) - | Bind -> ":bind",("Override Swf class declaration",[Platform Flash;UsedOn TClass]) - | Bitmap -> ":bitmap",("Embeds given bitmap data into the class (must extend flash.display.BitmapData)",[HasParam "Bitmap file path";UsedOn TClass;Platform Flash]) - | BridgeProperties -> ":bridgeProperties",("Creates native property bridges for all Haxe properties in this class",[UsedOn TClass;Platform Cs]) - | Build -> ":build",("Builds a class or enum from a macro",[HasParam "Build macro call";UsedOnEither [TClass;TEnum]]) - | BuildXml -> ":buildXml",("Specify xml data to be injected into Build.xml",[Platform Cpp]) - | BypassAccessor -> ":bypassAccessor",("Do not call property accessor method and access the field directly",[UsedOn TExpr]) - | Callable -> ":callable",("Abstract forwards call to its underlying type",[UsedOn TAbstract]) - | Class -> ":class",("Used internally to annotate an enum that will be generated as a class",[Platforms [Java;Cs]; UsedOn TEnum; UsedInternally]) - | ClassCode -> ":classCode",("Used to inject platform-native code into a class",[Platforms [Java;Cs]; UsedOn TClass]) - | Commutative -> ":commutative",("Declares an abstract operator as commutative",[UsedOn TAbstractField]) - | CompilerGenerated -> ":compilerGenerated",("Marks a field as generated by the compiler. Shouldn't be used by the end user",[Platforms [Java;Cs]]) - | Const -> ":const",("Allows a type parameter to accept expression values",[UsedOn TTypeParameter]) - | CoreApi -> ":coreApi",("Identifies this class as a core api class (forces Api check)",[UsedOnEither [TClass;TEnum;TTypedef;TAbstract]]) - | CoreType -> ":coreType",("Identifies an abstract as core type so that it requires no implementation",[UsedOn TAbstract]) - | CppFileCode -> ":cppFileCode",("Code to be injected into generated cpp file",[Platform Cpp]) - | CppInclude -> ":cppInclude",("File to be included in generated cpp file",[Platform Cpp]) - | CppNamespaceCode -> ":cppNamespaceCode",("",[Platform Cpp]) - | CsNative -> ":csNative",("Automatically added by -net-lib on classes generated from .NET DLL files",[Platform Cs; UsedOnEither[TClass;TEnum]; UsedInternally]) - | Dce -> ":dce",("Forces dead code elimination even when -dce full is not specified",[UsedOnEither [TClass;TEnum]]) - | Debug -> ":debug",("Forces debug information to be generated into the Swf even without -debug",[UsedOnEither [TClass;TClassField]; Platform Flash]) - | Decl -> ":decl",("",[Platform Cpp]) - | DefParam -> ":defParam",("Default function argument value loaded from the SWF and used for documentation in Genxml",[Platform Flash;UsedInternally]) - | Delegate -> ":delegate",("Automatically added by -net-lib on delegates",[Platform Cs; UsedOn TAbstract]) - | Depend -> ":depend",("",[Platform Cpp]) - | Deprecated -> ":deprecated",("Mark a type or field as deprecated",[]) - | DirectlyUsed -> ":directlyUsed",("Marks types that are directly referenced by non-extern code",[UsedInternally]) - | DynamicObject -> ":dynamicObject",("Used internally to identify the Dynamic Object implementation",[Platforms [Java;Cs]; UsedOn TClass; UsedInternally]) - | Eager -> ":eager",("Forces typedefs to be followed early",[UsedOn TTypedef]) - | Enum -> ":enum",("Defines finite value sets to abstract definitions",[UsedOn TAbstract]) - | EnumConstructorParam -> ":enumConstructorParam",("Used internally to annotate GADT type parameters",[UsedOn TClass; UsedInternally]) - | Event -> ":event",("Automatically added by -net-lib on events. Has no effect on types compiled by Haxe",[Platform Cs; UsedOn TClassField]) - | Exhaustive -> ":exhaustive",("",[UsedInternally]) - | Expose -> ":expose",("Includes the class or field in Haxe exports",[HasParam "?Name=Class path";UsedOnEither [TClass;TClassField];Platforms [Js;Lua]]) - | Extern -> ":extern",("Marks the field as extern so it is not generated",[UsedOn TClassField]) - | File -> ":file",("Includes a given binary file into the target Swf and associates it with the class (must extend flash.utils.ByteArray)",[HasParam "File path";UsedOn TClass;Platform Flash]) - | FileXml -> ":fileXml",("Include xml attribute snippet in Build.xml entry for file",[UsedOn TClass;Platform Cpp]) - | Final -> ":final",("Prevents a class or interface from being extended or a method from being overriden",[UsedOnEither [TClass;TClassField]]) - | Fixed -> ":fixed",("Delcares an anonymous object to have fixed fields",[ (*UsedOn TObjectDecl(_)*)]) - | FlatEnum -> ":flatEnum",("Internally used to mark an enum as being flat, i.e. having no function constructors",[UsedOn TEnum; UsedInternally]) - | FlashProperty -> ":flash.property",("",[UsedOn TClassField; Platform Flash]) - | Font -> ":font",("Embeds the given TrueType font into the class (must extend flash.text.Font)",[HasParam "TTF path";HasParam "Range String";UsedOn TClass]) - | ForLoopVariable -> ":forLoopVariable",("Internally used to mark for-loop variables",[UsedInternally]) - | Forward -> ":forward",("Forwards field access to underlying type",[HasParam "List of field names";UsedOn TAbstract]) - | ForwardStatics -> ":forwardStatics",("Forwards static field access to underlying type",[HasParam "List of field names";UsedOn TAbstract]) - | From -> ":from",("Specifies that the field of the abstract is a cast operation from the type identified in the function",[UsedOn TAbstractField]) - | FunctionCode -> ":functionCode",("Used to inject platform-native code into a function",[Platforms [Cpp;Java;Cs]]) - | FunctionTailCode -> ":functionTailCode",("",[Platform Cpp]) - | Generic -> ":generic",("Marks a class or class field as generic so each type parameter combination generates its own type/field",[UsedOnEither [TClass;TClassField]]) - | GenericBuild -> ":genericBuild",("Builds instances of a type using the specified macro",[UsedOn TClass]) - | GenericInstance -> ":genericInstance",("Internally used to mark instances of @:generic methods",[UsedOn TClassField;UsedInternally]) - | Getter -> ":getter",("Generates a native getter function on the given field",[HasParam "Class field name";UsedOn TClassField;Platform Flash]) - | Hack -> ":hack",("Allows extending classes marked as @:final",[UsedOn TClass]) - | HasUntyped -> (":has_untyped",("Used by the typer to mark fields that have untyped expressions",[UsedInternally])) - | HaxeGeneric -> ":haxeGeneric",("Used internally to annotate non-native generic classes",[Platform Cs; UsedOnEither[TClass;TEnum]; UsedInternally]) - | HeaderClassCode -> ":headerClassCode",("Code to be injected into the generated class, in the header",[Platform Cpp]) - | HeaderCode -> ":headerCode",("Code to be injected into the generated header file",[Platform Cpp]) - | HeaderInclude -> ":headerInclude",("File to be included in generated header file",[Platform Cpp]) - | HeaderNamespaceCode -> ":headerNamespaceCode",("",[Platform Cpp]) - | HlNative -> ":hlNative",("Specifies hdll name and function prefix for native functions",[UsedOnEither [TClass;TClassField];Platform Hl]) - | HxGen -> ":hxGen",("Annotates that an extern class was generated by Haxe",[Platforms [Java;Cs]; UsedOnEither [TClass;TEnum]]) - | IfFeature -> ":ifFeature",("Causes a field to be kept by DCE if the given feature is part of the compilation",[HasParam "Feature name";UsedOn TClassField]) - | Impl -> ":impl",("Used internally to mark abstract implementation fields",[UsedOn TAbstractField; UsedInternally]) - | PythonImport -> ":pythonImport",("Generates python import statement for extern classes",[Platforms [Python]; UsedOn TClass]) - | ImplicitCast -> ":implicitCast",("Generated automatically on the AST when an implicit abstract cast happens",[UsedInternally; UsedOn TExpr]) - | Include -> ":include",("",[Platform Cpp]) - | InitPackage -> ":initPackage",("Some weird thing for Genjs we want to remove someday",[UsedInternally; Platform Js]) - | Inline -> ":inline",("Inserted by the parser in case of `inline expr` and `inline function`",[UsedOn TExpr]) - | InlineConstructorArgument _ -> ":inlineConstructorArgument",("Internally used to mark expressions that were passed as arguments of an inlined constructor",[UsedInternally]) - | Internal -> ":internal",("Generates the annotated field/class with 'internal' access",[Platforms [Java;Cs]; UsedOnEither[TClass;TEnum;TClassField]]) - | IsVar -> ":isVar",("Forces a physical field to be generated for properties that otherwise would not require one",[UsedOn TClassField]) - | JavaCanonical -> ":javaCanonical",("Used by the Java target to annotate the canonical path of the type",[HasParam "Output type package";HasParam "Output type name";UsedOnEither [TClass;TEnum]; Platform Java]) - | JavaNative -> ":javaNative",("Automatically added by -java-lib on classes generated from JAR/class files",[Platform Java; UsedOnEither[TClass;TEnum]; UsedInternally]) - | JsRequire -> ":jsRequire",("Generate javascript module require expression for given extern",[Platform Js; UsedOn TClass]) - | LuaRequire -> ":luaRequire",("Generate lua module require expression for given extern",[Platform Lua; UsedOn TClass]) - | LuaDotMethod -> ":luaDotMethod",("Indicates that the given extern type instance should have dot-style invocation for methods instead of colon.",[Platform Lua; UsedOnEither[TClass;TClassField]]) - | Keep -> ":keep",("Causes a field or type to be kept by DCE",[]) - | KeepInit -> ":keepInit",("Causes a class to be kept by DCE even if all its field are removed",[UsedOn TClass]) - | KeepSub -> ":keepSub",("Extends @:keep metadata to all implementing and extending classes",[UsedOn TClass]) - | LibType -> ":libType",("Used by -net-lib and -java-lib to mark a class that shouldn't be checked (overrides, interfaces, etc) by the type loader",[UsedInternally; UsedOn TClass; Platforms [Java;Cs]]) - | LoopLabel -> ":loopLabel",("Mark loop and break expressions with a label to support breaking from within switch",[UsedInternally]) - | Markup -> ":markup",("Used as a result of inline XML parsing",[]) - | Meta -> ":meta",("Internally used to mark a class field as being the metadata field",[]) - | Macro -> ":macro",("(deprecated)",[]) - | MaybeUsed -> ":maybeUsed",("Internally used by DCE to mark fields that might be kept",[UsedInternally]) - | MergeBlock -> ":mergeBlock",("Merge the annotated block into the current scope",[UsedOn TExpr]) - | MultiReturn -> ":multiReturn",("Annotates an extern class as the result of multi-return function",[UsedOn TClass; Platform Lua]) - | MultiType -> ":multiType",("Specifies that an abstract chooses its this-type from its @:to functions",[UsedOn TAbstract; HasParam "Relevant type parameters"]) - | Native -> ":native",("Rewrites the path of a class or enum during generation",[HasParam "Output type path";UsedOnEither [TClass;TEnum]]) - | NativeChildren -> ":nativeChildren",("Annotates that all children from a type should be treated as if it were an extern definition - platform native",[Platforms [Java;Cs]; UsedOn TClass]) - | NativeGen -> ":nativeGen",("Annotates that a type should be treated as if it were an extern definition - platform native",[Platforms [Java;Cs;Python]; UsedOnEither[TClass;TEnum]]) - | NativeGeneric -> ":nativeGeneric",("Used internally to annotate native generic classes",[Platform Cs; UsedOnEither[TClass;TEnum]; UsedInternally]) - | NativeProperty -> ":nativeProperty",("Use native properties which will execute even with dynamic usage",[Platform Cpp]) - | NativeStaticExtension -> ":nativeStaticExtension",("Converts static function syntax into member call",[Platform Cpp]) - | NoCompletion -> ":noCompletion",("Prevents the compiler from suggesting completion on this field or type",[UsedOn TClassField]) - | NoDebug -> ":noDebug",("Does not generate debug information even if -debug is set",[UsedOnEither [TClass;TClassField];Platforms [Flash;Cpp]]) - | NoDoc -> ":noDoc",("Prevents a type from being included in documentation generation",[]) - | NoExpr -> ":noExpr",("Internally used to mark abstract fields which have no expression by design",[UsedInternally]) - | NoImportGlobal -> ":noImportGlobal",("Prevents a static field from being imported with import Class.*",[UsedOn TAnyField]) - | NonVirtual -> ":nonVirtual",("Declares function to be non-virtual in cpp",[Platform Cpp]) - | NoPackageRestrict -> ":noPackageRestrict",("Allows a module to be accessed across all targets if found on its first type",[UsedInternally]) - | NoPrivateAccess -> ":noPrivateAccess",("Disallow private access to anything for the annotated expression",[UsedOn TExpr]) - | NoStack -> ":noStack",("",[Platform Cpp]) - | NotNull -> ":notNull",("Declares an abstract type as not accepting null values",[UsedOn TAbstract]) - | NoUsing -> ":noUsing",("Prevents a field from being used with 'using'",[UsedOn TClassField]) - | Ns -> ":ns",("Internally used by the Swf generator to handle namespaces",[Platform Flash]) - | NullSafety -> ":nullSafety",("Enables null safety for classes or fields. Disables null safety for classes, fields or expressions if provided with `Off` as an argument (e.g. `@:nullSafety(Off)`)",[UsedOnEither [TClass;TClassField;TExpr]]) - | Objc -> ":objc",("Declares a class or interface that is used to interoperate with Objective-C code",[Platform Cpp;UsedOn TClass]) - | ObjcProtocol -> ":objcProtocol",("Associates an interface with, or describes a function in, a native Objective-C protocol.",[Platform Cpp;UsedOnEither [TClass;TClassField] ]) - | Op -> ":op",("Declares an abstract field as being an operator overload",[HasParam "The operation";UsedOn TAbstractField]) - | Optional -> ":optional",("Marks the field of a structure as optional",[UsedOn TClassField]) - | Overload -> ":overload",("Allows the field to be called with different argument types",[HasParam "Function specification (no expression)";UsedOn TClassField]) - | PhpGlobal -> ":phpGlobal",("Indicates that static fields of an extern class actually are located in the global PHP namespace",[Platform Php;UsedOn TClass]) - | PhpClassConst -> ":phpClassConst",("Indicates that a static var of an extern class is a PHP class constant",[Platform Php;UsedOn TClassField]) - | PhpMagic -> ":phpMagic",("Treat annotated field as special PHP magic field. This meta makes compiler avoid renaming such fields on generating PHP code.",[Platform Php;UsedOn TClassField]) - | PhpNoConstructor -> ":phpNoConstructor",("Special meta for extern classes which do not have native constructor in PHP, but need a constructor in Haxe extern",[Platform Php;UsedOn TClass]) - | Pos -> ":pos",("Sets the position of a reified expression",[HasParam "Position";UsedOn TExpr]) - | Public -> ":public",("Marks a class field as being public",[UsedOn TClassField;UsedInternally]) - | PublicFields -> ":publicFields",("Forces all class fields of inheriting classes to be public",[UsedOn TClass]) - | Private -> ":private",("Marks a class field as being private",[UsedOn TClassField;Platform Cs]) - | PrivateAccess -> ":privateAccess",("Allow private access to anything for the annotated expression",[UsedOn TExpr]) - | Protected -> ":protected",("Marks a class field as being protected",[UsedOn TClassField;Platforms [Cs;Java;Flash]]) - | Property -> ":property",("Marks a property field to be compiled as a native C# property",[UsedOn TClassField;Platform Cs]) - | Pure -> ":pure",("Marks a class field, class or expression as pure (side-effect free)",[UsedOnEither [TClass;TClassField;TExpr]]) - | ReadOnly -> ":readOnly",("Generates a field with the 'readonly' native keyword",[Platform Cs; UsedOn TClassField]) - | RealPath -> ":realPath",("Internally used on @:native types to retain original path information",[UsedInternally]) - | Remove -> ":remove",("Causes an interface to be removed from all implementing classes before generation",[UsedOn TClass]) - | Require -> ":require",("Allows access to a field only if the specified compiler flag is set",[HasParam "Compiler flag to check";UsedOn TClassField]) - | RequiresAssign -> ":requiresAssign",("Used internally to mark certain abstract operator overloads",[UsedInternally]) - | Resolve -> ":resolve",("Abstract fields marked with this metadata can be used to resolve unknown fields",[UsedOn TClassField]) - | Rtti -> ":rtti",("Adds runtime type information",[UsedOn TClass]) - | Runtime -> ":runtime",("?",[]) - | RuntimeValue -> ":runtimeValue",("Marks an abstract as being a runtime value",[UsedOn TAbstract]) - | Scalar -> ":scalar",("Used by hxcpp to mark a custom coreType abstract",[UsedOn TAbstract; Platform Cpp]) - | SelfCall -> ":selfCall",("Translates method calls into calling object directly",[UsedOn TClassField; Platforms [Js;Lua]]) - | Semantics -> ":semantics",("The native semantics of the type",[UsedOnEither [TClass;TTypedef;TAbstract];HasParam "value | reference | variable"]) - | Setter -> ":setter",("Generates a native setter function on the given field",[HasParam "Class field name";UsedOn TClassField;Platform Flash]) - | SkipCtor -> ":skipCtor",("Used internally to generate a constructor as if it were a native type (no __hx_ctor)",[Platforms [Java;Cs]; UsedInternally]) - | SkipReflection -> ":skipReflection",("Used internally to annotate a field that shouldn't have its reflection data generated",[Platforms [Java;Cs]; UsedOn TClassField; UsedInternally]) - | Sound -> ":sound",( "Includes a given .wav or .mp3 file into the target Swf and associates it with the class (must extend flash.media.Sound)",[HasParam "File path";UsedOn TClass;Platform Flash]) - | SourceFile -> ":sourceFile",("Source code filename for external class",[Platform Cpp]) - | StackOnly -> ":stackOnly",("Instances of this type can only appear on the stack",[Platform Cpp]) - | StaticExtension -> "haxe.internal.static_extension",("Used internally to mark static extension fields",[UsedInternally]) - | StoredTypedExpr -> ":storedTypedExpr",("Used internally to reference a typed expression returned from a macro",[UsedInternally]) - | Strict -> ":strict",("Used to declare a native C# attribute or a native Java metadata. Is type checked",[Platforms [Java;Cs]]) - | Struct -> ":struct",("Marks a class definition as a struct",[Platforms [Cs;Hl]; UsedOn TClass]) - | StructAccess -> ":structAccess",("Marks an extern class as using struct access('.') not pointer('->')",[Platform Cpp; UsedOn TClass]) - | StructInit -> ":structInit",("Allows one to initialize the class with a structure that matches constructor parameters",[UsedOn TClass]) - | SuppressWarnings -> ":suppressWarnings",("Adds a SuppressWarnings annotation for the generated Java class",[Platform Java; UsedOn TClass]) - | TemplatedCall -> ":templatedCall",("Indicates that the first parameter of static call should be treated as a template argument",[Platform Cpp; UsedOn TClassField]) - | Throws -> ":throws",("Adds a 'throws' declaration to the generated function",[HasParam "Type as String"; Platform Java; UsedOn TClassField]) - | This -> ":this",("Internally used to pass a 'this' expression to macros",[UsedInternally; UsedOn TExpr]) - | To -> ":to",("Specifies that the field of the abstract is a cast operation to the type identified in the function",[UsedOn TAbstractField]) - | ToString -> ":toString",("Internally used",[UsedInternally]) - | Transient -> ":transient",("Adds the 'transient' flag to the class field",[Platform Java; UsedOn TClassField]) - | ValueUsed -> ":valueUsed",("Internally used by DCE to mark an abstract value as used",[UsedInternally]) - | Volatile -> ":volatile",("",[Platforms [Java;Cs]]) - | UnifyMinDynamic -> ":unifyMinDynamic",("Allows a collection of types to unify to Dynamic",[UsedOn TClassField]) - | Unreflective -> ":unreflective",("",[Platform Cpp]) - | Unsafe -> ":unsafe",("Declares a class, or a method with the C#'s 'unsafe' flag",[Platform Cs; UsedOnEither [TClass;TClassField]]) - | Used -> ":used",("Internally used by DCE to mark a class or field as used",[UsedInternally]) - | Using -> ":using",("Automatically uses the argument types as static extensions for the annotated type",[UsedOnEither [TClass;TEnum;TAbstract]]) - | Value -> ":value",("Used to store default values for fields and function arguments",[UsedOn TClassField]) - | Void -> ":void",("Use Cpp native 'void' return type",[Platform Cpp]) - | Last -> assert false - (* do not put any custom metadata after Last *) - | Dollar s -> "$" ^ s,("",[]) - | Custom s -> s,("",[]) - let to_string m = fst (get_info m) let hmeta = @@ -417,10 +38,8 @@ let get_documentation d = let params = ref [] and used = ref [] and pfs = ref [] in List.iter (function | HasParam s -> params := s :: !params - | Platform f -> pfs := f :: !pfs | Platforms fl -> pfs := fl @ !pfs - | UsedOn u -> used := u :: !used - | UsedOnEither ul -> used := ul @ !used + | UsedOn ul -> used := ul @ !used | UsedInternally -> assert false ) flags; let params = (match List.rev !params with diff --git a/src/prebuild/main.ml b/src/prebuild/main.ml new file mode 100644 index 00000000000..afdb7b81154 --- /dev/null +++ b/src/prebuild/main.ml @@ -0,0 +1,203 @@ +open Json + +exception Prebuild_error of string + +let as_string = function + | JString s -> Some s + | _ -> None + +let as_params = function + | JArray s -> Some (List.map (function + | JString s -> s + | _ -> raise (Prebuild_error "parameter description should be a string") + ) s) + | _ -> None + +let as_platforms = function + | JArray s -> Some (List.map (function + | JString "cross" -> "Cross" + | JString "js" -> "Js" + | JString "lua" -> "Lua" + | JString "neko" -> "Neko" + | JString "flash" -> "Flash" + | JString "php" -> "Php" + | JString "cpp" -> "Cpp" + | JString "cs" -> "Cs" + | JString "java" -> "Java" + | JString "python" -> "Python" + | JString "hl" -> "Hl" + | JString "eval" -> "Eval" + | _ -> raise (Prebuild_error "invalid platform") + ) s) + | _ -> None + +let as_targets = function + | JArray s -> Some (List.map (function + | JString "TClass" -> "TClass" + | JString "TClassField" -> "TClassField" + | JString "TAbstract" -> "TAbstract" + | JString "TAbstractField" -> "TAbstractField" + | JString "TEnum" -> "TEnum" + | JString "TTypedef" -> "TTypedef" + | JString "TAnyField" -> "TAnyField" + | JString "TExpr" -> "TExpr" + | JString "TTypeParameter" -> "TTypeParameter" + | _ -> raise (Prebuild_error "invalid metadata target") + ) s) + | _ -> None + +let as_bool = function + | JBool b -> Some b + | _ -> None + +let get_optional_field name map default fields = + try + let field = List.find (fun (n, _) -> n = name) fields in + let value = map (snd field) in + match value with + | None -> raise (Prebuild_error ("field `" ^ name ^ "` has invalid data")) + | Some v -> v + with Not_found -> default + +let get_field name map fields = + let field = try List.find (fun (n, _) -> n = name) fields with Not_found -> raise (Prebuild_error ("no `" ^ name ^ "` field")) in + let value = map (snd field) in + match value with + | None -> raise (Prebuild_error ("field `" ^ name ^ "` has invalid data")) + | Some v -> v + +let parse_define json = + let fields = match json with + | JObject fl -> fl + | _ -> raise (Prebuild_error "not an object") + in + (*name*) get_field "name" as_string fields, + (*define*) get_field "define" as_string fields, + (*doc*) get_field "doc" as_string fields, + (*params*) get_optional_field "params" as_params [] fields, + (*platforms*) get_optional_field "platforms" as_platforms [] fields + +let parse_meta json = + let fields = match json with + | JObject fl -> fl + | _ -> raise (Prebuild_error "not an object") + in + (* name *) get_field "name" as_string fields, + (* metadata *) get_field "metadata" as_string fields, + (* doc *) get_field "doc" as_string fields, + (* params *) get_optional_field "params" as_params [] fields, + (* platforms *) get_optional_field "platforms" as_platforms [] fields, + (* targets *) get_optional_field "targets" as_targets [] fields, + (* internal *) get_optional_field "internal" as_bool false fields + +let parse_file_array path map = + let file = open_in path in + let data = Std.input_all file in + let open Json.Reader in + let lexbuf = Sedlexing.Utf8.from_string data in + let json = read_json lexbuf in + match json with + | JArray s -> List.map map s + | _ -> raise (Prebuild_error "not an array") + +let gen_platforms = function + | [] -> [] + | platforms -> ["Platforms [" ^ (String.concat ";" platforms) ^ "]"] + +let gen_params = List.map (function param -> "HasParam \"" ^ param ^ "\"" ) + +let gen_define_type defines = + String.concat "\n" (List.map (function (name, _, _, _, _) -> "\t| " ^ name) defines) + +let gen_define_info defines = + let define_str = List.map (function + (name, define, doc, params, platforms) -> + let platforms_str = gen_platforms platforms in + let params_str = gen_params params in + "\t| " ^ name ^ " -> \"" ^ define ^ "\",(" ^ (Printf.sprintf "%S" doc) ^ ",[" ^ (String.concat "; " (platforms_str @ params_str)) ^ "])" + ) defines in + String.concat "\n" define_str + +let gen_meta_type metas = + String.concat "\n" (List.map (function + | ("InlineConstructorArgument", _, _, _, _, _, _) -> "\t| InlineConstructorArgument of int * int" + | (name, _, _, _, _, _, _) -> "\t| " ^ name + ) metas) + +let gen_meta_info metas = + let meta_str = List.map (function + (name, metadata, doc, params, platforms, targets, internal) -> + let platforms_str = gen_platforms platforms in + let params_str = gen_params params in + let targets_str = (match targets with + | [] -> [] + | targets -> ["UsedOn [" ^ (String.concat ";" targets) ^ "]"] + ) in + let internal_str = if internal then ["UsedInternally"] else [] in + let name = (match name with + (* this is a hacky, I know *) + | "InlineConstructorArgument" -> "InlineConstructorArgument _" + | _ -> name + ) in + "\t| " ^ name ^ " -> \"" ^ metadata ^ "\",(" ^ (Printf.sprintf "%S" doc) ^ ",[" ^ (String.concat "; " (platforms_str @ params_str @ targets_str @ internal_str)) ^ "])" + ) metas in + String.concat "\n" meta_str + +let autogen_header = "(* This file is auto-generated using prebuild from files in src-json *) +(* Do not edit manually! *) +" + +let define_header = autogen_header ^ " +open Globals + +type define_parameter = + | HasParam of string + | Platforms of platform list + +" + +let meta_header = autogen_header ^ " +open Globals + +type meta_usage = + | TClass + | TClassField + | TAbstract + | TAbstractField + | TEnum + | TTypedef + | TAnyField + | TExpr + | TTypeParameter + | TVariable + +type meta_parameter = + | HasParam of string + | Platforms of platform list + | UsedOn of meta_usage list + | UsedInternally + +" + +;; + +match Sys.argv with + | [|_; "define"; define_path|] -> + let defines = parse_file_array define_path parse_define in + Printf.printf "%s" define_header; + Printf.printf "type strict_defined =\n"; + Printf.printf "%s" (gen_define_type defines); + Printf.printf "\n\t| Last\n\n"; (* must be last *) + Printf.printf "let infos = function\n"; + Printf.printf "%s" (gen_define_info defines); + Printf.printf "\n\t| Last -> assert false\n" + | [|_; "meta"; meta_path|] -> + let metas = parse_file_array meta_path parse_meta in + Printf.printf "%s" meta_header; + Printf.printf "type strict_meta =\n"; + Printf.printf "%s" (gen_meta_type metas); + Printf.printf "\n\t| Last\n\t| Dollar of string\n\t| Custom of string\n\n"; + Printf.printf "let get_info = function\n"; + Printf.printf "%s" (gen_meta_info metas); + Printf.printf "\n\t| Last -> assert false\n\t| Dollar s -> \"$\" ^ s,(\"\",[])\n\t| Custom s -> s,(\"\",[])\n" + | _ -> ()