File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -61,8 +61,18 @@ pub static WHITESPACE_TOKENS: &[SyntaxKind] = &[
6161 SyntaxKind :: SqlComment ,
6262] ;
6363
64- static PATTERN_LEXER : LazyLock < Regex > =
65- LazyLock :: new ( || Regex :: new ( r"(?P<whitespace> +)|(?P<newline>\r?\n+)|(?P<tab>\t+)" ) . unwrap ( ) ) ;
64+ static PATTERN_LEXER : LazyLock < Regex > = LazyLock :: new ( || {
65+ #[ cfg( windows) ]
66+ {
67+ // On Windows, treat \r\n as a single newline token
68+ Regex :: new ( r"(?P<whitespace> +)|(?P<newline>\r\n|\n+)|(?P<tab>\t+)" ) . unwrap ( )
69+ }
70+ #[ cfg( not( windows) ) ]
71+ {
72+ // On other platforms, just check for \n
73+ Regex :: new ( r"(?P<whitespace> +)|(?P<newline>\n+)|(?P<tab>\t+)" ) . unwrap ( )
74+ }
75+ } ) ;
6676
6777fn whitespace_tokens ( input : & str ) -> VecDeque < Token > {
6878 let mut tokens = VecDeque :: new ( ) ;
You can’t perform that action at this time.
0 commit comments