# @totvs/tds-parsers

> Extensão para análise sintática das linguagens proprietárias TOTVS.

Latest version **0.1.5** (published 2021-04-16) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @totvs/tds-parsers
pnpm add @totvs/tds-parsers
yarn add @totvs/tds-parsers
bun add @totvs/tds-parsers
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.5 |
| Published | 2021-04-16 |
| First published | 2021-03-16 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 8.0.0 |
| Dependencies | 3 |
| Unpacked size | 1.4 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | TOTVS |
| Maintainers | rogerio.fialho, jhonysenem, dev.totvs, fabio.rocha, jhosefmarks, felipecrescencio, nicoleoliveira, felipeconti, alexmmartins, danotto, mansano, rogeriorc, tvmatias, robson.dba, daniel.yampolschi, acandido, lwtnb.wrk, samirayoub, pouidev, 123samir, alinelariguet, roger.steuernagel, totvstec-bot, alvarocneto |
| Keywords | 4gl, advpl, tds, totvs, parser, pegjs |

## Links

- npm: https://www.npmjs.com/package/@totvs/tds-parsers
- Repository: https://github.com/totvs/tds-parsers
- Homepage: https://github.com/totvs/tds-parsers#readme
- Issues: https://github.com/totvs/tds-parsers/issues
- npm.io page: https://npm.io/package/@totvs/tds-parsers

## Dependencies (3)

- [pegjs](https://npm.io/package/pegjs.md) ^0.10.0
- [ts-pegjs](https://npm.io/package/ts-pegjs.md) ^0.3.1
- [typescript](https://npm.io/package/typescript.md) ^4.2.4

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.1.5 (latest) — 2021-04-16
- 0.1.4 — 2021-04-14
- 0.1.3 — 2021-04-13
- 0.1.2 — 2021-03-18
- 0.1.1 — 2021-03-16

## README

# TOTVS Developer Studio: Analisador sintático

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->

[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)

<!-- ALL-CONTRIBUTORS-BADGE:END -->

## Instalação

Para uso local:

```
npm install @totvs/tds-parsers
```

Para uso global:

```
npm install @totvs/tds-parsers -g
```

## Uso embarcado (API)

Se você deseja executar o **TDS-Parsers** via programa:

Importe o pacote

```ts
import { parser } from '@totvs/tds-parsers';
import { IParserOptions } from '@totvs/tds-parsers/typings/config';
import { ASTNode } from '@totvs/tds-parsers/typings/ast_node';
```

## `parser(source: string, parserInfo: IParserInfo): { ast: ASTNode~, error: Error }`

`parser` executa a análise sintática do conteúdo em `source`, retornando a arvore sintátîca abstrata (_AST_, em ingles). `parserInfo.parser` deve ser informado de acordo com a linguagem a ser formatada. Os valores válidos são: `advpl` ou `4gl`. As demais informações são opcionais.

```ts
try {
    const parserInfo: any = {
      debug: false, //adiciona informações de depuração do analisador
      filepath: "c:\\myProject\\file1.prw", //localização do arquivo
      parser: "advpl", //analisador a ser aplicado
      fileext: "prw", //extensão do arquivo a ser considerado
    };

    const result: any = parser(source, parserInfo);
    if (result.error) {
      throw result.error;
    }

    // processamento da AST aqui

  } catch (error) {
    if (error.location) {
      console.error(
        `Sintax error: [${error.location.start.line}:${error.location.start.column}] ${error.message}`
      );
    } else {
      console.error(error);
    }
    throw error;
  }
}
```

## Mantenedor

<table>
  <tr>
    <td align="center"><a href="https://twitter.com/TOTVSDevelopers"><img src="https://avatars2.githubusercontent.com/u/20243897?v=4?s=100" width="100px;" alt=""/><br /><sub><b>TOTVS S.A.</b></sub></a><br /><a href="#maintenance-totvs" title="Maintenance">🚧</a> <a href="#plugin-totvs" title="Plugin/utility libraries">🔌</a> <a href="#projectManagement-totvs" title="Project Management">📆</a></td>
    </tr>
</table>

## Colaboradores

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
  <tr>
    <td align="center"><a href="https://github.com/brodao"><img src="https://avatars0.githubusercontent.com/u/949914?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Alan Cândido</b></sub></a><br /><a href="https://github.com/totvs/@totvs/prettier-plugin-4gl/commits?author=brodao" title="Code">💻</a> <a href="https://github.com/totvs/@totvs/prettier-plugin-4gl/commits?author=brodao" title="Documentation">📖</a> <a href="https://github.com/totvs/@totvs/prettier-plugin-4gl/commits?author=brodao" title="Tests">⚠️</a></td>
  </tr>
</table>

<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

---
_Source: https://npm.io/package/@totvs/tds-parsers · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
