Skip to content

Commit

Permalink
More fixing of the parser package
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkar598 committed Jul 10, 2024
1 parent 8488af5 commit 35bf144
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 4 deletions.
2 changes: 2 additions & 0 deletions dm-lezer/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
src/parser.ts
src/parser.terms.ts
src/*.js
bin/*.js
2 changes: 2 additions & 0 deletions dm-lezer/jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ const config = {
watchPathIgnorePatterns: [
"<rootDir>/src/parser.ts",
"<rootDir>/src/parser.terms.ts",
"<rootDir>/(src|bin)/.*\.js",
"<rootDir>/node_modules",
],
moduleFileExtensions: ["js", "ts", "cjs", "test", "grammar"],
testPathIgnorePatterns: ["/node_modules/", "test.js"],
extensionsToTreatAsEsm: [".ts"],
resolver: "jest-ts-webcompat-resolver",
};
Expand Down
17 changes: 16 additions & 1 deletion dm-lezer/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion dm-lezer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"@types/node": "^20.14.10",
"jest": "^30.0.0-alpha.5",
"jest-ts-webcompat-resolver": "^1.0.0",
"tsx": "^4.16.2"
"tsx": "^4.16.2",
"typescript": "^5.5.3"
},
"dependencies": {
"@lezer/lr": "^1.4.1"
Expand Down
2 changes: 2 additions & 0 deletions dm-lezer/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { buildParserFile } from '@lezer/generator';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { LRParser } from '@lezer/lr';
import * as child_process from 'node:child_process';

export async function buildDmGrammar(): Promise<LRParser> {
const grammar = fs.readFileSync(
Expand All @@ -13,5 +14,6 @@ export async function buildDmGrammar(): Promise<LRParser> {
});
fs.writeFileSync(path.join(import.meta.dirname, 'parser.ts'), parser);
fs.writeFileSync(path.join(import.meta.dirname, 'parser.terms.ts'), terms);
child_process.execSync('npx tsc');
return (await import(path.join(import.meta.dirname, 'parser.ts'))).parser;
}
3 changes: 1 addition & 2 deletions dm-lezer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
// "outDir": "./", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
"noEmit": true,
/* Disable emitting files from a compilation. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
Expand Down

0 comments on commit 35bf144

Please sign in to comment.