aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-05-11 08:43:15 +0200
committerTristan Gingold <tgingold@free.fr>2019-05-11 18:13:38 +0200
commitb48a354b9bb3a68c255aee53a6ea688356c99ddc (patch)
tree3307c8d2d89a612b4f43c7acb4b38a3518233b1b
parenta93f7a341a188593632f7f46fd456a82a2609b0e (diff)
downloadghdl-b48a354b9bb3a68c255aee53a6ea688356c99ddc.tar.gz
ghdl-b48a354b9bb3a68c255aee53a6ea688356c99ddc.tar.bz2
ghdl-b48a354b9bb3a68c255aee53a6ea688356c99ddc.zip
pnodes.py: strengthen
-rwxr-xr-xsrc/xtools/pnodes.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/xtools/pnodes.py b/src/xtools/pnodes.py
index f573cc417..62d5362d3 100755
--- a/src/xtools/pnodes.py
+++ b/src/xtools/pnodes.py
@@ -221,7 +221,11 @@ def read_kinds(filename):
ml = pat_middle.match(l)
if ml:
# Check element in the middle
- if kinds.index(ml.group(1)) != idx + 1:
+ n = ml.group(1)
+ if n not in kinds:
+ raise ParseError(
+ lr, "unknown kind " + n + " in subtype")
+ if kinds.index(n) != idx + 1:
raise ParseError(
lr, "missing " + kinds[idx + 1] + " in subtype")
has_middle = True
@@ -312,6 +316,7 @@ def read_methods(filename):
# (one description may describe several nodes).
def read_nodes_fields(lr, names, fields, nodes, funcs_dict):
pat_only = re.compile(' -- Only for ' + prefix_name + '(\w+):\n')
+ pat_only_bad = re.compile (' -- *Only for.*\n')
pat_field = re.compile(' -- Get/Set_(\w+) \((Alias )?([\w,]+)\)\n')
pat_comment = re.compile(' --.*\n')
pat_start = re.compile(' -- \w.*\n')
@@ -369,6 +374,8 @@ def read_nodes_fields(lr, names, fields, nodes, funcs_dict):
only_nodes = cur_nodes
elif pat_start.match(l):
raise ParseError(lr, 'bad line in node description')
+ elif pat_only_bad.match(l):
+ raise ParseError(lr, "misleading 'Only for' comment")
elif not pat_comment.match(l):
raise ParseError(lr, 'bad line in node description')
l = lr.get()