aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-05-08 06:39:08 +0200
committerTristan Gingold <tgingold@free.fr>2018-05-23 20:34:33 +0200
commit56c06814817f3bd5134c34271023da400d2de1fc (patch)
tree3c4f8fe243660023587fa9159da371232a953e42 /src
parentd88ed36e42b1a744d71b5707f3521bca232eefb8 (diff)
downloadghdl-56c06814817f3bd5134c34271023da400d2de1fc.tar.gz
ghdl-56c06814817f3bd5134c34271023da400d2de1fc.tar.bz2
ghdl-56c06814817f3bd5134c34271023da400d2de1fc.zip
pnodes.py: add --kind-range-prefix option.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/xtools/pnodes.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/xtools/pnodes.py b/src/xtools/pnodes.py
index bc31114ea..4777a4ce3 100755
--- a/src/xtools/pnodes.py
+++ b/src/xtools/pnodes.py
@@ -189,8 +189,8 @@ def read_kinds(filename):
raise ParseError(lr, 'Unknow line within kind declaration')
# Check subtypes
- pat_subtype = re.compile(' subtype ' + prefix_range_name
- + r'(\w+) is ' + type_name + ' range\n')
+ pat_subtype = re.compile(' subtype ' + r'(\w+) is '
+ + type_name + ' range\n')
pat_first = re.compile(' ' + prefix_name + r'(\w+) ..\n')
pat_last = re.compile(' ' + prefix_name + r'(\w+);\n')
pat_middle = re.compile(' --' + prefix_name + r'(\w+)\n')
@@ -205,6 +205,9 @@ def read_kinds(filename):
if m:
# Check first bound
name = m.group(1)
+ if not name.startswith(prefix_range_name):
+ raise ParseError(lr, 'incorrect prefix for subtype')
+ name = name[len(prefix_range_name):]
l = lr.get()
mf = pat_first.match(l)
if not mf:
@@ -220,7 +223,7 @@ def read_kinds(filename):
# Check element in the middle
if kinds.index(ml.group(1)) != idx + 1:
raise ParseError(
- lr, "missing " + kinds[idx] + " in subtype")
+ lr, "missing " + kinds[idx + 1] + " in subtype")
has_middle = True
idx = idx + 1
else:
@@ -862,6 +865,9 @@ def main():
parser.add_argument('--kind-prefix', dest='kind_prefix',
default='Iir_Kind_',
help='prefix for kind literals')
+ parser.add_argument('--kind-range-prefix', dest='kind_range_prefix',
+ default='Iir_Kinds_',
+ help='prefix for kind subtype (range)')
parser.add_argument('--node-type', dest='node_type',
default='Iir',
help='name of the node type')
@@ -875,10 +881,11 @@ def main():
global formats, fields, nodes, kinds, kinds_ranges, funcs
global type_name, prefix_name, template_file, node_type, meta_base_file
- global flag_keep_order
+ global prefix_range_name, flag_keep_order
type_name = args.kind_type
prefix_name = args.kind_prefix
+ prefix_range_name = args.kind_range_prefix
template_file = args.template_file
node_type = args.node_type
meta_base_file = args.meta_basename