mr-doc-parser
This directory contains the source file for the parser. There are a few things to cover in order to understand how the parser works.
Last updated 4 years ago by iwatakeshi .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install mr-doc-parser 
SYNC missed versions from official npm registry.

Parser

Build Status

This repo contains the source file for the parser. There are a few things to cover in order to understand how the parser works.

Specification

The parser in index.js, uses the Factory Pattern to create different parsers for the specified language.

There are various languages that the parser hopes to support but the available ones are the following:

  • JavaScript
    • Acorn
    • Babylon (default)
    • Espree

The parser should only produce a an array with the results attached and ready to be passed down to the compiler.

Interface

Initially the interface was written in TypeScript, but to keep things simple for those who are not familiar with TypeScript and would like to contribute, I decided to stick with ES6 (without Babel).

The following would be interface that must be implemented (unless specified):

class IParser {
  /**
   * IParser
   * @param  {Object} options - The options for the compiler provided by mr-doc-utils/options
   */
  constructor(options) {
    this.options = options;
  }
  /**
   * Parses the source comments from the file into the desired output.
   * @param  {Object} file - The file to parse.
   * @param  {String} file.source - The source comment in the file.
   * @return {Array<Object>} - The parsed comments.
   */
  parse(file) {
    // ...
  }
}

Current Tags

  • 1.0.0                                ...           latest (4 years ago)

1 Versions

  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (9)
Dev Dependencies (9)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |