Skip to content

Commit

Permalink
fixed an edge-case bug preventing generation of helpful error message…
Browse files Browse the repository at this point in the history
…s in response to non-sensical user input (eg "@atom:")
  • Loading branch information
jewettaij committed Aug 6, 2020
1 parent 45904a0 commit 95449ab
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions moltemplate/scripts/moltemplate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
# Copyright (c) 2013

G_PROGRAM_NAME="moltemplate.sh"
G_VERSION="2.18.4"
G_DATE="2020-8-05"
G_VERSION="2.18.5"
G_DATE="2020-8-06"

echo "${G_PROGRAM_NAME} v${G_VERSION} ${G_DATE}" >&2
echo "" >&2
Expand Down
11 changes: 9 additions & 2 deletions moltemplate/ttree.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@
g_module_name = g_filename
if g_filename.rfind('.py') != -1:
g_module_name = g_filename[:g_filename.rfind('.py')]
g_date_str = '2020-8-05'
g_version_str = '0.86.5'
g_date_str = '2020-8-06'
g_version_str = '0.86.6'


class ClassReference(object):
Expand Down Expand Up @@ -872,6 +872,7 @@ def FollowPathCounterVar(leaf_ptkns, starting_node, dbg_loc):

is_static_node = isinstance(starting_node, StaticObj)

assert(len(leaf_ptkns) > 0)
if is_static_node:
is_simple_node = ((len(last_node.children) == 0) and
(len(last_node.instance_commands) == 0) and
Expand Down Expand Up @@ -1435,6 +1436,12 @@ def DescrToCatLeafNodes(descr_str, context_node, dbg_loc):

cat_name, cat_ptkns, leaf_ptkns = DescrToCatLeafPtkns(descr_str, dbg_loc)

if len(leaf_ptkns) == 0:
raise InputError('Error(' + g_module_name + '.DescrToCatLeafNodes()):\n'
' Error near ' +
ErrorLeader(dbg_loc.infile, dbg_loc.lineno) + '\n'
' Illegal counter variable \"' + descr_str + '\"\n')

# ---- ellipsis hack ----
#
# Search for class:
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@

url='https://github.com/jewettaij/moltemplate',

download_url='https://github.com/jewettaij/moltemplate/archive/v2.18.4.zip',
download_url='https://github.com/jewettaij/moltemplate/archive/v2.18.5.zip',

version='2.18.4',
version='2.18.5',

keywords=['simulation', 'LAMMPS', 'molecule editor', 'molecule builder',
'ESPResSo'],
Expand Down

0 comments on commit 95449ab

Please sign in to comment.