From ed67dc21827c67eec5a3abb663a8ffc71d5bfe7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabri=C3=ABl=20Konat?= Date: Tue, 19 Jul 2011 16:20:48 +0200 Subject: [PATCH] Improved code reuse and fixed some incorrect tag names in XML code generation. Added normalization step to lua/XML code generation that adds required plugins and components. Updated type data files from the DSLTypeExtractor to the newest version. --- DSL/DiversiaScript/syntax/data/enum.sdf | 43 +++++-- DSL/DiversiaScript/syntax/data/plugin.sdf | 1 + DSL/DiversiaScript/syntax/data/type-func.sdf | 12 +- DSL/DiversiaScript/syntax/data/type-prop.sdf | 37 +++--- DSL/DiversiaScript/syntax/data/type.sdf | 7 +- .../codegen/lua/{luagen.str => generate.str} | 3 +- .../trans/codegen/lua/normalise.str | 34 +++++ .../codegen/xml/{xmlgen.str => generate.str} | 30 ++--- DSL/DiversiaScript/trans/data/enum.str | 102 ++++++++++----- DSL/DiversiaScript/trans/data/plugin.str | 3 +- DSL/DiversiaScript/trans/data/type-base.str | 57 +++++---- DSL/DiversiaScript/trans/data/type-cons.str | 2 +- DSL/DiversiaScript/trans/data/type-func.str | 44 ++++--- DSL/DiversiaScript/trans/data/type-op.str | 14 +- DSL/DiversiaScript/trans/data/type-prop.str | 120 ++++++++++-------- DSL/DiversiaScript/trans/data/type.str | 7 +- DSL/DiversiaScript/trans/diversiascript.str | 15 ++- 17 files changed, 324 insertions(+), 207 deletions(-) rename DSL/DiversiaScript/trans/codegen/lua/{luagen.str => generate.str} (99%) create mode 100644 DSL/DiversiaScript/trans/codegen/lua/normalise.str rename DSL/DiversiaScript/trans/codegen/xml/{xmlgen.str => generate.str} (76%) diff --git a/DSL/DiversiaScript/syntax/data/enum.sdf b/DSL/DiversiaScript/syntax/data/enum.sdf index 4b15f2d..98d6919 100644 --- a/DSL/DiversiaScript/syntax/data/enum.sdf +++ b/DSL/DiversiaScript/syntax/data/enum.sdf @@ -19,20 +19,6 @@ exports "SmallHail" -> PrecipitationTypeValue {cons("SmallHail")} "Custom" -> PrecipitationTypeValue {cons("Custom")} - "ClientServerPluginType" -> ClientServerPluginTypeEnumType {cons("ClientServerPluginType")} - ClientServerPluginTypeEnumType -> EnumType - ClientServerPluginTypeEnumType "." ClientServerPluginTypeValue -> Exp {prefer, cons("EnumValueRef")} - "PermissionManager" -> ClientServerPluginTypeValue {cons("PermissionManager")} - "ResourceManager" -> ClientServerPluginTypeValue {cons("ResourceManager")} - "Lua" -> ClientServerPluginTypeValue {cons("Lua")} - "ServerNeighbors" -> ClientServerPluginTypeValue {cons("ServerNeighbors")} - "Sky" -> ClientServerPluginTypeValue {cons("Sky")} - "ObjectTemplateManager" -> ClientServerPluginTypeValue {cons("ObjectTemplateManager")} - "ObjectManager" -> ClientServerPluginTypeValue {cons("ObjectManager")} - "Terrain" -> ClientServerPluginTypeValue {cons("Terrain")} - "GameMode" -> ClientServerPluginTypeValue {cons("GameMode")} - "SceneManager" -> ClientServerPluginTypeValue {cons("SceneManager")} - "ComponentType" -> ComponentTypeEnumType {cons("ComponentType")} ComponentTypeEnumType -> EnumType ComponentTypeEnumType "." ComponentTypeValue -> Exp {prefer, cons("EnumValueRef")} @@ -325,12 +311,41 @@ exports "Kinematic" -> PhysicsTypeValue {cons("Kinematic")} "Dynamic" -> PhysicsTypeValue {cons("Dynamic")} + "PluginType" -> PluginTypeEnumType {cons("PluginType")} + PluginTypeEnumType -> EnumType + PluginTypeEnumType "." PluginTypeValue -> Exp {prefer, cons("EnumValueRef")} + "PermissionManager" -> PluginTypeValue {cons("PermissionManager")} + "ResourceManager" -> PluginTypeValue {cons("ResourceManager")} + "Lua" -> PluginTypeValue {cons("Lua")} + "ServerNeighbors" -> PluginTypeValue {cons("ServerNeighbors")} + "Sky" -> PluginTypeValue {cons("Sky")} + "ObjectTemplateManager" -> PluginTypeValue {cons("ObjectTemplateManager")} + "ObjectManager" -> PluginTypeValue {cons("ObjectManager")} + "Terrain" -> PluginTypeValue {cons("Terrain")} + "GameMode" -> PluginTypeValue {cons("GameMode")} + "SceneManager" -> PluginTypeValue {cons("SceneManager")} + "LevelManager" -> PluginTypeValue {cons("LevelManager")} + "ResourceLocationType" -> ResourceLocationTypeEnumType {cons("ResourceLocationType")} ResourceLocationTypeEnumType -> EnumType ResourceLocationTypeEnumType "." ResourceLocationTypeValue -> Exp {prefer, cons("EnumValueRef")} "FileSystem" -> ResourceLocationTypeValue {cons("FileSystem")} "URL" -> ResourceLocationTypeValue {cons("URL")} + "ResourceType" -> ResourceTypeEnumType {cons("ResourceType")} + ResourceTypeEnumType -> EnumType + ResourceTypeEnumType "." ResourceTypeValue -> Exp {prefer, cons("EnumValueRef")} + "Generic" -> ResourceTypeValue {cons("Generic")} + "OgreMesh" -> ResourceTypeValue {cons("OgreMesh")} + "BulletMesh" -> ResourceTypeValue {cons("BulletMesh")} + "Skeleton" -> ResourceTypeValue {cons("Skeleton")} + "Texture" -> ResourceTypeValue {cons("Texture")} + "MaterialScript" -> ResourceTypeValue {cons("MaterialScript")} + "ParticleScript" -> ResourceTypeValue {cons("ParticleScript")} + "LuaScript" -> ResourceTypeValue {cons("LuaScript")} + "Audio" -> ResourceTypeValue {cons("Audio")} + "Level" -> ResourceTypeValue {cons("Level")} + "SkyType" -> SkyTypeEnumType {cons("SkyType")} SkyTypeEnumType -> EnumType SkyTypeEnumType "." SkyTypeValue -> Exp {prefer, cons("EnumValueRef")} diff --git a/DSL/DiversiaScript/syntax/data/plugin.sdf b/DSL/DiversiaScript/syntax/data/plugin.sdf index cfb99b4..8a93a75 100644 --- a/DSL/DiversiaScript/syntax/data/plugin.sdf +++ b/DSL/DiversiaScript/syntax/data/plugin.sdf @@ -10,3 +10,4 @@ exports "Sky" -> PluginType {cons("Sky")} "Terrain" -> PluginType {cons("Terrain")} "SceneManager" -> PluginType {cons("SceneManager")} + "LevelManager" -> PluginType {cons("LevelManager")} diff --git a/DSL/DiversiaScript/syntax/data/type-func.sdf b/DSL/DiversiaScript/syntax/data/type-func.sdf index df7feb9..f9d6f20 100644 --- a/DSL/DiversiaScript/syntax/data/type-func.sdf +++ b/DSL/DiversiaScript/syntax/data/type-func.sdf @@ -6,14 +6,9 @@ exports context-free syntax - "Run_garbage_collection" -> BuiltinFunction {cons("Run_garbage_collection")} - "ForceSerialize" -> BuiltinFunction {cons("ForceSerialize")} - "CreatePlugin" -> BuiltinFunction {cons("CreatePlugin")} - "GetPlugin" -> BuiltinFunction {cons("GetPlugin")} - "HasPlugin" -> BuiltinFunction {cons("HasPlugin")} - "DestroyPlugin" -> BuiltinFunction {cons("DestroyPlugin")} + "Run_garbage_collection" -> BuiltinFunction {cons("Run_garbage_collection")} "IsCreatedBy" -> BuiltinFunction {cons("IsCreatedBy")} "IsCreatedBySource" -> BuiltinFunction {cons("IsCreatedBySource")} @@ -115,6 +110,11 @@ exports "ApplyCentralImpulse" -> BuiltinFunction {cons("ApplyCentralImpulse")} "ApplyTorque" -> BuiltinFunction {cons("ApplyTorque")} + "CreatePlugin" -> BuiltinFunction {cons("CreatePlugin")} + "GetPlugin" -> BuiltinFunction {cons("GetPlugin")} + "HasPlugin" -> BuiltinFunction {cons("HasPlugin")} + "DestroyPlugin" -> BuiltinFunction {cons("DestroyPlugin")} + "AddServer" -> BuiltinFunction {cons("AddServer")} "GetServer" -> BuiltinFunction {cons("GetServer")} "HasServer" -> BuiltinFunction {cons("HasServer")} diff --git a/DSL/DiversiaScript/syntax/data/type-prop.sdf b/DSL/DiversiaScript/syntax/data/type-prop.sdf index cd99b85..98ed74e 100644 --- a/DSL/DiversiaScript/syntax/data/type-prop.sdf +++ b/DSL/DiversiaScript/syntax/data/type-prop.sdf @@ -10,14 +10,6 @@ exports "ServerNeighbors" -> BuiltinProperty {cons("ServerNeighbors")} - "Type" -> BuiltinProperty {cons("Type")} - "TypeName" -> BuiltinProperty {cons("TypeName")} - "Mode" -> BuiltinProperty {cons("Mode")} - "PluginManager" -> BuiltinProperty {cons("PluginManager")} - - "Mode" -> BuiltinProperty {cons("Mode")} - "Plugins" -> BuiltinProperty {cons("Plugins")} - "WorldSize" -> BuiltinProperty {cons("WorldSize")} "TextureNames" -> BuiltinProperty {cons("TextureNames")} @@ -165,6 +157,9 @@ exports "WindowWidth" -> BuiltinProperty {cons("WindowWidth")} "WindowHeight" -> BuiltinProperty {cons("WindowHeight")} + "DefaultLevel" -> BuiltinProperty {cons("DefaultLevel")} + "LoadedPlugins" -> BuiltinProperty {cons("LoadedPlugins")} + "LightType" -> BuiltinProperty {cons("LightType")} "CastShadows" -> BuiltinProperty {cons("CastShadows")} "DiffuseColour" -> BuiltinProperty {cons("DiffuseColour")} @@ -202,6 +197,8 @@ exports "Enabled" -> BuiltinProperty {cons("Enabled")} "Speed" -> BuiltinProperty {cons("Speed")} + "BackgroundInitialise" -> BuiltinProperty {cons("BackgroundInitialise")} + "BackgroundLoad" -> BuiltinProperty {cons("BackgroundLoad")} "Type" -> BuiltinProperty {cons("Type")} "ResourceLocation" -> BuiltinProperty {cons("ResourceLocation")} "Group" -> BuiltinProperty {cons("Group")} @@ -259,6 +256,14 @@ exports "Caption" -> BuiltinProperty {cons("Caption")} "Colour" -> BuiltinProperty {cons("Colour")} + "Type" -> BuiltinProperty {cons("Type")} + "TypeName" -> BuiltinProperty {cons("TypeName")} + "Mode" -> BuiltinProperty {cons("Mode")} + "PluginManager" -> BuiltinProperty {cons("PluginManager")} + + "Mode" -> BuiltinProperty {cons("Mode")} + "Plugins" -> BuiltinProperty {cons("Plugins")} + "File" -> BuiltinProperty {cons("File")} "Type" -> BuiltinProperty {cons("Type")} "Priority" -> BuiltinProperty {cons("Priority")} @@ -308,10 +313,6 @@ exports "InheritScale" -> BuiltinProperty {cons("InheritScale")} "InheritScale" -> BuiltinObjectProperty {cons("InheritScale")} - "X" -> BuiltinProperty {cons("X")} - "Y" -> BuiltinProperty {cons("Y")} - "Z" -> BuiltinProperty {cons("Z")} - "W" -> BuiltinProperty {cons("W")} "XAxis" -> BuiltinProperty {cons("XAxis")} "YAxis" -> BuiltinProperty {cons("YAxis")} "ZAxis" -> BuiltinProperty {cons("ZAxis")} @@ -327,26 +328,30 @@ exports "ShortestPitch" -> BuiltinProperty {cons("ShortestPitch")} "Yaw" -> BuiltinProperty {cons("Yaw")} "ShortestYaw" -> BuiltinProperty {cons("ShortestYaw")} + "X" -> BuiltinProperty {cons("X")} + "Y" -> BuiltinProperty {cons("Y")} + "Z" -> BuiltinProperty {cons("Z")} + "W" -> BuiltinProperty {cons("W")} "Degrees" -> BuiltinProperty {cons("Degrees")} "AngleUnits" -> BuiltinProperty {cons("AngleUnits")} "Radians" -> BuiltinProperty {cons("Radians")} - "X" -> BuiltinProperty {cons("X")} - "Y" -> BuiltinProperty {cons("Y")} "Length" -> BuiltinProperty {cons("Length")} "SquaredLength" -> BuiltinProperty {cons("SquaredLength")} "IsZeroLength" -> BuiltinProperty {cons("IsZeroLength")} "NormalisedCopy" -> BuiltinProperty {cons("NormalisedCopy")} - "X" -> BuiltinProperty {cons("X")} "Y" -> BuiltinProperty {cons("Y")} - "Z" -> BuiltinProperty {cons("Z")} + "Zero" -> BuiltinProperty {cons("Zero")} "Length" -> BuiltinProperty {cons("Length")} "SquaredLength" -> BuiltinProperty {cons("SquaredLength")} "IsZeroLength" -> BuiltinProperty {cons("IsZeroLength")} "NormalisedCopy" -> BuiltinProperty {cons("NormalisedCopy")} + "X" -> BuiltinProperty {cons("X")} + "Y" -> BuiltinProperty {cons("Y")} + "Z" -> BuiltinProperty {cons("Z")} "X" -> BuiltinProperty {cons("X")} "Y" -> BuiltinProperty {cons("Y")} diff --git a/DSL/DiversiaScript/syntax/data/type.sdf b/DSL/DiversiaScript/syntax/data/type.sdf index a31dc2d..9e5b8e5 100644 --- a/DSL/DiversiaScript/syntax/data/type.sdf +++ b/DSL/DiversiaScript/syntax/data/type.sdf @@ -12,12 +12,10 @@ exports "ClientObjectManager" -> BuiltinType {cons("ClientObjectManager")} "ClientObjectTemplate" -> BuiltinType {cons("ClientObjectTemplate")} "ClientObjectTemplateManager" -> BuiltinType {cons("ClientObjectTemplateManager")} + "ClientPlugin" -> BuiltinType {cons("ClientPlugin")} "Lua" -> BuiltinType {cons("Lua")} "PermissionManager" -> BuiltinType {cons("PermissionManager")} "ServerNeighborsPlugin" -> BuiltinType {cons("ServerNeighborsPlugin")} - "ServerPlugin" -> BuiltinType {cons("ServerPlugin")} - "ClientServerPlugin" -> BuiltinType {cons("ClientServerPlugin")} - "ClientServerPluginManager" -> BuiltinType {cons("ClientServerPluginManager")} "LayerInstance" -> BuiltinType {cons("LayerInstance")} "Component" -> BuiltinType {cons("Component")} "ComponentHandle" -> BuiltinType {cons("ComponentHandle")} @@ -37,6 +35,7 @@ exports "GameMode" -> BuiltinType {cons("GameMode")} "InputManager" -> BuiltinType {cons("InputManager")} "KeyboardState" -> BuiltinType {cons("KeyboardState")} + "LevelManager" -> BuiltinType {cons("LevelManager")} "Light" -> BuiltinType {cons("Light")} "LuaObjectScript" -> BuiltinType {cons("LuaObjectScript")} "Mesh" -> BuiltinType {cons("Mesh")} @@ -49,6 +48,8 @@ exports "Sky" -> BuiltinType {cons("Sky")} "Terrain" -> BuiltinType {cons("Terrain")} "Text" -> BuiltinType {cons("Text")} + "Plugin" -> BuiltinType {cons("Plugin")} + "PluginManager" -> BuiltinType {cons("PluginManager")} "PropertySynchronization" -> BuiltinType {cons("PropertySynchronization")} "ResourceInfo" -> BuiltinType {cons("ResourceInfo")} "ServerInfo" -> BuiltinType {cons("ServerInfo")} diff --git a/DSL/DiversiaScript/trans/codegen/lua/luagen.str b/DSL/DiversiaScript/trans/codegen/lua/generate.str similarity index 99% rename from DSL/DiversiaScript/trans/codegen/lua/luagen.str rename to DSL/DiversiaScript/trans/codegen/lua/generate.str index 9866ac9..21ababd 100644 --- a/DSL/DiversiaScript/trans/codegen/lua/luagen.str +++ b/DSL/DiversiaScript/trans/codegen/lua/generate.str @@ -1,4 +1,4 @@ -module codegen/lua/luagen +module codegen/lua/generate imports @@ -6,7 +6,6 @@ imports libstratego-gpp include/DiversiaScript include/Lua - lib/namespaces namespace signatures diff --git a/DSL/DiversiaScript/trans/codegen/lua/normalise.str b/DSL/DiversiaScript/trans/codegen/lua/normalise.str new file mode 100644 index 0000000..ae19aa4 --- /dev/null +++ b/DSL/DiversiaScript/trans/codegen/lua/normalise.str @@ -0,0 +1,34 @@ +module codegen/lua/normalise + +imports + + include/DiversiaScript + + signatures + +rules // Normalisation rules that add plugins and components to objects to make them work with lua/game xml. + + normalise-luaxml(|mediaDir): Start(imports, pluginDefs, objectDefs, eventDefs) -> + Start(imports, pluginDefs', objectDefs, eventDefs) + where pluginDefs' := [ // Add PermissionManager, ResourceManager and Lua plugin. + pluginDefs, + [ + PluginDef("ResourceManager", ResourceManager(), [ + PluginProp(ResourceManager(), Type(), EnumValueRef(ResourceLocationType(), FileSystem())), + PluginProp(ResourceManager(), ResourceLocation(), StrConst(mediaDir)) + ]), + PluginDef("LevelManager", LevelManager(), []) + ] + ] + + normalise-luaxml: ObjectDef(name, propAssigns, propDefs, componentDefs, varDefs, defaultStateDef, stateDefs, eventDefs) -> + ObjectDef(name, propAssigns, propDefs, componentDefs', varDefs, defaultStateDef, stateDefs, eventDefs) + where componentDefs' := [ // Add LuaObjectScript component. + componentDefs, + [ + ComponentDef("LuaObjectScript", LuaObjectScript(), [ + ComponentProp(LuaObjectScript(), ClientScriptFile(), StrConst($[gen/[name].lua])), + ComponentProp(LuaObjectScript(), ClientSecurityLevel(), StrConst("Low")) + ]) + ] + ] \ No newline at end of file diff --git a/DSL/DiversiaScript/trans/codegen/xml/xmlgen.str b/DSL/DiversiaScript/trans/codegen/xml/generate.str similarity index 76% rename from DSL/DiversiaScript/trans/codegen/xml/xmlgen.str rename to DSL/DiversiaScript/trans/codegen/xml/generate.str index cb137da..5e9044a 100644 --- a/DSL/DiversiaScript/trans/codegen/xml/xmlgen.str +++ b/DSL/DiversiaScript/trans/codegen/xml/generate.str @@ -1,4 +1,4 @@ -module codegen/xml/xmlgen +module codegen/xml/generate imports @@ -19,7 +19,7 @@ imports rules // Structure - to-game-xml: Start(imports, pluginDefs, objectDefs, eventDefs) -> + to-game-xml: Start(_, pluginDefs, objectDefs, _) -> XMLNode("ClientPluginManager", [XMLNode("Plugins", [ pluginDefs, [XMLNode("item", [ @@ -52,7 +52,7 @@ rules // Object definitions (object templates) rules // Components (component templates) to-game-xml: ComponentDef(name, type, properties) -> XMLNode("item", [ - XMLNode("key", [XMLElement("type", type), XMLElement("name", name)]), + XMLNode("key", [XMLElement("Type", type), XMLElement("Name", name)]), XMLNode("value", [XMLNode("Properties", properties)]) ]) @@ -94,17 +94,17 @@ rules // Expressions (no type info) to-game-xml: New(type, params) -> XMLElement(name, value) \)> (propertyNames, values) where values := params - where (propertyNames, _) := values)> type + where (propertyNames, _) := values)> type rules // Expressions (with type info) - to-game-xml-typeinfo: True() -> XMLElement("bool", 1) - to-game-xml-typeinfo: False() -> XMLElement("bool", 0) - to-game-xml-typeinfo: IntConst(num) -> XMLElement("int", num) - to-game-xml-typeinfo: FloatConst(num) -> XMLElement("float", num) - to-game-xml-typeinfo: StrConst(string) -> XMLElement("string", string') + to-game-xml-typeinfo: exp@True() -> XMLElement("bool", exp) + to-game-xml-typeinfo: exp@False() -> XMLElement("bool", exp) + to-game-xml-typeinfo: exp@IntConst(num) -> XMLElement("int", exp) + to-game-xml-typeinfo: exp@FloatConst(num) -> XMLElement("float", exp) + to-game-xml-typeinfo: exp@StrConst(string) -> XMLElement("string", exp) where string' := string - to-game-xml-typeinfo: StrConst(string) -> XMLElement("string", string) + to-game-xml-typeinfo: exp@StrConst(string) -> XMLElement("string", exp) where not ( string) to-game-xml-typeinfo: Vector2Const(exp1, exp2) -> New(Vector2(), [exp1, exp2]) @@ -112,9 +112,7 @@ rules // Expressions (with type info) New(Vector3(), [exp1, exp2, exp3]) to-game-xml-typeinfo: Vector4Const(exp1, exp2, exp3, exp4) -> New(Vector4(), [exp1, exp2, exp3, exp4]) - to-game-xml-typeinfo: EnumValueRef(enum, value) -> - XMLNode("enum", [XMLElement( enum, value)]) - to-game-xml-typeinfo: New(type, params) -> - XMLNode("object", [XMLNode( type, XMLElement(name, value) \)> (propertyNames, values))]) - where values := params - where (propertyNames, _) := values)> type \ No newline at end of file + to-game-xml-typeinfo: exp@EnumValueRef(enum, value) -> + XMLNode("enum", [XMLElement( enum, exp)]) + to-game-xml-typeinfo: exp@New(type, params) -> + XMLNode("object", [XMLNode( type, exp)]) \ No newline at end of file diff --git a/DSL/DiversiaScript/trans/data/enum.str b/DSL/DiversiaScript/trans/data/enum.str index 013c55a..01e9225 100644 --- a/DSL/DiversiaScript/trans/data/enum.str +++ b/DSL/DiversiaScript/trans/data/enum.str @@ -38,39 +38,6 @@ rules builtin-enum-name(|param0) = ?8; param0; !Custom() builtin-enum-values: PrecipitationType() -> [(Drizzle(), 0), (Rain(), 1), (Snow(), 2), (Snowgrains(), 3), (Icecrystals(), 4), (Icepellets(), 5), (Hail(), 6), (SmallHail(), 7), (Custom(), 8)] - is-builtin-enum = ?ClientServerPluginType() - has-builtin-enum-valueName(|param0) = ?PermissionManager(); param0 - builtin-enum-value(|param0) = ?PermissionManager(); param0; !0 - builtin-enum-name(|param0) = ?0; param0; !PermissionManager() - has-builtin-enum-valueName(|param0) = ?ResourceManager(); param0 - builtin-enum-value(|param0) = ?ResourceManager(); param0; !1 - builtin-enum-name(|param0) = ?1; param0; !ResourceManager() - has-builtin-enum-valueName(|param0) = ?Lua(); param0 - builtin-enum-value(|param0) = ?Lua(); param0; !2 - builtin-enum-name(|param0) = ?2; param0; !Lua() - has-builtin-enum-valueName(|param0) = ?ServerNeighbors(); param0 - builtin-enum-value(|param0) = ?ServerNeighbors(); param0; !3 - builtin-enum-name(|param0) = ?3; param0; !ServerNeighbors() - has-builtin-enum-valueName(|param0) = ?Sky(); param0 - builtin-enum-value(|param0) = ?Sky(); param0; !4 - builtin-enum-name(|param0) = ?4; param0; !Sky() - has-builtin-enum-valueName(|param0) = ?ObjectTemplateManager(); param0 - builtin-enum-value(|param0) = ?ObjectTemplateManager(); param0; !5 - builtin-enum-name(|param0) = ?5; param0; !ObjectTemplateManager() - has-builtin-enum-valueName(|param0) = ?ObjectManager(); param0 - builtin-enum-value(|param0) = ?ObjectManager(); param0; !6 - builtin-enum-name(|param0) = ?6; param0; !ObjectManager() - has-builtin-enum-valueName(|param0) = ?Terrain(); param0 - builtin-enum-value(|param0) = ?Terrain(); param0; !7 - builtin-enum-name(|param0) = ?7; param0; !Terrain() - has-builtin-enum-valueName(|param0) = ?GameMode(); param0 - builtin-enum-value(|param0) = ?GameMode(); param0; !8 - builtin-enum-name(|param0) = ?8; param0; !GameMode() - has-builtin-enum-valueName(|param0) = ?SceneManager(); param0 - builtin-enum-value(|param0) = ?SceneManager(); param0; !9 - builtin-enum-name(|param0) = ?9; param0; !SceneManager() - builtin-enum-values: ClientServerPluginType() -> [(PermissionManager(), 0), (ResourceManager(), 1), (Lua(), 2), (ServerNeighbors(), 3), (Sky(), 4), (ObjectTemplateManager(), 5), (ObjectManager(), 6), (Terrain(), 7), (GameMode(), 8), (SceneManager(), 9)] - is-builtin-enum = ?ComponentType() has-builtin-enum-valueName(|param0) = ?SceneNode(); param0 builtin-enum-value(|param0) = ?SceneNode(); param0; !0 @@ -821,6 +788,42 @@ rules builtin-enum-name(|param0) = ?2; param0; !Dynamic() builtin-enum-values: PhysicsType() -> [(Static(), 0), (Kinematic(), 1), (Dynamic(), 2)] + is-builtin-enum = ?PluginType() + has-builtin-enum-valueName(|param0) = ?PermissionManager(); param0 + builtin-enum-value(|param0) = ?PermissionManager(); param0; !0 + builtin-enum-name(|param0) = ?0; param0; !PermissionManager() + has-builtin-enum-valueName(|param0) = ?ResourceManager(); param0 + builtin-enum-value(|param0) = ?ResourceManager(); param0; !1 + builtin-enum-name(|param0) = ?1; param0; !ResourceManager() + has-builtin-enum-valueName(|param0) = ?Lua(); param0 + builtin-enum-value(|param0) = ?Lua(); param0; !2 + builtin-enum-name(|param0) = ?2; param0; !Lua() + has-builtin-enum-valueName(|param0) = ?ServerNeighbors(); param0 + builtin-enum-value(|param0) = ?ServerNeighbors(); param0; !3 + builtin-enum-name(|param0) = ?3; param0; !ServerNeighbors() + has-builtin-enum-valueName(|param0) = ?Sky(); param0 + builtin-enum-value(|param0) = ?Sky(); param0; !4 + builtin-enum-name(|param0) = ?4; param0; !Sky() + has-builtin-enum-valueName(|param0) = ?ObjectTemplateManager(); param0 + builtin-enum-value(|param0) = ?ObjectTemplateManager(); param0; !5 + builtin-enum-name(|param0) = ?5; param0; !ObjectTemplateManager() + has-builtin-enum-valueName(|param0) = ?ObjectManager(); param0 + builtin-enum-value(|param0) = ?ObjectManager(); param0; !6 + builtin-enum-name(|param0) = ?6; param0; !ObjectManager() + has-builtin-enum-valueName(|param0) = ?Terrain(); param0 + builtin-enum-value(|param0) = ?Terrain(); param0; !7 + builtin-enum-name(|param0) = ?7; param0; !Terrain() + has-builtin-enum-valueName(|param0) = ?GameMode(); param0 + builtin-enum-value(|param0) = ?GameMode(); param0; !8 + builtin-enum-name(|param0) = ?8; param0; !GameMode() + has-builtin-enum-valueName(|param0) = ?SceneManager(); param0 + builtin-enum-value(|param0) = ?SceneManager(); param0; !9 + builtin-enum-name(|param0) = ?9; param0; !SceneManager() + has-builtin-enum-valueName(|param0) = ?LevelManager(); param0 + builtin-enum-value(|param0) = ?LevelManager(); param0; !16 + builtin-enum-name(|param0) = ?16; param0; !LevelManager() + builtin-enum-values: PluginType() -> [(PermissionManager(), 0), (ResourceManager(), 1), (Lua(), 2), (ServerNeighbors(), 3), (Sky(), 4), (ObjectTemplateManager(), 5), (ObjectManager(), 6), (Terrain(), 7), (GameMode(), 8), (SceneManager(), 9), (LevelManager(), 16)] + is-builtin-enum = ?ResourceLocationType() has-builtin-enum-valueName(|param0) = ?FileSystem(); param0 builtin-enum-value(|param0) = ?FileSystem(); param0; !0 @@ -830,6 +833,39 @@ rules builtin-enum-name(|param0) = ?1; param0; !URL() builtin-enum-values: ResourceLocationType() -> [(FileSystem(), 0), (URL(), 1)] + is-builtin-enum = ?ResourceType() + has-builtin-enum-valueName(|param0) = ?Generic(); param0 + builtin-enum-value(|param0) = ?Generic(); param0; !0 + builtin-enum-name(|param0) = ?0; param0; !Generic() + has-builtin-enum-valueName(|param0) = ?OgreMesh(); param0 + builtin-enum-value(|param0) = ?OgreMesh(); param0; !1 + builtin-enum-name(|param0) = ?1; param0; !OgreMesh() + has-builtin-enum-valueName(|param0) = ?BulletMesh(); param0 + builtin-enum-value(|param0) = ?BulletMesh(); param0; !2 + builtin-enum-name(|param0) = ?2; param0; !BulletMesh() + has-builtin-enum-valueName(|param0) = ?Skeleton(); param0 + builtin-enum-value(|param0) = ?Skeleton(); param0; !3 + builtin-enum-name(|param0) = ?3; param0; !Skeleton() + has-builtin-enum-valueName(|param0) = ?Texture(); param0 + builtin-enum-value(|param0) = ?Texture(); param0; !4 + builtin-enum-name(|param0) = ?4; param0; !Texture() + has-builtin-enum-valueName(|param0) = ?MaterialScript(); param0 + builtin-enum-value(|param0) = ?MaterialScript(); param0; !5 + builtin-enum-name(|param0) = ?5; param0; !MaterialScript() + has-builtin-enum-valueName(|param0) = ?ParticleScript(); param0 + builtin-enum-value(|param0) = ?ParticleScript(); param0; !6 + builtin-enum-name(|param0) = ?6; param0; !ParticleScript() + has-builtin-enum-valueName(|param0) = ?LuaScript(); param0 + builtin-enum-value(|param0) = ?LuaScript(); param0; !7 + builtin-enum-name(|param0) = ?7; param0; !LuaScript() + has-builtin-enum-valueName(|param0) = ?Audio(); param0 + builtin-enum-value(|param0) = ?Audio(); param0; !8 + builtin-enum-name(|param0) = ?8; param0; !Audio() + has-builtin-enum-valueName(|param0) = ?Level(); param0 + builtin-enum-value(|param0) = ?Level(); param0; !9 + builtin-enum-name(|param0) = ?9; param0; !Level() + builtin-enum-values: ResourceType() -> [(Generic(), 0), (OgreMesh(), 1), (BulletMesh(), 2), (Skeleton(), 3), (Texture(), 4), (MaterialScript(), 5), (ParticleScript(), 6), (LuaScript(), 7), (Audio(), 8), (Level(), 9)] + is-builtin-enum = ?SkyType() has-builtin-enum-valueName(|param0) = ?Box(); param0 builtin-enum-value(|param0) = ?Box(); param0; !0 diff --git a/DSL/DiversiaScript/trans/data/plugin.str b/DSL/DiversiaScript/trans/data/plugin.str index 3b5bb5e..49ee848 100644 --- a/DSL/DiversiaScript/trans/data/plugin.str +++ b/DSL/DiversiaScript/trans/data/plugin.str @@ -12,5 +12,6 @@ rules is-builtin-plugin = ?Sky() is-builtin-plugin = ?Terrain() is-builtin-plugin = ?SceneManager() + is-builtin-plugin = ?LevelManager() - builtin-plugins = ![ServerNeighbors(), Sky(), Terrain(), SceneManager()] + builtin-plugins = ![ServerNeighbors(), Sky(), Terrain(), SceneManager(), LevelManager()] diff --git a/DSL/DiversiaScript/trans/data/type-base.str b/DSL/DiversiaScript/trans/data/type-base.str index 99d096d..10297b0 100644 --- a/DSL/DiversiaScript/trans/data/type-base.str +++ b/DSL/DiversiaScript/trans/data/type-base.str @@ -20,33 +20,29 @@ rules builtin-type-bases: ClientObject() -> [Object()] is-builtin-type-base = ?(ClientObjectManager(), ObjectManager()) - is-builtin-type-base = ?(ClientObjectManager(), ServerPlugin()) - builtin-type-bases: ClientObjectManager() -> [ObjectManager(), ServerPlugin()] + is-builtin-type-base = ?(ClientObjectManager(), ClientPlugin()) + builtin-type-bases: ClientObjectManager() -> [ObjectManager(), ClientPlugin()] is-builtin-type-base = ?(ClientObjectTemplate(), ObjectTemplate()) is-builtin-type-base = ?(ClientObjectTemplate(), PropertySynchronization()) builtin-type-bases: ClientObjectTemplate() -> [ObjectTemplate(), PropertySynchronization()] is-builtin-type-base = ?(ClientObjectTemplateManager(), ObjectTemplateManager()) - is-builtin-type-base = ?(ClientObjectTemplateManager(), ServerPlugin()) - builtin-type-bases: ClientObjectTemplateManager() -> [ObjectTemplateManager(), ServerPlugin()] + is-builtin-type-base = ?(ClientObjectTemplateManager(), ClientPlugin()) + builtin-type-bases: ClientObjectTemplateManager() -> [ObjectTemplateManager(), ClientPlugin()] - is-builtin-type-base = ?(Lua(), ServerPlugin()) - builtin-type-bases: Lua() -> [ServerPlugin()] + is-builtin-type-base = ?(ClientPlugin(), Plugin()) + is-builtin-type-base = ?(ClientPlugin(), PropertySynchronization()) + builtin-type-bases: ClientPlugin() -> [Plugin(), PropertySynchronization()] - is-builtin-type-base = ?(PermissionManager(), ServerPlugin()) - builtin-type-bases: PermissionManager() -> [ServerPlugin()] + is-builtin-type-base = ?(Lua(), ClientPlugin()) + builtin-type-bases: Lua() -> [ClientPlugin()] - is-builtin-type-base = ?(ServerNeighborsPlugin(), ServerPlugin()) - builtin-type-bases: ServerNeighborsPlugin() -> [ServerPlugin()] + is-builtin-type-base = ?(PermissionManager(), ClientPlugin()) + builtin-type-bases: PermissionManager() -> [ClientPlugin()] - is-builtin-type-base = ?(ServerPlugin(), ClientServerPlugin()) - is-builtin-type-base = ?(ServerPlugin(), PropertySynchronization()) - builtin-type-bases: ServerPlugin() -> [ClientServerPlugin(), PropertySynchronization()] - - builtin-type-bases: ClientServerPlugin() -> [] - - builtin-type-bases: ClientServerPluginManager() -> [] + is-builtin-type-base = ?(ServerNeighborsPlugin(), ClientPlugin()) + builtin-type-bases: ServerNeighborsPlugin() -> [ClientPlugin()] builtin-type-bases: LayerInstance() -> [] @@ -89,13 +85,16 @@ rules is-builtin-type-base = ?(ForceField(), ClientComponent()) builtin-type-bases: ForceField() -> [ClientComponent()] - is-builtin-type-base = ?(GameMode(), ServerPlugin()) - builtin-type-bases: GameMode() -> [ServerPlugin()] + is-builtin-type-base = ?(GameMode(), ClientPlugin()) + builtin-type-bases: GameMode() -> [ClientPlugin()] builtin-type-bases: InputManager() -> [] builtin-type-bases: KeyboardState() -> [] + is-builtin-type-base = ?(LevelManager(), ClientPlugin()) + builtin-type-bases: LevelManager() -> [ClientPlugin()] + is-builtin-type-base = ?(Light(), ClientComponent()) builtin-type-bases: Light() -> [ClientComponent()] @@ -110,27 +109,31 @@ rules is-builtin-type-base = ?(Particle(), ClientComponent()) builtin-type-bases: Particle() -> [ClientComponent()] - is-builtin-type-base = ?(ResourceManager(), ServerPlugin()) - builtin-type-bases: ResourceManager() -> [ServerPlugin()] + is-builtin-type-base = ?(ResourceManager(), ClientPlugin()) + builtin-type-bases: ResourceManager() -> [ClientPlugin()] is-builtin-type-base = ?(RigidBody(), ClientComponent()) builtin-type-bases: RigidBody() -> [ClientComponent()] - is-builtin-type-base = ?(SceneManager(), ServerPlugin()) - builtin-type-bases: SceneManager() -> [ServerPlugin()] + is-builtin-type-base = ?(SceneManager(), ClientPlugin()) + builtin-type-bases: SceneManager() -> [ClientPlugin()] is-builtin-type-base = ?(SceneNode(), ClientComponent()) builtin-type-bases: SceneNode() -> [ClientComponent()] - is-builtin-type-base = ?(Sky(), ServerPlugin()) - builtin-type-bases: Sky() -> [ServerPlugin()] + is-builtin-type-base = ?(Sky(), ClientPlugin()) + builtin-type-bases: Sky() -> [ClientPlugin()] - is-builtin-type-base = ?(Terrain(), ServerPlugin()) - builtin-type-bases: Terrain() -> [ServerPlugin()] + is-builtin-type-base = ?(Terrain(), ClientPlugin()) + builtin-type-bases: Terrain() -> [ClientPlugin()] is-builtin-type-base = ?(Text(), ClientComponent()) builtin-type-bases: Text() -> [ClientComponent()] + builtin-type-bases: Plugin() -> [] + + builtin-type-bases: PluginManager() -> [] + builtin-type-bases: PropertySynchronization() -> [] builtin-type-bases: ResourceInfo() -> [] diff --git a/DSL/DiversiaScript/trans/data/type-cons.str b/DSL/DiversiaScript/trans/data/type-cons.str index ff2139a..a527c01 100644 --- a/DSL/DiversiaScript/trans/data/type-cons.str +++ b/DSL/DiversiaScript/trans/data/type-cons.str @@ -23,7 +23,7 @@ rules has-builtin-type-cons = ?(ResourceInfo(), []) has-builtin-type-cons = ?(ResourceInfo(), [StringType()]) - has-builtin-type-cons = ?(ResourceInfo(), [StringType(), StringType()]) + has-builtin-type-cons = ?(ResourceInfo(), [StringType(), ResourceType()]) has-builtin-type-cons = ?(Angle(), [RealType()]) diff --git a/DSL/DiversiaScript/trans/data/type-func.str b/DSL/DiversiaScript/trans/data/type-func.str index 4a61dbe..b0f5b3a 100644 --- a/DSL/DiversiaScript/trans/data/type-func.str +++ b/DSL/DiversiaScript/trans/data/type-func.str @@ -23,6 +23,11 @@ rules builtin-type-funcs: ClientObjectTemplateManager() -> [] + has-builtin-type-func = ?(ClientPlugin(), ForceSerialize()) + builtin-type-func-return: (ClientPlugin(), ForceSerialize()) -> VoidType() + builtin-type-func-params: (ClientPlugin(), ForceSerialize()) -> [] + builtin-type-funcs: ClientPlugin() -> [Function(ForceSerialize(), VoidType(), [])] + has-builtin-type-func = ?(Lua(), Run_garbage_collection()) builtin-type-func-return: (Lua(), Run_garbage_collection()) -> VoidType() builtin-type-func-params: (Lua(), Run_garbage_collection()) -> [] @@ -32,27 +37,6 @@ rules builtin-type-funcs: ServerNeighborsPlugin() -> [] - has-builtin-type-func = ?(ServerPlugin(), ForceSerialize()) - builtin-type-func-return: (ServerPlugin(), ForceSerialize()) -> VoidType() - builtin-type-func-params: (ServerPlugin(), ForceSerialize()) -> [] - builtin-type-funcs: ServerPlugin() -> [Function(ForceSerialize(), VoidType(), [])] - - builtin-type-funcs: ClientServerPlugin() -> [] - - has-builtin-type-func = ?(ClientServerPluginManager(), CreatePlugin()) - builtin-type-func-return: (ClientServerPluginManager(), CreatePlugin()) -> ClientServerPlugin() - builtin-type-func-params: (ClientServerPluginManager(), CreatePlugin()) -> [ClientServerPluginType()] - has-builtin-type-func = ?(ClientServerPluginManager(), GetPlugin()) - builtin-type-func-return: (ClientServerPluginManager(), GetPlugin()) -> ClientServerPlugin() - builtin-type-func-params: (ClientServerPluginManager(), GetPlugin()) -> [ClientServerPluginType()] - has-builtin-type-func = ?(ClientServerPluginManager(), HasPlugin()) - builtin-type-func-return: (ClientServerPluginManager(), HasPlugin()) -> BoolType() - builtin-type-func-params: (ClientServerPluginManager(), HasPlugin()) -> [ClientServerPluginType()] - has-builtin-type-func = ?(ClientServerPluginManager(), DestroyPlugin()) - builtin-type-func-return: (ClientServerPluginManager(), DestroyPlugin()) -> VoidType() - builtin-type-func-params: (ClientServerPluginManager(), DestroyPlugin()) -> [ClientServerPluginType()] - builtin-type-funcs: ClientServerPluginManager() -> [Function(CreatePlugin(), ClientServerPlugin(), [ClientServerPluginType()]), Function(GetPlugin(), ClientServerPlugin(), [ClientServerPluginType()]), Function(HasPlugin(), BoolType(), [ClientServerPluginType()]), Function(DestroyPlugin(), VoidType(), [ClientServerPluginType()])] - builtin-type-funcs: LayerInstance() -> [] has-builtin-type-func = ?(Component(), IsCreatedBy()) @@ -277,6 +261,8 @@ rules builtin-type-func-params: (KeyboardState(), Clear()) -> [] builtin-type-funcs: KeyboardState() -> [Function(IsButtonDown(), BoolType(), [KeyboardButton()]), Function(Clear(), VoidType(), [])] + builtin-type-funcs: LevelManager() -> [] + builtin-type-funcs: Light() -> [] has-builtin-type-func = ?(LuaObjectScript(), Reload_script()) @@ -370,6 +356,22 @@ rules builtin-type-funcs: Text() -> [] + builtin-type-funcs: Plugin() -> [] + + has-builtin-type-func = ?(PluginManager(), CreatePlugin()) + builtin-type-func-return: (PluginManager(), CreatePlugin()) -> Plugin() + builtin-type-func-params: (PluginManager(), CreatePlugin()) -> [PluginType()] + has-builtin-type-func = ?(PluginManager(), GetPlugin()) + builtin-type-func-return: (PluginManager(), GetPlugin()) -> Plugin() + builtin-type-func-params: (PluginManager(), GetPlugin()) -> [PluginType()] + has-builtin-type-func = ?(PluginManager(), HasPlugin()) + builtin-type-func-return: (PluginManager(), HasPlugin()) -> BoolType() + builtin-type-func-params: (PluginManager(), HasPlugin()) -> [PluginType()] + has-builtin-type-func = ?(PluginManager(), DestroyPlugin()) + builtin-type-func-return: (PluginManager(), DestroyPlugin()) -> VoidType() + builtin-type-func-params: (PluginManager(), DestroyPlugin()) -> [PluginType()] + builtin-type-funcs: PluginManager() -> [Function(CreatePlugin(), Plugin(), [PluginType()]), Function(GetPlugin(), Plugin(), [PluginType()]), Function(HasPlugin(), BoolType(), [PluginType()]), Function(DestroyPlugin(), VoidType(), [PluginType()])] + builtin-type-funcs: PropertySynchronization() -> [] builtin-type-funcs: ResourceInfo() -> [] diff --git a/DSL/DiversiaScript/trans/data/type-op.str b/DSL/DiversiaScript/trans/data/type-op.str index 3cc7e6e..3ebee55 100644 --- a/DSL/DiversiaScript/trans/data/type-op.str +++ b/DSL/DiversiaScript/trans/data/type-op.str @@ -24,18 +24,14 @@ rules builtin-type-ops: ClientObjectTemplateManager() -> [] + builtin-type-ops: ClientPlugin() -> [] + builtin-type-ops: Lua() -> [] builtin-type-ops: PermissionManager() -> [] builtin-type-ops: ServerNeighborsPlugin() -> [] - builtin-type-ops: ServerPlugin() -> [] - - builtin-type-ops: ClientServerPlugin() -> [] - - builtin-type-ops: ClientServerPluginManager() -> [] - builtin-type-ops: LayerInstance() -> [] builtin-type-ops: Component() -> [] @@ -74,6 +70,8 @@ rules builtin-type-ops: KeyboardState() -> [] + builtin-type-ops: LevelManager() -> [] + builtin-type-ops: Light() -> [] builtin-type-ops: LuaObjectScript() -> [] @@ -98,6 +96,10 @@ rules builtin-type-ops: Text() -> [] + builtin-type-ops: Plugin() -> [] + + builtin-type-ops: PluginManager() -> [] + builtin-type-ops: PropertySynchronization() -> [] builtin-type-ops: ResourceInfo() -> [] diff --git a/DSL/DiversiaScript/trans/data/type-prop.str b/DSL/DiversiaScript/trans/data/type-prop.str index f3a476c..23d5226 100644 --- a/DSL/DiversiaScript/trans/data/type-prop.str +++ b/DSL/DiversiaScript/trans/data/type-prop.str @@ -26,6 +26,8 @@ rules builtin-type-props: ClientObjectTemplateManager() -> [] + builtin-type-props: ClientPlugin() -> [] + builtin-type-props: Lua() -> [] builtin-type-props: PermissionManager() -> [] @@ -35,26 +37,6 @@ rules builtin-type-prop-type: (ServerNeighborsPlugin(), ServerNeighbors()) -> ServerNeighbors() builtin-type-props: ServerNeighborsPlugin() -> [Property(ServerNeighbors(), ServerNeighbors(), True())] - builtin-type-props: ServerPlugin() -> [] - - has-builtin-type-prop = ?(ClientServerPlugin(), Type()) - builtin-type-prop-type: (ClientServerPlugin(), Type()) -> ClientServerPluginType() - has-builtin-type-prop = ?(ClientServerPlugin(), TypeName()) - builtin-type-prop-type: (ClientServerPlugin(), TypeName()) -> StringType() - has-builtin-type-prop = ?(ClientServerPlugin(), Mode()) - builtin-type-prop-type: (ClientServerPlugin(), Mode()) -> Mode() - has-builtin-type-prop = ?(ClientServerPlugin(), PluginManager()) - is-builtin-type-prop-writable = ?(ClientServerPlugin(), PluginManager()) - builtin-type-prop-type: (ClientServerPlugin(), PluginManager()) -> ClientServerPluginManager() - builtin-type-props: ClientServerPlugin() -> [Property(Type(), ClientServerPluginType(), False()), Property(TypeName(), StringType(), False()), Property(Mode(), Mode(), False()), Property(PluginManager(), ClientServerPluginManager(), True())] - - has-builtin-type-prop = ?(ClientServerPluginManager(), Mode()) - builtin-type-prop-type: (ClientServerPluginManager(), Mode()) -> Mode() - has-builtin-type-prop = ?(ClientServerPluginManager(), Plugins()) - is-builtin-type-prop-writable = ?(ClientServerPluginManager(), Plugins()) - builtin-type-prop-type: (ClientServerPluginManager(), Plugins()) -> VoidType() - builtin-type-props: ClientServerPluginManager() -> [Property(Mode(), Mode(), False()), Property(Plugins(), VoidType(), True())] - has-builtin-type-prop = ?(LayerInstance(), WorldSize()) is-builtin-type-prop-writable = ?(LayerInstance(), WorldSize()) builtin-type-prop-type: (LayerInstance(), WorldSize()) -> RealType() @@ -387,6 +369,14 @@ rules builtin-type-props: KeyboardState() -> [] + has-builtin-type-prop = ?(LevelManager(), DefaultLevel()) + is-builtin-type-prop-writable = ?(LevelManager(), DefaultLevel()) + builtin-type-prop-type: (LevelManager(), DefaultLevel()) -> StringType() + has-builtin-type-prop = ?(LevelManager(), LoadedPlugins()) + is-builtin-type-prop-writable = ?(LevelManager(), LoadedPlugins()) + builtin-type-prop-type: (LevelManager(), LoadedPlugins()) -> VoidType() + builtin-type-props: LevelManager() -> [Property(DefaultLevel(), StringType(), True()), Property(LoadedPlugins(), VoidType(), True())] + has-builtin-type-prop = ?(Light(), LightType()) is-builtin-type-prop-writable = ?(Light(), LightType()) builtin-type-prop-type: (Light(), LightType()) -> LightType() @@ -493,6 +483,12 @@ rules builtin-type-prop-type: (Particle(), Speed()) -> RealType() builtin-type-props: Particle() -> [Property(Name(), StringType(), True()), Property(Quota(), IntType(), True()), Property(Enabled(), BoolType(), True()), Property(Speed(), RealType(), True())] + has-builtin-type-prop = ?(ResourceManager(), BackgroundInitialise()) + is-builtin-type-prop-writable = ?(ResourceManager(), BackgroundInitialise()) + builtin-type-prop-type: (ResourceManager(), BackgroundInitialise()) -> BoolType() + has-builtin-type-prop = ?(ResourceManager(), BackgroundLoad()) + is-builtin-type-prop-writable = ?(ResourceManager(), BackgroundLoad()) + builtin-type-prop-type: (ResourceManager(), BackgroundLoad()) -> BoolType() has-builtin-type-prop = ?(ResourceManager(), Type()) is-builtin-type-prop-writable = ?(ResourceManager(), Type()) builtin-type-prop-type: (ResourceManager(), Type()) -> ResourceLocationType() @@ -502,7 +498,7 @@ rules has-builtin-type-prop = ?(ResourceManager(), Group()) is-builtin-type-prop-writable = ?(ResourceManager(), Group()) builtin-type-prop-type: (ResourceManager(), Group()) -> StringType() - builtin-type-props: ResourceManager() -> [Property(Type(), ResourceLocationType(), True()), Property(ResourceLocation(), StringType(), True()), Property(Group(), StringType(), True())] + builtin-type-props: ResourceManager() -> [Property(BackgroundInitialise(), BoolType(), True()), Property(BackgroundLoad(), BoolType(), True()), Property(Type(), ResourceLocationType(), True()), Property(ResourceLocation(), StringType(), True()), Property(Group(), StringType(), True())] has-builtin-type-prop = ?(RigidBody(), PhysicsType()) is-builtin-type-prop-writable = ?(RigidBody(), PhysicsType()) @@ -660,6 +656,24 @@ rules builtin-type-prop-type: (Text(), Colour()) -> Colour() builtin-type-props: Text() -> [Property(Caption(), StringType(), True()), Property(Colour(), Colour(), True())] + has-builtin-type-prop = ?(Plugin(), Type()) + builtin-type-prop-type: (Plugin(), Type()) -> PluginType() + has-builtin-type-prop = ?(Plugin(), TypeName()) + builtin-type-prop-type: (Plugin(), TypeName()) -> StringType() + has-builtin-type-prop = ?(Plugin(), Mode()) + builtin-type-prop-type: (Plugin(), Mode()) -> Mode() + has-builtin-type-prop = ?(Plugin(), PluginManager()) + is-builtin-type-prop-writable = ?(Plugin(), PluginManager()) + builtin-type-prop-type: (Plugin(), PluginManager()) -> PluginManager() + builtin-type-props: Plugin() -> [Property(Type(), PluginType(), False()), Property(TypeName(), StringType(), False()), Property(Mode(), Mode(), False()), Property(PluginManager(), PluginManager(), True())] + + has-builtin-type-prop = ?(PluginManager(), Mode()) + builtin-type-prop-type: (PluginManager(), Mode()) -> Mode() + has-builtin-type-prop = ?(PluginManager(), Plugins()) + is-builtin-type-prop-writable = ?(PluginManager(), Plugins()) + builtin-type-prop-type: (PluginManager(), Plugins()) -> VoidType() + builtin-type-props: PluginManager() -> [Property(Mode(), Mode(), False()), Property(Plugins(), VoidType(), True())] + builtin-type-props: PropertySynchronization() -> [] has-builtin-type-prop = ?(ResourceInfo(), File()) @@ -667,11 +681,11 @@ rules builtin-type-prop-type: (ResourceInfo(), File()) -> StringType() has-builtin-type-prop = ?(ResourceInfo(), Type()) is-builtin-type-prop-writable = ?(ResourceInfo(), Type()) - builtin-type-prop-type: (ResourceInfo(), Type()) -> StringType() + builtin-type-prop-type: (ResourceInfo(), Type()) -> ResourceType() has-builtin-type-prop = ?(ResourceInfo(), Priority()) is-builtin-type-prop-writable = ?(ResourceInfo(), Priority()) builtin-type-prop-type: (ResourceInfo(), Priority()) -> IntType() - builtin-type-props: ResourceInfo() -> [Property(File(), StringType(), True()), Property(Type(), StringType(), True()), Property(Priority(), IntType(), True())] + builtin-type-props: ResourceInfo() -> [Property(File(), StringType(), True()), Property(Type(), ResourceType(), True()), Property(Priority(), IntType(), True())] has-builtin-type-prop = ?(ServerInfo(), AddressMerged()) builtin-type-prop-type: (ServerInfo(), AddressMerged()) -> StringType() @@ -759,18 +773,6 @@ rules builtin-type-prop-type: (Node(), InheritScale()) -> BoolType() builtin-type-props: Node() -> [Property(LocalAxes(), Matrix3(), False()), Property(FullTransform(), Matrix4(), False()), Property(DerivedScale(), Vector3(), False()), Property(InitialPosition(), Vector3(), False()), Property(InitialOrientation(), Quaternion(), False()), Property(InitialScale(), Vector3(), False()), Property(Position(), Vector3(), True()), Property(DerivedPosition(), Vector3(), True()), Property(Orientation(), Quaternion(), True()), Property(DerivedOrientation(), Quaternion(), True()), Property(Scale(), Vector3(), True()), Property(InheritOrientation(), BoolType(), True()), Property(InheritScale(), BoolType(), True())] - has-builtin-type-prop = ?(Quaternion(), X()) - is-builtin-type-prop-writable = ?(Quaternion(), X()) - builtin-type-prop-type: (Quaternion(), X()) -> RealType() - has-builtin-type-prop = ?(Quaternion(), Y()) - is-builtin-type-prop-writable = ?(Quaternion(), Y()) - builtin-type-prop-type: (Quaternion(), Y()) -> RealType() - has-builtin-type-prop = ?(Quaternion(), Z()) - is-builtin-type-prop-writable = ?(Quaternion(), Z()) - builtin-type-prop-type: (Quaternion(), Z()) -> RealType() - has-builtin-type-prop = ?(Quaternion(), W()) - is-builtin-type-prop-writable = ?(Quaternion(), W()) - builtin-type-prop-type: (Quaternion(), W()) -> RealType() has-builtin-type-prop = ?(Quaternion(), XAxis()) builtin-type-prop-type: (Quaternion(), XAxis()) -> Vector3() has-builtin-type-prop = ?(Quaternion(), YAxis()) @@ -801,7 +803,19 @@ rules builtin-type-prop-type: (Quaternion(), Yaw()) -> Radian() has-builtin-type-prop = ?(Quaternion(), ShortestYaw()) builtin-type-prop-type: (Quaternion(), ShortestYaw()) -> Radian() - builtin-type-props: Quaternion() -> [Property(X(), RealType(), True()), Property(Y(), RealType(), True()), Property(Z(), RealType(), True()), Property(W(), RealType(), True()), Property(XAxis(), Vector3(), False()), Property(YAxis(), Vector3(), False()), Property(ZAxis(), Vector3(), False()), Property(NormalizedCopy(), RealType(), False()), Property(Inverse(), Quaternion(), False()), Property(UnitInverse(), Quaternion(), False()), Property(Exp(), Quaternion(), False()), Property(Log(), Quaternion(), False()), Property(IsNaN(), BoolType(), False()), Property(Roll(), Radian(), False()), Property(ShortestRoll(), Radian(), False()), Property(Pitch(), Radian(), False()), Property(ShortestPitch(), Radian(), False()), Property(Yaw(), Radian(), False()), Property(ShortestYaw(), Radian(), False())] + has-builtin-type-prop = ?(Quaternion(), X()) + is-builtin-type-prop-writable = ?(Quaternion(), X()) + builtin-type-prop-type: (Quaternion(), X()) -> RealType() + has-builtin-type-prop = ?(Quaternion(), Y()) + is-builtin-type-prop-writable = ?(Quaternion(), Y()) + builtin-type-prop-type: (Quaternion(), Y()) -> RealType() + has-builtin-type-prop = ?(Quaternion(), Z()) + is-builtin-type-prop-writable = ?(Quaternion(), Z()) + builtin-type-prop-type: (Quaternion(), Z()) -> RealType() + has-builtin-type-prop = ?(Quaternion(), W()) + is-builtin-type-prop-writable = ?(Quaternion(), W()) + builtin-type-prop-type: (Quaternion(), W()) -> RealType() + builtin-type-props: Quaternion() -> [Property(XAxis(), Vector3(), False()), Property(YAxis(), Vector3(), False()), Property(ZAxis(), Vector3(), False()), Property(NormalizedCopy(), RealType(), False()), Property(Inverse(), Quaternion(), False()), Property(UnitInverse(), Quaternion(), False()), Property(Exp(), Quaternion(), False()), Property(Log(), Quaternion(), False()), Property(IsNaN(), BoolType(), False()), Property(Roll(), Radian(), False()), Property(ShortestRoll(), Radian(), False()), Property(Pitch(), Radian(), False()), Property(ShortestPitch(), Radian(), False()), Property(Yaw(), Radian(), False()), Property(ShortestYaw(), Radian(), False()), Property(X(), RealType(), True()), Property(Y(), RealType(), True()), Property(Z(), RealType(), True()), Property(W(), RealType(), True())] has-builtin-type-prop = ?(Radian(), Degrees()) builtin-type-prop-type: (Radian(), Degrees()) -> RealType() @@ -812,12 +826,6 @@ rules builtin-type-prop-type: (Radian(), Radians()) -> RealType() builtin-type-props: Radian() -> [Property(Degrees(), RealType(), False()), Property(AngleUnits(), RealType(), False()), Property(Radians(), RealType(), True())] - has-builtin-type-prop = ?(Vector2(), X()) - is-builtin-type-prop-writable = ?(Vector2(), X()) - builtin-type-prop-type: (Vector2(), X()) -> RealType() - has-builtin-type-prop = ?(Vector2(), Y()) - is-builtin-type-prop-writable = ?(Vector2(), Y()) - builtin-type-prop-type: (Vector2(), Y()) -> RealType() has-builtin-type-prop = ?(Vector2(), Length()) builtin-type-prop-type: (Vector2(), Length()) -> RealType() has-builtin-type-prop = ?(Vector2(), SquaredLength()) @@ -826,17 +834,14 @@ rules builtin-type-prop-type: (Vector2(), IsZeroLength()) -> BoolType() has-builtin-type-prop = ?(Vector2(), NormalisedCopy()) builtin-type-prop-type: (Vector2(), NormalisedCopy()) -> Vector2() - builtin-type-props: Vector2() -> [Property(X(), RealType(), True()), Property(Y(), RealType(), True()), Property(Length(), RealType(), False()), Property(SquaredLength(), RealType(), False()), Property(IsZeroLength(), BoolType(), False()), Property(NormalisedCopy(), Vector2(), False())] + has-builtin-type-prop = ?(Vector2(), X()) + is-builtin-type-prop-writable = ?(Vector2(), X()) + builtin-type-prop-type: (Vector2(), X()) -> RealType() + has-builtin-type-prop = ?(Vector2(), Y()) + is-builtin-type-prop-writable = ?(Vector2(), Y()) + builtin-type-prop-type: (Vector2(), Y()) -> RealType() + builtin-type-props: Vector2() -> [Property(Length(), RealType(), False()), Property(SquaredLength(), RealType(), False()), Property(IsZeroLength(), BoolType(), False()), Property(NormalisedCopy(), Vector2(), False()), Property(X(), RealType(), True()), Property(Y(), RealType(), True())] - has-builtin-type-prop = ?(Vector3(), X()) - is-builtin-type-prop-writable = ?(Vector3(), X()) - builtin-type-prop-type: (Vector3(), X()) -> RealType() - has-builtin-type-prop = ?(Vector3(), Y()) - is-builtin-type-prop-writable = ?(Vector3(), Y()) - builtin-type-prop-type: (Vector3(), Y()) -> RealType() - has-builtin-type-prop = ?(Vector3(), Z()) - is-builtin-type-prop-writable = ?(Vector3(), Z()) - builtin-type-prop-type: (Vector3(), Z()) -> RealType() has-builtin-type-prop = ?(Vector3(), Zero()) builtin-type-prop-type: (Vector3(), Zero()) -> Vector3() has-builtin-type-prop = ?(Vector3(), Length()) @@ -847,7 +852,16 @@ rules builtin-type-prop-type: (Vector3(), IsZeroLength()) -> BoolType() has-builtin-type-prop = ?(Vector3(), NormalisedCopy()) builtin-type-prop-type: (Vector3(), NormalisedCopy()) -> Vector3() - builtin-type-props: Vector3() -> [Property(X(), RealType(), True()), Property(Y(), RealType(), True()), Property(Z(), RealType(), True()), Property(Zero(), Vector3(), False()), Property(Length(), RealType(), False()), Property(SquaredLength(), RealType(), False()), Property(IsZeroLength(), BoolType(), False()), Property(NormalisedCopy(), Vector3(), False())] + has-builtin-type-prop = ?(Vector3(), X()) + is-builtin-type-prop-writable = ?(Vector3(), X()) + builtin-type-prop-type: (Vector3(), X()) -> RealType() + has-builtin-type-prop = ?(Vector3(), Y()) + is-builtin-type-prop-writable = ?(Vector3(), Y()) + builtin-type-prop-type: (Vector3(), Y()) -> RealType() + has-builtin-type-prop = ?(Vector3(), Z()) + is-builtin-type-prop-writable = ?(Vector3(), Z()) + builtin-type-prop-type: (Vector3(), Z()) -> RealType() + builtin-type-props: Vector3() -> [Property(Zero(), Vector3(), False()), Property(Length(), RealType(), False()), Property(SquaredLength(), RealType(), False()), Property(IsZeroLength(), BoolType(), False()), Property(NormalisedCopy(), Vector3(), False()), Property(X(), RealType(), True()), Property(Y(), RealType(), True()), Property(Z(), RealType(), True())] has-builtin-type-prop = ?(Vector4(), X()) is-builtin-type-prop-writable = ?(Vector4(), X()) diff --git a/DSL/DiversiaScript/trans/data/type.str b/DSL/DiversiaScript/trans/data/type.str index 3800d28..6ad132e 100644 --- a/DSL/DiversiaScript/trans/data/type.str +++ b/DSL/DiversiaScript/trans/data/type.str @@ -14,12 +14,10 @@ rules is-builtin-type = ?ClientObjectManager() is-builtin-type = ?ClientObjectTemplate() is-builtin-type = ?ClientObjectTemplateManager() + is-builtin-type = ?ClientPlugin() is-builtin-type = ?Lua() is-builtin-type = ?PermissionManager() is-builtin-type = ?ServerNeighborsPlugin() - is-builtin-type = ?ServerPlugin() - is-builtin-type = ?ClientServerPlugin() - is-builtin-type = ?ClientServerPluginManager() is-builtin-type = ?LayerInstance() is-builtin-type = ?Component() is-builtin-type = ?ComponentHandle() @@ -39,6 +37,7 @@ rules is-builtin-type = ?GameMode() is-builtin-type = ?InputManager() is-builtin-type = ?KeyboardState() + is-builtin-type = ?LevelManager() is-builtin-type = ?Light() is-builtin-type = ?LuaObjectScript() is-builtin-type = ?Mesh() @@ -51,6 +50,8 @@ rules is-builtin-type = ?Sky() is-builtin-type = ?Terrain() is-builtin-type = ?Text() + is-builtin-type = ?Plugin() + is-builtin-type = ?PluginManager() is-builtin-type = ?PropertySynchronization() is-builtin-type = ?ResourceInfo() is-builtin-type = ?ServerInfo() diff --git a/DSL/DiversiaScript/trans/diversiascript.str b/DSL/DiversiaScript/trans/diversiascript.str index 48a8f69..a7975dc 100644 --- a/DSL/DiversiaScript/trans/diversiascript.str +++ b/DSL/DiversiaScript/trans/diversiascript.str @@ -14,8 +14,9 @@ imports decorate import - codegen/lua/luagen - codegen/xml/xmlgen + codegen/lua/generate + codegen/lua/normalise + codegen/xml/generate codegen/xml/simplexml editor/complete @@ -33,7 +34,9 @@ strategies analyse-all-nostore(|path) = import-all(|path); desugar-all; decorate-all; rename-all // Analysis the AST (resolve imports, desugar, decorate, rename), stores declarations from the AST and all imports and // finally merges the AST's from the imported files into this AST. - analyse-all-merge(|path) = import-all(|path); desugar-all; decorate-all; rename-all; store-all; import-merge(|path) + analyse-all-merge(normalise|path) = import-all(|path); desugar-all; decorate-all; normalise; rename-all; store-all; import-merge(|path) + analyse-all-merge(|path) = analyse-all-merge(id|path) + rules // Main editor interface (defined by editor/DiversiaScript-Builders and -References.esv) @@ -78,13 +81,15 @@ rules // Main editor interface (defined by editor/DiversiaScript-Builders and -R generate-xml: (selected, position, ast, path, project-path) -> (filename, result) where editor-init; + dir := path; filename := path; - result := ast + result := ast generate-xml-aterm: (selected, position, ast, path, project-path) -> (filename, result) where editor-init; + dir := path; filename := path; - result := ast + result := ast // Transforms analysed AST to C++. generate-cpp: (selected, position, ast, path, project-path) -> (filename, result)