fusselwurm / arma-class-parser Goto Github PK
View Code? Open in Web Editor NEWConvert Arma3 class definitions to JSON
License: MIT License
Convert Arma3 class definitions to JSON
License: MIT License
class Foo {val=1;};class Moo {val=1;};
If you add a space before the second class, it parses fine
Is this code even needed, since it currently only handles addition and parses it wrong.
The code is:
return expression.split('+').map(parseNumber).reduce(function (prev, cur) {
return prev + cur;
}, 0);
In our missions.sqm, we have:
position[]={12365.242,2.1711425e+020,8484.4668};
So parseArray
will call parseMathExpression
for the second value in the array.
This in turn will split it to: 2.1711425e
and 020
, parse them separately and then sum the result, which is wrong.
The value above is supposed to evaluate to 2.1711425 * 2^20 = 217114250000000000000
and parseFloat does this out of the box.
I don't know if parseMathExpression
has ever been needed here. Maybe it was put here because the author thought this was a real mathematical addition?
Shouldn't you use while (current())
in parseTranslationString
just the same way as you're doing it in parseString
?
I noticed that you had a commit that was fixing the code that way and I thought that this may need the same change here: https://github.com/Fusselwurm/arma-class-parser/blob/master/src/class-parser.ts#L190
Hey!
What is the license of the code fot arma-class-parser?
You don't have any information about it on github (neither in the project settings nor in a LICENSE
file so I need to ask here).
I'm a Python programmer and I was using your code in my python programs coupled with PyExecJS first and js2py later to allow its execution from Python. The first one is tricky to set up in Windows and the second one is quite slow because it's like emulation of Javascript code.
Because your code is quite small, I thought about porting it to Python to for greater simplicity, ability to install it with a python package manager and for greater speed, of course. That's why the license choice is important for me (since I'd probably be reusing some of your code or at least part of the constructs).
I would like to release my code on Github under the MIT license (TL;DR: you can use this code wherever you want but you need to keep the information about the author in the source) but for that to happen your code would also have to be licensed as MIT. Are you okay with this?
Otherwise, I'll probably quickly hack a simple parser in python from scratch just for my needs that I'll be ashamed of showing to the world so I'd prefer you to agree on that license, tbh ;)
I was reading your code yesterday and I plan on reporting a few issues that I've noticed there in the next few days.
weHaveAStringLineBreak = function () {
return raw.substr(currentPosition, 6).indexOf('" \\n "') === 0;
},
What is the purpose of this part of the code?
It seems to check for the presence of " \n "
(including the quotes!). I haven't seen any occurrence of such a string in our sqm files anywhere so I suspect there is some kind of mistake here.
I would have to double-check this but I think that only one \
is needed if you mean splitting the string onto several lines. If that's the case, then the spaces around the \n
are wrong because there could be an arbitrary number of whitespace characters on both sides of the newline character (including tabs, etc...). Also \r\n
should be handled too probably.
1.58 added the ability to make linebreaks in editor fields, could look like this
init="[this, ""Platoon""] call FP_fnc_setVehicleName; " \n "if (isServer) then { " \n " [this] call FP_fnc_clearVehicle; this addWeaponCargoGlobal [""CUP_launch_M136"", 1]; " \n " this addMagazineCargoGlobal [""1Rnd_HE_Grenade_shell"", 10]; " \n "this addMagazineCargoGlobal [""ATMine_Range_Mag"", 6]" \n "};";
This is not supported and errors out
In parseMathExpression
, you have:
var
posOfExpressionEnd = Math.min(
indexOfOrMaxInt.call(raw, chars.SEMICOLON, currentPosition),
indexOfOrMaxInt.call(raw, chars.CURLY_CLOSE, currentPosition),
indexOfOrMaxInt.call(raw, chars.COMMA, currentPosition)
),
expression = raw.substr(currentPosition, posOfExpressionEnd - currentPosition);
assert(posOfExpressionEnd !== -1);
I'm not a JavaScript developer but you probably meant to assert if posOfExpressionEnd
is not infinity instead of -1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.