Method: JsDuck::DocParser#default_value

Defined in:
lib/jsduck/doc_parser.rb

#default_valueObject

Attempts to allow balanced braces in default value. When the nested parsing doesn’t finish at closing “]”, roll back to beginning and simply grab anything up to closing “]”.



507
508
509
510
511
512
513
514
515
516
# File 'lib/jsduck/doc_parser.rb', line 507

def default_value
  start_pos = @input.pos
  value = parse_balanced(/\[/, /\]/, /[^\[\]'"]*/)
  if look(/\]/)
    value
  else
    @input.pos = start_pos
    match(/[^\]]*/)
  end
end