Closed eszter137 closed 4 years ago
Yes, I also realised that querying negative numbers is broken. It is a consequence of fixing issue #56. The parer is confused where to split string when there is a '-' sing in it because it could be part the name of could be an operator. For simplity, I would suggest preventing using '-' character in the labels.
I guess the </>/= are not allowed in the label names so the program could see that the other part is a number. Or is it possible to compare labels in the query? - It seems not to me:
$ abcd summary -q E_CC_MP2_2B -q "cutoff>E_CC_MP2_2B"
Total number of configurations: 0
$ abcd summary -q E_CC_MP2_2B -q "cutoff<E_CC_MP2_2B"
Total number of configurations: 0
no, we must allow - in the label names. As Eszter says, you should first look for the operator to split! there will be no <,>,= in the label names.
Ok. But in this case, we will have issues with the arithmetic functions because '-' is also an operator
n_atom-3>2
I do not any programing language which would support '-' in the name of the variables
Hm... you do have a point. On second thoughts, I'm OK with disallowing arithmetic expressions involving keys with - in them. Is there a clean way to have this fail with an error message, without forbidding such keys in the first place? I.e. is there a point in the code when you know you are going to parse an arithmetic expression, and can check if any of the keys include the - character?
The point is that this could be part of user education. I upload stuff with - in the names, then try to use them, fail with the error, and then I can use --rename to change my key naming conventions
This is better than throwing an error when one tries to upload such data, because then the nice abcd tools cannot be used to remedy the situation!
Alternatively, we could have a --sanitize option to upload, which enforces whatever constraints we want, e.g. replacing all - characters in names to _ (or perhaps any other disallowed character that ASE still allows)
Decision: for now, check the uploaded file for key names: we only allow [a-zA-Z0-9] (no '-' obviously), if file fails, we stop with error and educational message: --sanitize will change all illegal characters to "" (underscore)
works with positive numbers or zero: