-
Notifications
You must be signed in to change notification settings - Fork 245
Expand file tree
/
Copy pathinline_parser.rbs
More file actions
68 lines (45 loc) · 1.59 KB
/
inline_parser.rbs
File metadata and controls
68 lines (45 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
use RBS::AST::Ruby::Declarations
module RBS
class InlineParser
class Result
attr_reader buffer: Buffer
attr_reader prism_result: Prism::ParseResult
attr_reader declarations: Array[AST::Ruby::Declarations::t]
attr_reader diagnostics: Array[Diagnostic::t]
def initialize: (Buffer, Prism::ParseResult) -> void
end
module Diagnostic
class Base
attr_reader message: String
attr_reader location: Location
def initialize: (Location, String) -> void
end
class NotImplementedYet < Base
end
class NonConstantClassName < Base
end
class NonConstantModuleName < Base
end
class TopLevelMethodDefinition < Base
end
type t = NotImplementedYet
| NonConstantClassName | NonConstantModuleName
| TopLevelMethodDefinition
end
def self.parse: (Buffer, Prism::ParseResult) -> Result
class Parser < Prism::Visitor
type module_context = Declarations::ClassDecl | Declarations::ModuleDecl
include AST::Ruby::Helpers::ConstantHelper
include AST::Ruby::Helpers::LocationHelper
attr_reader result: Result
attr_reader module_nesting: Array[module_context]
def initialize: (Result) -> void
def buffer: () -> Buffer
%a{pure} def current_module: () -> module_context?
%a{pure} def current_module!: () -> module_context
def diagnostics: () -> Array[Diagnostic::t]
def push_module_nesting: [T] (module_context) { () -> T } -> T
def insert_declaration: (module_context) -> void
end
end
end