Skip to content

Commit

Permalink
updated edit_grammars.mjs
Browse files Browse the repository at this point in the history
  • Loading branch information
urbit-pilled committed Mar 29, 2024
1 parent 17d80bc commit c631247
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion resources/edit_grammars.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,38 @@ async function buildLanguage(language) {
`${METAVARIABLE_GRAMMARS}/c_build.rs`,
`${tsLangDir}/bindings/rust/build.rs`,
);
} else {
} else if (language === 'php') {
//php has sub-grammars
log(`Copying files`);
await Promise.all([
copyMvGrammar('php-common', 'php/common'),
copyMvGrammar('php_only', 'php/php_only'),
copyMvGrammar('php', 'php/php'),
]);
log(`Running tree-sitter generate`);

await Promise.all([
treeSitterGenerate('php/php_only'),
treeSitterGenerate('php/php'),
]);

log(`Copying output node types`);
await Promise.all([
copyNodeTypes('php/php_only', 'php_only'),
copyNodeTypes('php/php', `php`),
]);

log(`Copying wasm parser`);
await fs.rename(
`tree-sitter-php/php/tree-sitter-php_only.wasm`,
`../../crates/wasm-bindings/wasm_parsers/tree-sitter-php_only.wasm`,
);

await fs.rename(
`tree-sitter-php/php/tree-sitter-php.wasm`,
`../../crates/wasm-bindings/wasm_parsers/tree-sitter-php.wasm`,
);
}else {
await buildSimpleLanguage(log, language);
}

Expand Down

0 comments on commit c631247

Please sign in to comment.