ripex 0.3.0

Multi-language structural parsing and fact extraction.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use super::scanner::Scanner;
use super::{Comment, CommentKind};
use crate::span::{Pos, Span};

pub fn skip_comment(scanner: &mut Scanner, start: Pos) -> Comment {
    // Line comment starting with #
    while let Some(ch) = scanner.peek() {
        if ch == '\n' || ch == '\r' {
            break;
        }
        scanner.advance();
    }
    let end = scanner.position();
    let text = scanner.slice(start).to_string();
    Comment::new(CommentKind::Line, Span::new(start, end), text)
}