Giter VIP home page Giter VIP logo

armaclass's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

armaclass's Issues

Macros cause parsing to fail (#define and #include statements)

Was parsing Mike Force vehicle configs as the tag inclusions/exclusions can be pain to work out the final results without starting the gamemode and manually testing.

The parser would fail on these first macro lines

#include "..\ui\icons.inc"

#define RESPAWN_SHORT respawnType = "RESPAWN"; time = 10
#define RESPAWN_MEDIUM respawnType = "RESPAWN"; time = 30
#define RESPAWN_LONG respawnType = "RESPAWN"; time = 60
#define WRECK_SHORT respawnType = "WRECK"; time = 10
#define WRECK_MEDIUM respawnType = "WRECK"; time = 30
#define WRECK_LONG respawnType = "WRECK"; time = 60

#include is a similar issue to #8 as it loads in additional config classes from somewhere else (inheritance is so fun isn't it :P )

But #define macros are used to inject common values later in the config file.... and they don't necessarily have a key that can be parsed by armaclass

NOTE -- I think the lack of a key caused errors without doing with the macro replacement on RESPAWN_SHORT. However, it was over 12 hours ago and i'm about to go to bed as it's 6am. so I could be wrong!

https://github.com/Savage-Game-Design/Mike-Force/blob/development/mission/config/subconfigs/vehicle_respawn_info.hpp#L503

class spawn_point_types {
	class light_transport {
		name = "Light transport";
		RESPAWN_SHORT;  // the problem line
		class categories {
			...
		}
	}
}

I've got a very messy, hacked together script which could possibly turn into a PR at some point.

  • grabs the config file with readlines
  • ignores the #include macros
  • grabs the #define macros and parses them
  • replaces everything in the readlines data that matches the macro key
  • feeds the fixed readlines data to armaclass.parse

Of course, there's also another option which is just to flat out exclude macros and any lines that don't have an appropriate key!

Generator does not preserve string break for properties

armaclass.arma_generator.ArmaGenerator seems to fail to preserve broken up SQF property strings (var="a" \n "b" \n "c";) treating them as regular strings instead, which causes the discrepancy between original and armaclass-serialized SQF definitions that contain broken up strings.

Example:
Given following SQF

class Item0 {
    init="[this, ""Platoon""] call FP_fnc_setVehicleName;" \n "this addMagazineCargoGlobal [""1Rnd_HE_Grenade_shell"", 10];";
};

armaclass.Parser would deserialize it as the following python dict - so far so good

{'Item0': {'init': '[this, "Platoon"] call FP_fnc_setVehicleName;\nthis addMagazineCargoGlobal ["1Rnd_HE_Grenade_shell", 10];'}}

However when attempting to serialize it back into SQF again, generator would output this:

class Item0
{
    init="[this, ""Platoon""] call FP_fnc_setVehicleName;
    this addMagazineCargoGlobal [""1Rnd_HE_Grenade_shell"", 10];";
};

The newline break would be inserted into the string property directly, and we'll lose all previously defined lines in the property; among other things this would also break the markup for sqms.
Solution to this would be to extend the armaclass.arma_generator.ArmaGenerator.generate_string to properly tokenize the parsed string by newlines and then serializing it.

Script can't handle class inheritance or class Instantiation

Would really love to have this fixed as its pretty important to capture class inheritance and instantiation when trying to parse Arma 3 classes.

When I try to parse a config.cpp file it errors out when it comes across the following.

class SlotInfo;

and

class my_class: other_class_inherited
{
       random data
};

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.