From 80c421e2d9f459ceda21a81c6380054f8ab21952 Mon Sep 17 00:00:00 2001 From: Gareth Aneurin Tribello Date: Tue, 25 Jun 2024 14:51:49 +0100 Subject: [PATCH] Fixed issue that appears when round brackets are used around keyword entry --- PlumedToHTML/PlumedLexer.py | 4 +++- setup.py | 2 +- tdata/lexertests.json | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/PlumedToHTML/PlumedLexer.py b/PlumedToHTML/PlumedLexer.py index c5f1560..d655514 100644 --- a/PlumedToHTML/PlumedLexer.py +++ b/PlumedToHTML/PlumedLexer.py @@ -26,8 +26,10 @@ class PlumedLexer(RegexLexer): (r'(\w+)(=)(@\S+:)((?s)\{.*?\})', bygroups(Name.Attribute, Text, Name.Constant, Generic)), # Find special replica syntax without brackets (r'(\w+)(=)(@\S+:)(\S+\b)', bygroups(Name.Attribute, Text, Name.Constant, Generic)), - # Find KEYWORD with brackets around value + # Find KEYWORD with {} brackets around value (r'(\w+)(=)((?s)\{.*?\})', bygroups(Name.Attribute, Text, Generic)), + # Find KEYWORD with () brackets around value + (r'(\w+)(=)((?s)\(.*?\))', bygroups(Name.Attribute, Text, Generic)), # Find KEYWORD=whatever (r'(\w+)(=)(\S+\b)', bygroups(Name.Attribute, Text, Generic)) ], diff --git a/setup.py b/setup.py index 5dd1123..abab29c 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setuptools.setup( name='PlumedToHTML', - version='0.71', + version='0.72', author="Gareth Tribello", author_email="gareth.tribello@gmail.com", description="A package for creating pretified HTML for PLUMED files", diff --git a/tdata/lexertests.json b/tdata/lexertests.json index 5e434ad..50b1de3 100644 --- a/tdata/lexertests.json +++ b/tdata/lexertests.json @@ -79,6 +79,10 @@ { "input": "# This is a comment \n phi: TORSION ATOMS=1,2,3,4 # This is also a comment with : a colon", "output": "
# This is a comment \n phi: TORSION ATOMS=1,2,3,4 # This is also a comment with : a colon\n
\n" + }, + { + "input": "st_saxs: STATS ARG=(SAXS\\.q-.*) PARARG=(SAXS\\.exp-.*)", + "output": "
st_saxs: STATS ARG=(SAXS\\.q-.*) PARARG=(SAXS\\.exp-.*)\n
\n" } ] }