rbs 4.0.1.dev.1 → 4.0.1.dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,60 +0,0 @@
1
- use ruby_rbs::node::{Node, parse};
2
-
3
- fn main() {
4
- let rbs_code = r#"class Foo[T] < Bar end"#;
5
- let signature = parse(rbs_code.as_bytes()).unwrap();
6
-
7
- let declaration = signature.declarations().iter().next().unwrap();
8
- if let Node::Class(class) = declaration {
9
- println!("Class declaration: '{}'", rbs_code);
10
- println!(
11
- "Overall location: {}..{}",
12
- class.location().start(),
13
- class.location().end()
14
- );
15
-
16
- // Required sub-locations
17
- let keyword = class.keyword_location();
18
- println!(
19
- " keyword location: {}..{} = '{}'",
20
- keyword.start(),
21
- keyword.end(),
22
- &rbs_code[keyword.start() as usize..keyword.end() as usize]
23
- );
24
-
25
- let name = class.name_location();
26
- println!(
27
- " name location: {}..{} = '{}'",
28
- name.start(),
29
- name.end(),
30
- &rbs_code[name.start() as usize..name.end() as usize]
31
- );
32
-
33
- let end_loc = class.end_location();
34
- println!(
35
- " end location: {}..{} = '{}'",
36
- end_loc.start(),
37
- end_loc.end(),
38
- &rbs_code[end_loc.start() as usize..end_loc.end() as usize]
39
- );
40
-
41
- // Optional sub-locations
42
- if let Some(type_params) = class.type_params_location() {
43
- println!(
44
- " type_params location: {}..{} = '{}'",
45
- type_params.start(),
46
- type_params.end(),
47
- &rbs_code[type_params.start() as usize..type_params.end() as usize]
48
- );
49
- }
50
-
51
- if let Some(lt) = class.lt_location() {
52
- println!(
53
- " lt location: {}..{} = '{}'",
54
- lt.start(),
55
- lt.end(),
56
- &rbs_code[lt.start() as usize..lt.end() as usize]
57
- );
58
- }
59
- }
60
- }
@@ -1 +0,0 @@
1
- pub mod node;