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

Add NMODL Language #6776

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Add NMODL Language #6776

wants to merge 3 commits into from

Conversation

matz-e
Copy link

@matz-e matz-e commented Mar 28, 2024

This is the NEURON extension to MODL, a model description language used
within the neuroscientific community. See also:

https://www.neuron.yale.edu/neuron/static/py_doc/modelspec/programmatic/mechanisms/nmodl2.html

Description

I am involved in the neuroscientific community around the NEURON simulator. It has its
own DSL used to describe neuron processes. We have noticed that a lot of the code files
are misclassified as AMPL, and would like to fix that.

The linked search matches 12.7k files, which I think constitutes a strong case to
recognize the language within Github. I have included two samples from the main NEURON
repository showcasing the syntax.

The extension is shared by kernel modules and AMPL. I have looked into providing more
samples for the latter, but I am not sure which licenses these examples would be.
Comparing the two languages, they seem very different. Do you have any advise?

I will contact the author(s) of existing syntax highlighting to see if they can provide
their syntax highlighting under a compatible license.

Checklist:

This is the NEURON extension to MODL, a model description language used
within the neuroscientific community.  See also:

https://www.neuron.yale.edu/neuron/static/py_doc/modelspec/programmatic/mechanisms/nmodl2.html
@matz-e matz-e requested a review from a team as a code owner March 28, 2024 10:19
@lildude
Copy link
Member

lildude commented Mar 28, 2024

Comparing the two languages, they seem very different. Do you have any advise?

Yup, add a regex to the list of current heuristics for the .mod extension:

- extensions: ['.mod']
rules:
- language: XML
pattern: '<!ENTITY '
- language: Modula-2
pattern: '^\s*(?i:MODULE|END) [\w\.]+;'
- language: [Linux Kernel Module, AMPL]

@matz-e
Copy link
Author

matz-e commented Mar 30, 2024

Comparing the two languages, they seem very different. Do you have any advise?

Yup, add a regex to the list of current heuristics for the .mod extension:

Thanks! I added some keywords that would seem fairly safe. Sorry, did not realize it would be relatively simple. Tested the changes on a local repo, too.

Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please update the test for this heuristic too.

@matz-e
Copy link
Author

matz-e commented Apr 4, 2024

Can you please update the test for this heuristic too.

OK, added a line there, bundle exec rake test and the crosstest seem to come back clean

Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

Note: this PR will not be merged until close to when the next release is made. See here for more details.

@matz-e
Copy link
Author

matz-e commented Apr 4, 2024

OK, no problem. Thank you for the help & guidance!

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

Successfully merging this pull request may close these issues.

None yet

2 participants