Skip to content

Commit

Permalink
add the script to parse quint with ohmjs
Browse files Browse the repository at this point in the history
  • Loading branch information
konnov committed Nov 15, 2023
1 parent 7c8b319 commit afd9798
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions quint/scripts/parse-ohmjs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env node

// A test script to make sure that our Ohmjs grammar conforms to the Antlr4
// grammar. Since we do not allow the user to parse files via Ohmjs directly,
// we have this script, for debugging purposes.

const fs = require('fs')
const quint = require('../src/generated/quint.ohm-bundle.js')
const filename = process.argv[2]
if (!filename) {
console.error('Expected an input file as my first argument')
process.exit(1)
}

const text = fs.readFileSync(filename, 'utf-8')
const m = quint.match(text)
if (m.failed()) {
console.error(m.message)
process.exit(2)
} else {
// nothing to report
process.exit(0)
}

0 comments on commit afd9798

Please sign in to comment.