#! /usr/bin/python3 # Simple script to parse specs and produce CSV files. # Released by Rusty Russell under CC0: # https://creativecommons.org/publicdomain/zero/1.0/ # Outputs: # # Standard message types: # msgtype,, # msgdata,,,,[] # # TLV types: # tlvtype,,, # tlvdata,,,,,[] # # Subtypes: # subtype, # subtypedata,,,,[] from optparse import OptionParser import sys import re import fileinput # We allow either ordered or unordered lists. typeline = re.compile( '(1\.|\*) type: (?P[-0-9A-Za-z_|]+) \(`(?P[A-Za-z0-9_]+)`\)( \(`?(?P