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

Document nmodl blame. #1189

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@ pull the changes from the main (upstream) repository:
Development Conventions
------------------------

New Lines
~~~~~~~~~

When generating/printing code it's important to use ``add_newline`` to
start a new line of code. When printing a string containing multiple lines,
i.e. one that contains a ``"\n"`` one must use ``add_multi_line``.

It's important that NMODL knows the line number it's currently on.

Formatting
~~~~~~~~~~

Expand Down Expand Up @@ -226,3 +235,27 @@ have ``CMake >= 3.15`` and use following cmake option:
::

cmake .. -DENABLE_CLANG_TIDY=ON

Blaming NMODL
~~~~~~~~~~~~~

While developing NMODL one may want to know which line of code in NMODL
produced a particular line of code in the generated file, e.g. when faced with
a compiler error such as

.. code-block::

hodhux.cpp:105:26: error: ‘coreneuron’ has not been declared
105 | double* celsius{&coreneuron::celsius};
| ^~~~~~~~~~

One can find the line by doing:

.. code-block::

$ nmodl hodhux.mod ... blame --line 105

which will print a backtrace every time NMODL writes to line 105. While this is
useful for finding the line responsible for printing, i.e. convert AST to C++,
that line it doesn't immediately explain why the AST ended up that way.
Currently, we don't have a tool for the latter.
Loading