Jelajahi Sumber

Allow leading whitespace in declaration regexp

leading whitespace is common in copy-paste situations or when using multi-line template literals; this change allows (and ignores) leading whitespace when looking for glsl function declarations
Xiaohan Zhang 5 tahun lalu
induk
melakukan
87df048a6b
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  1. 1 1
      examples/jsm/nodes/core/FunctionNode.js

+ 1 - 1
examples/jsm/nodes/core/FunctionNode.js

@@ -6,7 +6,7 @@
 import { TempNode } from './TempNode.js';
 import { NodeLib } from './NodeLib.js';
 
-var declarationRegexp = /^([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,
+var declarationRegexp = /^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,
 	propertiesRegexp = /[a-z_0-9]+/ig;
 
 function FunctionNode( src, includes, extensions, keywords, type ) {