()
| 23 | }; |
| 24 | |
| 25 | export 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 |
no test coverage detected