mirror of
https://github.com/emkay/parser-6502.git
synced 2024-12-20 23:30:57 +00:00
37 lines
608 B
JavaScript
37 lines
608 B
JavaScript
const mona = require('mona')
|
|
const parameters = require('./parameters').parameters
|
|
|
|
function directiveName () {
|
|
return mona.oneOf([
|
|
'.inesprg',
|
|
'.ineschr',
|
|
'.inesmap',
|
|
'.inesmir',
|
|
'.bank',
|
|
'.org',
|
|
'.db',
|
|
'.byte',
|
|
'.dw',
|
|
'.word',
|
|
'.incbin',
|
|
'.rsset',
|
|
'.rs'
|
|
])
|
|
}
|
|
|
|
function directive () {
|
|
return mona.sequence((s) => {
|
|
const d = s(directiveName())
|
|
const space = s(mona.spaces())
|
|
const args = s(parameters())
|
|
const nl = s(mona.eol())
|
|
|
|
return mona.value({
|
|
directive: d,
|
|
args: args
|
|
})
|
|
})
|
|
}
|
|
|
|
module.exports = directive
|