Skip to content

Commit

Permalink
Merge 5e36db1 into d9c001d
Browse files Browse the repository at this point in the history
  • Loading branch information
Enteee committed Feb 18, 2020
2 parents d9c001d + 5e36db1 commit c34a639
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ const data = `
`;

// parse PlantUML
const ast = parse(data);
const result = parse(data);

// Format and print AST
// Format and print parse result
console.log(
formatters.default(ast)
formatters.default(result)
);
```

Expand Down Expand Up @@ -89,20 +89,24 @@ console.log(

### `parse(data, options)`

Parse PlantUML in `data`. Returns abstract syntax tree.
Parse PlantUML in `data`. Returns the parse result.

* `data`: data to parse
* `options`: see [PEG.js parser options] and [pegjs-backtrace options]
* `options`: supports all [PEG.js parser options]. Enable tracing with
`options.verbose = true`. If tracing is enabled, `options` is also forwardet to the
tracer object. See [pegjs-backtrace options] for a full list of supported tracer options.

### `parseFile(pattern, options, cb)`

Parse all PlantUML diagrams in the files matching `pattern`. If given, the callback function `cb` will make this function behave asynchronous.

* `pattern`: files to parse, supports globbing, e.g.: `**/*.plantuml`.
* `options`: see [PEG.js parser options] and [pegjs-backtrace options]
* `cb`: (optional) asynchronous callback. Called with: `cb(err, ast)`
* `options`: supports all [PEG.js parser options]. Enable tracing with
`options.verbose = true`. If tracing is enabled, `options` is also forwardet to the
tracer object. See [pegjs-backtrace options] for a full list of supported tracer options.
* `cb`: (optional) asynchronous callback. Called with: `cb(err, result)`

### `formatters`: A collection of built-in AST formatters.
### `formatters`: A collection of built-in parse result formatters.

For a detailed description of all the formatters see [src/formatters](src/formatters).

Expand Down Expand Up @@ -187,5 +191,5 @@ $ git commit

* [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)

[PEG.js parser options]:https://pegjs.org/documentation#generating-a-parser-javascript-api
[PEG.js parser options]:https://pegjs.org/documentation#using-the-parser
[pegjs-backtrace options]:https://github.com/okaxaki/pegjs-backtrace#options

0 comments on commit c34a639

Please sign in to comment.