Skip to content

Commit

Permalink
Fix usage of 'Chevrotrain' -> 'Chevrotain'
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-fleck-at committed Nov 27, 2023
1 parent 3b8ae8c commit ad9ee17
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 50 deletions.
19 changes: 5 additions & 14 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
"source.fixAll.eslint": true,
"source.fixAll.markdownlint": true
},
"eslint.validate": [
"javascript",
"typescript"
],
"eslint.validate": ["javascript", "typescript"],
"search.exclude": {
"**/node_modules": true,
"**/out": true,
Expand Down Expand Up @@ -56,19 +53,15 @@
"ul_multi": 3
},
"no-inline-html": {
"allowed_elements": [
"br",
"details",
"summary"
]
"allowed_elements": ["br", "details", "summary"]
}
},
"jest.jestCommandLine": "yarn test",
"jest.debugMode": true,
"cSpell.enabled": true,
"cSpell.words": [
"Langium",
"Chevrotrain",
"Chevrotain",
"CrossModel",
"Modelserver",
"CrossBreeze",
Expand All @@ -89,7 +82,5 @@
"typescript",
"typescriptreact"
],
"cSpell.ignoreRegExpList": [
"/^\\s*import.*from.*/gm"
]
}
"cSpell.ignoreRegExpList": ["/^\\s*import.*from.*/gm"]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,6 @@ The repository itself contains the following components structured as follows:

- mui-x : MUI X is open core—base components are MIT-licensed, while more advanced features require a Pro or Premium commercial license. We are currently only using core-base
- react-tabs: MIT
- chevrotrain: This library is a dependency of langium. To get the Yaml language working in crossmodel an example implementation of the python language of chevrotrain has been used. This example has been modified to make it work for the yaml language.
- chevrotain: This library is a dependency of langium. To get the Yaml language working in crossmodel an example implementation of the python language of chevrotain has been used. This example has been modified to make it work for the yaml language.
- <https://github.com/Chevrotain/chevrotain>
- example that has been used: <https://github.com/Chevrotain/chevrotain/tree/master/examples/lexer/python_indentation>
66 changes: 33 additions & 33 deletions extensions/crossmodel-lang/esbuild.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,50 @@ const minify = process.argv.includes('--minify');
const success = watch ? 'Watch build succeeded' : 'Build succeeded';

function getTime() {
const date = new Date();
return `[${`${padZeroes(date.getHours())}:${padZeroes(date.getMinutes())}:${padZeroes(date.getSeconds())}`}] `;
const date = new Date();
return `[${`${padZeroes(date.getHours())}:${padZeroes(date.getMinutes())}:${padZeroes(date.getSeconds())}`}] `;
}

function padZeroes(i) {
return i.toString().padStart(2, '0');
return i.toString().padStart(2, '0');
}

const plugins = [
{
name: 'watch-plugin',
setup(build) {
build.onEnd(result => {
if (result.errors.length === 0) {
console.log(getTime() + success);
}
});
}
}
{
name: 'watch-plugin',
setup(build) {
build.onEnd(result => {
if (result.errors.length === 0) {
console.log(getTime() + success);
}
});
}
}
];

const ctx = await esbuild.context({
// Entry points for the vscode extension and the language server
entryPoints: ['src/extension.ts', 'src/main.ts'],
outdir: 'out',
bundle: true,
target: 'ES2017',
// VSCode's extension host is still using cjs, so we need to transform the code
format: 'cjs',
// To prevent confusing node, we explicitly use the `.cjs` extension
outExtension: {
'.js': '.cjs'
},
loader: { '.ts': 'ts' },
external: ['vscode'],
platform: 'node',
sourcemap: !minify,
minify,
plugins
// Entry points for the vscode extension and the language server
entryPoints: ['src/extension.ts', 'src/main.ts'],
outdir: 'out',
bundle: true,
target: 'ES2017',
// VSCode's extension host is still using cjs, so we need to transform the code
format: 'cjs',
// To prevent confusing node, we explicitly use the `.cjs` extension
outExtension: {
'.js': '.cjs'
},
loader: { '.ts': 'ts' },
external: ['vscode'],
platform: 'node',
sourcemap: !minify,
minify,
plugins
});

if (watch) {
await ctx.watch();
await ctx.watch();
} else {
await ctx.rebuild();
ctx.dispose();
await ctx.rebuild();
ctx.dispose();
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class CrossModelLexer extends DefaultLexer {

// add remaining dedents
while (indentStack.pop()) {
// chevrotrain uses 1-based indices for tokens which Langium transforms into 0-based indices by deducting 1
// chevrotain uses 1-based indices for tokens which Langium transforms into 0-based indices by deducting 1
// see for instance https://github.com/eclipse-langium/langium/blob/eea5bc2/packages/langium/src/utils/cst-util.ts#L49
const startOffset = text.length || 1;
const endOffset = text.length || 1;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"scripts": {
"build": "lerna run build",
"clean": "lerna run clean && rimraf node_modules",
"format": "yarn prettier-eslint --write '**/*.{ts,tsx,js,cjs}' '**/package.json'",
"format": "yarn prettier-eslint --write '**/*.{ts,tsx,js,cjs,mjs}' '**/package.json'",
"postinstall": "theia check:theia-version",
"lint": "lerna run lint",
"prepare": "lerna run prepare",
Expand Down

0 comments on commit ad9ee17

Please sign in to comment.