2016-10-02 21:54:14 +00:00
|
|
|
const mona = require('mona')
|
2016-10-07 17:45:55 +00:00
|
|
|
const parameters = require('./parameters').parameters
|
2016-10-02 21:54:14 +00:00
|
|
|
|
|
|
|
function directiveName () {
|
|
|
|
return mona.oneOf([
|
|
|
|
'.inesprg',
|
|
|
|
'.ineschr',
|
|
|
|
'.inesmap',
|
|
|
|
'.inesmir',
|
|
|
|
'.bank',
|
|
|
|
'.org',
|
|
|
|
'.db',
|
|
|
|
'.byte',
|
|
|
|
'.dw',
|
|
|
|
'.word',
|
|
|
|
'.incbin',
|
|
|
|
'.rsset',
|
|
|
|
'.rs'
|
|
|
|
])
|
|
|
|
}
|
|
|
|
|
|
|
|
// <directive> ::= <directive-name> [<spaces> <parameter>]*
|
|
|
|
function directive () {
|
|
|
|
return mona.sequence((s) => {
|
|
|
|
const d = s(directiveName())
|
2016-10-07 17:45:55 +00:00
|
|
|
const space = s(mona.spaces())
|
|
|
|
const args = s(parameters())
|
2016-10-02 21:54:14 +00:00
|
|
|
// const nl = s(mona.eol())
|
|
|
|
|
|
|
|
return mona.value({
|
|
|
|
directive: d,
|
|
|
|
args: args
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = directive
|