Skip to content

Commit

Permalink
Replace lang extensions by builtin blocktype definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
georg-schwarz committed Sep 4, 2023
1 parent ff1dacb commit ea637aa
Show file tree
Hide file tree
Showing 140 changed files with 512 additions and 4,021 deletions.
8 changes: 1 addition & 7 deletions apps/vs-code-extension/src/language-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@
//
// SPDX-License-Identifier: AGPL-3.0-only

import { StdLangExtension } from '@jvalue/jayvee-extensions/std/lang';
import {
createJayveeServices,
useExtension,
} from '@jvalue/jayvee-language-server';
import { createJayveeServices } from '@jvalue/jayvee-language-server';
import { startLanguageServer } from 'langium';
import { NodeFileSystem } from 'langium/node';
import { ProposedFeatures, createConnection } from 'vscode-languageserver/node';

// Create a connection to the client
const connection = createConnection(ProposedFeatures.all);

useExtension(new StdLangExtension());

// Inject the shared services and language-specific services
const { shared } = createJayveeServices({
connection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0-only

import { StdLangExtension } from '@jvalue/jayvee-extensions/std/lang';
import {
getStdLib,
registerConstraints,
useExtension as useLangExtension,
} from '@jvalue/jayvee-language-server';
import { getStdLib, registerConstraints } from '@jvalue/jayvee-language-server';
import {
EventEmitter,
ExtensionContext,
Expand All @@ -34,7 +29,6 @@ export class StandardLibraryFileSystemProvider implements FileSystemProvider {
private registerStdLib() {
// The VSCode Extension needs to register the StdLangExtension,
// otherwise the StdLib does not include the blocktype definitions.
useLangExtension(new StdLangExtension());
registerConstraints();

Object.entries(getStdLib()).forEach(([libName, lib]) => {
Expand Down
19 changes: 19 additions & 0 deletions example/test.jv
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
Interprets an input file as a csv-file containing string-values delimited by `delimiter` and outputs a `Sheet`.

@example Interprets an input file as a csv-file containing string-values delimited by `;` and outputs `Sheet`.
block AgencyCSVInterpreter oftype CSVInterpreter {
delimiter: ";";
}
*/
builtin blocktype CSVInterpreter {
input default oftype TextFile;
output default oftype Sheet;

// The delimiter for values in the CSV file.
property delimiter oftype text: ',';
// The enclosing character that may be used for values in the CSV file.
property enclosing oftype text: '';
// The character to escape enclosing characters in values.
property enclosingEscape oftype text: '';
}
5 changes: 3 additions & 2 deletions libs/execution/src/lib/execution-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { strict as assert } from 'assert';

import {
BlockDefinition,
BlockMetaInformation,
ConstraintDefinition,
EvaluationContext,
InternalValueRepresentation,
Expand All @@ -14,7 +15,6 @@ import {
TransformDefinition,
Valuetype,
evaluatePropertyValue,
getOrFailBockMetaInf,
getOrFailConstraintMetaInf,
isBlockDefinition,
isExpressionConstraintDefinition,
Expand Down Expand Up @@ -150,7 +150,8 @@ export class ExecutionContext {
return getOrFailConstraintMetaInf(currentNode.type);
} else if (isBlockDefinition(currentNode)) {
assert(isReference(currentNode.type));
return getOrFailBockMetaInf(currentNode.type);
assert(BlockMetaInformation.canBeWrapped(currentNode.type));
return new BlockMetaInformation(currentNode.type);
}
assertUnreachable(currentNode);
}
Expand Down
10 changes: 0 additions & 10 deletions libs/extensions/rdbms/lang/.babelrc

This file was deleted.

3 changes: 0 additions & 3 deletions libs/extensions/rdbms/lang/.babelrc.license

This file was deleted.

18 changes: 0 additions & 18 deletions libs/extensions/rdbms/lang/.eslintrc.json

This file was deleted.

3 changes: 0 additions & 3 deletions libs/extensions/rdbms/lang/.eslintrc.json.license

This file was deleted.

17 changes: 0 additions & 17 deletions libs/extensions/rdbms/lang/README.md

This file was deleted.

18 changes: 0 additions & 18 deletions libs/extensions/rdbms/lang/jest.config.ts

This file was deleted.

4 changes: 0 additions & 4 deletions libs/extensions/rdbms/lang/package.json

This file was deleted.

3 changes: 0 additions & 3 deletions libs/extensions/rdbms/lang/package.json.license

This file was deleted.

34 changes: 0 additions & 34 deletions libs/extensions/rdbms/lang/project.json

This file was deleted.

3 changes: 0 additions & 3 deletions libs/extensions/rdbms/lang/project.json.license

This file was deleted.

20 changes: 0 additions & 20 deletions libs/extensions/rdbms/lang/src/extension.ts

This file was deleted.

5 changes: 0 additions & 5 deletions libs/extensions/rdbms/lang/src/index.ts

This file was deleted.

6 changes: 0 additions & 6 deletions libs/extensions/rdbms/lang/src/lib/index.ts

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit ea637aa

Please sign in to comment.