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

PR: code review #1

Open
wants to merge 122 commits into
base: before-pse
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
6a51261
Add parser
PurpleAnanas Apr 3, 2023
265a9bf
Add Monaco
PurpleAnanas Apr 3, 2023
1475b78
Create new_parser.pegjs
PurpleAnanas Apr 30, 2023
2fc0ee2
Create variables.json
PurpleAnanas Apr 30, 2023
27b9df8
Create new_parser.js
PurpleAnanas Apr 30, 2023
a2f730c
Add files via upload
PurpleAnanas Apr 30, 2023
acfe21b
Create grammatik_idee
PurpleAnanas Apr 30, 2023
85b1fbc
Delete Parser directory
andrinM May 3, 2023
62f7028
Add files via upload
andrinM May 3, 2023
3443c84
added the latest version of the peggy parser
May 3, 2023
4fa55c0
Imported the Monaco Editor
Zediwan May 3, 2023
baeb60e
Updated README.md
Zediwan May 3, 2023
7451df9
Updated README.md
Zediwan May 3, 2023
7ace582
Renamed the Monaco Folder
Zediwan May 3, 2023
8312e60
Modified test file
oliolioli May 3, 2023
15af0c8
Removed old test file
oliolioli May 3, 2023
e5e3274
Cleaned up repo /src/__test__
oliolioli May 3, 2023
7c8b218
Deleted file
PurpleAnanas May 3, 2023
05d8275
Moved parser to Peggy
PurpleAnanas May 3, 2023
1b0e0c3
adapted a file
PurpleAnanas May 3, 2023
7deeaff
Modified and adapted tests in medcodelogic.test.tsx
oliolioli May 3, 2023
cd596be
Merge branch 'main' of https://github.com/eonum/mcl-editor into main
oliolioli May 3, 2023
a678d75
file deleted
PurpleAnanas May 3, 2023
cbc8e16
Changed tests
oliolioli May 3, 2023
190880c
Merge branch 'main' of https://github.com/eonum/mcl-editor into main
oliolioli May 3, 2023
ad67b93
changed reference
PurpleAnanas May 3, 2023
3262e01
Merge branch 'main' of https://github.com/eonum/mcl-editor
PurpleAnanas May 3, 2023
632816e
dummer Fehlerr korrigiert
PurpleAnanas May 3, 2023
9256aa5
Added exports
oliolioli May 3, 2023
5eda42b
parser erzeugt
PurpleAnanas May 3, 2023
bb3bfc2
Refactored all the element lists in the monaco editor
Zediwan May 3, 2023
ce06742
Updated tooltips for variables
Zediwan May 3, 2023
233a732
Added a few helpfull links to the README
Zediwan May 3, 2023
c43f071
Deleted deprecated infoParser.js
Zediwan May 3, 2023
3216513
Added comments
Zediwan May 3, 2023
8f68700
Removed the old ReadMe and moved the contents into README
Zediwan May 5, 2023
294a04b
Updated README
Zediwan May 5, 2023
742a0b6
Added functions to export, to test
oliolioli May 8, 2023
f2f3b6d
Merged READMEs
oliolioli May 8, 2023
1a7d304
test for new branch
May 8, 2023
b60873e
fixed bugs
PurpleAnanas May 8, 2023
cbc0177
Merge branch 'main' of https://github.com/eonum/mcl-editor
PurpleAnanas May 8, 2023
e0c0e7c
merged Peggy and Monaco, cleaned up repo
May 9, 2023
bd4319a
added error report, added testcases
May 9, 2023
b42b12b
Removed an empty line
Zediwan May 9, 2023
fa5ad7b
Merge branch 'main' into AndrinBranch
andrinM May 9, 2023
ccd023d
Merge pull request #12 from eonum/AndrinBranch
andrinM May 9, 2023
d26945f
Errors are now being shown
Zediwan May 9, 2023
d8790af
A Submit button is implemented, that is pressable if no error is thrown
Zediwan May 9, 2023
5db82a8
Updated README
Zediwan May 9, 2023
2cd6185
Added documentation to the parseInput method
Zediwan May 9, 2023
813a90e
Bugfix in the parseInput method
Zediwan May 9, 2023
a1e1626
Added inline documentation for checkContent
Zediwan May 9, 2023
a8aaf15
Added documentation to the checkContent
Zediwan May 9, 2023
21e9f3b
Merge branch 'main' into master
Zediwan May 9, 2023
6dd9b2f
Merge pull request #15 from eonum/master
Zediwan May 9, 2023
b483410
isInTable() update, rule inList updated
May 9, 2023
8b3b436
isInTable() update, rule inList updated
May 9, 2023
0b036e3
updated file bundle.js for in table and in list function
May 10, 2023
4c17e54
updated in list and in table function
May 10, 2023
372bbcd
Merge pull request #16 from eonum/AndrinBranche
andrinM May 10, 2023
3b611c7
added ''for date and removed '' in code
May 10, 2023
3e7db5f
Fixed the "error not defined" bug
Zediwan May 10, 2023
11a62bb
Fixed a bug where documentation was being loaded for undocumentet ele…
Zediwan May 10, 2023
7d69970
extracted functions from the grammar
May 10, 2023
2f1ada8
implemented correct colors
DavidRichardGit May 10, 2023
1ccbd97
added empty functions.test.js file
May 10, 2023
e2bda7b
Added default test in new functions.test.js
oliolioli May 10, 2023
ae69bdd
Cleaned directory
oliolioli May 10, 2023
1bad1db
Added and changed tests
oliolioli May 10, 2023
4513b5e
Fixed broken merged Readme
oliolioli May 10, 2023
e06b94f
Tried to get several tests running
oliolioli May 10, 2023
5062f84
Commented functions.js
oliolioli May 10, 2023
bccdd1b
Typos
oliolioli May 10, 2023
2e45d47
Added function tests
oliolioli May 10, 2023
cd59bbe
Added function tests
oliolioli May 10, 2023
53d8f9f
Added tests to test the functions in functions.js, variables in
oliolioli May 10, 2023
ab68e8b
accepted README changes
May 14, 2023
623fba7
restore .gitgnore, remove files & folders stated in .gitignore
jbessi May 15, 2023
302045d
Changed Variable names to match conventions
Zediwan May 15, 2023
36efe19
Removed minimap
Zediwan May 15, 2023
54ce3a0
Improved function loading in code editor
Zediwan May 16, 2023
24d09f9
Improved readabillity of completionItemProvider
Zediwan May 16, 2023
e983a71
Improved readabillity of hoverProvider
Zediwan May 16, 2023
02598cc
Tooltips now show translation and documentation
Zediwan May 16, 2023
58e95ab
Deleted Links
Zediwan May 17, 2023
8a038a3
Deleted Depricated Test.js
Zediwan May 17, 2023
99c4f15
yarn.lock file
jbessi May 17, 2023
f525dd2
Merge branch 'main' of github.com:eonum/mcl-editor
jbessi May 17, 2023
fce06ac
Merge branch 'main' into AndrinBranche
andrinM May 17, 2023
6510567
Merge pull request #35 from eonum/AndrinBranche
andrinM May 17, 2023
d01ece9
Submit Button now displays error message
Zediwan May 17, 2023
958b572
Removed decorative element on the right of the editor
Zediwan May 17, 2023
cf05480
Readded gitignore
oliolioli May 17, 2023
277f246
Added jest
oliolioli May 17, 2023
9f87109
Added jest
oliolioli May 17, 2023
64377ef
Refactored and improved the checkContent method
Zediwan May 17, 2023
5b498bf
added documentation for functions.js
May 17, 2023
5f6886b
Merge branch 'main' of https://github.com/eonum/mcl-editor
May 17, 2023
0c2dc38
Refactored Eventelistener to sumbit button and checkContent method
Zediwan May 17, 2023
85fa333
Referenced issue in todo
Zediwan May 18, 2023
0d34669
updated hover-tooltips to only show for exact matches
Zediwan May 18, 2023
b11ae53
Updated Operators supported by the editor
Zediwan May 18, 2023
9b1ab39
Removed Type Keywords
Zediwan May 18, 2023
e02e18e
updated signature of inlist and intable
Zediwan May 18, 2023
2ee45c5
Completion Items are now presented if they contain the substring
Zediwan May 18, 2023
e410625
Improved insertion of functions to show variables
Zediwan May 18, 2023
912e7cd
Added detail, documentation to keywords
Zediwan May 19, 2023
fcd126d
Removed deprecated method markErrors
Zediwan May 19, 2023
cec6cd8
updated README parser section)
May 20, 2023
725497a
bugfixes
DavidRichardGit May 21, 2023
7cb2146
visual enhancements
DavidRichardGit May 21, 2023
1221b70
Cleaned up comments and worked on tests
oliolioli May 21, 2023
d54c7b8
Added and reangered tests
oliolioli May 21, 2023
b6611c7
Rearranged README
oliolioli May 21, 2023
ae0bb84
Rearranged README
oliolioli May 21, 2023
5800a2b
Added Testkonzept
oliolioli May 21, 2023
3f02757
update Grammar
PurpleAnanas May 22, 2023
f07aa65
Merge branch 'main' of https://github.com/eonum/mcl-editor
PurpleAnanas May 22, 2023
85cf50f
Update setup
DavidRichardGit May 23, 2023
b7afe78
updated README
May 30, 2023
724158f
Update testkonzept.md
oliolioli Feb 7, 2024
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
Binary file added Monaco_editor/.DS_Store
Binary file not shown.
6 changes: 6 additions & 0 deletions Monaco_editor/ReadMe
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Running this requires the "live server" extension

to run it: right click the main.html code and click open with live server

monaco editor:
https://microsoft.github.io/monaco-editor/monarch.html
Zediwan marked this conversation as resolved.
Show resolved Hide resolved
57 changes: 57 additions & 0 deletions Monaco_editor/infoParser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* This function takes a JSON object and recursively parses it to return an array.
* If the value of a key is an array, it is directly pushed to the output array.
* If the value of a key is an object, the function is recursively called and the result is pushed to the output array.
*
* @param {Object} jsonObject - A JSON object to be parsed
* @returns {Array} - An array of objects with 'name' and 'tables' properties
*/
/*
function parseJsonToArray(jsonObject) {
Zediwan marked this conversation as resolved.
Show resolved Hide resolved
const array = [];

for (const key in jsonObject) {
if (Array.isArray(jsonObject[key])) {
// If the value is an array, just push it to the output array
array.push({
name: key,
data: jsonObject[key]
});
} else if (typeof jsonObject[key] === 'object') {
// If the value is an object, recursively call the function
// and push the result to the output array
array.push({
name: key,
data: parseJsonToArray(jsonObject[key])
});
}
}

return array;
}
*/
function parseJsonToArray(jsonObject){
let array;

fetch(jsonObject)
.then(data => data.json())
.then(data => {
array = data;
})
.catch(error => {
console.log(error);
})

//console.log(array)
return array;
}

function loadData(filePath) {
return fetch(filePath)
.then(response => response.json())
.then(data => {
//console.log(`Loaded ${filePath}:`, data);
return data;
})
.catch(error => console.error(error));
}
47 changes: 47 additions & 0 deletions Monaco_editor/infoParserTest.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html>
Zediwan marked this conversation as resolved.
Show resolved Hide resolved
<html>
<head>
<meta charset="UTF-8">
<title>JSON Parsing Test</title>
<script src="infoParser.js"></script>
</head>
<body>
<script>
const varFilePath = 'variable_and_tables_info/variables.json';
let mylangVariables;

const tabFilePath = 'variable_and_tables_info/tables.json';
let mylangTables;

//TODO find out how to better handle the loading than with these promises
const varPromise = loadData(varFilePath);
const tabPromise = loadData(tabFilePath);

// load variables data
varPromise.then((variablesData) => {
// save variables to global variable for later use
window.variablesData = variablesData;
mylangVariables = variablesData;
mylangVariables = Object.entries(mylangVariables);
mylangVariables = mylangVariables.map((variables) => variables[1])
});

// load tables data
tabPromise.then((tablesData) => {
// save tables to global variable for later use
window.tablesData = tablesData;
mylangTables = tablesData;
mylangTables = Object.entries(mylangTables);
mylangTables = mylangTables.map((tables) => tables[1])

mylangTables = [].concat(...mylangTables)

});

Promise.all([varPromise, tabPromise]).then(() => {
console.log(mylangVariables);
console.log(mylangTables);
})
</script>
</body>
</html>
93 changes: 93 additions & 0 deletions Monaco_editor/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<!-- Load the Monaco editor -->
jbessi marked this conversation as resolved.
Show resolved Hide resolved
<script src="https://unpkg.com/[email protected]/min/vs/loader.js"></script>

<!-- Initialize the Monaco editor -->
<script>
require.config({ paths: { 'vs': 'https://unpkg.com/[email protected]/min/vs' }});
require(['vs/editor/editor.main'], function() {
var editor = monaco.editor.create(document.getElementById('container'), {
value: '',
language: 'mylang',
lineNumbers: false
});

// Timer used for delay in output
let timerId;
let lastValue = "";

/**
* Throttle and debounce function for better performance
* <a href="https://www.youtube.com/watch?v=cjIswDCKgu0"> Youtube Video </a>
* @param value (string): The content that should be logged.
* @param delay (number): The amount of time before the editor's content is output. Default is 1 second delay.
* @param throttleDelay (number): The amount of time before the editor's content is output when typing slowly. Default is 300 milliseconds.
*/
function throttleAndDebounceLogEditorValue(value, delay = 1000, throttleDelay = 300) {
// Throttle
/**
* This statement checks whether timerId is currently null or not.
* If timerId is null, it means that no timer has been set, so we can go ahead and log the editor value.
* If timerId is not null, it means that a timer has already been set, and we don't want to log the editor value again until the timer has completed.
*/
if (!timerId) {
console.log(editor.getValue());
timerId = setTimeout(() => {
timerId = null;
}, throttleDelay);
}

// Debounce
/**
* This statement checks whether the current editor value, newVal, is different from the previous editor value, lastVal.
* If the values are the same, it means that nothing has changed since the last time the function was called, so we don't need to do anything.
* If the values are different, it means that the editor content has been updated, and we need to start the throttle timer again.
*/
if (value != lastValue) {
clearTimeout(timerId);
timerId = setTimeout(() => {
console.log(editor.getValue());
timerId = null;
}, delay);
lastValue = value;
}
}

// Call this method whenever the content of the editor is changed
editor.onDidChangeModelContent(() => {
throttleAndDebounceLogEditorValue(editor.getValue());
});

// Get the current value of the editor
editor.onDidChangeModelContent(() => {
parseInput(editor.getValue());
});

});
</script>

<!-- load language -->
<script src="./mylang.js"></script>

<!-- This is the visual code editor box -->
<div style="border: 3px solid #ccc; padding: 5px; max-width: 600px;">
<div id="container" style="height: 50px; box-sizing: border-box;"></div>
</div>

<script src = "medcodelogic.js"></script>
<script>

function parseInput(valueMonaco) {

// Call function from our parser (peg$parse) with the user input as a parameter
try {
var result = peg$parse(valueMonaco);
document.getElementById("output").innerHTML = result;
} catch (e) {
document.getElementById("output").innerHTML = "Error: " + e.message;
}
}
</script>
<br><br><br><br><br><br><br><br><br><br><br><br>
<div id="output"></div>


56 changes: 56 additions & 0 deletions Monaco_editor/mainreact.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!-- load language, somehow its not working with our language definition (mylang.js). there is a problem with the require command in mylang -->
<!-- in this file the monaco editors language is javascript (see line 34) -->

<!-- <script src="./mylang.js"></script> -->


<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>React Monaco Editor Example</title>
<script src="https://unpkg.com/[email protected]/umd/react.development.js"></script>
<script src="https://unpkg.com/[email protected]/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/[email protected]/min/vs/loader.js"></script>
</head>
<body>
<div id="root"></div>

<script>
// Define a React component that uses the Monaco editor
class MonacoEditor extends React.Component {
constructor(props) {
super(props);

this.state = {
editorValue: "",
};

// Load the Monaco editor
require.config({ paths: { vs: "https://unpkg.com/[email protected]/min/vs" } });
require(["vs/editor/editor.main"], () => {
// Initialize the editor
const editor = monaco.editor.create(document.getElementById("container"), {
value: "",
language: "javascript",
lineNumbers: false
});
});
}

render() {
return React.createElement(
'div',
null,
React.createElement('div', { id: 'container', style: { height: '400px', width: '800px' } }),
React.createElement('pre', null, this.state.editorValue)
);
}

}

// Render the MonacoEditor component to the root element
ReactDOM.render(React.createElement(MonacoEditor, null), document.getElementById("root"));
</script>
</body>
</html>
Loading