MCPcopy Create free account
hub / github.com/ShaderFrog/glsl-parser / buildParser

Function buildParser

src/parser/test-helpers.ts:25–46  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23};
24
25export const buildParser = () => {
26 execSync(
27 'npx peggy --cache --format es -o src/parser/parser.js src/parser/glsl-grammar.pegjs'
28 );
29 const parser = require('./parser');
30 const parse = parser.parse as Parse;
31 const ps = parseSrc(parse);
32 const ctx: Context = {
33 parse,
34 parseSrc: ps,
35 };
36 return {
37 parse,
38 parser,
39 parseSrc: ps,
40 debugSrc: debugSrc(ctx),
41 debugStatement: debugStatement(ctx),
42 expectParsedStatement: expectParsedStatement(ctx),
43 parseStatement: parseStatement(ctx),
44 expectParsedProgram: expectParsedProgram(ctx),
45 };
46};
47
48// Keeping this around in case I need to figure out how to do tracing again
49// Most of this ceremony around building a parser is dealing with Peggy's error

Callers 2

scope.test.tsFile · 0.85
parse.test.tsFile · 0.85

Calls 6

parseSrcFunction · 0.85
debugSrcFunction · 0.85
debugStatementFunction · 0.85
expectParsedStatementFunction · 0.85
parseStatementFunction · 0.85
expectParsedProgramFunction · 0.70

Tested by

no test coverage detected