Sequence parser is used to parse ZenUML DSL into an abstract syntax tree (AST). It also exposes a few utility methods.
We use the cucumber test to generate the specification for the ZenUML DSL. Make sure that the test is written clearly.
$ yarn run cucumber-js -f json:report/cucumber_report.json
# or use watch
$ watch 'yarn run cucumber-js -f json:report/cucumber_report.json' features
To ignore a folder from watch use
--ignoreDirectoryPattern /report/g
$ node report/index.js
# or use watch
$ watch 'node report/index.js' report
If you are using Intellij Idea, you can use the "Live Edit" plugin to load the generated HTML automatically. Right click the HTML file (in editor) and choose "Debug". Or use CTRL+SHIFT+F9.
The default cucumber-html-reporter
does not show the \n
character in the generated HTML.
Patch the tempates/simple/features.html file with step.name && step.name.replace('\n', '\\n')
.
The latest public / stable version of this parser is published to npm under name sequence-parser
(defined in package.json
) To use this parser, just import seqParser from 'sequence-parser'
.
This project generate a UMD library. The exported library name is sequenceParser
(defined in
webpack.config.js
). This, however, does NOT mean you need to name the module as sequenceParser
when it is imported or required.
Purpose: Get the prog
antlr4 context from the given ZenUML DSL
Type: function
Arguments: code
the DSL provided in a string
Result: An antlr4 context of theprog
node (see sequenceParser.g4
for the definition of prog
)
Purpose: Get all the participants from the given antlr4 context
Type: function
Arguments: ctx
the antlr4 context
Purpose: Get how many levels fragments (alt / loop) are within the given context
Type: function
Arguments: ctx
the antlr4 context
yarn build
runs three yarn commands:
-
generate
generates the lexer (sequenceLexer.js) and parser (sequenceParser.js); -
jest
run all the tests in the test folder; -
webpack
to pack up the library and put it indist/main.js
. -
I am not able to test the rule with 'ANTLR Preview'? Run
yarn generate
to re-generate the lexer and parser. -
A token is highlighted in the lexer with a warning that it is not recognised. Close the editor and re-open it.
-
yarn build
failed