-
Notifications
You must be signed in to change notification settings - Fork 1
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
base: before-pse
Are you sure you want to change the base?
Changes from 73 commits
6a51261
265a9bf
1475b78
2fc0ee2
27b9df8
a2f730c
acfe21b
85b1fbc
62f7028
3443c84
4fa55c0
baeb60e
7451df9
7ace582
8312e60
15af0c8
e5e3274
7c8b218
05d8275
1b0e0c3
7deeaff
cd596be
a678d75
cbc8e16
190880c
ad67b93
3262e01
632816e
9256aa5
5eda42b
bb3bfc2
ce06742
233a732
c43f071
3216513
8f68700
294a04b
742a0b6
f2f3b6d
1a7d304
b60873e
cbc0177
e0c0e7c
bd4319a
b42b12b
fa5ad7b
ccd023d
d26945f
d8790af
5db82a8
2cd6185
813a90e
a1e1626
a8aaf15
21e9f3b
6dd9b2f
b483410
8b3b436
0b036e3
4c17e54
372bbcd
3b611c7
3e7db5f
11a62bb
7d69970
2f1ada8
1ccbd97
e2bda7b
ae69bdd
1bad1db
4513b5e
e06b94f
5062f84
bccdd1b
2e45d47
cd59bbe
53d8f9f
ab68e8b
623fba7
302045d
36efe19
54ce3a0
24d09f9
e983a71
02598cc
58e95ab
8a038a3
99c4f15
f525dd2
fce06ac
6510567
d01ece9
958b572
cf05480
277f246
9f87109
64377ef
5b498bf
5f6886b
0c2dc38
85fa333
0d34669
b11ae53
9b1ab39
e02e18e
2ee45c5
e410625
912e7cd
fcd126d
cec6cd8
725497a
7cb2146
1221b70
d54c7b8
b6611c7
ae0bb84
5800a2b
3f02757
f07aa65
85cf50f
b7afe78
724158f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"liveServer.settings.port": 5501 | ||
} |
This file was deleted.
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): | ||
|
||
create the parser.js from your grammar: -peggy medcodelogic.pegjs <br> | ||
|
||
|
||
## Libraries | ||
- Peggy for parser (use typescript) https://github.com/peggyjs/peggy. | ||
|
@@ -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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
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" | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you delete the public folder? |
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
This file was deleted.
This file was deleted.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here you specify css for App component. |
This file was deleted.
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could be above mentioned MedcodelogicEditor component. |
This file was deleted.
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)")) |
Large diffs are not rendered by default.
There was a problem hiding this comment.
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.