Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to recognize missing colon (,) in arrays #35

Closed
veteran29 opened this issue Sep 23, 2018 · 4 comments
Closed

Fails to recognize missing colon (,) in arrays #35

veteran29 opened this issue Sep 23, 2018 · 4 comments
Assignees
Labels
bug grammar issues with grammar
Milestone

Comments

@veteran29
Copy link
Contributor

This does not produce error:

params [
    ["_start", nil, [[]], 3],
    ["_end", nil, [[]], 3],
    ["_focus", nil, [objNull, []], 3]   // <-- missing "," does not result in syntax error
    ["_camera", nil, [objNull]]
];

Additional colon is properly seen as error:

params [
    ["_start", nil, [[]], 3],
    ["_end", nil, [[]], 3],
    ["_focus", nil, [objNull, []], 3],
    ["_camera", nil, [objNull]], // <-- produces error
];
private _arr = ["1" "2", "3"]; // no error
private _arr = ["1", "2" "3"]; // no error
private _arr = ["1", "2" "3",]; // error
@SkaceKamen SkaceKamen self-assigned this Sep 23, 2018
@SkaceKamen
Copy link
Owner

This is because the "missing" colon is hard to recognise in current grammar, since I was lazy and the grammar is very broad. Any two expressions next to each other are allowed.

In the SQF something like this is valid with or without the colon:

private _arr1 = [1, player, call BIS_fnc_something];
private _arr2 = [1, player call BIS_fnc_something];

so, as far as the grammar is concerned right now, it's the same as

private _arr = [1, 2 3, 4];

(the 3 is argument of command 2)

I know this is terrible. I'll need to create some kind of inteligent check whenever two expressions next to each other are callable or not. I'm thinking about making all the "operators" (commands) part of grammar, so the grammar correctly recognises these issues... that may take a while

And as far as the trailing colon, since when is that allowed? I feel like when I was making this extension, it produced error.

@veteran29
Copy link
Contributor Author

Trailing colon is not allowed ("Additional colon is properly seen as error:") I've just added it as an example that it works correctly in that case.

@SkaceKamen
Copy link
Owner

SkaceKamen commented Oct 1, 2018

I'm blind, sorry :'(

@SkaceKamen SkaceKamen added this to the Version 0.8.9 milestone Oct 2, 2018
@SkaceKamen
Copy link
Owner

Partially fixed in version 0.9.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug grammar issues with grammar
Projects
None yet
Development

No branches or pull requests

2 participants