Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring: Define Blocktypes solely in Code #445

Merged
merged 45 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
ab785d9
Document constraint types in-code
georg-schwarz Sep 4, 2023
977d42f
Separate block and constraint meta inf registries
georg-schwarz Sep 4, 2023
d2dc2ca
Started refactoring BlockMetaInformation to be a wrapper instead of …
georg-schwarz Sep 4, 2023
ff1dacb
Adapt tests to removal of extensions
georg-schwarz Sep 4, 2023
a1f5ffe
Replace lang extensions by builtin blocktype definitions
georg-schwarz Sep 4, 2023
249c856
Fix build and linter of remaining apps/libs
georg-schwarz Sep 5, 2023
8f9da7e
Remove test.jv
georg-schwarz Sep 5, 2023
27d62f1
Move validations from ArchiveInterpreter to property assignment valid…
georg-schwarz Sep 5, 2023
4f26f7d
Move validations from CellWriter to property assignment validations
georg-schwarz Sep 5, 2023
575cad4
Move validations from ColumnDeleter to property assignment validations
georg-schwarz Sep 5, 2023
8e8c185
Move validations from GtfsRTInterpreter to property assignment valida…
georg-schwarz Sep 5, 2023
4363920
Test ArchiveInterpreter custom validation
georg-schwarz Sep 5, 2023
d8a5605
Fix too eager validation
georg-schwarz Sep 5, 2023
72866d5
Move validations from HttpExtractor to property assignment validations
georg-schwarz Sep 6, 2023
529f928
Move validations from RowDeleter to property assignment validations
georg-schwarz Sep 6, 2023
d73e1d7
Move validations from TableInterpreter to property assignment validat…
georg-schwarz Sep 6, 2023
e392224
Move validations from TextFileInterpreter to property assignment vali…
georg-schwarz Sep 6, 2023
bd50a8e
Move validations from TextLineDeleter to property assignment validations
georg-schwarz Sep 6, 2023
cc2a58d
Move validations from TextRangeSelector to property assignment valida…
georg-schwarz Sep 6, 2023
8cb933c
Refactor blocktype specific property validations into own file
georg-schwarz Sep 6, 2023
8536b44
Pull out checkPropertyValueOneOf function
georg-schwarz Sep 6, 2023
2a5d826
Move body validations from TextRangeSelector to property body validat…
georg-schwarz Sep 7, 2023
f087692
Move body validations from CellWriter to property body validations
georg-schwarz Sep 7, 2023
a3861f9
Move body validations from TableTransformer to property body validations
georg-schwarz Sep 7, 2023
d249c7e
Move body validations from TableTransformer to property body validations
georg-schwarz Sep 7, 2023
6337d40
Resolve TODO in runtime parameter literal validation
georg-schwarz Sep 7, 2023
7fec953
Remove TODO in BlockMetaInformation
georg-schwarz Sep 7, 2023
f812028
Iterate over all registered blocktypes where necessary with new way
georg-schwarz Sep 7, 2023
80d0a0b
Implement BlockMetaInformation.canBeWrapped
georg-schwarz Sep 7, 2023
718316c
Generate documentation of blocktype and examples from blocktype defin…
georg-schwarz Sep 7, 2023
55abaa6
Add documentation for properties of blocktypes reading from jv comment
georg-schwarz Sep 7, 2023
ca72b28
Pull out method extractDocsFromComment
georg-schwarz Sep 7, 2023
d0ad929
Improve assertion messages
georg-schwarz Sep 7, 2023
18a761c
Merge branch 'main' into block-meta-inf-in-code
georg-schwarz Sep 7, 2023
9acd943
Use default JSdocProvider
georg-schwarz Sep 26, 2023
a21ccc6
Implement utility function getMetaInformation
georg-schwarz Sep 26, 2023
8d7bc1a
Remove JayveeDocumentationProvider
georg-schwarz Sep 26, 2023
7932bd9
Fix linter and test
georg-schwarz Sep 26, 2023
4cd0a78
Pull out function getAllBuiltinBlocktypes
georg-schwarz Sep 26, 2023
2e64c22
Update docs
georg-schwarz Sep 26, 2023
e3caa48
Add missing license headers
georg-schwarz Sep 26, 2023
48b883c
Remove info box from docs
georg-schwarz Nov 2, 2023
7d98ae4
Ignore duplicates in getAllBuiltinBlocktypes
georg-schwarz Nov 2, 2023
b5bddfd
Merge branch 'main' into block-meta-inf-in-code
georg-schwarz Nov 2, 2023
57ee14d
Adapt tests to changes
georg-schwarz Nov 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,11 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0-only

import { StdLangExtension } from '@jvalue/jayvee-extensions/std/lang';
import {
getStdLib,
useExtension as useLangExtension,
} from '@jvalue/jayvee-language-server';
import { getStdLib, registerConstraints } from '@jvalue/jayvee-language-server';
import {
EventEmitter,
ExtensionContext,
Expand All @@ -33,7 +29,7 @@ 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]) => {
this.libraries.set(
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: '';
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export function createConstraintExecutor(
constraint: ConstraintDefinition,
): ConstraintExecutor {
if (isTypedConstraintDefinition(constraint)) {
const constraintType = constraint.type.name;
const constraintType = constraint.type.ref?.name;
assert(constraintType !== undefined);
const constraintExecutor = constraintExecutorRegistry.get(constraintType);
assert(
constraintExecutor !== undefined,
Expand Down
21 changes: 11 additions & 10 deletions libs/execution/src/lib/execution-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,24 @@ import { strict as assert } from 'assert';

import {
BlockDefinition,
BlockMetaInformation,
ConstraintDefinition,
EvaluationContext,
InternalValueRepresentation,
MetaInformation,
PipelineDefinition,
PropertyAssignment,
TransformDefinition,
Valuetype,
evaluatePropertyValue,
getOrFailMetaInformation,
isConstraintDefinition,
getOrFailConstraintMetaInf,
isBlockDefinition,
isExpressionConstraintDefinition,
isPipelineDefinition,
isPropertyBody,
isTransformDefinition,
isTypedConstraintDefinition,
} from '@jvalue/jayvee-language-server';
import { isReference } from 'langium';
import { assertUnreachable, isReference } from 'langium';

import {
DebugGranularity,
Expand Down Expand Up @@ -145,13 +146,13 @@ export class ExecutionContext {
assert(!isExpressionConstraintDefinition(currentNode));
assert(!isTransformDefinition(currentNode));

let metaInf: MetaInformation;
if (isConstraintDefinition(currentNode)) {
metaInf = getOrFailMetaInformation(currentNode.type);
} else {
if (isTypedConstraintDefinition(currentNode)) {
return getOrFailConstraintMetaInf(currentNode.type);
} else if (isBlockDefinition(currentNode)) {
assert(isReference(currentNode.type));
metaInf = getOrFailMetaInformation(currentNode.type);
assert(BlockMetaInformation.canBeWrapped(currentNode.type));
return new BlockMetaInformation(currentNode.type);
}
return metaInf;
assertUnreachable(currentNode);
}
}
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.

Loading
Loading