File tree Expand file tree Collapse file tree
naga/src/front/wgsl/parse Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ) ]
247255pub ( 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
272279impl < ' 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,
You can’t perform that action at this time.
0 commit comments