Method: JsDuck::DocParser#maybe_name_with_default

Defined in:
lib/jsduck/doc_parser.rb

#maybe_name_with_defaultObject

matches: <ident-chain> | “[” <ident-chain> [ “=” <default-value> ] “]”



451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
# File 'lib/jsduck/doc_parser.rb', line 451

def maybe_name_with_default
  skip_horiz_white
  if look(/\[/)
    match(/\[/)
    maybe_ident_chain(:name)
    skip_horiz_white
    if look(/=/)
      match(/=/)
      skip_horiz_white
      @current_tag[:default] = default_value
    end
    skip_horiz_white
    match(/\]/)
    @current_tag[:optional] = true
  else
    maybe_ident_chain(:name)
  end
end