File tree 2 files changed +8
-2
lines changed
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 2
2
import { RegExpLike } from './TokenizerEngine.js' ;
3
3
4
4
const START = / \/ \* / uy; // matches: /*
5
- const MIDDLE = / ( [ ^ / * ] | \* [ ^ / ] | \/ [ ^ * ] ) + / uy; // matches text NOT containing /* or */
5
+ const ANY_CHAR = / [ \s \S ] / uy; // matches single character
6
6
const END = / \* \/ / uy; // matches: */
7
7
8
8
/**
@@ -31,7 +31,7 @@ export class NestedComment implements RegExpLike {
31
31
} else if ( ( match = this . matchSection ( END , input ) ) ) {
32
32
result += match ;
33
33
nestLevel -- ;
34
- } else if ( ( match = this . matchSection ( MIDDLE , input ) ) ) {
34
+ } else if ( ( match = this . matchSection ( ANY_CHAR , input ) ) ) {
35
35
result += match ;
36
36
} else {
37
37
return null ;
Original file line number Diff line number Diff line change @@ -239,6 +239,12 @@ export default function supportsComments(format: FormatFn, opts: CommentsConfig
239
239
` ) ;
240
240
} ) ;
241
241
242
+ // Regression test for #747
243
+ it ( 'handles block comments with /** and **/ patterns' , ( ) => {
244
+ const sql = `/** This is a block comment **/` ;
245
+ expect ( format ( sql ) ) . toBe ( sql ) ;
246
+ } ) ;
247
+
242
248
if ( opts . hashComments ) {
243
249
it ( 'supports # line comment' , ( ) => {
244
250
const result = format ( 'SELECT alpha # commment\nFROM beta' ) ;
You can’t perform that action at this time.
0 commit comments