Class: TypedRb::TypeSignature::Parser
- Includes:
- TokenProcessor, TypeProcessor
- Defined in:
- lib/typed/type_signature/parser.rb
Instance Attribute Summary collapse
-
#method_info ⇒ Object
readonly
Returns the value of attribute method_info.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(method_info = {}) ⇒ Parser
constructor
A new instance of Parser.
- #parse(expr) ⇒ Object
Methods included from TypeProcessor
#block_arg?, #parse_binding, #parse_block_arg, #parse_end_of_binding, #parse_end_of_function, #parse_new_type, #parse_next_elem, #parse_start_of_type, #parse_variable_binding
Methods included from TokenProcessor
#group_tokens, #transform_function_tokens, #transform_nested_function, #variable_group?
Constructor Details
#initialize(method_info = {}) ⇒ Parser
Returns a new instance of Parser.
169 170 171 172 173 174 175 |
# File 'lib/typed/type_signature/parser.rb', line 169 def initialize(method_info = {}) @method_info = method_info @current_type = [] @current_function = [] @stack = [] @in_binding = false end |
Instance Attribute Details
#method_info ⇒ Object (readonly)
Returns the value of attribute method_info.
167 168 169 |
# File 'lib/typed/type_signature/parser.rb', line 167 def method_info @method_info end |
Class Method Details
Instance Method Details
#parse(expr) ⇒ Object
177 178 179 180 181 182 183 184 185 186 |
# File 'lib/typed/type_signature/parser.rb', line 177 def parse(expr) @input_expression = expr expr = sanitize_input(expr) expr.each_char { |elem| parse_next_char(elem) } build_final_signature rescue TypedRb::TypeSignature::ParsingError => e raise e rescue StandardError => e raise TypedRb::TypeSignature::ParsingError.new(expr, e.) end |