From 5e27798dc35f014e1b1efb3e2e13883e274a5da3 Mon Sep 17 00:00:00 2001 From: Boshen Date: Wed, 28 Aug 2024 18:12:08 +0800 Subject: [PATCH] chore(parser): parse regular expression in example --- crates/oxc_parser/examples/parser.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/oxc_parser/examples/parser.rs b/crates/oxc_parser/examples/parser.rs index f47a4c898..fcdb43c0d 100644 --- a/crates/oxc_parser/examples/parser.rs +++ b/crates/oxc_parser/examples/parser.rs @@ -2,7 +2,7 @@ use std::{env, path::Path}; use oxc_allocator::Allocator; -use oxc_parser::Parser; +use oxc_parser::{ParseOptions, Parser}; use oxc_span::SourceType; // Instruction: @@ -17,7 +17,9 @@ fn main() -> Result<(), String> { let allocator = Allocator::default(); let source_type = SourceType::from_path(path).unwrap(); let now = std::time::Instant::now(); - let ret = Parser::new(&allocator, &source_text, source_type).parse(); + let ret = Parser::new(&allocator, &source_text, source_type) + .with_options(ParseOptions { parse_regular_expression: true, ..ParseOptions::default() }) + .parse(); let elapsed_time = now.elapsed(); println!("{}ms.", elapsed_time.as_millis());