New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

docstring-parser

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

docstring-parser

This package contains a parser for a custom docstring syntax

  • 0.0.1
  • unpublished
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Example docstring parser

A source code docstring parser for C-like (including C++, JavaScript, Rust) and Python-like syntax.

Syntax

A text is considered a named fragment when it is located between // BEGIN FRAGMENT: <name> and // END FRAGMENT, <> not included. This syntax is case-sensitive.

Don't use special characters in names; snakeCase is preferrable.

Fragments can be included in one another. In that case the lines matching // BEGIN FRAGMENT: <name> and // END FRAGMENT are removed.

Elements between // BEGIN ESCAPE and // END ESCAPE are excluded unconditionally from the tutorial.

Installation

Type npm install example-docstring-parser --save-dev if you want to install it as a development dependency of your package. Type npm install example-docstring-parser -g to install the parser globally.

Example code

import { ExampleParser } from "example-docstring-parser"
let text = `
// BEGIN FRAGMENT: Test
This text is displayed
// BEGIN ESCAPE
OR IS IT?
// END ESCAPE
// END FRAGMENT
`
let parser_inst = new ExampleParser(text)
console.log(parser_inst.mapLines())

Keywords

FAQs

Package last updated on 11 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc