Method: JsDuck::TypeParser#parse

Defined in:
lib/jsduck/type_parser.rb

#parse(str) ⇒ Object

Parses the type definition

<type> ::= <alteration-type>


71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/jsduck/type_parser.rb', line 71

def parse(str)
  @input = StringScanner.new(str)
  @error = :syntax
  @out = []

  # Return immediately if the base type doesn't match
  return false unless alteration_type

  # Concatenate all output
  @out = @out.join

  # Success if we have reached the end of input
  return @input.eos?
end