jsdoc2md / jsdoc-parse

parses jsdoc documentation from javascript or html files, outputs JSON
MIT License
95 stars 19 forks source link

Could I parse a file that written with ES6 ES7? #7

Closed Aqzhyi closed 9 years ago

Aqzhyi commented 9 years ago

I am using a compiler for ES7 by babel.js

ERROR

/**
An async function defined
@param foo {string} foo is good than bar
@return bar {string} bar getting angry
*/
async function Named(foo) {
  let bar = await getBar()

  return bar
}
ERROR: Unable to parse /Users/pleasurazy/git/jsdoc-trial/jsdoc.js: Line 6: Unexpected token function
[SyntaxError: Unexpected end of input [Problem parsing the JSON data output by jsdoc, input data: ]]

OK

/**
An async function defined
@param foo {string} foo is good than bar
@return bar {string} bar getting angry
*/
function Named(foo) {
  let bar = getBar()

  return bar
}
[
  {
    "id": "Named",
    "longname": "Named",
    "name": "Named",
    "scope": "global",
    "kind": "function",
    "description": "An async function defined",
    "params": [
      {
        "type": {
          "names": [
            "string"
          ]
        },
        "description": "foo is good than bar",
        "name": "foo"
      }
    ],
    "returns": [
      {
        "type": {
          "names": [
            "string"
          ]
        },
        "description": "bar  bar getting angry"
      }
    ],
    "order": 0
  }
]
75lb commented 9 years ago

jsdoc-parse uses jsdoc3 under the hood.. jsdoc-parse supports whichever features of ES6 and ES7 that jsdoc3 supports, you can find more information here

Aqzhyi commented 9 years ago

Thank you very much.

75lb commented 9 years ago

good luck!