Skip to content

Added lexer support for keywords followed by nested braces - #39

Merged
gtribello merged 1 commit into
plumed:mainfrom
ollyfutur:main
Nov 20, 2026
Merged

gtribello merged 1 commit into
plumed:mainfrom
ollyfutur:main

Conversation

@ollyfutur

@ollyfutur ollyfutur commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

The lexer will now properly decompose KEYWORD={{...} {...} {...} ... } (one-level nesting only)

Solves #38

@gtribello

Copy link
Copy Markdown
Member

Hi @ollyfutur

Did you run the tests after making your change? As you can see here, when I ran them on GitHub they all failed.

To run the tests you need to issue the command:

tox -e tests

In the base directory of the package. You also need PLUMED to be available in your PATH for them to run.

You can also try building all the inputs into a website that you can load locally by issuing the following commands:

cd check_inputs
./make_inputs.sh

This creates an html page with all the inputs that could be rendered on it in testDir/check_site.html.

In my experience, the process of using regex to lex the input is pretty fiddly. If you think that two heads on this might be better than one drop me an email and we can arrange a time for a meeting.

@ollyfutur

ollyfutur commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Hi @ollyfutur

Did you run the tests after making your change? As you can see here, when I ran them on GitHub they all failed.

I only ran the test_lexer.py with my added item to tdata/lexertests.json and it passes.

I could not ran the full suite 100% successful locally, I’m not sure why, but the failures are not related to my PR (they are the same before and after the commit).

SUBFAILED[plumed plotswitch --switch="RATIONAL NN=5 MM=9 R_0=1.3" --from=1.29999 --to=1.30001 --steps=100 > plot.dat] (item={'input': 'plumed plotswitch --switch="RATIONAL NN=5 MM=9 R_0=1.3" --from=1.29999 --to=1.30001 --steps=100 > plot.dat'...plot.dat</span>\n</pre></div>\n', 'tooltips': ['plotswitch', '--switch', '--from', '--to', '--steps', 'plot.dat', ...]}) tests/test_cllexing.py::TestPlumedLexer::testCLtoolLexer - AssertionError: '<div[129 chars]pan>="RATIONAL NN=5 MM=9 R_0=1.3" <span class=[149 chars]v>\n' != '<div[129 chars]pan>=&quot;RATIONAL NN=5 MM=9 R_0=1.3&quot; <s[159 chars]v>\n'

AI points at an upgrade of the pygments library that changes the way quotes are written (" vs &quot;), but I did not investigate further.

Also I suspect there is an unrelated problem in the GitHub CI since it fails at Python setup (Error: The version '3.8' with architecture 'x64' was not found for Ubuntu 26.04.), but I’m not experimented in that regard.

Cheers!

@gtribello
gtribello merged commit 7538f47 into plumed:main Nov 20, 2026
1 of 7 checks passed
@gtribello

Copy link
Copy Markdown
Member

OK. In that case, I will merge (have merged) this and try to find some time to look at how to deal with other problems in the next few days. Once, I fix the problems causes by the changes to Pygments I will create a release so this new code is used to build the manual.

Many thanks

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.

2 participants