UNPKG

typegpu

Version:

A thin layer between JS and WebGPU/WGSL that improves development experience and allows for faster iteration.

39 lines (38 loc) 947 B
interface FunctionArgsInfo { args: ArgInfo[]; ret: ReturnInfo | undefined; range: { begin: number; end: number; }; } interface ArgInfo { identifier: string; attributes: string[]; type: string | undefined; } interface ReturnInfo { attributes: string[]; type: string; } /** * Extracts info about arguments of a given WGSL function string. * @example * const code = ` * fn add(a: i32, @location(0) b: i32, c) -> i32 { * return a + b + c; * }`; * * extractArgs(code); * // { * // args: [ * // { identifier: 'a', attributes: [], type: 'i32' }, * // { identifier: 'b', attributes: ['@location(0)'], type: 'i32' }, * // { identifier: 'c', attributes: [], type: undefined } * // ], * // ret: { type: 'i32', attributes: [] }, * // range: { begin: 11, end: 51 } * // } */ export declare function extractArgs(rawCode: string): FunctionArgsInfo; export {};