npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sequence-parser

v0.8.8

Published

Parse sequence diagram DSL to an Abstract Syntax Tree

Downloads

23

Readme

Sequence Parser

Sequence parser is used to parse ZenUML DSL into an abstract syntax tree (AST). It also exposes a few utility methods.

Run cucumber test

We use the cucumber test to generate the specification for the ZenUML DSL. Make sure that the test is written clearly.

Run test

$ 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

Convert the report to HTML

$ 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.

Patch the cucumber HTML reporter

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').

Usage of the parser

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'.

Exported module

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.

RootContext

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)

Participants

Purpose: Get all the participants from the given antlr4 context Type: function Arguments: ctx the antlr4 context

Depth

Purpose: Get how many levels fragments (alt / loop) are within the given context Type: function Arguments: ctx the antlr4 context

Development

Build

yarn build runs three yarn commands:

  1. generate generates the lexer (sequenceLexer.js) and parser (sequenceParser.js);

  2. jest run all the tests in the test folder;

  3. webpack to pack up the library and put it in dist/main.js.

  4. I am not able to test the rule with 'ANTLR Preview'? Run yarn generate to re-generate the lexer and parser.

  5. A token is highlighted in the lexer with a warning that it is not recognised. Close the editor and re-open it.

  6. yarn build failed