File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 22import { RegExpLike } from './TokenizerEngine.js' ;
33
44const START = / \/ \* / uy; // matches: /*
5- const MIDDLE = / ( [ ^ / * ] | \* [ ^ / ] | \/ [ ^ * ] ) + / uy; // matches text NOT containing /* or */
5+ const ANY_CHAR = / [ \s \S ] / uy; // matches single character
66const END = / \* \/ / uy; // matches: */
77
88/**
@@ -31,7 +31,7 @@ export class NestedComment implements RegExpLike {
3131 } else if ( ( match = this . matchSection ( END , input ) ) ) {
3232 result += match ;
3333 nestLevel -- ;
34- } else if ( ( match = this . matchSection ( MIDDLE , input ) ) ) {
34+ } else if ( ( match = this . matchSection ( ANY_CHAR , input ) ) ) {
3535 result += match ;
3636 } else {
3737 return null ;
Original file line number Diff line number Diff line change @@ -239,6 +239,12 @@ export default function supportsComments(format: FormatFn, opts: CommentsConfig
239239 ` ) ;
240240 } ) ;
241241
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+
242248 if ( opts . hashComments ) {
243249 it ( 'supports # line comment' , ( ) => {
244250 const result = format ( 'SELECT alpha # commment\nFROM beta' ) ;
You can’t perform that action at this time.
0 commit comments