Skip to content

Commit c3b07ef

Browse files
Deepak Singhfacebook-github-bot
authored andcommitted
Rust code for Hack Client LSP
Reviewed By: arseniy-panfilov Differential Revision: D74611738 fbshipit-source-id: 5e53b843da52bd4e4b47c8f4507a3dd132a39c4e
1 parent cf63740 commit c3b07ef

File tree

1 file changed

+16
-4
lines changed
  • compiler/crates/extract-graphql/src

1 file changed

+16
-4
lines changed

compiler/crates/extract-graphql/src/lib.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ impl<'a> CharReader<'a> {
5555
column_index: 0,
5656
}
5757
}
58+
59+
pub fn get_line_index(&self) -> usize {
60+
self.line_index
61+
}
62+
63+
pub fn get_column_index(&self) -> usize {
64+
self.column_index
65+
}
66+
67+
pub fn get_chars(&self) -> Peekable<CharIndices<'a>> {
68+
self.chars.clone()
69+
}
5870
}
5971

6072
impl Iterator for CharReader<'_> {
@@ -216,11 +228,11 @@ pub fn extract(input: &str) -> Vec<JavaScriptSourceFeature> {
216228
res
217229
}
218230

219-
fn consume_escaped_char(it: &mut CharReader<'_>) {
231+
pub fn consume_escaped_char(it: &mut CharReader<'_>) {
220232
it.next();
221233
}
222234

223-
fn consume_identifier(it: &mut CharReader<'_>) {
235+
pub fn consume_identifier(it: &mut CharReader<'_>) {
224236
while it.chars.peek().is_some() {
225237
match it.chars.peek() {
226238
Some((_, 'a'..='z' | 'A'..='Z' | '_' | '0'..='9')) => {
@@ -231,7 +243,7 @@ fn consume_identifier(it: &mut CharReader<'_>) {
231243
}
232244
}
233245

234-
fn consume_line_comment(it: &mut CharReader<'_>) {
246+
pub fn consume_line_comment(it: &mut CharReader<'_>) {
235247
for (_, c) in it {
236248
match c {
237249
'\n' | '\r' => {
@@ -242,7 +254,7 @@ fn consume_line_comment(it: &mut CharReader<'_>) {
242254
}
243255
}
244256

245-
fn consume_string(it: &mut CharReader<'_>, quote: char) {
257+
pub fn consume_string(it: &mut CharReader<'_>, quote: char) {
246258
while let Some((_, c)) = it.next() {
247259
match c {
248260
'\\' => {

0 commit comments

Comments
 (0)