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 73 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
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# README Medcodelogic Editor

## Brief description
This is the parser for medcodelogic.

In the file medcodelogic.pegjs you can find the current medcodelogic grammar rules.

Based on this rules the parser will be generated using the following commands (make sure peggy is installed globally):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move specific information like how to generate the parser to the "Setup" section where you should have a "Parser" subsection.


create the parser.js from your grammar: -peggy medcodelogic.pegjs <br>


## Libraries
- Peggy for parser (use typescript) https://github.com/peggyjs/peggy.
Expand All @@ -20,6 +28,12 @@
- Use self declaring code (f.e. method & variable names).

## Setup
### Monaco Editor
https://microsoft.github.io/monaco-editor/monarch.html

Running the `/Monaco/main.html` requires the "live server" extension.
To run it: right click `/Monaco/main.html` and click open with live server.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to be as precise as possible. We're not working with vscode and thus I wasted time to find out what you mean by "live server" extension. It was not clear for me to use vscode and to find the live server extension there...


### Development
Use `yarn` command to install all packages and dependencies from package.json.
Use `yarn start` to start local dev server.
Expand All @@ -43,3 +57,27 @@ Use `yarn test` to start headless server and tests. You can also just test singl
For further question:
- [[email protected]]([email protected]) -> eonum contact
- [eonum.ch/de/kontakt/](https://eonum.ch/de/kontakt/) -> eonum website

## Monaco
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there a section under Setup for Monaco-Editor and again a Monaco section here?

- See [this](https://microsoft.github.io/monaco-editor/typedoc/enums/languages.CompletionItemKind.html) for additional information about the CompletionItemKind
- See [this](https://microsoft.github.io/monaco-editor/typedoc/interfaces/languages.CompletionItem.html#documentation) for additional information about CompletionItems

<h1>Peggy Parser</h1>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use markdown


This is the parser for medcodelogic.<br>
In the file medcodelogic.pegjs you can find the current medcodelogic grammar rules.
Based on this rules the parser will be generated using the following commands (make sure peggy is installed globally):
create the parser.js from your grammar use the command peggy medcodelogic.pegjs (note here its peggy src/Peggy/medcodelogic.pegjs)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update to new folder structure, i.e. Peggy folder doesn't exist anymore.


The generated parser can be used as an object in JS. But for use in the browser we had to bundle it.
Therefore we used Webpack. All the necessary configurations are in the webpack.config.js

webpack.config.js if you want to use the function .parse from the bundled file (bundle.js) use Parser.parse(). We only use the .prase() function.
Copy link
Collaborator Author

@jbessi jbessi May 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: .prase() should be parse()

This function is exported (see webpack.config.js).
In the HTML the script for the bundle (actual Parser) needs to be initialized BEFORE the loader of the Monaco Code Editor.

If you change something in the grammar (medcodelogic.pegjs) run peggy src/Peggy/medcodelogic.pegjs after your changes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment on deprecated folder "Peggy"

This will generate a new parser (medcodelogic.js). Then use npm run build to bundle the parser. Make sure to delet the old bundle.js file in the Monaco directory and replace the newly generated bundle.js file in the Monaco folder.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you go with yarn or npm? Same goes of course using "yarn run build"...


## Running
The submit button is disabled as long as there is no content or an error. Pressing the submit button will log the valid content into the console.
6 changes: 0 additions & 6 deletions babel.config.js

This file was deleted.

3 changes: 0 additions & 3 deletions deploy.sh

This file was deleted.

20 changes: 0 additions & 20 deletions jest-puppeteer.config.js

This file was deleted.

9 changes: 0 additions & 9 deletions jest.config.js

This file was deleted.

152 changes: 94 additions & 58 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,65 +1,101 @@
{
"name": "mcl-editor",
"version": "1.0.0",
"description": "Code editor for medcodelogic language",
"main": "index.tsx",
"license": "MIT",
"private": true,
"description": "This is the parser for medcodelogic.",
"main": "webpack.config.js",
"dependencies": {
"@testing-library/jest-dom": "^5.16.2",
"@testing-library/react": "^13.2.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^29.4.0",
"@types/node": "^18.14.2",
"@types/react": "^16.9.17",
"@types/react-dom": "^16.9.4",
"bootstrap": "^5.1.3",
"react": "17.0.2",
"react-bootstrap": "^2.1.3",
"react-dom": "17.0.2",
"react-router-dom": "^5.0.1",
"react-scripts": "^5.0.1",
"typescript": ">3.5"
},
"config": {
"testPort": "8080",
"testURL": "http://localhost:8080"
"acorn": "^8.8.2",
"acorn-import-assertions": "^1.8.0",
"ajv": "^6.12.6",
"ajv-keywords": "^3.5.2",
"browserslist": "^4.21.5",
"buffer-from": "^1.1.2",
"caniuse-lite": "^1.0.30001486",
"chrome-trace-event": "^1.0.3",
"clone-deep": "^4.0.1",
"colorette": "^2.0.20",
"commander": "^2.20.3",
"cross-spawn": "^7.0.3",
"electron-to-chromium": "^1.4.385",
"enhanced-resolve": "^5.13.0",
"envinfo": "^7.8.1",
"es-module-lexer": "^1.2.1",
"escalade": "^3.1.1",
"eslint-scope": "^5.1.1",
"esrecurse": "^4.3.0",
"estraverse": "^4.3.0",
"events": "^3.3.0",
"fast-deep-equal": "^3.1.3",
"fast-json-stable-stringify": "^2.1.0",
"fastest-levenshtein": "^1.0.16",
"find-up": "^4.1.0",
"function-bind": "^1.1.1",
"glob-to-regexp": "^0.4.1",
"graceful-fs": "^4.2.11",
"has": "^1.0.3",
"has-flag": "^4.0.0",
"import-local": "^3.1.0",
"interpret": "^3.1.1",
"is-core-module": "^2.12.0",
"is-plain-object": "^2.0.4",
"isexe": "^2.0.0",
"isobject": "^3.0.1",
"jest-worker": "^27.5.1",
"json-parse-even-better-errors": "^2.3.1",
"json-schema-traverse": "^0.4.1",
"kind-of": "^6.0.3",
"loadash": "^1.0.0",
"loader-runner": "^4.3.0",
"locate-path": "^5.0.0",
"merge-stream": "^2.0.0",
"mime-db": "^1.52.0",
"mime-types": "^2.1.35",
"neo-async": "^2.6.2",
"node-releases": "^2.0.10",
"p-limit": "^2.3.0",
"p-locate": "^4.1.0",
"p-try": "^2.2.0",
"path-exists": "^4.0.0",
"path-key": "^3.1.1",
"path-parse": "^1.0.7",
"picocolors": "^1.0.0",
"pkg-dir": "^4.2.0",
"punycode": "^2.3.0",
"randombytes": "^2.1.0",
"rechoir": "^0.8.0",
"resolve": "^1.22.2",
"resolve-cwd": "^3.0.0",
"resolve-from": "^5.0.0",
"safe-buffer": "^5.2.1",
"schema-utils": "^3.1.2",
"serialize-javascript": "^6.0.1",
"shallow-clone": "^3.0.1",
"shebang-command": "^2.0.0",
"shebang-regex": "^3.0.0",
"source-map": "^0.6.1",
"source-map-support": "^0.5.21",
"supports-color": "^8.1.1",
"supports-preserve-symlinks-flag": "^1.0.0",
"tapable": "^2.2.1",
"terser": "^5.17.2",
"terser-webpack-plugin": "^5.3.8",
"update-browserslist-db": "^1.0.11",
"uri-js": "^4.4.1",
"watchpack": "^2.4.0",
"webpack": "^5.82.0",
"webpack-cli": "^5.1.0",
"webpack-merge": "^5.8.0",
"webpack-sources": "^3.2.3",
"which": "^2.0.2",
"wildcard": "^2.0.1"
},
"devDependencies": {},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "jest --runInBand",
"startHeadlessOnTestPort": "BROWSER=none PORT=$npm_package_config_testPort yarn start",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@babel/core": "^7.18.6",
"@babel/preset-env": "^7.18.6",
"babel-jest": "^28.1.1",
"chromedriver": "^100.0.0",
"geckodriver": "^3.0.1",
"jest": "^27.5.1",
"jest-puppeteer": "^6.1.0",
"puppeteer": "^15.1.1",
"react-string-replace": "^1.0.0",
"start-server-and-test": "^1.14.0"
}
"build":"webpack",
"test": "jest"

},
"keywords": [],
"author": "",
"license": "ISC"
}
Binary file removed public/favicon.ico
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you delete the public folder?

Binary file not shown.
42 changes: 0 additions & 42 deletions public/index.html
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a react app, this is the only html file in the whole application. The line <div id="root"></div> triggers that all the application components are loaded into this div. Then you create an index.tsx file in the src folder where you specify with the line ReactDOM.render(<App />, document.getElementById(‘root’)) that the App Component ( see comment further down on deleted App.tsx file) has to be loaded into an html element with id root. This is nothing but the div element present in index.html.

This file was deleted.

15 changes: 0 additions & 15 deletions public/manifest.json

This file was deleted.

Empty file removed public/robots.txt
Empty file.
3 changes: 0 additions & 3 deletions src/App.css
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you specify css for App component.

This file was deleted.

10 changes: 0 additions & 10 deletions src/App.tsx
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the file for App Component. App Component is the main component in React which acts as a container for all other components. That's the place where you would render the MedcodelogicEditor component (the component where you integrated the mcl editor using react).

This file was deleted.

5 changes: 0 additions & 5 deletions src/Components/ExampleComponent.tsx
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be above mentioned MedcodelogicEditor component.

This file was deleted.

3 changes: 3 additions & 0 deletions src/Monaco/Test.js
Zediwan marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const Parser = require("./bundle.js")

console.log(Parser.parse("age_years in table(MDC1)"))
89 changes: 89 additions & 0 deletions src/Monaco/bundle.js

Large diffs are not rendered by default.

Loading