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

Issue warning for empty units during semantic analysis #8

Open
pramodk opened this issue Feb 23, 2019 · 4 comments · May be fixed by #883
Open

Issue warning for empty units during semantic analysis #8

pramodk opened this issue Feb 23, 2019 · 4 comments · May be fixed by #883
Labels
enhancement New feature or request parser Parser related issue semantics Related to semantics of the language

Comments

@pramodk
Copy link
Contributor

pramodk commented Feb 23, 2019

Empty unit name declaration is valid according to the original implementation in NEURON:

i.e.

UNITS 
{
                   () = (millivolt)
}

is accepted now. Note the empty bracket on the left where there should be a name. Similarly, function declarations like the below are now also accepted:

FUNCTION ssCB(kdf(), kds()) (mM) 
{
}

Above behaviour was implemented in #3 in order to pass the fail existing ModelDB files.

When we will have semantic analysis pass for error checking, we can add a check to see if there is an empty unit definition like above and then error / throw exception. This way, parsing will be successful but the semantic analysis will be a "proper" place to do such checking.

@pramodk pramodk added enhancement New feature or request parser Parser related issue semantics Related to semantics of the language labels Feb 23, 2019
@pramodk pramodk added this to the v1.0 milestone Mar 3, 2019
@pramodk pramodk removed this from the v0.2 milestone Apr 30, 2019
@alkino
Copy link
Member

alkino commented Dec 15, 2020

Can you give an example here of such files

@iomaganaris
Copy link
Contributor

On top of that it would be useful to have a more detailed description about what empty units are what they are used for

@nrnhines
Copy link
Collaborator

If by empty, you mean no units specified, then that is equivalent to dimensionless, i.e. units syntax of (1).

@alkino alkino linked a pull request Jun 15, 2022 that will close this issue
@alkino
Copy link
Member

alkino commented Feb 13, 2023

About empty units in nrn.
The truely empty units () is forbidden because:

Redefinition of units () to:	0.001 m2-kg/sec2-coul
 is ignored.
They remain:	1
Error: Units redefinition at line 3 in file a.mod
    () = (millivolt)
                   ^

The onespace unit ( ) is accepted once.

Inside function arguments both are accepted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request parser Parser related issue semantics Related to semantics of the language
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants