@zenuml/core 2.0.16 → 2.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -75,5 +75,22 @@ A.method
75
75
  The entry point of the demo pages is `src/main.ts`. It will find all the `pre` elements with
76
76
  class `zenuml` and render the ZenUML DSL code in it.
77
77
 
78
+ == Parser
78
79
 
80
+ We use antlr4 to parse the ZenUML DSL code. The grammar files are:
81
+
82
+ 1. Parser: `./src/g4/sequenceParser.g4`
83
+ 2. Lexer: `./src/g4/sequenceLexer.g4`
84
+
85
+ === How to generate the parser and lexer
86
+
87
+ Run `yarn antlr4` to generate the parser and lexer.
88
+
89
+ === Setup local development environment
90
+
91
+ Run `yarn antlr:setup` (`python3 -m pip install antlr4-tools`) to install the antlr4 command and the runtime.
92
+
93
+ To test the setup, go to `src/g4-unit/hello-world` folder, and run:
94
+
95
+ 1.
79
96
 
@@ -0,0 +1,38 @@
1
+ This document describe the design of parsing rules for the `divider` statement.
2
+
3
+ ## Typical use case
4
+
5
+ The `divider` statement is used to separate the sequence of statements into logical
6
+ groups.
7
+
8
+ For example, a HTTPS sequence can be separated into three logical groups:
9
+ 1. Connect establishment
10
+ 2. TLS handshake
11
+ 3. HTTP request/response
12
+
13
+ ```
14
+ Client->Server: TCP SYNC
15
+ Server->Client: TCP SYN+ACK
16
+ Client->Server: TCP ACK
17
+ == Connection Established ==
18
+ Client->Server: TLS Client Hello
19
+ Server->Client: TLS Server Hello
20
+ Server->Client: TLS Certificate
21
+ Server->Client: TLS Server Hello Done
22
+ == Certificate Check ==
23
+ Client->Server: TLS Client Key Exchange
24
+ Client->Server: TLS Change Cipher Spec
25
+ Client->Server: TLS Finished
26
+ Server->Client: TLS Change Cipher Spec
27
+ Server->Client: TLS Finished
28
+ == Key Exchange, Handshake Completed ==
29
+ Client->Server: HTTP Request
30
+ Server->Client: HTTP Response
31
+ ```
32
+
33
+ ## The Lexer
34
+
35
+
36
+ ## `divider` is a statement
37
+
38
+ `divider` is treated as a statement as any other messages.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenuml/core",
3
- "version": "2.0.16",
3
+ "version": "2.0.17",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "url": "https://github.com/ZenUml/core.git"
@@ -13,10 +13,14 @@
13
13
  "test:unit:watch": "yarn antlr && vue-cli-service test:unit --watch",
14
14
  "cy": "cypress run",
15
15
  "lint": "vue-cli-service lint",
16
+ "antlr:setup": "python3 -m pip install antlr4-tools",
17
+ "antlr:generate": "pwd && cd ./src/g4-units/hello-world && antlr4 Hello.g4",
18
+ "antlr:javac": "pwd && cd ./src/g4-units/hello-world && CLASSPATH=\"../../../antlr/antlr-4.11.1-complete.jar:$CLASSPATH\" javac *.java",
19
+ "antlr:grun": "pwd && cd ./src/g4-units/hello-world && grun Hello r -tokens",
16
20
  "antlr": "yarn antlr:lexer && yarn antlr:parser",
17
21
  "antlr:clear": "rm -rf src/generated-parser/*",
18
- "antlr:lexer": "java -Duser.dir=$(pwd)/src/g4 -cp $(pwd)/antlr/antlr-4.8-complete.jar org.antlr.v4.Tool -o ./src/generated-parser -Dlanguage=JavaScript sequenceLexer.g4",
19
- "antlr:parser": "java -Duser.dir=$(pwd)/src/g4 -cp $(pwd)/antlr/antlr-4.8-complete.jar org.antlr.v4.Tool -o ./src/generated-parser -Dlanguage=JavaScript sequenceParser.g4",
22
+ "antlr:lexer": "java -Duser.dir=$(pwd)/src/g4 -cp $(pwd)/antlr/antlr-4.11.1-complete.jar org.antlr.v4.Tool -o ./src/generated-parser -Dlanguage=JavaScript sequenceLexer.g4",
23
+ "antlr:parser": "java -Duser.dir=$(pwd)/src/g4 -cp $(pwd)/antlr/antlr-4.11.1-complete.jar org.antlr.v4.Tool -o ./src/generated-parser -Dlanguage=JavaScript sequenceParser.g4",
20
24
  "build-crx": "vue-cli-service build --mode production --target lib --name zenuml/core ./src/index.js",
21
25
  "start": "vue-cli-service serve",
22
26
  "git:branch:clean:gone": "git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -d",
@@ -30,7 +34,7 @@
30
34
  "dependencies": {
31
35
  "@types/assert": "^1.5.4",
32
36
  "@types/ramda": "^0.28.0",
33
- "antlr4": "~4.8.0",
37
+ "antlr4": "^4.11.0",
34
38
  "color-string": "1.5.2",
35
39
  "dom-to-image-more": "^2.9.5",
36
40
  "file-saver": "^2.0.5",
@@ -56,6 +60,7 @@
56
60
  "@babel/polyfill": "^7.10.1",
57
61
  "@babel/preset-env": "^7.13.5",
58
62
  "@babel/runtime-corejs2": "^7.12.13",
63
+ "@types/antlr4": "^4.11.2",
59
64
  "@types/color-string": "^1.5.2",
60
65
  "@types/jest": "^24.0.19",
61
66
  "@types/lodash": "^4.14.168",
Binary file