瀏覽代碼

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 年之前
父節點
當前提交
87df048a6b
共有 1 個文件被更改,包括 1 次插入1 次删除
  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 { TempNode } from './TempNode.js';
 import { NodeLib } from './NodeLib.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;
 	propertiesRegexp = /[a-z_0-9]+/ig;
 
 
 function FunctionNode( src, includes, extensions, keywords, type ) {
 function FunctionNode( src, includes, extensions, keywords, type ) {