1
0
mirror of https://github.com/emkay/parser-6502.git synced 2024-12-20 23:30:57 +00:00
parser-6502/parsers/directive.js
2016-10-11 17:01:15 -07:00

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