Skip to content

Commit ff0dbcc

Browse files
WIP: refactor(wgsl-in): extract Lexer::new's ignore_doc_comments arg. into new struct LexerConfig
TODO: document TODO: `CHANGELOG`
1 parent 2b8b5f7 commit ff0dbcc

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

naga/src/front/wgsl/parse/lexer.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,14 @@ fn is_word_part(c: char) -> bool {
243243
unicode_ident::is_xid_continue(c)
244244
}
245245

246+
// TODO: document
247+
#[derive(Clone, Eq, PartialEq)]
248+
pub struct LexerConfig {
249+
/// Whether or not to ignore doc comments.
250+
/// If `true`, doc comments are treated as [`Token::Trivia`].
251+
ignore_doc_comments: bool,
252+
}
253+
246254
#[derive(Clone)]
247255
pub(in crate::front::wgsl) struct Lexer<'a> {
248256
/// The remaining unconsumed input.
@@ -262,15 +270,17 @@ pub(in crate::front::wgsl) struct Lexer<'a> {
262270
/// statements.
263271
last_end_offset: usize,
264272

265-
/// Whether or not to ignore doc comments.
266-
/// If `true`, doc comments are treated as [`Token::Trivia`].
273+
/// See [`LexerConfig::ignore_doc_comments`].
267274
ignore_doc_comments: bool,
268275

269276
pub(in crate::front::wgsl) enable_extensions: EnableExtensions,
270277
}
271278

272279
impl<'a> Lexer<'a> {
273-
pub(in crate::front::wgsl) const fn new(input: &'a str, ignore_doc_comments: bool) -> Self {
280+
pub(in crate::front::wgsl) const fn new(input: &'a str, config: LexerConfig) -> Self {
281+
let LexerConfig {
282+
ignore_doc_comments,
283+
} = config;
274284
Lexer {
275285
input,
276286
source: input,

0 commit comments

Comments
 (0)