#![allow(clippy::must_use_candidate)]
use crate::parser::ParseOptions;
pub use copybook_lexer::{CobolFormat, Token, TokenPos};
pub struct Lexer<'a> {
inner: copybook_lexer::Lexer<'a>,
}
impl<'a> Lexer<'a> {
pub fn new(input: &'a str) -> Self {
Self::new_with_options(input, &ParseOptions::default())
}
pub fn new_with_options(input: &'a str, options: &ParseOptions) -> Self {
let lexer_options = copybook_lexer::LexerOptions {
allow_inline_comments: options.allow_inline_comments,
strict_comments: options.strict_comments,
};
Self {
inner: copybook_lexer::Lexer::new_with_options(input, lexer_options),
}
}
#[inline]
pub fn format(&self) -> CobolFormat {
self.inner.format()
}
#[inline]
pub fn tokenize(&mut self) -> Vec<TokenPos> {
self.inner.tokenize()
}
}