diff options
-rw-r--r-- | tools/fuzzing/rost/convert.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/fuzzing/rost/convert.py b/tools/fuzzing/rost/convert.py index 116dee6..b0ed90c 100644 --- a/tools/fuzzing/rost/convert.py +++ b/tools/fuzzing/rost/convert.py @@ -11,6 +11,14 @@ def define_PLAIN_TEXT(name, last): print(' "<char>": [ ["0"], ["1"], ["2"], ["3"], ["4"], ["5"], ["6"], ["7"], ["8"], ["9"], ["A"], ["B"], ["C"], ["D"], ["E"], ["F"] ]%s' % (',' if not(last) else '')) +def define_IDENTIFIER(name, last): + """Create definition for the RULE_IDENTIFIER token.""" + + print(' "<%s>": [ [ "<id>", "<id>", "<id>", "<idx>" ] ],' % name.lower()) + print(' "<id>": [ ["a"], ["b"], ["c"], ["d"], ["e"], ["f"], ["g"], ["h"], ["i"], ["j"], ["k"], ["l"] ],') + print(' "<idx>": [ ["0"], ["1"], ["2"], ["3"], ["4"], ["5"], ["6"], ["7"], ["8"], ["9"] ]%s' % (',' if not(last) else '')) + + def define_SIGNED_INTEGER(name, last): """Create definition for the SIGNED_INTEGER token.""" @@ -105,7 +113,7 @@ def define_GB(name, last): __lexer_tokens = { 'PLAIN_TEXT': define_PLAIN_TEXT, 'ESCAPED_TEXT': define_PLAIN_TEXT, - 'RULE_IDENTIFIER': define_PLAIN_TEXT, + 'RULE_IDENTIFIER': define_IDENTIFIER, 'INFO_KEY': define_PLAIN_TEXT, 'SIGNED_INTEGER': define_SIGNED_INTEGER, 'UNSIGNED_INTEGER': define_UNSIGNED_INTEGER, @@ -131,7 +139,6 @@ __lexer_tokens = { 'KB': define_KB, 'MB': define_MB, 'GB': define_GB, - 'STRING': define_PLAIN_TEXT, } @@ -378,7 +385,7 @@ def output_rules(tree): for k, v in tree.items(): - print(' "<%s>": [ ' % k, end='') + print(' "<%s>": [' % k, end='') first = True |