Skip to content

Commit

Permalink
feat: use xmi parser for ecore and uml parser
Browse files Browse the repository at this point in the history
  • Loading branch information
DerYeger committed Dec 1, 2023
1 parent 8a7181b commit d6a4230
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 36 deletions.
5 changes: 2 additions & 3 deletions packages/ecore-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@
"dependencies": {
"@cm2ml/ir": "workspace:*",
"@cm2ml/plugin": "workspace:*",
"@yeger/streams": "1.0.1",
"domhandler": "5.0.3",
"htmlparser2": "9.0.0"
"@cm2ml/xmi-parser": "workspace:*",
"@yeger/streams": "1.0.1"
},
"devDependencies": {
"@cm2ml/tsconfig": "workspace:*",
Expand Down
17 changes: 8 additions & 9 deletions packages/ecore-parser/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import type { GraphModel } from '@cm2ml/ir'
import { definePlugin } from '@cm2ml/plugin'
import { compose, definePlugin } from '@cm2ml/plugin'
import { XmiParser } from '@cm2ml/xmi-parser'

export const EcoreParser = definePlugin({
export const EcoreRefiner = definePlugin({
name: 'ecore',
parameters: {},
invoke: (input: string) => parse(input),
invoke: (input: GraphModel) => refine(input),
})

function parse(_ecore: string): GraphModel {
// const document = parseDocument(uml, {
// xmlMode: true,
// })
throw new Error('Not yet implemented')
// return new GraphModel(new GraphNode('TODO', {}, []), [], [])
function refine(model: GraphModel): GraphModel {
return model
}

export const EcoreParser = compose(XmiParser, EcoreRefiner, 'ecore')
5 changes: 2 additions & 3 deletions packages/uml-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@
"dependencies": {
"@cm2ml/ir": "workspace:*",
"@cm2ml/plugin": "workspace:*",
"@yeger/streams": "1.0.1",
"domhandler": "5.0.3",
"htmlparser2": "9.0.0"
"@cm2ml/xmi-parser": "workspace:*",
"@yeger/streams": "1.0.1"
},
"devDependencies": {
"@cm2ml/tsconfig": "workspace:*",
Expand Down
17 changes: 8 additions & 9 deletions packages/uml-parser/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import type { GraphModel } from '@cm2ml/ir'
import { definePlugin } from '@cm2ml/plugin'
import { compose, definePlugin } from '@cm2ml/plugin'
import { XmiParser } from '@cm2ml/xmi-parser'

export const UmlParser = definePlugin({
export const UmlRefiner = definePlugin({
name: 'uml',
parameters: {},
invoke: (input: string) => parse(input),
invoke: (input: GraphModel) => refine(input),
})

function parse(_uml: string): GraphModel {
// const document = parseDocument(uml, {
// xmlMode: true,
// })
throw new Error('Not yet implemented')
// return new GraphModel(new GraphNode('TODO', {}, []), [], [])
function refine(model: GraphModel): GraphModel {
return model
}

export const UmlParser = compose(XmiParser, UmlRefiner, 'uml')
18 changes: 6 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d6a4230

Please sign in to comment.