Issue with series of numerical arrays
This should be parsed:
d = (dipole: [0.59656566009308, 0.59656566009677, -1.3e-13]) [bohr * elementary_charge]
but I get
Syntax error: None:1:62 --> 1.3e-13]) *[bohr * el <--
Expected 'if' or 'for' or 'on' or '^|;' or EOF
This works:
d = (dipole: [0.59656566009308, 0.59656566009677, -1.3e-13] [bohr * elementary_charge])
but it is not practical for more than one series elements (each of which is an array). Now if I want to print it in units of Debye:
print(d [debye])
I get this error:
Traceback (most recent call last):
File "vre-language/src/virtmat/language/utilities/errors.py", line 96, in wrapper
return func(*args, **kwargs)
File "../scripts/run_model.py", line 60, in run_instant_deferred
return meta.model_from_file(clargs.model_file, deferred_mode=deferred,
File "jupyter-tensorflow-2023-01-02/lib64/python3.8/site-packages/textx/metamodel.py", line 658, in model_from_file
return self.internal_model_from_file(
File "jupyter-tensorflow-2023-01-02/lib64/python3.8/site-packages/textx/metamodel.py", line 712, in internal_model_from_file
p(model, self)
File "vre-language/src/virtmat/language/constraints/typechecks.py", line 59, in check_types_processor
_ = obj.type_
File "/usr/lib64/python3.8/functools.py", line 967, in __get__
val = self.func(instance)
File "vre-language/src/virtmat/language/constraints/typechecks.py", line 95, in print_type
_ = par.type_
File "/usr/lib64/python3.8/functools.py", line 967, in __get__
val = self.func(instance)
File "vre-language/src/virtmat/language/utilities/errors.py", line 42, in wrapper
raise TextXError(str(err), **loc, context=con) from err
textx.exceptions.TextXError: vre-language/examples/2.vm:2:7: 'PrintParameter' object has no attribute 'parameter' => 'd [debye]'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "../scripts/run_model.py", line 118, in <module>
main()
File "../scripts/run_model.py", line 108, in main
prog = run_instant_deferred(clargs, deferred=False)
File "vre-language/src/virtmat/language/utilities/errors.py", line 98, in wrapper
process_error(err)
File "vre-language/src/virtmat/language/utilities/errors.py", line 81, in process_error
raise err.__cause__
File "vre-language/src/virtmat/language/utilities/errors.py", line 35, in wrapper
return func(*args, **kwargs)
File "vre-language/src/virtmat/language/constraints/typechecks.py", line 104, in print_parameter_type
raise TypeError(f'Parameter {self.parameter} is no numeric type')
AttributeError: 'PrintParameter' object has no attribute 'parameter'
Element-wise conversion works:
print(d[0] [debye])
Result:
[1.516318662573084, 1.5163186625824632, -3.304270415158405e-13] [debye]
Edited by Ivan Kondov