code: function typedef() {
    match(/\{/);
  
    name = parse_balanced(/\{/, /\}/, /[^{}]*/);
  
    if (/=$/.test(name)) {
      name = name.substring(0, name.length - 1);
      optional = true;
    }
    else {
      optional = null;
    }
  
    match(/\}/);
  
    return {"type" : name, "optional": optional};
  }
docs: matches {...=} and returns text inside brackets