Class: RBS::Parser
Relationships & Source Files | |
Namespace Children | |
Classes:
| |
Inherits: | Object |
Defined in: | lib/rbs/parser_aux.rb, ext/rbs_extension/parser.c |
Constant Summary
-
KEYWORDS =
# File 'lib/rbs/parser_aux.rb', line 36%w( bool bot class instance interface nil self singleton top void type unchecked in out end def include extend prepend alias module attr_reader attr_writer attr_accessor public private untyped true false ).each_with_object({}) do |keyword, hash| hash[keyword] = nil end
-
LexerError =
# File 'lib/rbs/parser_compat/lexer_error.rb', line 6RBS::ParsingError
-
SemanticsError =
# File 'lib/rbs/parser_compat/semantics_error.rb', line 6RBS::ParsingError
-
SyntaxError =
# File 'lib/rbs/parser_compat/syntax_error.rb', line 6RBS::ParsingError
Class Method Summary
- ._parse_method_type(buffer, start_pos, end_pos, variables, require_eof)
- ._parse_signature(buffer, end_pos)
- ._parse_type(buffer, start_pos, end_pos, variables, require_eof)
- .buffer(source)
- .parse_method_type(source, range: 0, variables: [], require_eof: false)
- .parse_signature(source)
- .parse_type(source, range: 0, variables: [], require_eof: false)
Class Method Details
._parse_method_type(buffer, start_pos, end_pos, variables, require_eof)
[ GitHub ]# File 'ext/rbs_extension/parser.c', line 2772
static VALUE rbsparser_parse_method_type(VALUE self, VALUE buffer, VALUE start_pos, VALUE end_pos, VALUE variables, VALUE require_eof) { parserstate *parser = alloc_parser(buffer, FIX2INT(start_pos), FIX2INT(end_pos), variables); if (parser->next_token.type == pEOF) { return Qnil; } VALUE method_type = parse_method_type(parser); if (RB_TEST(require_eof)) { parser_advance_assert(parser, pEOF); } free_parser(parser); return method_type; }
._parse_signature(buffer, end_pos)
[ GitHub ]# File 'ext/rbs_extension/parser.c', line 2792
static VALUE rbsparser_parse_signature(VALUE self, VALUE buffer, VALUE end_pos) { parserstate *parser = alloc_parser(buffer, 0, FIX2INT(end_pos), Qnil); VALUE pair = parse_signature(parser); free_parser(parser); return pair; }
._parse_type(buffer, start_pos, end_pos, variables, require_eof)
[ GitHub ]# File 'ext/rbs_extension/parser.c', line 2752
static VALUE rbsparser_parse_type(VALUE self, VALUE buffer, VALUE start_pos, VALUE end_pos, VALUE variables, VALUE require_eof) { parserstate *parser = alloc_parser(buffer, FIX2INT(start_pos), FIX2INT(end_pos), variables); if (parser->next_token.type == pEOF) { return Qnil; } VALUE type = parse_type(parser); if (RB_TEST(require_eof)) { parser_advance_assert(parser, pEOF); } free_parser(parser); return type; }
.buffer(source)
[ GitHub ].parse_method_type(source, range: 0, variables: [], require_eof: false)
[ GitHub ]# File 'lib/rbs/parser_aux.rb', line 10
def self.parse_method_type(source, range: 0..., variables: [], require_eof: false) buf = buffer(source) _parse_method_type(buf, range.begin || 0, range.end || buf.last_position, variables, require_eof) end
.parse_signature(source)
[ GitHub ]# File 'lib/rbs/parser_aux.rb', line 15
def self.parse_signature(source) buf = buffer(source) dirs, decls = _parse_signature(buf, buf.last_position) [buf, dirs, decls] end
.parse_type(source, range: 0, variables: [], require_eof: false)
[ GitHub ]# File 'lib/rbs/parser_aux.rb', line 5
def self.parse_type(source, range: 0..., variables: [], require_eof: false) buf = buffer(source) _parse_type(buf, range.begin || 0, range.end || buf.last_position, variables, require_eof) end