Skip to content

AttributeError: type object 'JSONGenerator' has no attribute '<INVALID>' #80

Closed
@bendrissou

Description

@bendrissou

I was trying to generate json files using the --population option and the antlr json grammar. The grt files have been prepared with no problem. But I get an error when I run the following command:

grammarinator-generate JSONGenerator.JSONGenerator -r json -o tests/test_%d.json -d 20 -n 1 --population ../seeds/grts --no-generate --sys-path .

The error output:

Test generation failed.
Traceback (most recent call last):
  File "/home/bachir/.local/lib/python3.8/site-packages/grammarinator/generate.py", line 119, in create_new_test
    tree = generator(self.rule, self.max_depth)
  File "/home/bachir/.local/lib/python3.8/site-packages/grammarinator/generate.py", line 197, in recombine
    options = self.default_selector(node for rule_name in common_types for node in tree_1.node_dict[rule_name])
  File "/home/bachir/.local/lib/python3.8/site-packages/grammarinator/generate.py", line 213, in default_selector
    return [node for node in iterable if node.name is not None and node.parent is not None and node.name != 'EOF' and node.level + min_depth(node) < self.max_depth]
  File "/home/bachir/.local/lib/python3.8/site-packages/grammarinator/generate.py", line 213, in <listcomp>
    return [node for node in iterable if node.name is not None and node.parent is not None and node.name != 'EOF' and node.level + min_depth(node) < self.max_depth]
  File "/home/bachir/.local/lib/python3.8/site-packages/grammarinator/generate.py", line 211, in min_depth
    return getattr(getattr(self.generator_cls, node.name), 'min_depth', 0)
AttributeError: type object 'JSONGenerator' has no attribute '<INVALID>'

The error does not occur if option --population is omitted. In addition, the seed inputs have been successfully parsed into grt files. The error occurs with any provided grt file.

Any idea what could be the cause of this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions