Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shivamka1/js-dot-antlr-parser
The objective of this project is to demostrate how to capture diagnostics i.e., semantic and syntactic errors for DOT language using ANTLR parser written in Javascript.
https://github.com/shivamka1/js-dot-antlr-parser
antlr4 diagnostics dot javascript parser
Last synced: about 8 hours ago
JSON representation
The objective of this project is to demostrate how to capture diagnostics i.e., semantic and syntactic errors for DOT language using ANTLR parser written in Javascript.
- Host: GitHub
- URL: https://github.com/shivamka1/js-dot-antlr-parser
- Owner: shivamka1
- License: mit
- Created: 2018-05-09T14:12:46.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-05-16T15:00:53.000Z (over 6 years ago)
- Last Synced: 2025-01-13T06:20:58.495Z (6 days ago)
- Topics: antlr4, diagnostics, dot, javascript, parser
- Language: JavaScript
- Homepage:
- Size: 33.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# js-dot-antlr-parser
The objective of this project is to demostrate how to capture diagnostics i.e., semantic and syntactic errors for DOT language using ANTLR parser written in Javascript.# Installation
```script
npm install --save js-dot-antlr-parser
```# Usage
```javascript
const jdap = require('js-dot-antlr-parser');
console.log(JSON.stringify(jdap.doValidation("gaph { \n a -- b \n a - b \n b - a [color=blue] \n }")));
console.log(JSON.stringify(jdap.doValidation("gaph { \n a -- b \n a - b \n b - a [color=blue] \n }").semanticErrors));
console.log(JSON.stringify(jdap.doValidation("gaph { \n a -- b \n a - b \n b - a [color=blue] \n }").syntacticErrors));
```# Output
```
{
"syntacticErrors": [{
"message": "token recognition error at: '- '",
"line": 2,
"character": 3,
"symbol": "",
"length": 1
}, {
"message": "token recognition error at: '- '",
"line": 3,
"character": 3,
"symbol": "",
"length": 1
}],
"semanticErrors": [{
"message": "mismatched input 'gaph' expecting {STRICT, GRAPH, DIGRAPH}",
"line": 0,
"character": 0,
"symbol": "gaph",
"length": 4
}]
}
```