Skip to content

Commit

Permalink
Add CSVFileInterpreter to stdlib
Browse files Browse the repository at this point in the history
  • Loading branch information
georg-schwarz committed Jan 9, 2024
1 parent a5c2a3f commit 5c013e6
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 14 deletions.
20 changes: 11 additions & 9 deletions libs/language-server/src/stdlib/CSVExtractor.jv
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,24 @@ composite blocktype CSVExtractor {
property delimiter oftype text: ',';
property enclosing oftype text: '';
property enclosingEscape oftype text: '';
property encoding oftype text: 'utf-8';

input inputPort oftype None;
output outputPort oftype Sheet;

block FileExtractor oftype HttpExtractor { url: url; }
block FileTextInterpreter oftype TextFileInterpreter {}
inputPort
-> FileExtractor
-> FileCSVInterpreter
-> outputPort;

block FileExtractor oftype HttpExtractor {
url: url;
}

block FileCSVInterpreter oftype CSVInterpreter {
block FileCSVInterpreter oftype CSVFileInterpreter {
delimiter: delimiter;
enclosing: enclosing;
enclosingEscape: enclosingEscape;
enoding: encoding;
}

inputPort
->FileExtractor
->FileTextInterpreter
->FileCSVInterpreter
->outputPort;
}
31 changes: 31 additions & 0 deletions libs/language-server/src/stdlib/CSVFileInterpreter.jv
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg
//
// SPDX-License-Identifier: AGPL-3.0-only

/**
* A CSVFileInterpreter interprets a file as CSV
*/
composite blocktype CSVFileInterpreter {
property delimiter oftype text: ',';
property enclosing oftype text: '';
property enclosingEscape oftype text: '';
property enoding oftype text: 'utf-8';

input inputPort oftype File;
output outputPort oftype Sheet;

inputPort
-> FileTextInterpreter
-> FileCSVInterpreter
-> outputPort;

block FileTextInterpreter oftype TextFileInterpreter {
encoding: enoding;
}

block FileCSVInterpreter oftype CSVInterpreter {
delimiter: delimiter;
enclosing: enclosing;
enclosingEscape: enclosingEscape;
}
}
10 changes: 5 additions & 5 deletions libs/language-server/src/stdlib/GTFSExtractor.jv
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ composite blocktype GTFSExtractor {
input inputPort oftype None;
output outputPort oftype FileSystem;

inputPort
-> FileExtractor
-> ZipArchiveInterpreter
-> outputPort;

block FileExtractor oftype HttpExtractor { url: url; }

block ZipArchiveInterpreter oftype ArchiveInterpreter { archiveType: "zip"; }

inputPort
->FileExtractor
->ZipArchiveInterpreter
->outputPort;
}

0 comments on commit 5c013e6

Please sign in to comment.